diff options
Diffstat (limited to 'examples/widgets/widgetsgallery/widgetgallery.py')
-rw-r--r-- | examples/widgets/widgetsgallery/widgetgallery.py | 67 |
1 files changed, 21 insertions, 46 deletions
diff --git a/examples/widgets/widgetsgallery/widgetgallery.py b/examples/widgets/widgetsgallery/widgetgallery.py index f57e23992..d43ab26a5 100644 --- a/examples/widgets/widgetsgallery/widgetgallery.py +++ b/examples/widgets/widgetsgallery/widgetgallery.py @@ -1,52 +1,23 @@ -############################################################################# -## -## Copyright (C) 2020 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the Qt for Python examples of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:BSD$ -## You may use this file under the terms of the BSD license as follows: -## -## "Redistribution and use in source and binary forms, with or without -## modification, are permitted provided that the following conditions are -## met: -## * Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. -## * Redistributions in binary form must reproduce the above copyright -## notice, this list of conditions and the following disclaimer in -## the documentation and/or other materials provided with the -## distribution. -## * Neither the name of The Qt Company Ltd nor the names of its -## contributors may be used to endorse or promote products derived -## from this software without specific prior written permission. -## -## -## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import sys -from PySide6.QtWidgets import * +from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo, QSysInfo, Qt, + QTimer, Slot, qVersion) from PySide6.QtGui import (QCursor, QDesktopServices, QGuiApplication, QIcon, QKeySequence, QShortcut, QStandardItem, - QStandardItemModel, QScreen, QWindow) -from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo, QMetaObject, - QSysInfo, QTextStream, QTimer, Qt, qVersion) - + QStandardItemModel) +from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, + QCommandLinkButton, QDateTimeEdit, QDial, + QDialog, QDialogButtonBox, QFileSystemModel, + QGridLayout, QGroupBox, QHBoxLayout, QLabel, + QLineEdit, QListView, QMenu, QPlainTextEdit, + QProgressBar, QPushButton, QRadioButton, + QScrollBar, QSizePolicy, QSlider, QSpinBox, + QStyleFactory, QTableWidget, QTabWidget, + QTextBrowser, QTextEdit, QToolBox, QToolButton, + QTreeView, QVBoxLayout, QWidget) POEM = """Twinkle, twinkle, little star, How I wonder what you are. @@ -193,8 +164,8 @@ class WidgetGallery(QDialog): top_layout.addStretch(1) top_layout.addWidget(disable_widgets_checkbox) - dialog_buttonbox = QDialogButtonBox(QDialogButtonBox.Help | - QDialogButtonBox.Close) + dialog_buttonbox = QDialogButtonBox(QDialogButtonBox.Help + | QDialogButtonBox.Close) init_widget(dialog_buttonbox, "dialogButtonBox") dialog_buttonbox.helpRequested.connect(launch_module_help) dialog_buttonbox.rejected.connect(self.reject) @@ -217,9 +188,11 @@ class WidgetGallery(QDialog): self.windowHandle().screenChanged.connect(self.update_systeminfo) self.update_systeminfo() + @Slot(str) def change_style(self, style_name): QApplication.setStyle(QStyleFactory.create(style_name)) + @Slot() def advance_progressbar(self): cur_val = self._progress_bar.value() max_val = self._progress_bar.maximum() @@ -416,6 +389,7 @@ class WidgetGallery(QDialog): timer.start(1000) return result + @Slot() def update_systeminfo(self): """Display system information""" system_info = SYSTEMINFO.format(sys.version, @@ -424,6 +398,7 @@ class WidgetGallery(QDialog): screen_info(self)) self._systeminfo_textbrowser.setHtml(system_info) + @Slot() def help_on_current_widget(self): """Display help on widget under mouse""" w = QApplication.widgetAt(QCursor.pos(self.screen())) |