本文整理汇总了Python中qtpy.QtWidgets.QToolButton.setAutoRaise方法的典型用法代码示例。如果您正苦于以下问题:Python QToolButton.setAutoRaise方法的具体用法?Python QToolButton.setAutoRaise怎么用?Python QToolButton.setAutoRaise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QToolButton
的用法示例。
在下文中一共展示了QToolButton.setAutoRaise方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_toolbutton
# 需要导入模块: from qtpy.QtWidgets import QToolButton [as 别名]
# 或者: from qtpy.QtWidgets.QToolButton import setAutoRaise [as 别名]
def create_toolbutton(parent,
text=None,
shortcut=None,
icon=None,
tip=None,
toggled=None,
triggered=None,
autoraise=True,
text_beside_icon=False):
"""Create a QToolButton"""
button = QToolButton(parent)
if text is not None:
button.setText(text)
if icon is not None:
if is_text_string(icon):
icon = get_icon(icon)
button.setIcon(icon)
if text is not None or tip is not None:
button.setToolTip(text if tip is None else tip)
if text_beside_icon:
button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
button.setAutoRaise(autoraise)
if triggered is not None:
button.clicked.connect(triggered)
if toggled is not None:
button.toggled.connect(toggled)
button.setCheckable(True)
if shortcut is not None:
button.setShortcut(shortcut)
return button
示例2: action2button
# 需要导入模块: from qtpy.QtWidgets import QToolButton [as 别名]
# 或者: from qtpy.QtWidgets.QToolButton import setAutoRaise [as 别名]
def action2button(action, autoraise=True, text_beside_icon=False, parent=None):
"""Create a QToolButton directly from a QAction object"""
if parent is None:
parent = action.parent()
button = QToolButton(parent)
button.setDefaultAction(action)
button.setAutoRaise(autoraise)
if text_beside_icon:
button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
return button
示例3: toolbutton
# 需要导入模块: from qtpy.QtWidgets import QToolButton [as 别名]
# 或者: from qtpy.QtWidgets.QToolButton import setAutoRaise [as 别名]
def toolbutton(icon):
bt = QToolButton()
bt.setAutoRaise(True)
bt.setIcon(icon)
return bt
示例4: CondaPackagesWidget
# 需要导入模块: from qtpy.QtWidgets import QToolButton [as 别名]
# 或者: from qtpy.QtWidgets.QToolButton import setAutoRaise [as 别名]
#.........这里部分代码省略.........
import qtawesome as qta
icon_options = qta.icon('fa.cog')
# Widgets
self.cancel_dialog = ClosePackageManagerDialog
self.bbox = QDialogButtonBox(Qt.Horizontal)
self.button_cancel = QPushButton('Cancel')
self.button_channels = QPushButton(_('Channels'))
self.button_ok = QPushButton(_('Ok'))
self.button_update = QPushButton(_('Update index...'))
self.button_apply = QPushButton(_('Apply'))
self.button_clear = QPushButton(_('Clear'))
self.button_options = QToolButton()
self.combobox_filter = DropdownPackageFilter(self)
self.frame_top = FramePackageTop()
self.frame_bottom = FramePackageTop()
self.progress_bar = ProgressBarPackage(self)
self.status_bar = LabelPackageStatus(self)
self.table = TableCondaPackages(self)
self.textbox_search = LineEditSearch(self)
self.widgets = [self.button_update, self.button_channels,
self.combobox_filter, self.textbox_search, self.table,
self.button_ok, self.button_apply, self.button_clear,
self.button_options]
self.table_first_row = FirstRowWidget(
widget_before=self.textbox_search)
self.table_last_row = LastRowWidget(
widgets_after=[self.button_apply, self.button_clear,
self.button_cancel, self.combobox_filter])
# Widget setup
self.button_options.setPopupMode(QToolButton.InstantPopup)
self.button_options.setIcon(icon_options)
self.button_options.setAutoRaise(True)
max_height = self.status_bar.fontMetrics().height()
max_width = self.textbox_search.fontMetrics().width('M'*23)
self.bbox.addButton(self.button_ok, QDialogButtonBox.ActionRole)
self.button_ok.setAutoDefault(True)
self.button_ok.setDefault(True)
self.button_ok.setMaximumSize(QSize(0, 0))
self.button_ok.setVisible(False)
self.combobox_filter.addItems([k for k in C.COMBOBOX_VALUES_ORDERED])
self.combobox_filter.setMinimumWidth(120)
self.progress_bar.setMaximumHeight(max_height*1.2)
self.progress_bar.setMaximumWidth(max_height*12)
self.progress_bar.setTextVisible(False)
self.progress_bar.setVisible(False)
self.setMinimumSize(QSize(480, 300))
self.setWindowTitle(_("Conda Package Manager"))
self.status_bar.setFixedHeight(max_height*1.5)
self.textbox_search.setMaximumWidth(max_width)
self.textbox_search.setPlaceholderText('Search Packages')
self.table_first_row.setMaximumHeight(0)
self.table_last_row.setMaximumHeight(0)
self.table_last_row.setVisible(False)
self.table_first_row.setVisible(False)
# Layout
top_layout = QHBoxLayout()
top_layout.addWidget(self.combobox_filter)
top_layout.addWidget(self.button_channels)
top_layout.addWidget(self.button_update)
top_layout.addWidget(self.textbox_search)
top_layout.addStretch()
top_layout.addWidget(self.button_options)