def __init__(self, parent): QTableView.__init__(self, parent) self.resizeRowsToContents() self.verticalHeader().setDefaultSectionSize(20) self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel) self.center = QPoint(-10, -10) self.startCenter = QPoint(-10, -10) self.mouseIsDown = False
def __init__(self, *args, **kwargs): QTableView.__init__(self, *args, **kwargs) myqa = QAction("Copy selected cells...", self) myqa.setData(("Copying selection")) self.tablemenu = QMenu(self) self.tablemenu.addAction(myqa) self.tablemenu.triggered.connect(self.onTableMenuAction) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.onRightClick)
def __init__(self, parent=None): QTableView.__init__(self, parent) header = self.horizontalHeader() header.setSectionResizeMode(QHeaderView.ResizeToContents) header.setStretchLastSection(True) self.progbar = ProgressBarDelegate(self) self.setItemDelegateForColumn(1, CheckBoxDelegate(self)) self.setItemDelegateForColumn(3, self.progbar)
def __init__(self, parent=None): QTableView.__init__(self, parent=parent) self.activeImage: str = None self.setEditTriggers(QTableView.NoEditTriggers) self.setSelectionBehavior(QTableView.SelectRows) self.setMinimumWidth(200) self.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents) self.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.resizeColumnsToContents()
def __init__(self, parent=None): QTableView.__init__(self, parent) if parent: self.setStyleSheet(parent.styleSheet()) header = self.horizontalHeader() header.setSectionResizeMode(QHeaderView.ResizeToContents) header.setStretchLastSection(True) header.setStyleSheet(self.styleSheet()) self.setItemDelegateForColumn(1, CheckBoxDelegate(self)) self.setItemDelegateForColumn(3, ProgressBarDelegate(self))
def __init__(self, parent: QtWidgets.QWidget): """ Args: parent (QtWidgets.QWidget): parent widget """ QTableView.__init__(self, parent) QWidget_PlaceholderText.__init__(self, "Select a QComponent to edit"\ "\n\nfrom the QComponents window") QTimer.singleShot( 200, self.style_me) # not sure whu the ui isnt unpdating these here.
def __init__(self, parent: QtWidgets.QWidget): """ Args: parent (QWidget): Parent widget """ QTableView.__init__(self, parent) QWidget_PlaceholderText.__init__( self, "No QComponents to show.\n\nCreate components from the QLibrary.") self.clicked.connect(self.viewClicked) self.doubleClicked.connect(self.doDoubleClicked) # Handling selection dynamically self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setSelectionBehavior(QTableView.SelectRows) QTimer.singleShot(100, self.style2)
def __init__(self, single_selection: bool = True): """ Common TableView used in side panels :param single_selection: disable multi-selection (True by default) :type single_selection: bool """ QTableView.__init__(self) self.verticalHeader().hide() self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.setSelectionMode( QAbstractItemView.SingleSelection if single_selection else QAbstractItemView.MultiSelection) self.horizontalHeader().setStretchLastSection(True) self.horizontalHeader().setSectionResizeMode(QHeaderView.Fixed) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
def __init__(self, df): QTableView.__init__(self) # Getting the Model self.model = CustomTableModel(df) self.setModel(self.model) # QTableView Headers self.horizontal_header = self.horizontalHeader() self.vertical_header = self.verticalHeader() self.horizontal_header.setSectionResizeMode(QHeaderView.Stretch) self.vertical_header.setSectionResizeMode(QHeaderView.Fixed) self.vertical_header.setDefaultSectionSize(19) # self.verticalResizeTableViewToContents() # self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.setMinimumWidth(400) self.setMaximumWidth(400) self.setMinimumHeight(59) self.setMaximumHeight(59)
def __init__(self, parent=None): QTableView.__init__(self, parent) # left mouse click self.clicked.connect(self.onLeftClick) self.doubleClicked.connect(self.onDoubleClick) # right mouse click self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.onRightClick) self.setMouseTracking(True) #self.horizontalHeader().sortIndicatorChanged.connect( self.afterSort ) # self.ctvCellEnter.connect( self._onCellEnter ) # self.ctvCellLeave.connect( self._onCellLeave ) self._vheaderView = CustomHeaderView(Qt.Orientation.Vertical) self.setVerticalHeader(self._vheaderView) self._vheaderView.chvMouseMove.connect(self.onMouseMoveOutside) self._hheaderView = CustomHeaderView(Qt.Orientation.Horizontal) self._hheaderView.chvMouseMove.connect(self.onMouseMoveOutside) #self.setHorizontalHeader( self._hheaderView ) # mit dem CustomHeaderView funktioniert das Sortieren nicht self._mouseOverCol = -1 self._mouseOverRow = -1
def __init__(self, parent=None): QTableView.__init__(self, parent) self._model = ReportModel() self.setModel(self._model) self._model.dataChanged.connect(self.on_item_changed)
def __init__(self, parent=None): QTableView.__init__(self, parent) self.clicked.connect(self._onLeftClick)