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


Python QSizePolicy.setHorizontalStretch方法代码示例

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


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

示例1: _populate_subjects

# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHorizontalStretch [as 别名]
    def _populate_subjects(self):
        '''
        '''
        # Setting size policy allows us to match Subjects fields height
        sp = QSizePolicy()
        sp.setHorizontalStretch(True)
        sp.setVerticalStretch(False)
        sp.setHeightForWidth(False)
        self.calibre_subjects.setSizePolicy(sp)
        self.marvin_subjects.setSizePolicy(sp)

        if 'tags' in self.mismatches:
            cs = "<b>Subjects:</b> {0}".format(', '.join(self.mismatches['tags']['calibre']))
            self.calibre_subjects.setText(self.YELLOW_BG.format(cs))
            ms = "<b>Subjects:</b> {0}".format(', '.join(self.mismatches['tags']['Marvin']))
            self.marvin_subjects.setText(self.YELLOW_BG.format(ms))

            calibre_height = self.calibre_subjects.sizeHint().height()
            marvin_height = self.marvin_subjects.sizeHint().height()
            if calibre_height > marvin_height:
                self.marvin_subjects.setMinimumHeight(calibre_height)
                self.marvin_subjects.setMaximumHeight(calibre_height)
            elif marvin_height > calibre_height:
                self.calibre_subjects.setMinimumHeight(marvin_height)
                self.calibre_subjects.setMaximumHeight(marvin_height)
        else:
            #self._log(repr(self.installed_book.tags))
            cs = "<b>Subjects:</b> {0}".format(', '.join(self.installed_book.tags))
            #self._log("cs: %s" % repr(cs))
            self.calibre_subjects.setText(cs)
            self.marvin_subjects.setText(cs)
开发者ID:Philantrop,项目名称:calibre-marvin-manager,代码行数:33,代码来源:view_metadata.py

示例2: __init__

# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHorizontalStretch [as 别名]
    def __init__(self, parent, icon, prefs, html=None, page=None, title=''):
        self.prefs = prefs
        #QDialog.__init__(self, parent=parent)
        super(HelpView, self).__init__(parent, 'help_dialog')
        self.setWindowTitle(title)
        self.setWindowIcon(icon)
        self.l = QVBoxLayout(self)
        self.setLayout(self.l)

        self.wv = QWebView()
        if html is not None:
            self.wv.setHtml(html)
        elif page is not None:
            self.wv.load(QUrl(page))
        self.wv.setMinimumHeight(100)
        self.wv.setMaximumHeight(16777215)
        self.wv.setMinimumWidth(400)
        self.wv.setMaximumWidth(16777215)
        self.wv.setGeometry(0, 0, 400, 100)
        self.wv.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.l.addWidget(self.wv)

        # Sizing
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.resize_dialog()
开发者ID:mkarpiarz,项目名称:calibre-annotations,代码行数:31,代码来源:common_utils.py

示例3: addVignette

# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHorizontalStretch [as 别名]
    def addVignette (self,warrior,i):
        widget_vignette = QWidget(self.vignettes)        
        layout_one_vignette = QVBoxLayout(widget_vignette)
        layout_one_vignette.setSpacing(0)
        layout_one_vignette.setContentsMargins(0, 0, 0, 0)
        warrior_button = QPushButton(widget_vignette)
        # on met plus car dans le cas du signal clicked on enverra True ou False (0 ou 1)
        warrior_button.setObjectName(str(i+2))
        warrior_button.clicked.connect(self.parent().goWarriorPage)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        warrior_button.setFixedSize(QtCore.QSize(100,120))
        warrior_button.setSizePolicy(sizePolicy)
        layout_one_vignette.addWidget(warrior_button)
        
        # label
        warrior_label = HerosLabel(warrior,widget_vignette)
        layout_one_vignette.addWidget(warrior_label)
        
        max_col  = 3
        groupe_name = warrior.groupe().name
        if warrior.masterGroupe() != None : 
            groupe_name = warrior.masterGroupe().name+"/"+groupe_name
        

        #path = os.path.join(Config().instance.path_to_pic(),faction_name,empire_name,kingdom_name,"Picture",groupe_name,warrior_name
        icon = QIcon(warrior.thumb)

        #print (basepath+"/"+faction_name+"/"+empire_name+"/"+kingdom_name+"/Picture/"+groupe_name+"/"+warrior.name+"/portrait_thumbnail.jpg")
        warrior_button.setIcon(icon)
        warrior_button.setIconSize(QtCore.QSize(100,120))

        if self.nb_col == 0:
            self.nb_row = self.nb_row + 1


        self.gridLayout.addWidget(widget_vignette,self.nb_row,self.nb_col)
        self.vignettes_liste.append(widget_vignette)
        self.nb_col = (self.nb_col +1)%max_col
开发者ID:cyril711,项目名称:git-MythicWar,代码行数:42,代码来源:book_warrior_homepage.py

示例4: __init__

# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHorizontalStretch [as 别名]
    def __init__(self, parent, plugin, locations):
        QDialog.__init__(self, parent)
        self.locations = locations

        self.setWindowTitle(
            _('Add "%s" to toolbars or menus')%plugin.name)

        self._layout = QVBoxLayout(self)
        self.setLayout(self._layout)

        self._header_label = QLabel(
                _('Select the toolbars and/or menus to add <b>%s</b> to:') %
                plugin.name)
        self._layout.addWidget(self._header_label)

        self._locations_list = QListWidget(self)
        self._locations_list.setSelectionMode(QAbstractItemView.MultiSelection)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        self._locations_list.setSizePolicy(sizePolicy)
        for key, text in locations:
            self._locations_list.addItem(text)
            if key in {'toolbar', 'toolbar-device'}:
                self._locations_list.item(self._locations_list.count()-1
                        ).setSelected(True)
        self._layout.addWidget(self._locations_list)

        self._footer_label = QLabel(
            _('You can also customise the plugin locations '
              'using <b>Preferences -> Customise the toolbar</b>'))
        self._layout.addWidget(self._footer_label)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok |
                QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.accept)
        button_box.rejected.connect(self.reject)
        self._layout.addWidget(button_box)
        self.resize(self.sizeHint())
开发者ID:AtulKumar2,项目名称:calibre,代码行数:41,代码来源:choose_plugin_toolbars.py

示例5: __init__

# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHorizontalStretch [as 别名]
    def __init__(self, parent, object_name):
        self.parent = parent
        self.prefs = parent.prefs
        self.elements = self.prefs.get('appearance_css', None)
        if not self.elements:
            self.elements = default_elements

        QTableWidget.__init__(self)
        self.setObjectName(object_name)
        self.layout = parent.elements_hl.layout()

        # Add ourselves to the layout
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        #sizePolicy.setVerticalStretch(0)
        #sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        #self.setMaximumSize(QSize(16777215, self.MAXIMUM_TABLE_HEIGHT))

        self.setColumnCount(0)
        self.setRowCount(0)
        self.layout.addWidget(self)
开发者ID:Philantrop,项目名称:calibre-marvin-manager,代码行数:24,代码来源:appearance.py


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