コード例 #1
0
    def treePopupWidget(self):
        """
        Returns the popup widget for this record box when it is supposed to
        be an ORB tree widget.
        
        :return     <XTreeWidget>
        """
        if not self._treePopupWidget:
            # create the treewidget
            tree = XTreeWidget(self)
            tree.setWindowFlags(Qt.Popup)
            tree.setFocusPolicy(Qt.StrongFocus)
            tree.installEventFilter(self)
            tree.setAlternatingRowColors(True)
            tree.setShowGridColumns(False)
            tree.setRootIsDecorated(False)
            tree.setVerticalScrollMode(tree.ScrollPerPixel)

            # create connections
            tree.itemClicked.connect(self.acceptRecord)

            self.lineEdit().textEdited.connect(tree.filterItems)
            self.lineEdit().textEdited.connect(self.showPopup)

            self._treePopupWidget = tree

        return self._treePopupWidget
コード例 #2
0
    def setupUi(self, XGanttWidget):
        XGanttWidget.setObjectName(_fromUtf8("XGanttWidget"))
        XGanttWidget.resize(733, 462)
        self.gridLayout = QtGui.QGridLayout(XGanttWidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.verticalLayout_3 = QtGui.QVBoxLayout()
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.createProjectButton = QtGui.QPushButton(XGanttWidget)
        self.createProjectButton.setObjectName(
            _fromUtf8("createProjectButton"))
        self.verticalLayout_3.addWidget(self.createProjectButton)
        self.widget = QtGui.QWidget(XGanttWidget)
        self.widget.setObjectName(_fromUtf8("widget"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget)
        self.verticalLayout_2.setMargin(0)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.uiGanttSPLT = XSplitter(self.widget)
        self.uiGanttSPLT.setOrientation(QtCore.Qt.Horizontal)
        self.uiGanttSPLT.setObjectName(_fromUtf8("uiGanttSPLT"))
        self.uiGanttTREE = XTreeWidget(self.uiGanttSPLT)
        self.uiGanttTREE.setAlternatingRowColors(True)
        self.uiGanttTREE.setProperty("x_arrowStyle", True)
        self.uiGanttTREE.setObjectName(_fromUtf8("uiGanttTREE"))
        self.uiGanttTREE.headerItem().setText(0, _fromUtf8("Name"))
        self.uiGanttVIEW = QtGui.QGraphicsView(self.uiGanttSPLT)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(
            self.uiGanttVIEW.sizePolicy().hasHeightForWidth())
        self.uiGanttVIEW.setSizePolicy(sizePolicy)
        self.uiGanttVIEW.setViewportUpdateMode(
            QtGui.QGraphicsView.FullViewportUpdate)
        self.uiGanttVIEW.setObjectName(_fromUtf8("uiGanttVIEW"))
        self.verticalLayout_2.addWidget(self.uiGanttSPLT)
        self.saveButton = QtGui.QPushButton(self.widget)
        self.saveButton.setObjectName(_fromUtf8("saveButton"))
        self.verticalLayout_2.addWidget(self.saveButton)
        self.verticalLayout_3.addWidget(self.widget)
        self.gridLayout.addLayout(self.verticalLayout_3, 0, 0, 1, 1)

        self.retranslateUi(XGanttWidget)
        QtCore.QMetaObject.connectSlotsByName(XGanttWidget)
コード例 #3
0
ファイル: xmenu.py プロジェクト: zengjunfeng/projexui
    def __init__(self, parent, action):
        super(XSearchActionWidget, self).__init__(parent)

        # define custom properties
        self._initialized = False
        self._triggerText = ''

        # define the interface
        self._searchEdit = XLineEdit(self)
        self._searchEdit.setIcon(QIcon(resources.find('img/search.png')))
        self._searchEdit.setHint('enter search')
        self._searchEdit.setFixedHeight(24)

        # define the completer
        self._completer = XTreeWidget(self)
        self._completer.setHint('No actions were found.')
        self._completer.setWindowFlags(Qt.Popup)
        self._completer.setRootIsDecorated(False)
        self._completer.header().hide()
        self._completer.setSortingEnabled(True)
        self._completer.sortByColumn(0, Qt.AscendingOrder)
        self._completer.installEventFilter(self)
        self._completer.setFocusProxy(self._searchEdit)
        self._completer.setShowGrid(False)
        self._completer.setFrameShape(XTreeWidget.Box)
        self._completer.setFrameShadow(XTreeWidget.Plain)

        # match the look for the completer to the menu
        palette = self._completer.palette()
        palette.setColor(palette.Base, palette.color(palette.Window))
        palette.setColor(palette.Text, palette.color(palette.WindowText))
        palette.setColor(palette.WindowText, palette.color(palette.Mid))
        self._completer.setPalette(palette)

        # create the layout
        layout = QHBoxLayout()
        layout.setContentsMargins(4, 4, 4, 4)
        layout.addWidget(self._searchEdit)
        self.setLayout(layout)

        # create connections
        self._searchEdit.textChanged.connect(self.filterOptions)
        self._completer.itemClicked.connect(self.triggerItem)
        parent.aboutToShow.connect(self.aboutToShow)