本文整理汇总了Python中AnyQt.QtWidgets.QStackedWidget.setCurrentIndex方法的典型用法代码示例。如果您正苦于以下问题:Python QStackedWidget.setCurrentIndex方法的具体用法?Python QStackedWidget.setCurrentIndex怎么用?Python QStackedWidget.setCurrentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QStackedWidget
的用法示例。
在下文中一共展示了QStackedWidget.setCurrentIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWRank
# 需要导入模块: from AnyQt.QtWidgets import QStackedWidget [as 别名]
# 或者: from AnyQt.QtWidgets.QStackedWidget import setCurrentIndex [as 别名]
#.........这里部分代码省略.........
self.noClassRanksView.setModel(self.noClassRanksProxyModel)
self.noClassRanksView.setColumnWidth(0, 20)
self.noClassRanksView.selectionModel().selectionChanged.connect(
self.commit
)
self.noClassRanksView.pressed.connect(self.onSelectItem)
self.noClassRanksView.horizontalHeader().sectionClicked.connect(
self.headerClick
)
self.noClassRanksView.verticalHeader().sectionClicked.connect(
self.onSelectItem
)
if self.headerState[2] is not None:
self.noClassRanksView.horizontalHeader().restoreState(
self.headerState[2])
# Switch the current view to Discrete
self.switchRanksMode(0)
self.resetInternals()
self.updateDelegates()
self.updateVisibleScoreColumns()
self.resize(690, 500)
self.measure_scores = table((len(self.measures), 0), None)
def switchRanksMode(self, index):
"""
Switch between discrete/continuous/no_class mode
"""
self.rankMode = index
self.ranksViewStack.setCurrentIndex(index)
if index == 0:
self.ranksView = self.discRanksView
self.ranksModel = self.discRanksModel
self.ranksProxyModel = self.discRanksProxyModel
self.measures = self.discMeasures
self.selected_checks = self.cls_default_selected
self.reg_scoring_box.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Ignored)
self.cls_scoring_box.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
elif index == 1:
self.ranksView = self.contRanksView
self.ranksModel = self.contRanksModel
self.ranksProxyModel = self.contRanksProxyModel
self.measures = self.contMeasures
self.selected_checks = self.reg_default_selected
self.cls_scoring_box.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Ignored)
self.reg_scoring_box.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Expanding)
else:
self.ranksView = self.noClassRanksView
self.ranksModel = self.noClassRanksModel
self.ranksProxyModel = self.noClassRanksProxyModel
self.measures = []
self.selected_checks = set()
self.reg_scoring_box.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Ignored)
self.cls_scoring_box.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Ignored)
示例2: OWImportImages
# 需要导入模块: from AnyQt.QtWidgets import QStackedWidget [as 别名]
# 或者: from AnyQt.QtWidgets.QStackedWidget import setCurrentIndex [as 别名]
#.........这里部分代码省略.........
self.pathlabel.setTextElideMode(Qt.ElideMiddle)
self.pathlabel.setAttribute(Qt.WA_MacSmallSize)
vlayout.addWidget(self.pathlabel)
w.setLayout(vlayout)
self.infostack.addWidget(self.info_area)
self.infostack.addWidget(w)
box.layout().addWidget(self.infostack)
self.__initRecentItemsModel()
self.__invalidated = True
self.__executor = ThreadExecutor(self)
QApplication.postEvent(self, QEvent(RuntimeEvent.Init))
def __initRecentItemsModel(self):
self._relocate_recent_files()
recent_paths = []
for item in self.recent_paths:
recent_paths.append(item)
recent_paths = recent_paths[:OWImportImages.MaxRecentItems]
recent_model = self.recent_cb.model()
recent_model.clear()
for pathitem in recent_paths:
item = RecentPath_asqstandarditem(pathitem)
recent_model.appendRow(item)
self.recent_paths = recent_paths
if self.recent_paths and os.path.isdir(self.recent_paths[0].abspath):
self.recent_cb.setCurrentIndex(0)
self.__actions.reload.setEnabled(True)
else:
self.recent_cb.setCurrentIndex(-1)
self.__actions.reload.setEnabled(False)
def customEvent(self, event):
"""Reimplemented."""
if event.type() == RuntimeEvent.Init:
if self.__invalidated:
try:
self.start()
finally:
self.__invalidated = False
super().customEvent(event)
def __runOpenDialog(self):
startdir = os.path.expanduser("~/")
if self.recent_paths:
startdir = os.path.dirname(self.recent_paths[0].abspath)
if OWImportImages.Modality == Qt.WindowModal:
dlg = QFileDialog(
self, "Select Top Level Directory", startdir,
acceptMode=QFileDialog.AcceptOpen,
modal=True,
)
dlg.setFileMode(QFileDialog.Directory)
dlg.setOption(QFileDialog.ShowDirsOnly)
dlg.setDirectory(startdir)
dlg.setAttribute(Qt.WA_DeleteOnClose)