当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QStyleFactory类代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QStyleFactory的典型用法代码示例。如果您正苦于以下问题:Python QStyleFactory类的具体用法?Python QStyleFactory怎么用?Python QStyleFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QStyleFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, parent=None):
        super(Example, self).__init__(parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))

        # -------------- QCOMBOBOX ----------------------
        cbx = QComboBox()
        # agregar lista de nombres de estilos disponibles
        cbx.addItems(QStyleFactory.keys())
        # responder al evento cambio de texto
        cbx.currentTextChanged.connect(self.textChanged)
        # seleccionar el ultimo elemento
        cbx.setItemText(4, 'Fusion')

        # -------------- QLISTWIDGET ---------------------
        items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone']

        self.lv = QListWidget()
        self.lv.addItems(items)
        self.lv.itemSelectionChanged.connect(self.itemChanged)

        # -------------- QTABLEWIDGET --------------------
        self.table = QTableWidget(10, 3)
        # establecer nombre de cabecera de las columnas
        self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad'])
        # evento producido cuando cambia el elemento seleccionado
        self.table.itemSelectionChanged.connect(self.tableItemChanged)
        # alternar color de fila
        self.table.setAlternatingRowColors(True)
        # seleccionar solo filas
        self.table.setSelectionBehavior(QTableWidget.SelectRows)
        # usar seleccion simple, una fila a la vez
        self.table.setSelectionMode(QTableWidget.SingleSelection)

        table_data = [
            ("Alice", 15, "Panama"),
            ("Dana", 25, "Chile"),
            ("Fernada", 18, "Ecuador")
        ]

        # agregar cada uno de los elementos al QTableWidget
        for i, (name, age, city) in enumerate(table_data):
            self.table.setItem(i, 0, QTableWidgetItem(name))
            self.table.setItem(i, 1, QTableWidgetItem(str(age)))
            self.table.setItem(i, 2, QTableWidgetItem(city))

        vbx = QVBoxLayout()
        vbx.addWidget(QPushButton('Tutoriales PyQT-5'))
        vbx.setAlignment(Qt.AlignTop)
        vbx.addWidget(cbx)
        vbx.addWidget(self.lv)
        vbx.addWidget(self.table)

        self.setWindowTitle("Items View")
        self.resize(362, 320)
        self.setLayout(vbx)
开发者ID:TutorProgramacion,项目名称:pyqt-tutorial,代码行数:55,代码来源:item-view.py

示例2: on_vertical_header_color_status_changed

    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)
开发者ID:jopohl,项目名称:urh,代码行数:12,代码来源:TableView.py

示例3: nfontEditGUIStart

def nfontEditGUIStart():
    app = QApplication(sys.argv)
    ex = NFontEditWidget('__main__')
    QApplication.setStyle(QStyleFactory.create('Fusion'))
    ex.openFile()
    ex.show()
    sys.exit(app.exec_())
开发者ID:LeftRadio,项目名称:ngl_utils,代码行数:7,代码来源:editwidget.py

示例4: changeStyle

    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()
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:25,代码来源:icons.py

示例5: styleChanged

    def styleChanged(self, styleName):
        style = QStyleFactory.create(styleName)
        if style:
            self.setStyleHelper(self, style)

        # Keep a reference to the style.
        self._style = style
开发者ID:death-finger,项目名称:Scripts,代码行数:7,代码来源:embeddeddialogs.py

示例6: __init__

    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)
开发者ID:michaelbeaumont,项目名称:qutebrowser,代码行数:34,代码来源:webview.py

示例7: __updateChildren

 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()
开发者ID:Darriall,项目名称:eric,代码行数:26,代码来源:UIPreviewer.py

示例8: __init__

    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)
开发者ID:addictedtoflames,项目名称:qutebrowser,代码行数:29,代码来源:webview.py

示例9: __init__

    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()
开发者ID:kkfong,项目名称:openshot-qt,代码行数:60,代码来源:app.py

示例10: _configure_qt_style

 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
开发者ID:jfisteus,项目名称:eyegrade,代码行数:7,代码来源:gui.py

示例11: __init__

    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()
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:28,代码来源:completionwidget.py

示例12: __init__

    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)
开发者ID:mehak,项目名称:qutebrowser,代码行数:26,代码来源:webview.py

示例13: setStyle

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))
开发者ID:19joho66,项目名称:frescobaldi,代码行数:8,代码来源:guistyle.py

示例14: setFusionTheme

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)
开发者ID:Abdul007Malik,项目名称:mini-project,代码行数:9,代码来源:app.py

示例15: main

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_())
开发者ID:xela144,项目名称:testPyQt,代码行数:9,代码来源:calc.py


注:本文中的PyQt5.QtWidgets.QStyleFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。