本文整理汇总了Python中PyQt5.QtWidgets.QStyleFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Python QStyleFactory.create方法的具体用法?Python QStyleFactory.create怎么用?Python QStyleFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStyleFactory
的用法示例。
在下文中一共展示了QStyleFactory.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_vertical_header_color_status_changed
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def on_vertical_header_color_status_changed(self, use_colors: bool):
if use_colors == self.use_header_colors:
return
self.use_header_colors = use_colors
header = self.verticalHeader()
if self.use_header_colors:
header.setStyle(QStyleFactory.create("Fusion"))
else:
header.setStyle(QStyleFactory.create(""))
self.setVerticalHeader(header)
示例2: changeStyle
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def changeStyle(self, checked):
if not checked:
return
action = self.sender()
style = QStyleFactory.create(action.data())
if not style:
return
QApplication.setStyle(style)
self.setButtonText(self.smallRadioButton, "Small (%d x %d)",
style, QStyle.PM_SmallIconSize)
self.setButtonText(self.largeRadioButton, "Large (%d x %d)",
style, QStyle.PM_LargeIconSize)
self.setButtonText(self.toolBarRadioButton, "Toolbars (%d x %d)",
style, QStyle.PM_ToolBarIconSize)
self.setButtonText(self.listViewRadioButton, "List views (%d x %d)",
style, QStyle.PM_ListViewIconSize)
self.setButtonText(self.iconViewRadioButton, "Icon views (%d x %d)",
style, QStyle.PM_IconViewIconSize)
self.setButtonText(self.tabBarRadioButton, "Tab bars (%d x %d)",
style, QStyle.PM_TabBarIconSize)
self.changeSize()
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, *, win_id, tab_id, tab, private, parent=None):
super().__init__(parent)
if sys.platform == 'darwin' and qtutils.version_check('5.4'):
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
# See https://github.com/qutebrowser/qutebrowser/issues/462
self.setStyle(QStyleFactory.create('Fusion'))
# FIXME:qtwebengine this is only used to set the zoom factor from
# the QWebPage - we should get rid of it somehow (signals?)
self.tab = tab
self._tabdata = tab.data
self.win_id = win_id
self.scroll_pos = (-1, -1)
self._old_scroll_pos = (-1, -1)
self._set_bg_color()
self._tab_id = tab_id
page = webpage.BrowserPage(win_id=self.win_id, tab_id=self._tab_id,
tabdata=tab.data, private=private,
parent=self)
try:
page.setVisibilityState(
QWebPage.VisibilityStateVisible if self.isVisible()
else QWebPage.VisibilityStateHidden)
except AttributeError:
pass
self.setPage(page)
mode_manager = objreg.get('mode-manager', scope='window',
window=win_id)
mode_manager.entered.connect(self.on_mode_entered)
mode_manager.left.connect(self.on_mode_left)
objreg.get('config').changed.connect(self._set_bg_color)
示例4: __updateChildren
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __updateChildren(self, sstyle):
"""
Private slot to change the style of the show UI.
@param sstyle name of the selected style (string)
"""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
qstyle = QStyleFactory.create(sstyle)
self.mainWidget.setStyle(qstyle)
lst = self.mainWidget.findChildren(QWidget)
for obj in lst:
try:
obj.setStyle(qstyle)
except AttributeError:
pass
del lst
self.mainWidget.hide()
self.mainWidget.show()
self.lastQStyle = qstyle
self.lastStyle = sstyle
Preferences.Prefs.settings.setValue(
'UIPreviewer/style', self.styleCombo.currentIndex())
QApplication.restoreOverrideCursor()
示例5: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, win_id, tab_id, tab, parent=None):
super().__init__(parent)
if sys.platform == 'darwin' and qtutils.version_check('5.4'):
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
# See https://github.com/The-Compiler/qutebrowser/issues/462
self.setStyle(QStyleFactory.create('Fusion'))
self.tab = tab
self.win_id = win_id
self._check_insertmode = False
self.scroll_pos = (-1, -1)
self._old_scroll_pos = (-1, -1)
self._ignore_wheel_event = False
self._set_bg_color()
self._tab_id = tab_id
page = self._init_page()
hintmanager = hints.HintManager(win_id, self._tab_id, self)
hintmanager.mouse_event.connect(self.on_mouse_event)
hintmanager.start_hinting.connect(page.on_start_hinting)
hintmanager.stop_hinting.connect(page.on_stop_hinting)
objreg.register('hintmanager', hintmanager, scope='tab', window=win_id,
tab=tab_id)
mode_manager = objreg.get('mode-manager', scope='window',
window=win_id)
mode_manager.entered.connect(self.on_mode_entered)
mode_manager.left.connect(self.on_mode_left)
if config.get('input', 'rocker-gestures'):
self.setContextMenuPolicy(Qt.PreventContextMenu)
objreg.get('config').changed.connect(self.on_config_changed)
示例6: styleChanged
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def styleChanged(self, styleName):
style = QStyleFactory.create(styleName)
if style:
self.setStyleHelper(self, style)
# Keep a reference to the style.
self._style = style
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, *, win_id, tab_id, tab, private, parent=None):
super().__init__(parent)
if utils.is_mac:
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
# See https://github.com/qutebrowser/qutebrowser/issues/462
self.setStyle(QStyleFactory.create('Fusion'))
# FIXME:qtwebengine this is only used to set the zoom factor from
# the QWebPage - we should get rid of it somehow (signals?)
self.tab = tab
self._tabdata = tab.data
self.win_id = win_id
self.scroll_pos = (-1, -1)
self._old_scroll_pos = (-1, -1)
self._set_bg_color()
self._tab_id = tab_id
page = webpage.BrowserPage(win_id=self.win_id, tab_id=self._tab_id,
tabdata=tab.data, private=private,
parent=self)
page.setVisibilityState(
QWebPage.VisibilityStateVisible if self.isVisible()
else QWebPage.VisibilityStateHidden)
self.setPage(page)
config.instance.changed.connect(self._set_bg_color)
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, *args):
QApplication.__init__(self, *args)
# Setup appication
self.setApplicationName('openshot')
self.setApplicationVersion(info.SETUP['version'])
# self.setWindowIcon(QIcon("xdg/openshot.svg"))
# Init settings
self.settings = settings.SettingStore()
try:
self.settings.load()
except Exception as ex:
log.error("Couldn't load user settings. Exiting.\n{}".format(ex))
exit()
# Init translation system
language.init_language()
# Tests of project data loading/saving
self.project = project_data.ProjectDataStore()
# Init Update Manager
self.updates = updates.UpdateManager()
# It is important that the project is the first listener if the key gets update
self.updates.add_listener(self.project)
# Load ui theme if not set by OS
ui_util.load_theme()
# Track which dockable window received a context menu
self.context_menu_object = None
# Set Experimental Dark Theme
if self.settings.get("theme") == "Humanity: Dark":
# Only set if dark theme selected
self.setStyle(QStyleFactory.create("Fusion"))
darkPalette = self.palette()
darkPalette.setColor(QPalette.Window, QColor(53, 53, 53))
darkPalette.setColor(QPalette.WindowText, Qt.white)
darkPalette.setColor(QPalette.Base, QColor(25, 25, 25))
darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ToolTipBase, Qt.white)
darkPalette.setColor(QPalette.ToolTipText, Qt.white)
darkPalette.setColor(QPalette.Text, Qt.white)
darkPalette.setColor(QPalette.Button, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ButtonText, Qt.white)
darkPalette.setColor(QPalette.BrightText, Qt.red)
darkPalette.setColor(QPalette.Link, QColor(42, 130, 218))
darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218))
darkPalette.setColor(QPalette.HighlightedText, Qt.black)
self.setPalette(darkPalette)
self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")
# Create main window
from windows.main_window import MainWindow
self.window = MainWindow()
self.window.show()
示例9: _configure_qt_style
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def _configure_qt_style(self, preferred_styles):
if preferred_styles is not None:
for style_key in preferred_styles:
style = QStyleFactory.create(style_key)
if style is not None:
self.app.setStyle(style)
break
示例10: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, win_id, parent=None):
super().__init__(parent)
self.pattern = ''
self._win_id = win_id
config.instance.changed.connect(self._on_config_changed)
self._active = False
self._delegate = completiondelegate.CompletionItemDelegate(self)
self.setItemDelegate(self._delegate)
self.setStyle(QStyleFactory.create('Fusion'))
config.set_register_stylesheet(self)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.setHeaderHidden(True)
self.setAlternatingRowColors(True)
self.setIndentation(0)
self.setItemsExpandable(False)
self.setExpandsOnDoubleClick(False)
self.setAnimated(False)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# WORKAROUND
# This is a workaround for weird race conditions with invalid
# item indexes leading to segfaults in Qt.
#
# Some background: http://bugs.quassel-irc.org/issues/663
# The proposed fix there was later reverted because it didn't help.
self.setUniformRowHeights(True)
self.hide()
示例11: nfontEditGUIStart
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def nfontEditGUIStart():
app = QApplication(sys.argv)
ex = NFontEditWidget('__main__')
QApplication.setStyle(QStyleFactory.create('Fusion'))
ex.openFile()
ex.show()
sys.exit(app.exec_())
示例12: setStyle
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def setStyle():
global _system_default
style = QSettings().value("guistyle", "", str).lower()
if style not in keys():
style = _system_default
if style != app.qApp.style().objectName():
app.qApp.setStyle(QStyleFactory.create(style))
示例13: main
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def main():
app = QApplication(sys.argv)
app.setStyle(QStyleFactory.create("Fusion"))
main = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(main)
main.show()
sys.exit(app.exec_())
示例14: setFusionTheme
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def setFusionTheme(myQApplication):
myQApplication.setStyle(QStyleFactory.create("Fusion"))
p = myQApplication.palette()
p.setColor(QPalette.Window, QColor(52, 73, 94))
p.setColor(QPalette.Button, QColor(52, 73, 94))
p.setColor(QPalette.Highlight, QColor(0, 0, 255))
p.setColor(QPalette.ButtonText, QColor(255, 255, 255))
p.setColor(QPalette.WindowText, QColor(255, 255, 255))
myQApplication.setPalette(p)
示例15: __init__
# 需要导入模块: from PyQt5.QtWidgets import QStyleFactory [as 别名]
# 或者: from PyQt5.QtWidgets.QStyleFactory import create [as 别名]
def __init__(self, win_id, parent=None):
super().__init__(parent)
if sys.platform == 'darwin' and qtutils.version_check('5.4'):
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
# See https://github.com/The-Compiler/qutebrowser/issues/462
self.setStyle(QStyleFactory.create('Fusion'))
self.win_id = win_id
self.load_status = LoadStatus.none
self._check_insertmode = False
self.inspector = None
self.scroll_pos = (-1, -1)
self.statusbar_message = ''
self._old_scroll_pos = (-1, -1)
self._zoom = None
self._has_ssl_errors = False
self._ignore_wheel_event = False
self.keep_icon = False
self.search_text = None
self.search_flags = 0
self.selection_enabled = False
self.init_neighborlist()
self._set_bg_color()
cfg = objreg.get('config')
cfg.changed.connect(self.init_neighborlist)
# For some reason, this signal doesn't get disconnected automatically
# when the WebView is destroyed on older PyQt versions.
# See https://github.com/The-Compiler/qutebrowser/issues/390
self.destroyed.connect(functools.partial(
cfg.changed.disconnect, self.init_neighborlist))
self._cur_url = None
self.cur_url = QUrl()
self.progress = 0
self.registry = objreg.ObjectRegistry()
self.tab_id = next(tab_id_gen)
tab_registry = objreg.get('tab-registry', scope='window',
window=win_id)
tab_registry[self.tab_id] = self
objreg.register('webview', self, registry=self.registry)
page = self._init_page()
hintmanager = hints.HintManager(win_id, self.tab_id, self)
hintmanager.mouse_event.connect(self.on_mouse_event)
hintmanager.start_hinting.connect(page.on_start_hinting)
hintmanager.stop_hinting.connect(page.on_stop_hinting)
objreg.register('hintmanager', hintmanager, registry=self.registry)
mode_manager = objreg.get('mode-manager', scope='window',
window=win_id)
mode_manager.entered.connect(self.on_mode_entered)
mode_manager.left.connect(self.on_mode_left)
self.viewing_source = False
self.setZoomFactor(float(config.get('ui', 'default-zoom')) / 100)
self._default_zoom_changed = False
if config.get('input', 'rocker-gestures'):
self.setContextMenuPolicy(Qt.PreventContextMenu)
self.urlChanged.connect(self.on_url_changed)
self.loadProgress.connect(lambda p: setattr(self, 'progress', p))
objreg.get('config').changed.connect(self.on_config_changed)