本文整理汇总了Python中PyQt5.QtWidgets.QTreeWidget.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidget.setMinimumHeight方法的具体用法?Python QTreeWidget.setMinimumHeight怎么用?Python QTreeWidget.setMinimumHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget.setMinimumHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt5.QtWidgets import QTreeWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QTreeWidget import setMinimumHeight [as 别名]
class MainWindow(QMainWindow):
def __init__(self, screen_height, screen_width, version, parent=None):
super(MainWindow, self).__init__(parent)
self.screen_width = screen_width
self.screen_height = screen_height
self.version = version
# basic main window settings
self.resize(MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT)
self.setWindowTitle('Linguistica {}'.format(self.version))
# lexicon and lexicon tree
self.lexicon = None
self.lexicon_tree = None
self.initialize_lexicon_tree()
# set up major display, parameter window, then load main window
self.majorDisplay = QWidget()
self.parameterWindow = QWidget()
self.load_main_window()
# 'File' menu and actions
select_corpus_action = self.create_action(text='&Select corpus...',
slot=self.corpus_dir_dialog,
tip='Select a corpus file',
shortcut='Ctrl+N')
select_wordlist_action = self.create_action(text='&Select wordlist...',
slot=self.wordlist_dir_dialog,
tip='Select a wordlist file',
shortcut='Ctrl+W')
run_file_action = self.create_action(text='&Run...',
slot=self.run_file,
tip='Run the input file',
shortcut='Ctrl+D')
parameters_action = self.create_action(text='&Parameters...',
slot=self.parameters_dialog,
tip='Change parameters',
shortcut='Ctrl+P')
file_menu = self.menuBar().addMenu('&File')
file_menu.addAction(select_corpus_action)
file_menu.addAction(select_wordlist_action)
file_menu.addAction(run_file_action)
file_menu.addAction(parameters_action)
self.status = self.statusBar()
self.status.setSizeGripEnabled(False)
self.status.showMessage('No input file loaded. To select one: File --> '
'Select corpus... or Select wordlist...')
def initialize_lexicon_tree(self):
self.lexicon_tree = QTreeWidget()
self.lexicon_tree.setEnabled(True)
self.lexicon_tree.setMinimumWidth(TREEWIDGET_WIDTH_MIN)
self.lexicon_tree.setMaximumWidth(TREEWIDGET_WIDTH_MAX)
self.lexicon_tree.setMinimumHeight(TREEWIDGET_HEIGHT_MIN)
self.lexicon_tree.setHeaderLabel('')
self.lexicon_tree.setItemsExpandable(True)
# noinspection PyUnresolvedReferences
self.lexicon_tree.itemClicked.connect(self.tree_item_clicked)
def create_action(self, text=None, slot=None, tip=None, shortcut=None):
"""
This create actions for the File menu, things like
Read Corpus, Rerun Corpus etc
"""
action = QAction(text, self)
if shortcut:
action.setShortcut(shortcut)
if tip:
action.setToolTip(tip)
action.setStatusTip(tip)
if slot:
# noinspection PyUnresolvedReferences
action.triggered.connect(slot)
if shortcut:
# noinspection PyUnresolvedReferences
QShortcut(QKeySequence(shortcut), self).activated.connect(slot)
return action
def _get_filename_from_dialog(self, ftype='input'):
self.determine_last_file()
if self.last_file_path and self.last_file_type == ftype:
open_dir = self.last_file_path
else:
open_dir = os.getcwd()
# noinspection PyTypeChecker,PyCallByClass
fname = QFileDialog.getOpenFileName(self,
'Select the {} file'.format(ftype),
open_dir)
process_all_gui_events()
# HACK: fname is supposed to be a string (at least according to the
# PyQt5 documentation), but for some reason fname is a tuple.
# So we need this hack to make sure that fname is a string of a filename
# -- Jackson Lee, 2015/06/22
# update: it's turned out that this behavior is due to compatibility
# between PyQt and PySide. The "tuple" behavior is in line with the
#.........这里部分代码省略.........