def __init__(self, label="", parent=None, showToolbar=True, showArrows=True, showClose=True, titleEditable=True): super(StackWidget, self).__init__(parent=parent) self.stackTableWgt = StackTableWidget(showArrows=showArrows, showClose=showClose, parent=self) self.stackItems = self.stackTableWgt.stackItems self.stackSearchEdit = QtWidgets.QLineEdit(parent=self) self.collapseBtn = QtWidgets.QPushButton(parent=self) self.expandBtn = QtWidgets.QPushButton(parent=self) self.text = label self.showToolbar = showToolbar self.showArrows = showArrows self.showClose = showClose self.titleEditable = titleEditable self.initUi() self.connections()
def vlineEdit(labelName, parent, enabled=True): layout = QtWidgets.QVBoxLayout() label = QtWidgets.QLabel(labelName, parent=parent) edit = QtWidgets.QLineEdit(parent=parent) edit.setEnabled(enabled) layout.addWidget(label) layout.addWidget(edit) layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(1) return label, edit, layout
def __init__(self, parent, text): super(LineEditProxyWidget, self).__init__() self.setParentItem(parent) self.lineedit = QtWidgets.QLineEdit() self.setWidget(self.lineedit) self.lineedit.setText(text) self.setZValue(100) self.lineedit.editingFinished.connect(self.done) self._text = text self._done = False
def _init(self): # search custom widget action self.searchAction = QtWidgets.QWidgetAction(self) self.searchAction.setObjectName("SearchAction") self.searchEdit = QtWidgets.QLineEdit() self.searchEdit.setPlaceholderText("Search...") self.searchEdit.textChanged.connect(self.updateSearch) self.searchAction.setDefaultWidget(self.searchEdit) self.addAction(self.searchAction) self.addSeparator()
def __init__(self, model, parent=None): super(PathWidget, self).__init__(parent=parent) self.directory = False self.model = model self.edit = QtWidgets.QLineEdit(parent=self) self.layout = QtWidgets.QHBoxLayout() self.layout.setSpacing(0) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) self.layout.addWidget(self.edit) self.browserBtn = QtWidgets.QPushButton("...", parent=self) self.layout.addWidget(self.browserBtn) self.browserBtn.clicked.connect(self.onBrowserClicked) self.edit.editingFinished.connect(self.onEditChanged)
def __init__(self, uiApplication, parent): super(NodesBox, self).__init__(parent) self.uiApplication = uiApplication self.setObjectName("NodeLibrary") self.verticalLayout = QtWidgets.QVBoxLayout(self) self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setContentsMargins(4, 4, 4, 4) self.lineEdit = QtWidgets.QLineEdit(self) self.lineEdit.setObjectName("nodelibraryLineEdit") self.lineEdit.setPlaceholderText("Enter node name..") self.verticalLayout.addWidget(self.lineEdit) self.nodeListWidget = NodeBoxWidget(parent=self) self.verticalLayout.addWidget(self.nodeListWidget) self.lineEdit.textChanged.connect(self.searchTextChanged) self.nodeListWidget.itemChanged.connect(self.onSelectionChanged) self.nodeListWidget.itemDoubleClicked.connect(self.onDoubleClicked) self.nodeListWidget.enterPressed.connect(self.onEnterPressed) self.resize(400, 250)
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 LineEdit(placeholder="", placeholderText=False, parent=None, toolTip="", editWidth=None, inputMode="string"): """Creates a simple textbox (QLineEdit) :param placeholder the default text in the text box, if placeholderText is True then it's greyed out :type placeholder: str or float or int :param placeholderText: default text is greyed out inside the textbox if true (QLineEdit) :type placeholderText: bool :param parent: the qt parent :type parent: class :param toolTip: the tool tip message on mouse over hover, extra info :type toolTip: str :param editWidth: the width of the textbox in pixels optional, None is ignored :type editWidth: int :param inputMode: restrict the user to this data entry, "string" text, "float" decimal or "int" no decimal :type inputMode: str :return textBox: the QT QLabel widget :rtype textBox: QWidget.QLabel """ textBox = QtWidgets.QLineEdit(parent=parent) # todo: STYLESHEET hardcoded color & margins here as a temp workaround, this should be in stylesheets textBox.setStyleSheet("QLineEdit {background: rgb(27, 27, 27);}") if inputMode == "float": placeholder = str(placeholder) textBox.setValidator(QtGui.QDoubleValidator()) if inputMode == "int": placeholder = int(placeholder) textBox.setValidator(QtGui.QIntValidator()) textBox.setTextMargins(*utils.marginsDpiScale(2, 2, 2, 2)) if editWidth: textBox.setFixedWidth(utils.dpiScale(editWidth)) if placeholderText: textBox.setPlaceholderText(placeholder) else: textBox.setText(placeholder) textBox.setToolTip(toolTip) return textBox