本文整理汇总了Python中Qt.QtGui.QIcon方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QIcon方法的具体用法?Python QtGui.QIcon怎么用?Python QtGui.QIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qt.QtGui
的用法示例。
在下文中一共展示了QtGui.QIcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def __init__(self, parent=None,validPins=None):
super(SelectPinDialog, self).__init__(None)
self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
self.setWindowTitle("Select pin")
self.setWindowIcon(QtGui.QIcon(":/pin.png"))
self.resize(QtCore.QSize(400, 300))
self.mainLayout = QtWidgets.QVBoxLayout(self)
self.mainLayout.setContentsMargins(2, 2, 2, 2)
self.searchBox = QtWidgets.QLineEdit()
self.searchBox.setPlaceholderText("search...")
self.searchBox.textChanged.connect(self.filterContent)
self.mainLayout.addWidget(self.searchBox)
if not validPins:
validPins = [pin.__name__ for pin in getAllPinClasses()]
self.content = _PinsListWidget(validPins=validPins)
self.mainLayout.addWidget(self.content)
self.content.itemClicked.connect(self.onItemClicked)
self.content.returnPressed.connect(self.onReturnPressed)
self._result = None
示例2: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "preview.png")
示例3: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "compute.png")
示例4: __init__
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def __init__(self, parent=None):
# Initialize UI
super().__init__(parent)
self.setupUi(self)
# Set window icon
icon_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "qspectrumanalyzer.svg")
self.setWindowIcon(QtGui.QIcon(icon_path))
# Create progress bar
self.progressbar = QtWidgets.QProgressBar()
self.progressbar.setMaximumWidth(250)
self.progressbar.setVisible(False)
self.statusbar.addPermanentWidget(self.progressbar)
# Create plot widgets and update UI
self.spectrumPlotWidget = SpectrumPlotWidget(self.mainPlotLayout)
self.waterfallPlotWidget = WaterfallPlotWidget(self.waterfallPlotLayout, self.histogramPlotLayout)
# Link main spectrum plot to waterfall plot
self.spectrumPlotWidget.plot.setXLink(self.waterfallPlotWidget.plot)
# Setup power thread and connect signals
self.update_status_timer = QtCore.QTimer()
self.update_status_timer.timeout.connect(self.update_status)
self.prev_sweep_time = None
self.prev_data_timestamp = None
self.start_timestamp = None
self.data_storage = None
self.power_thread = None
self.backend = None
self.setup_power_thread()
self.update_buttons()
self.load_settings()
示例5: customTextEditorContextMenu
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def customTextEditorContextMenu(self, pos):
""" Slot for the right-click context menu when in Edit mode.
:Parameters:
pos : `QtCore.QPoint`
Position of the right-click
"""
# Add icons to standard context menu.
menu = self.currTab.textEditor.createStandardContextMenu()
actions = menu.actions()
actions[0].setIcon(self.actionUndo.icon())
actions[1].setIcon(self.actionRedo.icon())
actions[3].setIcon(self.actionCut.icon())
actions[4].setIcon(self.actionCopy.icon())
actions[5].setIcon(self.actionPaste.icon())
actions[6].setIcon(QtGui.QIcon.fromTheme("edit-delete"))
actions[8].setIcon(self.actionSelectAll.icon())
path = self.currTab.getCurrentPath()
if path:
menu.addSeparator()
if utils.isUsdFile(path):
menu.addAction(self.actionUsdView)
menu.addAction(self.actionTextEditor)
menu.addAction(self.actionOpenWith)
menu.addSeparator()
menu.addAction(self.actionFileInfo)
menu.exec_(self.currTab.textEditor.mapToGlobal(pos))
del actions, menu
示例6: saveFileAs
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def saveFileAs(self):
""" Save the current file with a new filename.
:Returns:
If saved or not.
:Rtype:
`bool`
"""
filePath, fileFormat = self.getSaveAsPath()
if filePath is not None:
# Save file and apply new name where needed.
if self.saveFile(filePath, fileFormat):
idx = self.tabWidget.currentIndex()
fileInfo = QtCore.QFileInfo(filePath)
fileName = fileInfo.fileName()
ext = fileInfo.suffix()
self.tabWidget.setTabText(idx, fileName)
if self.currTab.fileFormat == FILE_FORMAT_USDC:
self.tabWidget.setTabIcon(idx, self.binaryIcon)
self.tabWidget.setTabToolTip(idx, "{} - {} (binary)".format(fileName, filePath))
elif self.currTab.fileFormat == FILE_FORMAT_USDZ:
self.tabWidget.setTabIcon(idx, self.zipIcon)
self.tabWidget.setTabToolTip(idx, "{} - {} (zip)".format(fileName, filePath))
else:
self.tabWidget.setTabIcon(idx, QtGui.QIcon())
self.tabWidget.setTabToolTip(idx, "{} - {}".format(fileName, filePath))
self.currTab.updateHistory(QtCore.QUrl(filePath))
self.currTab.updateFileStatus()
self.setHighlighter(ext)
self.updateButtons()
return True
return False
示例7: updateEditButtons
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def updateEditButtons(self):
""" Toggle edit action and button text.
"""
if self.currTab.inEditMode:
self.actionEdit.setVisible(False)
self.actionBrowse.setVisible(True)
self.actionSave.setEnabled(True)
self.actionPaste.setEnabled(self.currTab.textEditor.canPaste())
self.actionUndo.setEnabled(self.currTab.textEditor.document().isUndoAvailable())
self.actionRedo.setEnabled(self.currTab.textEditor.document().isRedoAvailable())
self.actionFind.setText("&Find/Replace...")
self.actionFind.setIcon(QtGui.QIcon.fromTheme("edit-find-replace"))
self.actionCommentOut.setEnabled(True)
self.actionUncomment.setEnabled(True)
self.actionIndent.setEnabled(True)
self.actionUnindent.setEnabled(True)
else:
self.actionEdit.setVisible(True)
self.actionBrowse.setVisible(False)
self.actionSave.setEnabled(False)
self.actionUndo.setEnabled(False)
self.actionRedo.setEnabled(False)
self.actionCut.setEnabled(False)
self.actionPaste.setEnabled(False)
self.actionFind.setText("&Find...")
self.actionFind.setIcon(QtGui.QIcon.fromTheme("edit-find"))
self.actionCommentOut.setEnabled(False)
self.actionUncomment.setEnabled(False)
self.actionIndent.setEnabled(False)
self.actionUnindent.setEnabled(False)
示例8: setTabIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def setTabIcon(self, index, icon):
""" Override the default method to set the same icon on our custom action that focuses on or re-opens the
widget at the given index.
:Parameters:
index : `int`
Index of widget
icon : `QtGui.QIcon`
Icon
"""
super(TabWidget, self).setTabIcon(index, icon)
self.widget(index).action.setIcon(icon)
示例9: icon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def icon(self):
""" Get an icon to display representing the file's status.
:Returns:
Icon (may be blank)
:Rtype:
`QIcon`
"""
if self.status == self.FILE_NOT_WRITABLE:
return QIcon(":images/images/lock")
return QIcon()
示例10: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "aligntop.png")
示例11: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "alignright.png")
示例12: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "alignleft.png")
示例13: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "compile.png")
示例14: getIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def getIcon():
return QtGui.QIcon(RESOURCES_DIR + "screenshot_icon.png")
示例15: changeLockIcon
# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QIcon [as 别名]
def changeLockIcon(self,checked):
if checked:
self.lockCheckBox.setIcon(QtGui.QIcon(':/locked.png'))
else:
self.lockCheckBox.setIcon(QtGui.QIcon(':/unlocked.png'))