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


Python QVBoxLayout.sizeHint方法代码示例

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


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

示例1: create_controls

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import sizeHint [as 别名]
    def create_controls(self):
        self.btn_start = QPushButton(tr("Start"))
        self.btn_stop = QPushButton(tr("Stop"))
        self.btn_stop.setEnabled(False)

        self.btn_start.clicked.connect(self.start_recording)
        self.btn_stop.clicked.connect(self.stop_recording)

        self.chk_actions = QCheckBox(tr("Actions"))
        self.chk_code = QCheckBox(tr("Code"))
        for c in [self.chk_actions, self.chk_code]:
            c.setChecked(True)
            c.toggled.connect(self.update_filter)

        hbox = QHBoxLayout()
        for w in [self.btn_start, self.btn_stop]:
            hbox.addWidget(w)
        hbox2 = QHBoxLayout()
        for w in [self.chk_actions, self.chk_code]:
            hbox2.addWidget(w)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(hbox2)

        wrap = QWidget()
        wrap.setLayout(vbox)
        height = vbox.sizeHint().height()
        wrap.setFixedHeight(height)
        self.setWidget(wrap)
开发者ID:hyperspy,项目名称:hyperspyUI,代码行数:32,代码来源:recorderwidget.py

示例2: init_ui

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import sizeHint [as 别名]
    def init_ui(self):
        """
        Create and layout the GUI elements.
        """
        self.execute_button = self._make_execute_button()
        self.search_box = self._make_search_box()
        self.tree = self._make_tree_widget()

        top_layout = QHBoxLayout()
        top_layout.addWidget(self.execute_button)
        top_layout.addWidget(self.search_box)
        top_layout.setStretch(1, 1)

        layout = QVBoxLayout()
        layout.addLayout(top_layout)
        layout.addWidget(self.tree)
        layout.addWidget(AlgorithmProgressWidget())
        # todo: Without the sizeHint() call the minimum size is not set correctly
        #       This needs some investigation as to why this is.
        layout.sizeHint()
        self.setLayout(layout)
开发者ID:samueljackson92,项目名称:mantid,代码行数:23,代码来源:widget.py

示例3: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import sizeHint [as 别名]
    def __init__(self, presenter, parent=None):
        """
        Initialise a new instance of PlotSelectorWidget
        :param presenter: The presenter controlling this view
        :param parent: Optional - the parent QWidget
        running as a unit test, in which case skip file dialogs
        """
        super(PlotSelectorView, self).__init__(parent)
        self.presenter = presenter

        # This mutex prevents multiple operations on the table at the
        # same time. Wrap code in - with QMutexLocker(self.mutex):
        self.mutex = QMutex()
        self.active_plot_number = -1

        self.show_button = QPushButton('Show')
        self.hide_button = QPushButton('Hide')
        # Note this button is labeled delete, but for consistency
        # with matplotlib 'close' is used in the code
        self.close_button = QPushButton('Delete')
        self.select_all_button = QPushButton('Select All')
        self.sort_button = self._make_sort_button()
        self.export_button = self._make_export_button()
        self.filter_box = self._make_filter_box()
        self.table_widget = self._make_table_widget()

        # Add the context menu
        self.table_widget.setContextMenuPolicy(Qt.CustomContextMenu)
        self.context_menu, self.export_menu = self._make_context_menu()
        self.table_widget.customContextMenuRequested.connect(self.context_menu_opened)

        buttons_layout = FlowLayout()
        buttons_layout.setSpacing(1)
        buttons_layout.addWidget(self.show_button)
        buttons_layout.addWidget(self.hide_button)
        buttons_layout.addWidget(self.close_button)
        buttons_layout.addWidget(self.select_all_button)
        buttons_layout.addWidget(self.sort_button)
        buttons_layout.addWidget(self.export_button)

        filter_layout = QHBoxLayout()
        filter_layout.addWidget(self.filter_box)

        layout = QVBoxLayout()
        layout.addLayout(buttons_layout)
        layout.addLayout(filter_layout)
        layout.addWidget(self.table_widget)
        # todo: Without the sizeHint() call the minimum size is not set correctly
        #       This needs some investigation as to why this is.
        layout.sizeHint()
        self.setLayout(layout)

        # Any updates that originate from the matplotlib figure
        # windows must be wrapped in a QAppThreadCall. Not doing this
        # WILL result in segfaults.
        self.set_plot_list_orig = self.set_plot_list
        self.set_plot_list = QAppThreadCall(self.set_plot_list_orig)
        self.append_to_plot_list_orig = self.append_to_plot_list
        self.append_to_plot_list = QAppThreadCall(self.append_to_plot_list_orig)
        self.remove_from_plot_list_orig = self.remove_from_plot_list
        self.remove_from_plot_list = QAppThreadCall(self.remove_from_plot_list_orig)
        self.rename_in_plot_list_orig = self.rename_in_plot_list
        self.rename_in_plot_list = QAppThreadCall(self.rename_in_plot_list_orig)
        self.set_active_font_orig = self.set_active_font
        self.set_active_font = QAppThreadCall(self.set_active_font_orig)
        self.set_visibility_icon_orig = self.set_visibility_icon
        self.set_visibility_icon = QAppThreadCall(self.set_visibility_icon_orig)
        self.set_last_active_values_orig = self.set_last_active_values
        self.set_last_active_values = QAppThreadCall(self.set_last_active_values_orig)
        self.sort_type_orig = self.sort_type
        self.sort_type = QAppThreadCall(self.sort_type_orig)

        # Connect presenter methods to things in the view
        self.show_button.clicked.connect(self.presenter.show_multiple_selected)
        self.hide_button.clicked.connect(self.presenter.hide_selected_plots)
        self.close_button.clicked.connect(self.presenter.close_action_called)
        self.select_all_button.clicked.connect(self.table_widget.selectAll)
        self.table_widget.doubleClicked.connect(self.presenter.show_single_selected)
        self.filter_box.textChanged.connect(self.presenter.filter_text_changed)
        self.deleteKeyPressed.connect(self.presenter.close_action_called)

        if DEBUG_MODE:
            self.table_widget.clicked.connect(self.show_debug_info)
开发者ID:mantidproject,项目名称:mantid,代码行数:85,代码来源:view.py


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