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


Python QTreeWidget.setVerticalScrollBarPolicy方法代码示例

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


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

示例1: Ui_Ucics

# 需要导入模块: from PyQt5.QtWidgets import QTreeWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QTreeWidget import setVerticalScrollBarPolicy [as 别名]

#.........这里部分代码省略.........
        # ------------添加到布局
        toolLayout.addWidget(self.qzoneButton, 0, Qt.AlignLeft)
        toolLayout.addWidget(self.skinButton, 1, Qt.AlignLeft)
        # --------添加到布局
        headInfoLayout.addWidget(self.nameLabel)
        headInfoLayout.addWidget(self.moodEdit)
        headInfoLayout.addWidget(self.toolWidget)
        # ----天气
        self.weatherLabel = QLabel(self.headWidget)
        self.weatherLabel.setMinimumWidth(60)
        self.weatherLabel.setMaximumWidth(60)
        self.weatherLabel.setCursor(QCursor(Qt.PointingHandCursor))
        self.weatherLabel.setObjectName("weatherLabel")
        # ----添加到布局中
        headLayout.addWidget(self.headLabel, 0, Qt.AlignLeft)
        headLayout.addWidget(self.headInfoWidget, 0, Qt.AlignCenter)
        headLayout.addWidget(self.weatherLabel, 0, Qt.AlignRight)

        # 搜索输入框
        self.searchEdit = LineEdit(self.bgWidget)
        self.searchEdit.setFrame(False)
        # self.searchEdit.setClearButtonEnabled(True)
        self.searchEdit.setObjectName("searchEdit")

        # tab
        self.tabWidget = QTabWidget(self.bgWidget)
        self.tabWidget.setUsesScrollButtons(False)    # 取消两个切换按钮
        self.tabWidget.setDocumentMode(True)    # 取消边框
        self.tabWidget.setObjectName("tabWidget")
        # --分组
        self.tabGroup = QWidget(self.tabWidget)
        self.tabGroup.setObjectName("tabGroup")
        # ----分组布局
        groupVerticalLayout = QVBoxLayout(self.tabGroup)
        groupVerticalLayout.setSpacing(0)
        groupVerticalLayout.setContentsMargins(0, 0, 0, 0)
        groupVerticalLayout.setObjectName("groupVerticalLayout")
        # ------分组list控件
        self.groupTreeWidget = QTreeWidget(self.tabGroup)
        self.groupTreeWidget.setFrameShape(QFrame.NoFrame)
        self.groupTreeWidget.setFrameStyle(QFrame.NoFrame)
        self.groupTreeWidget.setLineWidth(0)
        self.groupTreeWidget.setIndentation(0)
        self.groupTreeWidget.setRootIsDecorated(False)
        self.groupTreeWidget.setExpandsOnDoubleClick(False)
        self.groupTreeWidget.header().setVisible(False)
        self.groupTreeWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.groupTreeWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.groupTreeWidget.setObjectName("groupTreeWidget")
        # ----添加到布局
        groupVerticalLayout.addWidget(self.groupTreeWidget)
        # --历史
        self.tabHistory = QWidget(self.tabWidget)
        self.tabHistory.setObjectName("tabHistory")
        # ----历史布局
        historyVerticalLayout = QVBoxLayout(self.tabHistory)
        historyVerticalLayout.setSpacing(0)
        historyVerticalLayout.setContentsMargins(0, 0, 0, 0)
        historyVerticalLayout.setObjectName("historyVerticalLayout")
        # ------历史list控件
        self.historyTreeWidget = QTreeWidget(self.tabHistory)
        self.historyTreeWidget.setFrameShape(QFrame.NoFrame)
        self.historyTreeWidget.setFrameStyle(QFrame.NoFrame)
        self.historyTreeWidget.setLineWidth(0)
        self.historyTreeWidget.setIndentation(0)
        self.historyTreeWidget.setRootIsDecorated(False)
        self.historyTreeWidget.setExpandsOnDoubleClick(False)
        self.historyTreeWidget.header().setVisible(False)
        self.historyTreeWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.historyTreeWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.historyTreeWidget.setObjectName("historyTreeWidget")
        # ----添加到布局
        historyVerticalLayout.addWidget(self.historyTreeWidget)
        # 添加到tab中
        self.tabWidget.addTab(self.tabGroup, "")
        self.tabWidget.addTab(self.tabHistory, "")

        # 整体布局
        verticalLayout = QVBoxLayout(self.bgWidget)
        verticalLayout.setSpacing(0)
        verticalLayout.setContentsMargins(0, 0, 0, 0)
        verticalLayout.setObjectName("verticalLayout")
        verticalLayout.addWidget(self.topWidget)
        verticalLayout.addWidget(self.headWidget)
        verticalLayout.addWidget(self.searchEdit)
        verticalLayout.addWidget(self.tabWidget)

        # bg
        layout = QVBoxLayout(Ucics)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.bgWidget)

        # 初始化一些设置
        _translate = QCoreApplication.translate
        Ucics.setWindowTitle(_translate("Ucics", "UCICS"))
        self.tabWidget.setCurrentIndex(0)
        self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tabGroup), _translate("tabGroup", "分组"))
        self.tabWidget.setTabToolTip(self.tabWidget.indexOf(self.tabHistory), _translate("tabHistory", "历史"))
        QMetaObject.connectSlotsByName(Ucics)
开发者ID:892768447,项目名称:ucics,代码行数:104,代码来源:ui_ucics.py


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