diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-06-26 15:20:01 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-06-29 14:49:13 +0200 |
commit | 1e954f9be898a604499c53fe639e89e8c48a4b0e (patch) | |
tree | e18c0a8cb02ce952c923f3fd7041c61d54360920 /tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp | |
parent | c5ee7c8b8f214dde6f5e9c513ef3a8592cc4dd7a (diff) |
Move stylesheets example to manual test
Pick-to: 6.5 6.6
Change-Id: If0206e63546bf948af4cfb65773e2662c53a5e79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp')
-rw-r--r-- | tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp b/tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp new file mode 100644 index 0000000000..a43613c757 --- /dev/null +++ b/tests/manual/examples/widgets/widgets/stylesheet/mainwindow.cpp @@ -0,0 +1,41 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "mainwindow.h" +#include "stylesheeteditor.h" + +#include <QMessageBox> + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + ui.setupUi(this); + + ui.nameLabel->setProperty("class", "mandatory QLabel"); + ui.nameCombo->lineEdit()->setPlaceholderText(tr("Last, First")); + + styleSheetEditor = new StyleSheetEditor(this); + + statusBar()->addWidget(new QLabel(tr("Ready"))); + + connect(ui.exitAction, &QAction::triggered, qApp, &QApplication::quit); + connect(ui.aboutQtAction, &QAction::triggered, qApp, &QApplication::aboutQt); +} + +void MainWindow::on_editStyleAction_triggered() +{ + styleSheetEditor->show(); + styleSheetEditor->activateWindow(); +} + +void MainWindow::on_aboutAction_triggered() +{ + const QString url = QStringLiteral("http://doc.qt.io/qt-%1/stylesheet.html") + .arg(QT_VERSION_MAJOR); + QMessageBox::about(this, tr("About Style sheet"), + tr("The <b>Style Sheet</b> example shows how widgets can be styled " + "using <a href=\"%1\">Qt " + "Style Sheets</a>. Click <b>File|Edit Style Sheet</b> to pop up the " + "style editor, and either choose an existing style sheet or design " + "your own.").arg(url)); +} |