Exemple #1
0
 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)
Exemple #2
0
    def __init__(self, label="", items=(), parent=None, labelRatio=None, boxRatio=None, toolTip="", setIndex=0):
        """initialize class

        :param label: the label of the combobox
        :type label: str
        :param items: the item list of the combobox
        :type items: list
        :param parent: the qt parent
        :type parent: class
        :param toolTip: the tooltip info to display with mouse hover
        :type toolTip: str
        :param setIndex: set the combo box value as an int - 0 is the first value, 1 is the second
        :type setIndex: int
        """
        super(ComboBoxRegular, self).__init__(parent=parent)

        if items is None:
            items = []

        layout = HBoxLayout(parent=None, margins=utils.marginsDpiScale(0, 0, 0, 0),
                            spacing=utils.dpiScale(uiconstants.SREG))  # margins kwarg should be added
        self.box = QtWidgets.QComboBox(parent)
        self.box.addItems(items)
        self.box.setToolTip(toolTip)
        if label != "":
            self.label = Label(label, parent, toolTip)
            if labelRatio:
                layout.addWidget(self.label, labelRatio)
            else:
                layout.addWidget(self.label)
        if boxRatio:
            layout.addWidget(self.box, boxRatio)
        else:
            layout.addWidget(self.box)
        if setIndex:
            self.box.setCurrentIndex(setIndex)
        self.setLayout(layout)

        self.box.currentIndexChanged.connect(self.onItemChanged)