本文整理汇总了Python中PyQt4.Qt.QToolButton.setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QToolButton.setSizePolicy方法的具体用法?Python QToolButton.setSizePolicy怎么用?Python QToolButton.setSizePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QToolButton
的用法示例。
在下文中一共展示了QToolButton.setSizePolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setSizePolicy [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
self._layout = l = QHBoxLayout()
self.setLayout(self._layout)
self._layout.setContentsMargins(0,5,0,0)
x = QToolButton(self)
x.setText(_('Vi&rtual Library'))
x.setIcon(QIcon(I('lt.png')))
x.setObjectName("virtual_library")
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
l.addWidget(x)
parent.virtual_library = x
x = QToolButton(self)
x.setIcon(QIcon(I('minus.png')))
x.setObjectName('clear_vl')
l.addWidget(x)
x.setVisible(False)
x.setToolTip(_('Close the Virtual Library'))
parent.clear_vl = x
x = QLabel(self)
x.setObjectName("search_count")
l.addWidget(x)
parent.search_count = x
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
parent.advanced_search_button = x = QToolButton(self)
parent.advanced_search_toggle_action = ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('advanced search toggle',
_('Advanced search'), default_keys=(_("Shift+Ctrl+F"),),
action=ac)
ac.triggered.connect(x.click)
x.setIcon(QIcon(I('search.png')))
l.addWidget(x)
x.setToolTip(_("Advanced search"))
x = parent.search = SearchBox2(self)
x.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
x.setObjectName("search")
x.setToolTip(_("<p>Search the list of books by title, author, publisher, "
"tags, comments, etc.<br><br>Words separated by spaces are ANDed"))
x.setMinimumContentsLength(10)
l.addWidget(x)
self.search_button = QToolButton()
self.search_button.setToolButtonStyle(Qt.ToolButtonTextOnly)
self.search_button.setText(_('&Go!'))
l.addWidget(self.search_button)
self.search_button.setSizePolicy(QSizePolicy.Minimum,
QSizePolicy.Minimum)
self.search_button.clicked.connect(parent.do_search_button)
self.search_button.setToolTip(
_('Do Quick Search (you can also press the Enter key)'))
x = parent.clear_button = QToolButton(self)
x.setIcon(QIcon(I('clear_left.png')))
x.setObjectName("clear_button")
l.addWidget(x)
x.setToolTip(_("Reset Quick Search"))
x = parent.highlight_only_button = QToolButton(self)
x.setIcon(QIcon(I('arrow-down.png')))
l.addWidget(x)
x = parent.saved_search = SavedSearchBox(self)
x.setMaximumSize(QSize(150, 16777215))
x.setMinimumContentsLength(10)
x.setObjectName("saved_search")
l.addWidget(x)
x = parent.copy_search_button = QToolButton(self)
x.setIcon(QIcon(I("search_copy_saved.png")))
x.setObjectName("copy_search_button")
l.addWidget(x)
x.setToolTip(_("Copy current search text (instead of search name)"))
x = parent.save_search_button = QToolButton(self)
x.setIcon(QIcon(I("search_add_saved.png")))
x.setObjectName("save_search_button")
l.addWidget(x)
示例2: __init__
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setSizePolicy [as 别名]
#.........这里部分代码省略.........
lo1.setContentsMargins(0, 0, 0, 0)
lo1.setSpacing(2)
lo0.addLayout(lo1)
lo1.addWidget(QLabel("Current slice: ", self))
for i, (iextra, name, labels) in enumerate(sliced_axes):
lo1.addWidget(QLabel("%s:" % name, self))
if name == "STOKES":
self._stokes_axis = iextra
# add controls
wslicer = QComboBox(self)
self._wslicers.append(wslicer)
wslicer.addItems(labels)
wslicer.setToolTip("""<P>Selects current slice along the %s axis.</P>""" % name)
wslicer.setCurrentIndex(self._rc.currentSlice()[iextra])
QObject.connect(wslicer, SIGNAL("activated(int)"), self._currier.curry(self._rc.changeSlice, iextra))
lo2 = QVBoxLayout()
lo1.addLayout(lo2)
lo2.setContentsMargins(0, 0, 0, 0)
lo2.setSpacing(0)
wminus = QToolButton(self)
wminus.setArrowType(Qt.UpArrow)
QObject.connect(wminus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, 1))
if i == 0:
wminus.setShortcut(Qt.SHIFT + Qt.Key_F7)
elif i == 1:
wminus.setShortcut(Qt.SHIFT + Qt.Key_F8)
wplus = QToolButton(self)
wplus.setArrowType(Qt.DownArrow)
QObject.connect(wplus, SIGNAL("clicked()"), self._currier.curry(self._rc.incrementSlice, iextra, -1))
if i == 0:
wplus.setShortcut(Qt.Key_F7)
elif i == 1:
wplus.setShortcut(Qt.Key_F8)
wminus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
wplus.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
sz = QSize(12, 8)
wminus.setMinimumSize(sz)
wplus.setMinimumSize(sz)
wminus.resize(sz)
wplus.resize(sz)
lo2.addWidget(wminus)
lo2.addWidget(wplus)
lo1.addWidget(wslicer)
lo1.addSpacing(5)
lo1.addStretch(1)
# subset indicator
lo1 = QHBoxLayout()
lo1.setContentsMargins(0, 0, 0, 0)
lo1.setSpacing(2)
lo0.addLayout(lo1)
self._wlab_subset = QLabel("Subset: xxx", self)
self._wlab_subset.setToolTip("""<P>This indicates the current data subset to which the histogram
and the stats given here apply. Use the "Reset to" control on the right to change the
current subset and recompute the histogram and stats.</P>""")
lo1.addWidget(self._wlab_subset, 1)
self._wreset_full = self.makeButton("\u2192 full", self._rc.setFullSubset)
lo1.addWidget(self._wreset_full)
if sliced_axes:
# if self._stokes_axis is not None and len(sliced_axes)>1:
# self._wreset_stokes = self.makeButton(u"\u21920Stokes",self._rc.setFullSubset)
self._wreset_slice = self.makeButton("\u2192 slice", self._rc.setSliceSubset)
lo1.addWidget(self._wreset_slice)
else:
self._wreset_slice = None