diff options
Diffstat (limited to 'examples/widgets')
-rw-r--r-- | examples/widgets/doc/src/gallery.qdoc | 36 | ||||
-rw-r--r-- | examples/widgets/widgets/styles/widgetgallery.cpp | 8 | ||||
-rw-r--r-- | examples/widgets/widgets/styles/widgetgallery.h | 2 |
3 files changed, 38 insertions, 8 deletions
diff --git a/examples/widgets/doc/src/gallery.qdoc b/examples/widgets/doc/src/gallery.qdoc new file mode 100644 index 0000000000..a262374ce6 --- /dev/null +++ b/examples/widgets/doc/src/gallery.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widgets/gallery + \title Widgets Gallery Example + \ingroup examples-widgets + \brief The Widgets Gallery example shows widgets relevant for designing UIs. + + This example demonstrates widgets typically used in dialogs and forms. + It also allows for changing the style. +*/ diff --git a/examples/widgets/widgets/styles/widgetgallery.cpp b/examples/widgets/widgets/styles/widgetgallery.cpp index d70c503f53..bf8e93feb4 100644 --- a/examples/widgets/widgets/styles/widgetgallery.cpp +++ b/examples/widgets/widgets/styles/widgetgallery.cpp @@ -75,8 +75,6 @@ WidgetGallery::WidgetGallery(QWidget *parent) : QDialog(parent) { - originalPalette = QApplication::palette(); - styleComboBox = new QComboBox; const QString defaultStyleName = QApplication::style()->objectName(); QStringList styleNames = QStyleFactory::keys(); @@ -162,10 +160,8 @@ void WidgetGallery::changeStyle(const QString &styleName) void WidgetGallery::changePalette() //! [7] //! [8] { - if (useStylePaletteCheckBox->isChecked()) - QApplication::setPalette(QApplication::style()->standardPalette()); - else - QApplication::setPalette(originalPalette); + QApplication::setPalette(useStylePaletteCheckBox->isChecked() ? + QApplication::style()->standardPalette() : QPalette()); } //! [8] diff --git a/examples/widgets/widgets/styles/widgetgallery.h b/examples/widgets/widgets/styles/widgetgallery.h index 4deee6839a..8c4c880536 100644 --- a/examples/widgets/widgets/styles/widgetgallery.h +++ b/examples/widgets/widgets/styles/widgetgallery.h @@ -96,8 +96,6 @@ private: void createBottomRightGroupBox(); void createProgressBar(); - QPalette originalPalette; - QLabel *styleLabel; QComboBox *styleComboBox; QCheckBox *useStylePaletteCheckBox; |