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


Python QScrollArea.setMinimumWidth方法代码示例

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


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

示例1: GalaxyWidget

# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMinimumWidth [as 别名]
class GalaxyWidget(QWidget):
    """
    Serves as container for galaxy coords selector widget
    and galaxy view widget. All this container can be added
    as a signle widget (tab page).
    """

    def __init__(self, parent: QWidget):
        super(GalaxyWidget, self).__init__(parent)
        self.world = XNovaWorld_instance()
        # main layout
        self._layout = QVBoxLayout()
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(2)
        self.setLayout(self._layout)
        # sub-widgets
        self._galaxy_coords = GalaxyCoordsSelectorWidget(self)
        self._galaxy_coords.setGalaxyRange(1, 5)
        self._galaxy_coords.setSystemRange(1, 499)
        self._galaxy_coords.coordsChanged.connect(self.on_coords_cahnged)
        self._galaxyview = GalaxyView(self)
        # scrollarea
        self._sa_galaxy = QScrollArea(self)
        self._sa_galaxy.setMinimumWidth(400)
        self._sa_galaxy.setMinimumHeight(300)
        self._sa_galaxy.setWidget(self._galaxyview)
        #
        self._layout.addWidget(self._galaxy_coords)
        self._layout.addWidget(self._sa_galaxy)

    @pyqtSlot(int, int)
    def on_coords_cahnged(self, galaxy: int, system: int):
        logger.debug('on_coords_changed ({0}, {1})'.format(galaxy, system))
        self._galaxyview.show_coords(galaxy, system)

    def setCoords(self, galaxy: int, system: int):
        self._galaxy_coords.setCoords(galaxy, system, do_emit=False)
        self._galaxyview.show_coords(galaxy, system)

    def coords(self) -> list:
        ret = self._galaxy_coords.coords()
        return ret

    def get_tab_type(self) -> str:
        return 'galaxy'
开发者ID:minlexx,项目名称:xnovacmd,代码行数:47,代码来源:galaxy_widget.py

示例2: XNova_MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setMinimumWidth [as 别名]
class XNova_MainWindow(QWidget):

    STATE_NOT_AUTHED = 0
    STATE_AUTHED = 1

    def __init__(self, parent=None):
        super(XNova_MainWindow, self).__init__(parent, Qt.Window)
        # state vars
        self.config_store_dir = './cache'
        self.cfg = configparser.ConfigParser()
        self.cfg.read('config/net.ini', encoding='utf-8')
        self.state = self.STATE_NOT_AUTHED
        self.login_email = ''
        self.cookies_dict = {}
        self._hidden_to_tray = False
        #
        # init UI
        self.setWindowIcon(QIcon(':/i/xnova_logo_64.png'))
        self.setWindowTitle('XNova Commander')
        # main layouts
        self._layout = QVBoxLayout()
        self._layout.setContentsMargins(0, 2, 0, 0)
        self._layout.setSpacing(3)
        self.setLayout(self._layout)
        self._horizontal_layout = QHBoxLayout()
        self._horizontal_layout.setContentsMargins(0, 0, 0, 0)
        self._horizontal_layout.setSpacing(6)
        # flights frame
        self._fr_flights = QFrame(self)
        self._fr_flights.setMinimumHeight(22)
        self._fr_flights.setFrameShape(QFrame.NoFrame)
        self._fr_flights.setFrameShadow(QFrame.Plain)
        # planets bar scrollarea
        self._sa_planets = QScrollArea(self)
        self._sa_planets.setMinimumWidth(125)
        self._sa_planets.setMaximumWidth(125)
        self._sa_planets.setFrameShape(QFrame.NoFrame)
        self._sa_planets.setFrameShadow(QFrame.Plain)
        self._sa_planets.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self._sa_planets.setWidgetResizable(True)
        self._panel_planets = QWidget(self._sa_planets)
        self._layout_pp = QVBoxLayout()
        self._panel_planets.setLayout(self._layout_pp)
        self._lbl_planets = QLabel(self.tr('Planets:'), self._panel_planets)
        self._lbl_planets.setMaximumHeight(32)
        self._layout_pp.addWidget(self._lbl_planets)
        self._layout_pp.addStretch()
        self._sa_planets.setWidget(self._panel_planets)
        #
        # tab widget
        self._tabwidget = XTabWidget(self)
        self._tabwidget.enableButtonAdd(False)
        self._tabwidget.tabCloseRequested.connect(self.on_tab_close_requested)
        self._tabwidget.addClicked.connect(self.on_tab_add_clicked)
        #
        # create status bar
        self._statusbar = XNCStatusBar(self)
        self.set_status_message(self.tr('Not connected: Log in!'))
        #
        # tab widget pages
        self.login_widget = None
        self.flights_widget = None
        self.overview_widget = None
        self.imperium_widget = None
        #
        # settings widget
        self.settings_widget = SettingsWidget(self)
        self.settings_widget.settings_changed.connect(self.on_settings_changed)
        self.settings_widget.hide()
        #
        # finalize layouts
        self._horizontal_layout.addWidget(self._sa_planets)
        self._horizontal_layout.addWidget(self._tabwidget)
        self._layout.addWidget(self._fr_flights)
        self._layout.addLayout(self._horizontal_layout)
        self._layout.addWidget(self._statusbar)
        #
        # system tray icon
        self.tray_icon = None
        show_tray_icon = False
        if 'tray' in self.cfg:
            if (self.cfg['tray']['icon_usage'] == 'show') or \
                    (self.cfg['tray']['icon_usage'] == 'show_min'):
                self.create_tray_icon()
        #
        # try to restore last window size
        ssz = self.load_cfg_val('main_size')
        if ssz is not None:
            self.resize(ssz[0], ssz[1])
        #
        # world initialization
        self.world = XNovaWorld_instance()
        self.world_timer = QTimer(self)
        self.world_timer.timeout.connect(self.on_world_timer)

    # overrides QWidget.closeEvent
    # cleanup just before the window close
    def closeEvent(self, close_event: QCloseEvent):
        logger.debug('closing')
        if self.tray_icon is not None:
#.........这里部分代码省略.........
开发者ID:minlexx,项目名称:xnovacmd,代码行数:103,代码来源:main.py


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