summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp6
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp12
-rw-r--r--tests/manual/foreignwindows/main.cpp11
-rw-r--r--tests/manual/lance/interactivewidget.cpp2
-rw-r--r--tests/manual/lance/main.cpp10
-rw-r--r--tests/manual/lance/widgets.h62
-rw-r--r--tests/manual/qcursor/grab_override/mainwindow.cpp4
-rw-r--r--tests/manual/qsslsocket/main.cpp12
-rw-r--r--tests/manual/shortcuts/main.cpp3
-rw-r--r--tests/manual/widgets/itemviews/itemviews.pro8
-rw-r--r--tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp88
-rw-r--r--tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro8
-rw-r--r--tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp111
-rw-r--r--tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro4
14 files changed, 281 insertions, 60 deletions
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 62d03e735d..25c1e44b8c 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -438,9 +438,9 @@ void FileDialogPanel::restoreDefaults()
setComboBoxValue(m_viewMode, d.viewMode());
m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly));
m_allowedSchemes->setText(QString());
- m_confirmOverWrite->setChecked(d.confirmOverwrite());
- m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible());
- m_resolveSymLinks->setChecked(d.resolveSymlinks());
+ m_confirmOverWrite->setChecked(!d.testOption(QFileDialog::DontConfirmOverwrite));
+ m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails));
+ m_resolveSymLinks->setChecked(!d.testOption(QFileDialog::DontResolveSymlinks));
m_readOnly->setChecked(d.isReadOnly());
m_native->setChecked(true);
m_customDirIcons->setChecked(d.testOption(QFileDialog::DontUseCustomDirectoryIcons));
diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp
index d999dbc30c..8d64d2f6a6 100644
--- a/tests/manual/dialogs/printdialogpanel.cpp
+++ b/tests/manual/dialogs/printdialogpanel.cpp
@@ -55,6 +55,10 @@
#include <QTextStream>
#include <QDir>
+#if QT_VERSION >= 0x050000
+# include <QScreen>
+#endif
+
const FlagData printerModeComboData[] =
{
{"ScreenResolution", QPrinter::ScreenResolution},
@@ -705,7 +709,13 @@ void PrintDialogPanel::showPreviewDialog()
{
applySettings(m_printer.data());
PrintPreviewDialog dialog(m_printer.data(), this);
- dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5);
+#if QT_VERSION >= 0x050000
+ const int screenNumber = QApplication::desktop()->screenNumber(this);
+ const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize();
+#else
+ const QSize availableSize = QApplication::desktop()->availableGeometry().size();
+#endif
+ dialog.resize(availableSize * 4/ 5);
if (dialog.exec() == QDialog::Accepted)
retrieveSettings(m_printer.data());
}
diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp
index 74c6d8c376..44aff54773 100644
--- a/tests/manual/foreignwindows/main.cpp
+++ b/tests/manual/foreignwindows/main.cpp
@@ -195,6 +195,9 @@ static QString description(const QString &appName)
"tests embedding foreign windows into Qt.\n\nUse cases:\n\n"
<< appName << " -a Dump a list of all native window ids.\n"
<< appName << " <winid> Dump information on the window.\n"
+ << appName << " -m <winid> Move window to top left corner\n"
+ << QByteArray(appName.size(), ' ')
+ << " (recover lost windows after changing monitor setups).\n"
<< appName << " -c <winid> Dump information on the window continuously.\n"
<< appName << " -e <winid> Embed window into a Qt widget.\n"
<< "\nOn Windows, class names of well known controls (EDIT, BUTTON...) can be\n"
@@ -245,6 +248,10 @@ int main(int argc, char *argv[])
parser.addOption(outputAllOption);
QCommandLineOption continuousOption(QStringList() << QStringLiteral("c") << QStringLiteral("continuous"),
QStringLiteral("Output continuously."));
+ parser.addOption(outputAllOption);
+ QCommandLineOption moveOption(QStringList() << QStringLiteral("m") << QStringLiteral("move"),
+ QStringLiteral("Move window to top left corner."));
+ parser.addOption(moveOption);
parser.addOption(continuousOption);
QCommandLineOption embedOption(QStringList() << QStringLiteral("e") << QStringLiteral("embed"),
QStringLiteral("Embed a foreign window into a Qt widget."));
@@ -274,8 +281,12 @@ int main(int argc, char *argv[])
return -1;
}
QWindow *foreignWindow = QWindow::fromWinId(wid);
+ if (!foreignWindow)
+ return -1;
foreignWindow->setObjectName("ForeignWindow" + QString::number(wid, 16));
windows.append(foreignWindow);
+ if (parser.isSet(moveOption))
+ foreignWindow->setFramePosition(QGuiApplication::primaryScreen()->availableGeometry().topLeft());
}
if (windows.isEmpty())
diff --git a/tests/manual/lance/interactivewidget.cpp b/tests/manual/lance/interactivewidget.cpp
index 8ac3881af7..d172fac900 100644
--- a/tests/manual/lance/interactivewidget.cpp
+++ b/tests/manual/lance/interactivewidget.cpp
@@ -45,7 +45,7 @@ InteractiveWidget::InteractiveWidget()
// create and populate the command toolbox
m_commandsToolBox = new QToolBox();
- QListWidget *currentListWidget = 0;
+ QListWidget *currentListWidget = nullptr;
foreach (PaintCommands::PaintCommandInfos paintCommandInfo, PaintCommands::s_commandInfoTable) {
if (paintCommandInfo.isSectionHeader()) {
currentListWidget = new QListWidget();
diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp
index 749a4b1943..7f5af2d908 100644
--- a/tests/manual/lance/main.cpp
+++ b/tests/manual/lance/main.cpp
@@ -185,7 +185,7 @@ static void displayCommands()
" pixmap_load filename name_in_script\n"
" image_load filename name_in_script\n");
}
-static InteractiveWidget *interactive_widget = 0;
+static InteractiveWidget *interactive_widget = nullptr;
static void runInteractive()
{
@@ -350,15 +350,15 @@ int main(int argc, char **argv)
#endif
}
}
- scaledWidth = width * scalefactor;
- scaledHeight = height * scalefactor;
+ scaledWidth = int(width * scalefactor);
+ scaledHeight = int(height * scalefactor);
PaintCommands pcmd(QStringList(), 800, 800, imageFormat);
pcmd.setVerboseMode(verboseMode);
pcmd.setType(type);
pcmd.setCheckersBackground(checkers_background);
- QWidget *activeWidget = 0;
+ QWidget *activeWidget = nullptr;
if (interactive) {
runInteractive();
@@ -610,7 +610,7 @@ int main(int argc, char **argv)
QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution);
if (printdlg) {
- QPrintDialog printDialog(&p, 0);
+ QPrintDialog printDialog(&p, nullptr);
if (printDialog.exec() != QDialog::Accepted)
break;
} else {
diff --git a/tests/manual/lance/widgets.h b/tests/manual/lance/widgets.h
index 583d9e2455..46c55f4c16 100644
--- a/tests/manual/lance/widgets.h
+++ b/tests/manual/lance/widgets.h
@@ -45,31 +45,12 @@
#include <QPaintEngine>
#include <QSignalMapper>
#include <QAction>
+#include <QDebug>
#include <qmath.h>
const int CP_RADIUS = 10;
-class StupidWorkaround : public QObject
-{
- Q_OBJECT
-public:
- StupidWorkaround(QWidget *widget, int *value)
- : QObject(widget), w(widget), mode(value)
- {
- }
-
-public slots:
- void setViewMode(int m) {
- *mode = m;
- w->update();
- }
-
-private:
- QWidget *w;
- int *mode;
-};
-
template <class T>
class OnScreenWidget : public T
{
@@ -81,7 +62,7 @@ public:
DifferenceView
};
- OnScreenWidget(const QString &file, QWidget *parent = 0)
+ OnScreenWidget(const QString &file, QWidget *parent = nullptr)
: T(parent),
m_filename(file),
m_view_mode(RenderView)
@@ -108,33 +89,20 @@ public:
} else {
T::setWindowTitle("Rendering: '" + file + "'. Shortcuts: 1=render, 2=baseline, 3=difference");
- StupidWorkaround *workaround = new StupidWorkaround(this, &m_view_mode);
-
- QSignalMapper *mapper = new QSignalMapper(this);
- T::connect(mapper, SIGNAL(mapped(int)), workaround, SLOT(setViewMode(int)));
- T::connect(mapper, SIGNAL(mapped(QString)), this, SLOT(setWindowTitle(QString)));
-
QAction *renderViewAction = new QAction("Render View", this);
renderViewAction->setShortcut(Qt::Key_1);
- T::connect(renderViewAction, SIGNAL(triggered()), mapper, SLOT(map()));
- mapper->setMapping(renderViewAction, RenderView);
- mapper->setMapping(renderViewAction, "Render View: " + file);
+ T::connect(renderViewAction, &QAction::triggered, [&] { setMode(RenderView); });
T::addAction(renderViewAction);
QAction *baselineAction = new QAction("Baseline", this);
baselineAction->setShortcut(Qt::Key_2);
- T::connect(baselineAction, SIGNAL(triggered()), mapper, SLOT(map()));
- mapper->setMapping(baselineAction, BaselineView);
- mapper->setMapping(baselineAction, "Baseline View: " + file);
+ T::connect(baselineAction, &QAction::triggered, [&] { setMode(BaselineView); });
T::addAction(baselineAction);
- QAction *differenceAction = new QAction("Differenfe View", this);
+ QAction *differenceAction = new QAction("Difference View", this);
differenceAction->setShortcut(Qt::Key_3);
- T::connect(differenceAction, SIGNAL(triggered()), mapper, SLOT(map()));
- mapper->setMapping(differenceAction, DifferenceView);
- mapper->setMapping(differenceAction, "Difference View" + file);
+ T::connect(differenceAction, &QAction::triggered, [&] { setMode(DifferenceView); });
T::addAction(differenceAction);
-
}
}
@@ -148,6 +116,18 @@ public:
settings.sync();
}
+ void setMode(ViewMode mode) {
+ m_view_mode = mode;
+ QString title;
+ switch (m_view_mode) {
+ case RenderView: title = "Render"; break;
+ case BaselineView: title = "Baseline"; break;
+ case DifferenceView: title = "Difference"; break;
+ }
+ T::setWindowTitle(title + " View: " + m_filename);
+ T::update();
+ }
+
void setVerboseMode(bool v) { m_verboseMode = v; }
void setCheckersBackground(bool b) { m_checkersBackground = b; }
void setType(DeviceType t) { m_deviceType = t; }
@@ -205,7 +185,7 @@ public:
pt.begin(this);
pt.setRenderHint(QPainter::Antialiasing);
pt.setFont(this->font());
- pt.resetMatrix();
+ pt.resetTransform();
pt.setPen(QColor(127, 127, 127, 191));
pt.setBrush(QColor(191, 191, 255, 63));
for (int i=0; i<m_controlPoints.size(); ++i) {
@@ -239,7 +219,7 @@ public:
p.drawPixmap(0, 0, m_baseline);
- p.setPen(QColor::fromRgb(0, 0, 0, 0.1));
+ p.setPen(QColor::fromRgbF(0, 0, 0, 0.1));
p.setFont(QFont("Arial", 128));
p.rotate(45);
p.drawText(100, 0, "BASELINE");
@@ -251,7 +231,7 @@ public:
img.fill(0);
QPainter p(&img);
- p.drawPixmap(0, 0, m_render_view);
+ p.drawImage(0, 0, m_image);
p.setCompositionMode(QPainter::RasterOp_SourceXorDestination);
p.drawPixmap(0, 0, m_baseline);
diff --git a/tests/manual/qcursor/grab_override/mainwindow.cpp b/tests/manual/qcursor/grab_override/mainwindow.cpp
index d2b7311846..087ee8d1d8 100644
--- a/tests/manual/qcursor/grab_override/mainwindow.cpp
+++ b/tests/manual/qcursor/grab_override/mainwindow.cpp
@@ -79,10 +79,10 @@ void MainWindow::toggleOverrideCursor()
{
switch (override) {
case 0:
- QApplication::setOverrideCursor(Qt::BusyCursor);
+ QGuiApplication::setOverrideCursor(Qt::BusyCursor);
break;
case 1:
- QApplication::restoreOverrideCursor();
+ QGuiApplication::restoreOverrideCursor();
break;
case 2:
ui->label->grabMouse(Qt::ForbiddenCursor);
diff --git a/tests/manual/qsslsocket/main.cpp b/tests/manual/qsslsocket/main.cpp
index b2cc1b5f23..58da520c07 100644
--- a/tests/manual/qsslsocket/main.cpp
+++ b/tests/manual/qsslsocket/main.cpp
@@ -91,21 +91,21 @@ void tst_QSslSocket::nextProtocolNegotiation_data()
<< QSslConfiguration::NextProtocolNegotiationNegotiated;
tag = host.toLocal8Bit();
- tag.append("-spdy/3");
+ tag.append("-h2");
QTest::newRow(tag)
<< true
<< host
- << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0)
- << QByteArray(QSslConfiguration::NextProtocolSpdy3_0)
+ << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2)
+ << QByteArray(QSslConfiguration::ALPNProtocolHTTP2)
<< QSslConfiguration::NextProtocolNegotiationNegotiated;
tag = host.toLocal8Bit();
- tag.append("-spdy/3-and-http/1.1");
+ tag.append("-h2-and-http/1.1");
QTest::newRow(tag)
<< true
<< host
- << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0 << QSslConfiguration::NextProtocolHttp1_1)
- << QByteArray(QSslConfiguration::NextProtocolSpdy3_0)
+ << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2 << QSslConfiguration::NextProtocolHttp1_1)
+ << QByteArray(QSslConfiguration::ALPNProtocolHTTP2)
<< QSslConfiguration::NextProtocolNegotiationNegotiated;
}
}
diff --git a/tests/manual/shortcuts/main.cpp b/tests/manual/shortcuts/main.cpp
index acc2a2525c..289e8526f0 100644
--- a/tests/manual/shortcuts/main.cpp
+++ b/tests/manual/shortcuts/main.cpp
@@ -108,6 +108,7 @@ void ShortcutTester::setupLayout()
Qt::ControlModifier + Qt::Key_5, Qt::AltModifier + Qt::Key_5,
Qt::ControlModifier + Qt::Key_Plus,
Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Plus,
+ Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Equal,
Qt::ControlModifier + Qt::Key_Y, Qt::ShiftModifier + Qt::Key_Comma,
Qt::ControlModifier + Qt::Key_Comma, Qt::ControlModifier + Qt::Key_Slash,
Qt::ControlModifier + Qt::Key_Backslash
@@ -121,6 +122,8 @@ void ShortcutTester::setupLayout()
const int keys3[] = {
Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_A,
+ Qt::MetaModifier + Qt::Key_A,
+ Qt::MetaModifier + Qt::Key_Q,
Qt::MetaModifier + Qt::ShiftModifier + Qt::Key_5,
Qt::ControlModifier + Qt::Key_BracketRight,
Qt::ShiftModifier + Qt::Key_F3,
diff --git a/tests/manual/widgets/itemviews/itemviews.pro b/tests/manual/widgets/itemviews/itemviews.pro
index 53f658d54d..8884cc3aae 100644
--- a/tests/manual/widgets/itemviews/itemviews.pro
+++ b/tests/manual/widgets/itemviews/itemviews.pro
@@ -1,2 +1,8 @@
TEMPLATE = subdirs
-SUBDIRS = delegate qheaderview qtreeview qtreewidget tableview-span-navigation
+SUBDIRS = delegate \
+ qconcatenatetablesproxymodel \
+ qheaderview \
+ qtreeview \
+ qtreewidget \
+ tableview-span-navigation \
+
diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp
new file mode 100644
index 0000000000..2c1825f29f
--- /dev/null
+++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QConcatenateTablesProxyModel>
+#include <QStandardItemModel>
+#include <QTableView>
+#include <QTreeView>
+
+static void prepareModel(const QString &prefix, QStandardItemModel *model)
+{
+ for (int row = 0; row < model->rowCount(); ++row) {
+ for (int column = 0; column < model->columnCount(); ++column) {
+ QStandardItem *item = new QStandardItem(prefix + QString(" %1,%2").arg(row).arg(column));
+ item->setDragEnabled(true);
+ item->setDropEnabled(true);
+ model->setItem(row, column, item);
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QStandardItemModel firstModel(4, 4);
+ prepareModel("First", &firstModel);
+ QStandardItemModel secondModel(2, 2);
+
+ QConcatenateTablesProxyModel proxy;
+ proxy.addSourceModel(&firstModel);
+ proxy.addSourceModel(&secondModel);
+
+ prepareModel("Second", &secondModel);
+
+ QTableView tableView;
+ tableView.setWindowTitle("concat proxy, in QTableView");
+ tableView.setDragDropMode(QAbstractItemView::DragDrop);
+ tableView.setModel(&proxy);
+ tableView.show();
+
+ QTreeView treeView;
+ treeView.setWindowTitle("concat proxy, in QTreeView");
+ treeView.setDragDropMode(QAbstractItemView::DragDrop);
+ treeView.setModel(&proxy);
+ treeView.show();
+
+ // For comparison, views on top on QStandardItemModel
+
+ QTableView tableViewTest;
+ tableViewTest.setWindowTitle("first model, in QTableView");
+ tableViewTest.setDragDropMode(QAbstractItemView::DragDrop);
+ tableViewTest.setModel(&firstModel);
+ tableViewTest.show();
+
+ QTreeView treeViewTest;
+ treeViewTest.setWindowTitle("first model, in QTreeView");
+ treeViewTest.setDragDropMode(QAbstractItemView::DragDrop);
+ treeViewTest.setModel(&firstModel);
+ treeViewTest.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro
new file mode 100644
index 0000000000..19904212a7
--- /dev/null
+++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro
@@ -0,0 +1,8 @@
+
+TEMPLATE = app
+TARGET = qconcatenatetablesproxymodel
+INCLUDEPATH += .
+
+QT += widgets
+
+SOURCES += main.cpp
diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp
new file mode 100644
index 0000000000..dbca6df454
--- /dev/null
+++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2019 The Qt Company Ltd.
+ ** Contact: https://www.qt.io/licensing/
+ **
+ ** This file is part of the test suite of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+ ** 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 General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3 as published by the Free Software
+ ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+ ** included in the packaging of this file. Please review the following
+ ** information to ensure the GNU General Public License requirements will
+ ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+// Test that the size of the saved state bytearray does not change due to moving a
+// toolbar from one area to another. It should stay the same size as the first time
+// it had that toolbar in it
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QToolBar>
+#include <QPushButton>
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QMessageBox>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow() : QMainWindow()
+ {
+ auto *tb = new QToolBar(this);
+ tb->setObjectName("Toolbar");
+ tb->addAction("Test action");
+ tb->addAction("Test action");
+ addToolBar(Qt::TopToolBarArea, tb);
+ auto *movableTb = new QToolBar(this);
+ movableTb->setObjectName("Movable Toolbar");
+ movableTb->addAction("Test action");
+ movableTb->addAction("Test action");
+ addToolBar(Qt::TopToolBarArea, movableTb);
+ auto *widget = new QWidget;
+ auto *vbox = new QVBoxLayout;
+ auto *label = new QLabel;
+ label->setText("1. Click on check state size to save initial state\n"
+ "2. Drag the movable toolbar in the top dock area to the left area."
+ " Click on check state size to save moved state\n"
+ "3. Drag the movable toolbar from the left dock area to the top area."
+ " Click on check state size to compare the state sizes.\n"
+ "4. Drag the movable toolbar in the top dock area to the left area."
+ " Click on check state size to compare the state sizes.\n"
+ "5. Drag the movable toolbar from the left dock area to the top area."
+ " Click on check state size to compare the state sizes.\n");
+ vbox->addWidget(label);
+ auto *pushButton = new QPushButton("Check state size");
+ connect(pushButton, &QPushButton::clicked, this, &MainWindow::checkState);
+ vbox->addWidget(pushButton);
+ widget->setLayout(vbox);
+ setCentralWidget(widget);
+ }
+public slots:
+ void checkState()
+ {
+ stepCounter++;
+ QString messageText;
+ if (stepCounter == 1) {
+ beforeMoveStateData = saveState();
+ messageText = QLatin1String("Initial state saved");
+ } else if (stepCounter == 2) {
+ afterMoveStateData = saveState();
+ messageText = QLatin1String("Moved state saved");
+ } else {
+ const int currentSaveSize = saveState().size();
+ const int compareValue = (stepCounter == 4) ? afterMoveStateData.size() : beforeMoveStateData.size();
+ messageText = QString::fromLatin1("%1 step %2")
+ .arg((currentSaveSize == compareValue) ? QLatin1String("SUCCESS") : QLatin1String("FAIL"))
+ .arg(stepCounter);
+ }
+ QMessageBox::information(this, "Step done", messageText);
+ }
+private:
+ int stepCounter = 0;
+ QByteArray beforeMoveStateData;
+ QByteArray afterMoveStateData;
+};
+
+#include "main.moc"
+
+int main(int argc, char **argv)
+{
+ QApplication a(argc, argv);
+ MainWindow mw;
+ mw.show();
+ return a.exec();
+}
+
diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro
new file mode 100644
index 0000000000..6ee128ed3b
--- /dev/null
+++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro
@@ -0,0 +1,4 @@
+QT += widgets
+TEMPLATE = app
+TARGET = saveStateSize
+SOURCES += main.cpp