本文整理匯總了Python中PyQt4.QtGui.QToolButton方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QToolButton方法的具體用法?Python QtGui.QToolButton怎麽用?Python QtGui.QToolButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QToolButton方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def __init__(self, *args, **kwargs):
super(EmoticonDialog, self).__init__(*args, **kwargs)
saved = Settings.value(Settings.EMOTICON_DIALOG_GEOMETRY)
if saved:
self.restoreGeometry(saved)
self._value = ''
flowLayout = FlowLayout(self)
customEmoticons = Settings.value(Settings.CUSTOM_EMOTICONS)
if customEmoticons:
customEmoticons = filter(None, [line.strip()
for line in customEmoticons.split("\n")
if 0 < len(line) < 64])
else:
customEmoticons = []
for emoticon in customEmoticons + _emoticons.split("\n"):
act = QtGui.QAction(emoticon, self)
act.triggered.connect(self.onActionTriggered)
btn = QtGui.QToolButton(self)
btn.setDefaultAction(act)
flowLayout.addWidget(btn)
self.setLayout(flowLayout)
self.setWindowTitle("Insert emoticon")
self.accepted.connect(self.saveGeometrySettings)
self.finished.connect(self.saveGeometrySettings)
self.rejected.connect(self.saveGeometrySettings)
示例2: _create_toolbar
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def _create_toolbar(self):
toolbar = QToolBar()
toolbar.setFloatable(False)
toolbar.setMovable(False)
self.layout_combo = LayoutCombo()
toolbar.addWidget(self.layout_combo)
self.layout_combo.layout_changed.connect(self._plot_layout_changed)
self._settings_button = QToolButton()
self._settings_button.setToolTip("Toggle settings visibility")
self._settings_button.setIcon(resource_icon("cog.png"))
self._settings_button.setCheckable(True)
self._settings_button.toggled.connect(self._show_settings)
toolbar.addWidget(self._settings_button)
def toggle_on_close(event):
self._settings_button.setChecked(False)
event.accept()
self._settings_window.closeEvent = toggle_on_close
return toolbar
示例3: create_toolbar
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def create_toolbar(self):
settingsAction = QtGui.QAction("&Set Cluster Parameters", self)
settingsAction.setShortcut("Ctrl+Q")
settingsAction.triggered.connect(didPressSettingsMenuItem)
settingsMenu = QtGui.QMenu(self)
settingsMenu.addAction(settingsAction)
toolBar = QtGui.QToolBar()
settingsButton = QtGui.QToolButton()
settingsButton.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
settingsButton.setText("Settings")
settingsButton.setMenu(settingsMenu)
toolBar.addWidget(settingsButton)
self.layout.addWidget(toolBar)
示例4: addSplitterHandleToggleButton
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def addSplitterHandleToggleButton(self):
self.uiSplitter.setStyle(QtGui.QStyleFactory.create("Cleanlooks"))
handle = self.uiSplitter.handle(1)
layout = QtGui.QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
button = QtGui.QToolButton(handle)
button.setArrowType(QtCore.Qt.LeftArrow)
button.clicked.connect(self.onToggleSidebarAction)
layout.addWidget(button)
button = QtGui.QToolButton(handle)
button.setArrowType(QtCore.Qt.RightArrow)
button.clicked.connect(self.onToggleSidebarAction)
layout.addWidget(button)
handle.setLayout(layout)
示例5: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def setupUi(self, SourceDocumentTranslatorDialog):
SourceDocumentTranslatorDialog.setObjectName(_fromUtf8("SourceDocumentTranslatorDialog"))
SourceDocumentTranslatorDialog.resize(497, 127)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(SourceDocumentTranslatorDialog.sizePolicy().hasHeightForWidth())
SourceDocumentTranslatorDialog.setSizePolicy(sizePolicy)
SourceDocumentTranslatorDialog.setMinimumSize(QtCore.QSize(0, 127))
self.gridLayout = QtGui.QGridLayout(SourceDocumentTranslatorDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.vlNotification = QtGui.QVBoxLayout()
self.vlNotification.setObjectName(_fromUtf8("vlNotification"))
self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 3)
self.label = QtGui.QLabel(SourceDocumentTranslatorDialog)
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.txtRootFolder = QtGui.QLineEdit(SourceDocumentTranslatorDialog)
self.txtRootFolder.setMinimumSize(QtCore.QSize(0, 30))
self.txtRootFolder.setObjectName(_fromUtf8("txtRootFolder"))
self.gridLayout.addWidget(self.txtRootFolder, 1, 1, 1, 1)
self.btn_source_doc_folder = QtGui.QToolButton(SourceDocumentTranslatorDialog)
self.btn_source_doc_folder.setMinimumSize(QtCore.QSize(30, 30))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/open_file.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.btn_source_doc_folder.setIcon(icon)
self.btn_source_doc_folder.setObjectName(_fromUtf8("btn_source_doc_folder"))
self.gridLayout.addWidget(self.btn_source_doc_folder, 1, 2, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(SourceDocumentTranslatorDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 3)
self.retranslateUi(SourceDocumentTranslatorDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SourceDocumentTranslatorDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SourceDocumentTranslatorDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SourceDocumentTranslatorDialog)
示例6: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def __init__(self, gui, header, prefs, icon, books,
save_size_name='epubmerge:update list dialog'):
SizePersistedDialog.__init__(self, gui, save_size_name)
self.gui = gui
self.setWindowTitle(header)
self.setWindowIcon(icon)
layout = QVBoxLayout(self)
self.setLayout(layout)
title_layout = ImageTitleLayout(self, 'images/icon.png',
header)
layout.addLayout(title_layout)
books_layout = QHBoxLayout()
layout.addLayout(books_layout)
self.books_table = StoryListTableWidget(self)
books_layout.addWidget(self.books_table)
button_layout = QVBoxLayout()
books_layout.addLayout(button_layout)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem)
self.move_up_button = QtGui.QToolButton(self)
self.move_up_button.setToolTip(_('Move selected books up the list'))
self.move_up_button.setIcon(QIcon(I('arrow-up.png')))
self.move_up_button.clicked.connect(self.books_table.move_rows_up)
button_layout.addWidget(self.move_up_button)
self.remove_button = QtGui.QToolButton(self)
self.remove_button.setToolTip(_('Remove selected books from the list'))
self.remove_button.setIcon(get_icon('list_remove.png'))
self.remove_button.clicked.connect(self.remove_from_list)
button_layout.addWidget(self.remove_button)
self.move_down_button = QtGui.QToolButton(self)
self.move_down_button.setToolTip(_('Move selected books down the list'))
self.move_down_button.setIcon(QIcon(I('arrow-down.png')))
self.move_down_button.clicked.connect(self.books_table.move_rows_down)
button_layout.addWidget(self.move_down_button)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
button_layout.addItem(spacerItem1)
options_layout = QHBoxLayout()
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
options_layout.addWidget(button_box)
layout.addLayout(options_layout)
# Cause our dialog size to be restored from prefs or created on first usage
self.resize_dialog()
self.books_table.populate_table(books)
示例7: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def setupUi(self, frmLogin):
frmLogin.setObjectName(_fromUtf8("frmLogin"))
frmLogin.resize(320, 152)
frmLogin.setMaximumSize(QtCore.QSize(320, 152))
self.gridLayout_2 = QtGui.QGridLayout(frmLogin)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.btnBox = QtGui.QDialogButtonBox(frmLogin)
self.btnBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.btnBox.setObjectName(_fromUtf8("btnBox"))
self.gridLayout_2.addWidget(self.btnBox, 3, 1, 1, 1)
self.btn_db_settings = QtGui.QToolButton(frmLogin)
self.btn_db_settings.setText(_fromUtf8(""))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/db_server_settings.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.btn_db_settings.setIcon(icon)
self.btn_db_settings.setIconSize(QtCore.QSize(16, 16))
self.btn_db_settings.setCheckable(False)
self.btn_db_settings.setAutoRaise(False)
self.btn_db_settings.setObjectName(_fromUtf8("btn_db_settings"))
self.gridLayout_2.addWidget(self.btn_db_settings, 3, 0, 1, 1)
self.gridLayout = QtGui.QGridLayout()
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.txtUserName = QtGui.QLineEdit(frmLogin)
self.txtUserName.setMinimumSize(QtCore.QSize(0, 30))
self.txtUserName.setObjectName(_fromUtf8("txtUserName"))
self.gridLayout.addWidget(self.txtUserName, 0, 1, 1, 1)
self.label = QtGui.QLabel(frmLogin)
self.label.setMinimumSize(QtCore.QSize(70, 0))
self.label.setObjectName(_fromUtf8("label"))
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtGui.QLabel(frmLogin)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
self.txtPassword = QtGui.QLineEdit(frmLogin)
self.txtPassword.setMinimumSize(QtCore.QSize(0, 30))
self.txtPassword.setEchoMode(QtGui.QLineEdit.Password)
self.txtPassword.setObjectName(_fromUtf8("txtPassword"))
self.gridLayout.addWidget(self.txtPassword, 1, 1, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 2)
self.vlNotification = QtGui.QVBoxLayout()
self.vlNotification.setObjectName(_fromUtf8("vlNotification"))
self.gridLayout_2.addLayout(self.vlNotification, 0, 0, 1, 2)
self.retranslateUi(frmLogin)
QtCore.QObject.connect(self.btnBox, QtCore.SIGNAL(_fromUtf8("rejected()")), frmLogin.reject)
QtCore.QMetaObject.connectSlotsByName(frmLogin)
frmLogin.setTabOrder(self.txtUserName, self.txtPassword)
frmLogin.setTabOrder(self.txtPassword, self.btnBox)
示例8: setupUi
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def setupUi(self, DetailsDock):
DetailsDock.setObjectName(_fromUtf8("DetailsDock"))
DetailsDock.resize(400, 300)
DetailsDock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self.dockWidgetContents = QtGui.QWidget()
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.edit_btn = QtGui.QToolButton(self.dockWidgetContents)
self.edit_btn.setMinimumSize(QtCore.QSize(23, 22))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/edit.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.edit_btn.setIcon(icon)
self.edit_btn.setIconSize(QtCore.QSize(16, 16))
self.edit_btn.setObjectName(_fromUtf8("edit_btn"))
self.horizontalLayout.addWidget(self.edit_btn)
self.delete_btn = QtGui.QToolButton(self.dockWidgetContents)
self.delete_btn.setMinimumSize(QtCore.QSize(23, 22))
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/remove.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.delete_btn.setIcon(icon1)
self.delete_btn.setIconSize(QtCore.QSize(16, 16))
self.delete_btn.setObjectName(_fromUtf8("delete_btn"))
self.horizontalLayout.addWidget(self.delete_btn)
self.view_document_btn = QtGui.QToolButton(self.dockWidgetContents)
self.view_document_btn.setMinimumSize(QtCore.QSize(23, 22))
self.view_document_btn.setMaximumSize(QtCore.QSize(16777215, 16777215))
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/document.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.view_document_btn.setIcon(icon2)
self.view_document_btn.setIconSize(QtCore.QSize(16, 16))
self.view_document_btn.setObjectName(_fromUtf8("view_document_btn"))
self.horizontalLayout.addWidget(self.view_document_btn)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout)
self.tree_scrollArea = QtGui.QScrollArea(self.dockWidgetContents)
self.tree_scrollArea.setMinimumSize(QtCore.QSize(70, 70))
self.tree_scrollArea.setFrameShape(QtGui.QFrame.NoFrame)
self.tree_scrollArea.setFrameShadow(QtGui.QFrame.Plain)
self.tree_scrollArea.setLineWidth(0)
self.tree_scrollArea.setWidgetResizable(True)
self.tree_scrollArea.setObjectName(_fromUtf8("tree_scrollArea"))
self.scrollAreaWidgetContents = QtGui.QWidget()
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 378, 221))
self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.tree_scrollArea.setWidget(self.scrollAreaWidgetContents)
self.verticalLayout.addWidget(self.tree_scrollArea)
DetailsDock.setWidget(self.dockWidgetContents)
self.retranslateUi(DetailsDock)
QtCore.QMetaObject.connectSlotsByName(DetailsDock)
示例9: _create_toolbar
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QToolButton [as 別名]
def _create_toolbar(self, color_maps):
toolbar = QToolBar()
toolbar.setFloatable(False)
toolbar.setMovable(False)
self._layout_combo = LayoutCombo()
self._layout_combo_action = QWidgetAction(self._layout_combo)
self._layout_combo_action.setDefaultWidget(self._layout_combo)
toolbar.addAction(self._layout_combo_action)
self._layout_combo.layout_changed.connect(self._slice_view_widget.set_plot_layout)
# self._colormap_combo = ColormapCombo(['seismic', 'spectral', 'RdGy', 'hot', 'jet', 'gray'])
self._colormap_combo = ColormapCombo(color_maps)
self._colormap_combo.currentIndexChanged[int].connect(self._colormap_changed)
toolbar.addWidget(self._colormap_combo)
self._save_button = QToolButton()
self._save_button.setToolTip("Save as image")
self._save_button.setIcon(resource_icon("table_export.png"))
self._save_button.clicked.connect(self._save_figure)
toolbar.addWidget(self._save_button)
self._settings_button = QToolButton()
self._settings_button.setToolTip("Toggle settings visibility")
self._settings_button.setIcon(resource_icon("cog.png"))
self._settings_button.setCheckable(True)
self._settings_button.toggled.connect(self._show_settings)
toolbar.addWidget(self._settings_button)
self._help_button = QToolButton()
self._help_button.setToolTip("View help")
self._help_button.setIcon(resource_icon("help.png"))
self._help_button.setCheckable(True)
self._help_button.toggled.connect(self._show_help)
toolbar.addWidget(self._help_button)
def toggle_on_close(event):
self._settings_button.setChecked(False)
event.accept()
def toggle_on_close_help(event):
self._help_button.setChecked(False)
event.accept()
self._settings_window.closeEvent = toggle_on_close
self._help_window.closeEvent = toggle_on_close_help
self._colormap_combo.setCurrentIndex(45)
self.set_default_layout()
return toolbar