def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent) layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(4, 4, 4, 4) layout.setSpacing(2) self.__iconLabel = QtWidgets.QLabel('', self) self.__iconLabel.setFixedSize(QtCore.QSize(16, 16)) self.__textLabel = QtWidgets.QLabel('', self) self.__inputEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self) self.__inputEdit.hide() layout.addWidget(self.__iconLabel) layout.addWidget(self.__textLabel) layout.addWidget(self.__inputEdit, 2) layout.addStretch() self.__enableCustomName = QtWidgets.QCheckBox('use custom asset name', self) self.__enableCustomName.hide() self.setFixedHeight(self.__inputEdit.height()) layout.addWidget(self.__enableCustomName) self.__enableCustomName.clicked.connect(self.__enableClicked) if hasattr(self.__inputEdit, 'EMITS_CUSTOM_FOCUS_EVENTS' ) and self.__inputEdit.EMITS_CUSTOM_FOCUS_EVENTS: self.__inputEdit.lostFocus.connect(self.__customFieldChanged) else: self.__inputEdit.lostFocus.connect(self.__customFieldChanged)
def __init__(self, parent=None): QtGui.QToolButton.__init__(self, parent) self.resized.connect(self.setButtonGeometry) self.h = 40 self.button = QtGui.QToolButton() self.button.setAutoRaise(True) self.button.setIconSize(QtCore.QSize(28, 28)) self.button.setParent(self)
def populate(self): self.listWidget.clear() self.listWidget.setIconSize( QtCore.QSize(self.icon_size.value(), self.icon_size.value())) self.listWidget.setGridSize( QtCore.QSize(self.icon_size.value() + 20, self.icon_size.value() + 30)) checkCat = str(self.catedoryCB.currentText()) if not checkCat == 'ALL': directory = os.path.join(self.directory, checkCat) self.popItems(directory) else: for root, dirs, files in os.walk(self.directory): for dir in dirs: directory = os.path.join(root, dir) self.popItems(directory)
def sizeHint(self): """ Get the size """ if self.__displayMode == (DISPLAY_LIGHTS | DISPLAY_CAMERAS): w = self.fontMetrics().width(self.text()) + 16 else: w=8 #set some initial arbitrary size if self.__scenegraphPixmap: w += self.__scenegraphPixmap.width() return QtCore.QSize(w, 24)