当前位置: 首页>>代码示例>>Python>>正文


Python QStackedWidget.setMinimumHeight方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QStackedWidget.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedWidget.setMinimumHeight方法的具体用法?Python QStackedWidget.setMinimumHeight怎么用?Python QStackedWidget.setMinimumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QStackedWidget的用法示例。


在下文中一共展示了QStackedWidget.setMinimumHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FilterDialog

# 需要导入模块: from PyQt5.QtWidgets import QStackedWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QStackedWidget import setMinimumHeight [as 别名]
class FilterDialog(QDialog):

    def __init__(self, parent=None):
        super(FilterDialog, self).__init__(parent)

        self.accepted.connect(self.createFilter)

        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.IconMode)
        self.contentsWidget.setIconSize(QSize(96, 84))
        self.contentsWidget.setMovement(QListView.Static)
        self.contentsWidget.setMaximumWidth(128)
        self.contentsWidget.setSpacing(12)

        self.basicFilterPage = BasicFilterPage()
        self.timeFilterPage = DateTimeFilterPage()
        self.locationFilterPage = LocationFilterPage()

        self.pagesWidget = QStackedWidget()
        self.pagesWidget.addWidget(self.basicFilterPage)
        self.pagesWidget.addWidget(self.timeFilterPage)
        self.pagesWidget.addWidget(self.locationFilterPage)
        self.pagesWidget.setMinimumHeight(360)

        rejectButton = QPushButton("Storno")
        rejectButton.clicked.connect(self.reject)
        acceptButton = QPushButton("OK")
        acceptButton.clicked.connect(self.accept)

        self.createIcons()
        self.contentsWidget.setCurrentRow(0)

        horizontalLayout = QHBoxLayout()
        horizontalLayout.addWidget(self.contentsWidget)
        horizontalLayout.addWidget(self.pagesWidget, 1)

        buttonsLayout = QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(acceptButton)
        buttonsLayout.addWidget(rejectButton)

        layout = QVBoxLayout()
        layout.addLayout(horizontalLayout)
        layout.addStretch(1)
        layout.addSpacing(12)
        layout.addLayout(buttonsLayout)

        self.setLayout(layout)

        self.setMinimumWidth(450)
        self.setWindowTitle("Filtrování výsledků")

    def initControls(self, options, filter_):
        self.basicFilterPage.initControls(options, filter_)
        self.timeFilterPage.initControls(filter_)
        self.locationFilterPage.initControls(filter_)

    def changePage(self, current, previous):
        if not current:
            current = previous

        self.pagesWidget.setCurrentIndex(self.contentsWidget.row(current))

    def createIcons(self):
        basicButton = QListWidgetItem(self.contentsWidget)
        basicButton.setIcon(QIcon('app/ui/images/settings.png'))
        basicButton.setText("Základní filtry")
        basicButton.setTextAlignment(Qt.AlignHCenter)
        basicButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        timeButton = QListWidgetItem(self.contentsWidget)
        timeButton.setIcon(QIcon('app/ui/images/time.png'))
        timeButton.setText("Datum a čas")
        timeButton.setTextAlignment(Qt.AlignHCenter)
        timeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        locationButton = QListWidgetItem(self.contentsWidget)
        locationButton.setIcon(QIcon('app/ui/images/location.png'))
        locationButton.setText("Lokace")
        locationButton.setTextAlignment(Qt.AlignHCenter)
        locationButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)

    @pyqtSlot()
    def createFilter(self):
        self._filter = self.basicFilterPage.getFilter()
        self._filter.update(self.timeFilterPage.getFilter())
        self._filter.update(self.locationFilterPage.getFilter())

    def filter(self):
        return self._filter
开发者ID:johnymachine,项目名称:csv2db,代码行数:94,代码来源:filterdialog.py


注:本文中的PyQt5.QtWidgets.QStackedWidget.setMinimumHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。