# Path: pdil/vendor/Qt.py
# QT_VERBOSE = bool(os.getenv("QT_VERBOSE"))
# QT_PREFERRED_BINDING = os.getenv("QT_PREFERRED_BINDING", "")
# QT_SIP_API_HINT = os.getenv("QT_SIP_API_HINT")
# def _qInstallMessageHandler(handler):
#     def messageOutputHandler(*args):
# def _getcpppointer(object):
# def _wrapinstance(ptr, base=None):
# def _translate(context, sourceText, *args):
# def _loadUi(uifile, baseinstance=None):
#             def __init__(self, baseinstance):
#             def _loadCustomWidgets(self, etree):
#                 def headerToModule(header):
#             def load(self, uifile, *args, **kwargs):
#             def createWidget(self, class_name, parent=None, name=""):
# def _apply_site_config():
# def _new_module(name):
# def _import_sub_module(module, name):
# def _setup(module, extras):
# def _reassign_misplaced_members(binding):
# def _build_compatibility_members(binding, decorators=None):
# def _pyside2():
# def _pyside():
# def _pyqt5():
# def _pyqt4():
#     def _standardizeQFileDialog(some_function):
#         def wrapper(*args, **kwargs):
# def _none():
# def _log(text):
# def _convert(lines):
#     def parse(line):
# def _cli(args):
# def _install():
#         class _UiLoader(Qt._QtUiTools.QUiLoader):


import collections
import math
from ..vendor.Qt import QtGui, QtWidgets
from ..vendor.Qt.QtCore import QPoint
    width = sum( sizes[highlightColumns[0]: highlightColumns[-1] + 1 ] )

    offset = header.mapToGlobal(QPoint(0, 0)) - widget.mapToGlobal(QPoint(0, 0))

    count = min(count, widget.rowCount()) if count >= 0 else widget.rowCount()
    rowHeights = sum( widget.rowHeight(i) for i in range(count) )

    # It looks like the horizontal header spans the width so offset.x() doesn't work
    x = 0
    vHeader = widget.verticalHeader()
    if vHeader:
        x += vHeader.geometry().width()

    _drawHighlight(img, pen, left + x, offset.y(), width, rowHeights + header.geometry().height())

    return img


def grabTree(widget, highlightColumns=[], count=-1, pen='yellow'):
    img = widget.grab()

    header = widget.header()

    sizes = [header.sectionSize(i) for i in range(header.count())]
    highlightColumns.sort()
    left = sum( sizes[ :highlightColumns[0] ] )
    width = sum( sizes[highlightColumns[0]: highlightColumns[-1] + 1 ] )

    offset = header.mapToGlobal(QPoint(0, 0)) - widget.mapToGlobal(QPoint(0, 0))


# Path: pdil/vendor/Qt.py
# QT_VERBOSE = bool(os.getenv("QT_VERBOSE"))
# QT_PREFERRED_BINDING = os.getenv("QT_PREFERRED_BINDING", "")
# QT_SIP_API_HINT = os.getenv("QT_SIP_API_HINT")
# def _qInstallMessageHandler(handler):
#     def messageOutputHandler(*args):
# def _getcpppointer(object):
# def _wrapinstance(ptr, base=None):
# def _translate(context, sourceText, *args):
# def _loadUi(uifile, baseinstance=None):
#             def __init__(self, baseinstance):
#             def _loadCustomWidgets(self, etree):
#                 def headerToModule(header):
#             def load(self, uifile, *args, **kwargs):
#             def createWidget(self, class_name, parent=None, name=""):
# def _apply_site_config():
# def _new_module(name):
# def _import_sub_module(module, name):
# def _setup(module, extras):
# def _reassign_misplaced_members(binding):
# def _build_compatibility_members(binding, decorators=None):
# def _pyside2():
# def _pyside():
# def _pyqt5():
# def _pyqt4():
#     def _standardizeQFileDialog(some_function):
#         def wrapper(*args, **kwargs):
# def _none():
# def _log(text):
# def _convert(lines):
#     def parse(line):
# def _cli(args):
# def _install():
#         class _UiLoader(Qt._QtUiTools.QUiLoader):


# Path: pdil/_core/image.py
import collections
import math
from ..vendor.Qt import QtGui, QtWidgets
from ..vendor.Qt.QtCore import QPoint

    width = sum( sizes[highlightColumns[0]: highlightColumns[-1] + 1 ] )

    offset = header.mapToGlobal(QPoint(0, 0)) - widget.mapToGlobal(QPoint(0, 0))

    count = min(count, widget.rowCount()) if count >= 0 else widget.rowCount()
    rowHeights = sum( widget.rowHeight(i) for i in range(count) )

    # It looks like the horizontal header spans the width so offset.x() doesn't work
    x = 0
    vHeader = widget.verticalHeader()
    if vHeader:
        x += vHeader.geometry().width()

    _drawHighlight(img, pen, left + x, offset.y(), width, rowHeights + header.geometry().height())

    return img


def grabTree(widget, highlightColumns=[], count=-1, pen='yellow'):
    img = widget.grab()

    header = widget.header()

    sizes = [header.sectionSize(i) for i in range(header.count())]
    highlightColumns.sort()
    left = sum( sizes[ :highlightColumns[0] ] )
    width = sum( sizes[highlightColumns[0]: highlightColumns[-1] + 1 ] )

    offset = header.mapToGlobal(QPoint(0, 0)) - widget.mapToGlobal(QPoint(0, 0))


    it = QtWidgets.QTreeWidgetItemIterator(widget)