本文整理汇总了Python中PyQt5.Qt.QSizePolicy.setHeightForWidth方法的典型用法代码示例。如果您正苦于以下问题:Python QSizePolicy.setHeightForWidth方法的具体用法?Python QSizePolicy.setHeightForWidth怎么用?Python QSizePolicy.setHeightForWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy.setHeightForWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _populate_subjects
# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHeightForWidth [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)
示例2: __init__
# 需要导入模块: from PyQt5.Qt import QSizePolicy [as 别名]
# 或者: from PyQt5.Qt.QSizePolicy import setHeightForWidth [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()