def __init__(self, searchPixmap=None, clearPixmap=None, parent=None): QtWidgets.QLineEdit.__init__(self, parent) if searchPixmap is None: searchPixmap = iconlib.iconColorized("magnifier", utils.dpiScale(16), (128,128,128)) # these should be in layouts if clearPixmap is None: clearPixmap = iconlib.iconColorized("close", utils.dpiScale(16), (128,128,128)) self.clearButton = QtWidgets.QToolButton(self) self.clearButton.setIcon(QtGui.QIcon(clearPixmap)) self.clearButton.setCursor(QtCore.Qt.ArrowCursor) self.clearButton.setStyleSheet("QToolButton { border: none; padding: 1px; }") self.clearButton.hide() self.clearButton.clicked.connect(self.clear) self.textChanged.connect(self.updateCloseButton) self.searchButton = QtWidgets.QToolButton(self) self.searchButton.setStyleSheet("QToolButton { border: none; padding: 0px; }") self.searchButton.setIcon(QtGui.QIcon(searchPixmap)) frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth) self.setStyleSheet("QLineEdit { padding-left: %dpx; padding-right: %dpx; } "%( self.searchButton.sizeHint().width() + frameWidth + 1, self.clearButton.sizeHint().width() + frameWidth + 1)) msz = self.minimumSizeHint() self.setMinimumSize(max(msz.width(), self.searchButton.sizeHint().width() + self.clearButton.sizeHint().width() + frameWidth * 2 + 2), max(msz.height(), self.clearButton.sizeHint().height() + frameWidth * 2 + 2))
def buildTitleFrame(self): """Builds the title part of the layout with a QFrame widget """ # main dark grey qframe self.titleFrame = frame.QFrame(parent=self) self.setFrameColor(self.color) self.titleFrame.setContentsMargins(4, 0, 4, 0) # the horizontal layout self.horizontalLayout = QtWidgets.QHBoxLayout(self.titleFrame) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) # the icon and title and spacer self.iconButton = QtWidgets.QToolButton(parent=self) if self.collapsed: self.iconButton.setIcon(self._collapsedIcon) else: self.iconButton.setIcon(self._expandIcon) self.titleLabel = QtWidgets.QLabel(self.title, parent=self) self.titleLabel.setStyleSheet("font: bold;") self.titleLabel.setContentsMargins(0, 0, 0, 0) spacerItem = QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) # add to horizontal layout self.horizontalLayout.addWidget(self.iconButton) self.horizontalLayout.addWidget(self.titleLabel) self.horizontalLayout.addItem(spacerItem) self.titleFrame.setFixedHeight(self.titleFrame.sizeHint().height()) self.setMinimumSize(self.titleFrame.sizeHint().width(), self.titleFrame.sizeHint().height())
def __init__(self, title="", parent=None, treeItem=None): super(GroupWidget, self).__init__(parent=parent) self.color = uiconstants.DARKBGCOLOR self.horizontalLayout = utils.hBoxLayout(self) self.mainLayout = utils.hBoxLayout(self) self.expandToggleButton = QtWidgets.QToolButton(parent=self) self.folderIcon = QtWidgets.QToolButton(parent=self) self.titleFrame = frame.QFrame(parent=self) self.collapsed = False self.groupTextEdit = LineClickEdit(title, single=False) self.titleExtrasLayout = QtWidgets.QHBoxLayout() self.deleteBtn = QtWidgets.QToolButton(parent=self) self.treeItem = treeItem self.initUi() self.connections()
def _setupFilter(self): self.reloadBtn = QtWidgets.QToolButton(parent=self) self.reloadBtn.setIcon(iconlib.icon("reload")) self.searchLayout = QtWidgets.QHBoxLayout(self) self.searchLayout.setContentsMargins(2, 2, 2, 2) self.searchLayout.addWidget(self.reloadBtn) self.searchWidget = viewfilterwidget.ViewSearchWidget(showColumnVisBox=False, showHeaderBox=False, parent=self) self.searchLayout.addWidget(self.searchWidget) self.mainLayout.addLayout(self.searchLayout)
def _initUi(self): parent = self.parent() self.frame = QtWidgets.QFrame(parent) self.iconWidget = QtWidgets.QLabel(parent) self.iconWidget.setFixedWidth(29) self.label = _ExtendedQLabel(self._label, parent) self.optionBox = QtWidgets.QToolButton(parent) self.iconWidget.setFixedWidth(29) self.label.clicked.connect(self.triggered.emit) self.optionBox.clicked.connect(self.optionBoxTriggered.emit)
def _setupFilter(self): self.reloadBtn = QtWidgets.QToolButton(parent=self) self.reloadBtn.setIcon(iconlib.icon("reload")) self.searchLayout = QtWidgets.QHBoxLayout(self) self.searchLayout.setContentsMargins(2, 2, 2, 2) self.searchLayout.addWidget(self.reloadBtn) # setup the column search widget self.searchWidget = viewfilterwidget.ViewSearchWidget(parent=self) self.searchLayout.addWidget(self.searchWidget) self.mainLayout.addLayout(self.searchLayout)
def setIcon(self, icon): """Sets the large icon of this tooltip dialogue window :param icon: """ icon = icon or self.defaultIcon qicon = iconlib.iconColorized(icon, self.iconSize, self.iconColour) iconWgt = QtWidgets.QToolButton() iconWgt.setIconSize(QtCore.QSize(self.iconSize, self.iconSize)) iconWgt.setIcon(qicon) self.tooltipIcon = iconWgt
def _setupFilter(self): self.reloadBtn = QtWidgets.QToolButton(parent=self) # TODO: this button color needs stylesheeting once Stylesheeting is moved to zoocore self.reloadBtn.setIcon(iconlib.iconColorized("reload", color=(255, 255, 255))) self.searchLayout = QtWidgets.QHBoxLayout(self) self.searchLayout.setContentsMargins(0, 0, 0, 0) self.searchLayout.addWidget(self.reloadBtn) self.searchWidget = viewfilterwidget.ViewSearchWidget(showColumnVisBox=False, showHeaderBox=False, parent=self) self.searchWidget.setFixedHeight(utils.dpiScale(23)) self.searchLayout.addWidget(self.searchWidget) self.mainLayout.addLayout(self.searchLayout)
def __init__(self, parent): QtWidgets.QLineEdit.__init__(self, parent) # create the clear button. self._clearButton = QtWidgets.QToolButton(self) self._clearButton.setText('x') self._clearButton.setCursor(QtCore.Qt.ArrowCursor) self._clearButton.setFixedSize(16, 16) self._clearButton.hide() self._defaultText = '' # default value holder self._clearButton.clicked.connect(self._resetDefault) self.textEdited.connect(self._overrideSet)
def __init__(self, name, title, parent=None): super(HeaderToolbar, self).__init__(parent) self.setObjectName(name) self.setWindowTitle(title) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setMovable(False) self.isFloatable = False self.spacer = QtWidgets.QWidget() self.spacer.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.minimizeBtn = QtWidgets.QToolButton(self) self.minimizeBtn.setText("-") self.minimizeBtn.clicked.connect(self.parent().showMinimized) self.minimizeBtn.setMaximumWidth(20) self.minimizeBtn.setMaximumHeight(20) self.maximizeBtn = QtWidgets.QToolButton(self) self.maximizeBtn.setText('+') self.maximizeBtn.clicked.connect(self.parent().toggleMaximized) self.maximizeBtn.setMaximumWidth(20) self.maximizeBtn.setMaximumHeight(20) self.closeBtn = QtWidgets.QToolButton(self) self.closeBtn.setText('X') self.closeBtn.clicked.connect(self.parent().close) self.closeBtn.setMaximumWidth(20) self.closeBtn.setMaximumHeight(20) self.addWidget(self.spacer) self.addWidget(self.minimizeBtn) self.addWidget(self.maximizeBtn) self.addWidget(self.closeBtn) self.minimizeBtn.setIcon(iconlib.icon("minusHollow")) self.minimizeBtn.setIcon(iconlib.icon("window")) self.minimizeBtn.setIcon(iconlib.icon("close"))
def __init__(self, primViewItem, refreshFunc, printTiming=False, parent=None): QtWidgets.QWidget.__init__(self, parent) self._primViewItem = primViewItem self._layout = QtWidgets.QHBoxLayout() self._layout.setSpacing(0) self._layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self._layout) self._comboBox = DrawModeComboBox(self) self._modelAPI = UsdGeom.ModelAPI(self._primViewItem.prim) # Reducing the width further causes the pop-up dialog to be trimmed # and option text to be pruned. self._comboBox.setFixedWidth(100) self._comboBox.addItem(DrawModes.DEFAULT) self._comboBox.addItem(DrawModes.CARDS) self._comboBox.addItem(DrawModes.BOUNDS) self._comboBox.addItem(DrawModes.ORIGIN) self._layout.addWidget(self._comboBox) self._clearButton = QtWidgets.QToolButton(self) self._clearButton.setText('X') self._clearButton.setFixedSize(16, 16) retainSizePolicy = self._clearButton.sizePolicy() retainSizePolicy.setRetainSizeWhenHidden(True) self._clearButton.setSizePolicy(retainSizePolicy) self._layout.addWidget(self._clearButton) self._currentDrawMode = None self.RefreshDrawMode() self._firstPaint = True self._refreshFunc = refreshFunc self._printTiming = printTiming self._comboBox.signalPopupHidden.connect(self._PopupHidden) self._comboBox.activated.connect(self._UpdateDrawMode) self._clearButton.clicked.connect(self._ClearDrawMode)
def _setupFilter(self): self.searchBoxLabel = QtWidgets.QLabel("Search By: ", parent=self) self.searchHeaderBox = QtWidgets.QComboBox(parent=self) self.refreshBtn = QtWidgets.QToolButton(parent=self) self.refreshBtn.setIcon(iconlib.icon("reload")) self.searchFrame = QtWidgets.QFrame(parent=self) self.searchFrame.setFrameShape(QtWidgets.QFrame.NoFrame) self.searchFrame.setFrameShadow(QtWidgets.QFrame.Plain) self.searchLayout = QtWidgets.QHBoxLayout(self) self.searchLayout.setContentsMargins(2, 2, 2, 2) self.searchClearBtn = QtWidgets.QPushButton("Clear", parent=self) self.searchLabel = QtWidgets.QLabel("Search", parent=self) self.searchEdit = QtWidgets.QLineEdit(self) self.searchFrame.setLayout(self.searchLayout) self.searchLayout.addWidget(self.refreshBtn) self.searchLayout.addWidget(self.searchBoxLabel) self.searchLayout.addWidget(self.searchHeaderBox) self.searchLayout.addWidget(self.searchLabel) self.searchLayout.addWidget(self.searchEdit) self.searchLayout.addWidget(self.searchClearBtn) self.mainLayout.addWidget(self.searchFrame)
def initUI(self): self.mainLayout = QtWidgets.QVBoxLayout(self) self.scrollArea = QtWidgets.QScrollArea(parent=self) self.scrollArea.setWidgetResizable(True) self.scrollArea.setFrameStyle(QtWidgets.QFrame.NoFrame) self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain) self.scrollWidget = QtWidgets.QWidget() self.scrollLayout = flowlayout.FlowLayout() self.scrollWidget.setLayout(self.scrollLayout) self.scrollArea.setWidget(self.scrollWidget) self.mainLayout.addWidget(self.scrollArea) self.setLayout(self.mainLayout) for i in iconlib.Icon.iconCollection: colorRandom = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255)) btn = QtWidgets.QToolButton(parent=self) icon = iconlib.Icon.iconColorized(i, size=256, color=colorRandom) btn.setIcon(icon) btn.setText(i) btn.clicked.connect(self.copyNameToClipboard) self.scrollLayout.addWidget(btn)