summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/bearerex/bearerex.cpp42
-rw-r--r--tests/manual/bearerex/bearerex.h8
-rw-r--r--tests/manual/bearerex/xqlistwidget.cpp4
-rw-r--r--tests/manual/bearerex/xqlistwidget.h4
-rw-r--r--tests/manual/cocoa/nativewidgets/main.cpp147
-rw-r--r--tests/manual/cocoa/nativewidgets/nativewigets.pro7
-rw-r--r--tests/manual/dialogs/colordialogpanel.cpp261
-rw-r--r--tests/manual/dialogs/colordialogpanel.h86
-rw-r--r--tests/manual/dialogs/dialogs.pro6
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp105
-rw-r--r--tests/manual/dialogs/filedialogpanel.h13
-rw-r--r--tests/manual/dialogs/fontdialogpanel.cpp208
-rw-r--r--tests/manual/dialogs/fontdialogpanel.h87
-rw-r--r--tests/manual/dialogs/main.cpp7
-rw-r--r--tests/manual/dialogs/wizardpanel.cpp361
-rw-r--r--tests/manual/dialogs/wizardpanel.h69
-rw-r--r--tests/manual/filetest/main.cpp45
-rw-r--r--tests/manual/gestures/graphicsview/main.cpp11
-rw-r--r--tests/manual/gestures/scrollarea/main.cpp12
-rw-r--r--tests/manual/highdpi/highdpi.qrc8
-rw-r--r--tests/manual/highdpi/main.cpp201
-rw-r--r--tests/manual/highdpi/qticon16.pngbin0 -> 1884 bytes
-rw-r--r--tests/manual/highdpi/qticon16@2x.pngbin0 -> 3187 bytes
-rw-r--r--tests/manual/highdpi/qticon32.pngbin0 -> 3187 bytes
-rw-r--r--tests/manual/highdpi/qticon32@2x.png (renamed from tests/manual/highdpi/qticon.png)bin6474 -> 6474 bytes
-rw-r--r--tests/manual/highdpi/qticon64.pngbin0 -> 6474 bytes
-rw-r--r--tests/manual/highdpi/qticon@2x.pngbin17168 -> 0 bytes
-rw-r--r--tests/manual/highdpi/qticon_large.pngbin17168 -> 0 bytes
-rw-r--r--tests/manual/inputmethodhints/inputmethodhints.h4
-rw-r--r--tests/manual/inputmethodhints/main.cpp1
-rw-r--r--tests/manual/keypadnavigation/main.cpp9
-rw-r--r--tests/manual/lance/lance.pro1
-rw-r--r--tests/manual/manual.pro15
-rw-r--r--tests/manual/qcursor/allcursors/main.cpp2
-rw-r--r--tests/manual/qcursor/allcursors/mainwindow.h2
-rw-r--r--tests/manual/qcursor/grab_override/main.cpp2
-rw-r--r--tests/manual/qcursor/grab_override/mainwindow.h6
-rw-r--r--tests/manual/qdesktopwidget/main.cpp6
-rw-r--r--tests/manual/qgraphicsitem/main.cpp10
-rw-r--r--tests/manual/qgraphicsitemgroup/main.cpp2
-rw-r--r--tests/manual/qgraphicslayout/flicker/main.cpp3
-rw-r--r--tests/manual/qgraphicslayout/flicker/window.h20
-rw-r--r--tests/manual/qimagereader/main.cpp7
-rw-r--r--tests/manual/qlocale/calendar.cpp19
-rw-r--r--tests/manual/qlocale/calendar.h12
-rw-r--r--tests/manual/qlocale/currency.cpp4
-rw-r--r--tests/manual/qlocale/currency.h6
-rw-r--r--tests/manual/qlocale/dateformats.cpp7
-rw-r--r--tests/manual/qlocale/dateformats.h8
-rw-r--r--tests/manual/qlocale/info.cpp6
-rw-r--r--tests/manual/qlocale/info.h7
-rw-r--r--tests/manual/qlocale/languages.cpp4
-rw-r--r--tests/manual/qlocale/languages.h6
-rw-r--r--tests/manual/qlocale/main.cpp2
-rw-r--r--tests/manual/qlocale/miscellaneous.cpp4
-rw-r--r--tests/manual/qlocale/miscellaneous.h6
-rw-r--r--tests/manual/qlocale/numberformats.cpp6
-rw-r--r--tests/manual/qlocale/numberformats.h6
-rw-r--r--tests/manual/qlocale/window.cpp7
-rw-r--r--tests/manual/qlocale/window.h5
-rw-r--r--tests/manual/qnetworkreply/main.cpp6
-rw-r--r--tests/manual/qpainfo/main.cpp220
-rw-r--r--tests/manual/qpainfo/qpainfo.pro7
-rw-r--r--tests/manual/qtbug-8933/main.cpp2
-rw-r--r--tests/manual/qtouchevent/main.cpp3
-rw-r--r--tests/manual/qtouchevent/qtouchevent.pro3
-rw-r--r--tests/manual/qtouchevent/touchwidget.cpp2
-rw-r--r--tests/manual/qwidget_zorder/main.cpp6
-rw-r--r--tests/manual/repaint/mainwindow/main.cpp19
-rw-r--r--tests/manual/repaint/scrollarea/main.cpp9
-rw-r--r--tests/manual/repaint/shared/shared.h6
-rw-r--r--tests/manual/repaint/splitter/main.cpp7
-rw-r--r--tests/manual/repaint/tableview/main.cpp11
-rw-r--r--tests/manual/repaint/task141091/main.cpp15
-rw-r--r--tests/manual/repaint/toplevel/main.cpp3
-rw-r--r--tests/manual/repaint/widget/main.cpp12
-rw-r--r--tests/manual/textrendering/glyphshaping/main.cpp10
-rw-r--r--tests/manual/textrendering/textperformance/main.cpp7
-rw-r--r--tests/manual/transientwindow/main.cpp51
-rw-r--r--tests/manual/transientwindow/mainwindow.cpp66
-rw-r--r--tests/manual/transientwindow/mainwindow.h64
-rw-r--r--tests/manual/transientwindow/transientwindow.pro6
-rw-r--r--tests/manual/widgets/itemviews/delegate/example.cpp7
-rw-r--r--tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp3
-rw-r--r--tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp41
-rw-r--r--tests/manual/windowflags/controls.cpp4
-rw-r--r--tests/manual/windowgeometry/controllerwidget.cpp12
-rwxr-xr-xtests/manual/xembed-raster/gtk-embedder.py74
-rw-r--r--tests/manual/xembed-raster/main.cpp66
-rw-r--r--tests/manual/xembed-raster/rasterwindow.cpp107
-rw-r--r--tests/manual/xembed-raster/rasterwindow.h69
-rw-r--r--tests/manual/xembed-raster/xembed-raster.pro9
-rwxr-xr-xtests/manual/xembed-widgets/gtk-embedder.py77
-rw-r--r--tests/manual/xembed-widgets/main.cpp69
-rw-r--r--tests/manual/xembed-widgets/window.cpp228
-rw-r--r--tests/manual/xembed-widgets/window.h73
-rw-r--r--tests/manual/xembed-widgets/xembed-widgets.pro9
97 files changed, 3090 insertions, 190 deletions
diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp
index 4417253930..185dbe123e 100644
--- a/tests/manual/bearerex/bearerex.cpp
+++ b/tests/manual/bearerex/bearerex.cpp
@@ -49,9 +49,9 @@ BearerEx::BearerEx(QWidget* parent)
: QMainWindow(parent)
{
setupUi(this);
-
+
createMenus();
-
+
connect(&m_NetworkConfigurationManager, SIGNAL(updateCompleted()), this, SLOT(configurationsUpdateCompleted()));
connect(&m_NetworkConfigurationManager, SIGNAL(configurationAdded(QNetworkConfiguration)),
this, SLOT(configurationAdded(QNetworkConfiguration)));
@@ -79,19 +79,19 @@ void BearerEx::showConfigurations()
{
listWidget->clear();
QListWidgetItem* listItem;
-
+
QNetworkConfiguration defaultConfig = m_NetworkConfigurationManager.defaultConfiguration();
if (defaultConfig.type() == QNetworkConfiguration::UserChoice) {
listItem = new QListWidgetItem();
QFont font = listItem->font();
font.setBold(true);
font.setUnderline(true);
- listItem->setFont(font);
+ listItem->setFont(font);
listItem->setText(" UserChoice");
listItem->setData(Qt::UserRole, QVariant::fromValue(defaultConfig));
listWidget->addItem(listItem);
}
-
+
QList<QNetworkConfiguration> configurations = m_NetworkConfigurationManager.allConfigurations();
for (int i=0; i<configurations.count(); i++)
{
@@ -102,7 +102,7 @@ void BearerEx::showConfigurations()
} else if (configurations[i].type() == QNetworkConfiguration::ServiceNetwork) {
text.append("(SNAP,");
}
-
+
if ((configurations[i].state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
text.append("Act) ");
} else if ((configurations[i].state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) {
@@ -111,12 +111,12 @@ void BearerEx::showConfigurations()
text.append("Def) ");
}
text.append(configurations[i].name());
-
+
if (defaultConfig.isValid() && defaultConfig == configurations[i]) {
QFont font = listItem->font();
font.setBold(true);
font.setUnderline(true);
- listItem->setFont(font);
+ listItem->setFont(font);
}
listItem->setText(text);
listItem->setData(Qt::UserRole, QVariant::fromValue(configurations[i]));
@@ -151,7 +151,7 @@ void BearerEx::on_createSessionButton_clicked()
QListWidgetItem* item = listWidget->currentItem();
if (!item) {
return;
- }
+ }
QNetworkConfiguration networkConfiguration = qvariant_cast<QNetworkConfiguration>(item->data(Qt::UserRole));
int newTabIndex = mainTabWidget->count();
SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1);
@@ -184,7 +184,7 @@ void BearerEx::onlineStateChanged(bool isOnline)
QListWidgetItem* listItem = new QListWidgetItem();
QFont font = listItem->font();
font.setBold(true);
- listItem->setFont(font);
+ listItem->setFont(font);
if (isOnline) {
listItem->setText(QString("> Online"));
} else {
@@ -231,7 +231,7 @@ DetailedInfoDialog::DetailedInfoDialog(QNetworkConfiguration* apNetworkConfigura
tableWidget->setColumnCount(2);
int rowCount = 2;
-
+
if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
rowCount = rowCount + apNetworkConfiguration->children().count();
}
@@ -274,7 +274,7 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
connect(m_NetworkSession, SIGNAL(opened()), this, SLOT(opened()));
connect(m_NetworkSession, SIGNAL(closed()), this, SLOT(closed()));
connect(m_NetworkSession, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(error(QNetworkSession::SessionError)));
-
+
if (apNetworkConfiguration->type() == QNetworkConfiguration::InternetAccessPoint) {
snapLabel->hide();
snapLineEdit->hide();
@@ -342,7 +342,7 @@ void SessionTab::on_openSessionButton_clicked()
{
m_NetworkSession->open();
if (m_NetworkSession->isOpen()) {
- newState(m_NetworkSession->state());
+ newState(m_NetworkSession->state());
}
}
@@ -350,7 +350,7 @@ void SessionTab::on_closeSessionButton_clicked()
{
m_NetworkSession->close();
if (!m_NetworkSession->isOpen()) {
- newState(m_NetworkSession->state());
+ newState(m_NetworkSession->state());
}
}
@@ -414,10 +414,10 @@ void SessionTab::opened()
QListWidgetItem* listItem = new QListWidgetItem();
QFont font = listItem->font();
font.setBold(true);
- listItem->setFont(font);
+ listItem->setFont(font);
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened"));
m_eventListWidget->addItem(listItem);
-
+
QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration");
if (!identifier.isNull()) {
QString configId = identifier.toString();
@@ -445,7 +445,7 @@ void SessionTab::closed()
QListWidgetItem* listItem = new QListWidgetItem();
QFont font = listItem->font();
font.setBold(true);
- listItem->setFont(font);
+ listItem->setFont(font);
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Closed"));
m_eventListWidget->addItem(listItem);
}
@@ -492,10 +492,10 @@ void SessionTab::on_dataObjectChanged(const QString &newObjectType)
}
-void SessionTab::stateChanged(QNetworkSession::State state)
+void SessionTab::stateChanged(QNetworkSession::State state)
{
newState(state);
-
+
QListWidgetItem* listItem = new QListWidgetItem();
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+stateString(state));
m_eventListWidget->addItem(listItem);
@@ -527,7 +527,7 @@ void SessionTab::error(QNetworkSession::SessionError error)
QListWidgetItem* listItem = new QListWidgetItem();
QMessageBox msgBox;
msgBox.setStandardButtons(QMessageBox::Close);
-
+
QString errorString;
switch (error)
{
@@ -549,7 +549,7 @@ void SessionTab::error(QNetworkSession::SessionError error)
}
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+errorString);
m_eventListWidget->addItem(listItem);
-
+
msgBox.setText(errorString);
msgBox.exec();
}
diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h
index 5ec2e17060..8de2b1d41d 100644
--- a/tests/manual/bearerex/bearerex.h
+++ b/tests/manual/bearerex/bearerex.h
@@ -88,7 +88,7 @@ private Q_SLOTS:
void configurationAdded(const QNetworkConfiguration& config);
void configurationRemoved(const QNetworkConfiguration& config);
void onlineStateChanged(bool isOnline);
- void configurationChanged(const QNetworkConfiguration & config);
+ void configurationChanged(const QNetworkConfiguration & config);
private:
QNetworkConfigurationManager m_NetworkConfigurationManager;
@@ -112,8 +112,8 @@ public:
SessionTab(QNetworkConfiguration* apNetworkConfiguration = 0, QNetworkConfigurationManager* configManager = 0,
QListWidget* eventListWidget = 0, int index = 0, BearerEx* parent = 0);
~SessionTab();
-
- QString stateString(QNetworkSession::State state);
+
+ QString stateString(QNetworkSession::State state);
private Q_SLOTS:
void on_createQNetworkAccessManagerButton_clicked();
@@ -125,7 +125,7 @@ private Q_SLOTS:
void on_dataObjectChanged(const QString& newObjectType);
void on_alrButton_clicked();
void finished(quint32 errorCode, qint64 dataReceived, QString errorType);
-
+
void newConfigurationActivated();
void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless);
void stateChanged(QNetworkSession::State state);
diff --git a/tests/manual/bearerex/xqlistwidget.cpp b/tests/manual/bearerex/xqlistwidget.cpp
index 556d9e400f..cb03f6e9bf 100644
--- a/tests/manual/bearerex/xqlistwidget.cpp
+++ b/tests/manual/bearerex/xqlistwidget.cpp
@@ -42,7 +42,7 @@
#include "xqlistwidget.h"
XQListWidget::XQListWidget(QWidget* parent) : QListWidget(parent)
-{
+{
}
void XQListWidget::keyPressEvent(QKeyEvent* event)
@@ -59,7 +59,7 @@ void XQListWidget::keyPressEvent(QKeyEvent* event)
focusNextChild();
break;
}
- default:
+ default:
{
QListWidget::keyPressEvent(event);
}
diff --git a/tests/manual/bearerex/xqlistwidget.h b/tests/manual/bearerex/xqlistwidget.h
index b23dfb5735..80aecceb0b 100644
--- a/tests/manual/bearerex/xqlistwidget.h
+++ b/tests/manual/bearerex/xqlistwidget.h
@@ -48,8 +48,8 @@
class XQListWidget: public QListWidget
{
public:
- XQListWidget(QWidget* parent = 0);
-
+ XQListWidget(QWidget* parent = 0);
+
protected:
void keyPressEvent(QKeyEvent* event);
};
diff --git a/tests/manual/cocoa/nativewidgets/main.cpp b/tests/manual/cocoa/nativewidgets/main.cpp
new file mode 100644
index 0000000000..2ff919b125
--- /dev/null
+++ b/tests/manual/cocoa/nativewidgets/main.cpp
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtWidgets>
+
+class ColorWidget : public QWidget
+{
+ QColor color;
+ int s;
+ int v;
+
+ void changeColor()
+ {
+ color.setHsv((qreal(qrand()) / RAND_MAX) * 50 + 200, s, s);
+ }
+
+public:
+ ColorWidget()
+ {
+ s = 150;
+ v = 150;
+ changeColor();
+ setMouseTracking(true);
+ }
+
+ void mousePressEvent(QMouseEvent *)
+ {
+ changeColor();
+ update();
+ }
+
+ void mouseMoveEvent(QMouseEvent *)
+ {
+ changeColor();
+ update();
+ }
+
+ void enterEvent(QEvent *)
+ {
+ s = 200;
+ v = 200;
+ changeColor();
+ update();
+ }
+
+ void leaveEvent(QEvent *)
+ {
+ s = 75;
+ v = 75;
+ changeColor();
+ update();
+ }
+
+ void paintEvent(QPaintEvent *){
+ QPainter p(this);
+ p.fillRect(QRect(QPoint(0, 0), size()), QBrush(color));
+ }
+};
+
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ ColorWidget window;
+
+ QWidget *w1 = new ColorWidget;
+ QWidget *w2 = new ColorWidget;
+ QWidget *w3 = new ColorWidget;
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget(w1);
+ layout->addWidget(w2);
+ layout->addWidget(w3);
+
+ QWidget *w3_1 = new ColorWidget;
+ QWidget *w3_2 = new ColorWidget;
+ QWidget *w3_3 = new ColorWidget;
+
+ QVBoxLayout *layout3 = new QVBoxLayout;
+ layout3->setMargin(0);
+ layout3->addWidget(w3_1);
+ layout3->addWidget(w3_2);
+ layout3->addWidget(w3_3);
+ w3->setLayout(layout3);
+
+ window.setLayout(layout);
+
+ bool native = 1;
+
+ if (native) {
+ w1->winId();
+ w2->winId();
+ w3->winId();
+
+ w3_1->winId();
+ w3_2->winId();
+ w3_3->winId();
+ }
+
+ window.resize(640, 480);
+ window.show();
+
+ return app.exec();
+}
+
+
+
diff --git a/tests/manual/cocoa/nativewidgets/nativewigets.pro b/tests/manual/cocoa/nativewidgets/nativewigets.pro
new file mode 100644
index 0000000000..f1b1260688
--- /dev/null
+++ b/tests/manual/cocoa/nativewidgets/nativewigets.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+
+HEADERS +=
+SOURCES += main.cpp
+
+QT += core widgets
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/manual/dialogs/colordialogpanel.cpp b/tests/manual/dialogs/colordialogpanel.cpp
new file mode 100644
index 0000000000..695e37a4c7
--- /dev/null
+++ b/tests/manual/dialogs/colordialogpanel.cpp
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "colordialogpanel.h"
+
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QMessageBox>
+#include <QSortFilterProxyModel>
+#include <QComboBox>
+#include <QTimer>
+#include <QDebug>
+
+// SVG color keyword names provided by the World Wide Web Consortium
+static inline QStringList svgColorNames()
+{
+ return QStringList()
+ << "aliceblue" << "antiquewhite" << "aqua" << "aquamarine" << "azure" << "beige" << "bisque"
+ << "black" << "blanchedalmond" << "blue" << "blueviolet" << "brown" << "burlywood" << "cadetblue"
+ << "chartreuse" << "chocolate" << "coral" << "cornflowerblue" << "cornsilk" << "crimson" << "cyan"
+ << "darkblue" << "darkcyan" << "darkgoldenrod" << "darkgray" << "darkgreen" << "darkgrey"
+ << "darkkhaki" << "darkmagenta" << "darkolivegreen" << "darkorange" << "darkorchid" << "darkred"
+ << "darksalmon" << "darkseagreen" << "darkslateblue" << "darkslategray" << "darkslategrey"
+ << "darkturquoise" << "darkviolet" << "deeppink" << "deepskyblue" << "dimgray" << "dimgrey"
+ << "dodgerblue" << "firebrick" << "floralwhite" << "forestgreen" << "fuchsia" << "gainsboro"
+ << "ghostwhite" << "gold" << "goldenrod" << "gray" << "grey" << "green" << "greenyellow"
+ << "honeydew" << "hotpink" << "indianred" << "indigo" << "ivory" << "khaki" << "lavender"
+ << "lavenderblush" << "lawngreen" << "lemonchiffon" << "lightblue" << "lightcoral" << "lightcyan"
+ << "lightgoldenrodyellow" << "lightgray" << "lightgreen" << "lightgrey" << "lightpink"
+ << "lightsalmon" << "lightseagreen" << "lightskyblue" << "lightslategray" << "lightslategrey"
+ << "lightsteelblue" << "lightyellow" << "lime" << "limegreen" << "linen" << "magenta"
+ << "maroon" << "mediumaquamarine" << "mediumblue" << "mediumorchid" << "mediumpurple"
+ << "mediumseagreen" << "mediumslateblue" << "mediumspringgreen" << "mediumturquoise"
+ << "mediumvioletred" << "midnightblue" << "mintcream" << "mistyrose" << "moccasin"
+ << "navajowhite" << "navy" << "oldlace" << "olive" << "olivedrab" << "orange" << "orangered"
+ << "orchid" << "palegoldenrod" << "palegreen" << "paleturquoise" << "palevioletred"
+ << "papayawhip" << "peachpuff" << "peru" << "pink" << "plum" << "powderblue" << "purple" << "red"
+ << "rosybrown" << "royalblue" << "saddlebrown" << "salmon" << "sandybrown" << "seagreen"
+ << "seashell" << "sienna" << "silver" << "skyblue" << "slateblue" << "slategray" << "slategrey"
+ << "snow" << "springgreen" << "steelblue" << "tan" << "teal" << "thistle" << "tomato"
+ << "turquoise" << "violet" << "wheat" << "white" << "whitesmoke" << "yellow" << "yellowgreen";
+}
+
+static inline QPushButton *addButton(const QString &description, QVBoxLayout *layout,
+ QObject *receiver, const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button);
+ return button;
+}
+
+class ColorProxyModel : public QSortFilterProxyModel
+{
+public:
+ ColorProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent)
+ {
+ }
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const
+ {
+ if (role == Qt::DisplayRole) {
+ QString name = data(index, Qt::EditRole).toString();
+ return tr("%1 (%2)").arg(name, QColor(name).name());
+ }
+ if (role == Qt::DecorationRole)
+ return QColor(data(index, Qt::EditRole).toString());
+ return QSortFilterProxyModel::data(index, role);
+ }
+};
+
+ColorDialogPanel::ColorDialogPanel(QWidget *parent)
+ : QWidget(parent)
+ , m_colorComboBox(new QComboBox)
+ , m_showAlphaChannel(new QCheckBox(tr("Show alpha channel")))
+ , m_noButtons(new QCheckBox(tr("Don't display OK/Cancel buttons")))
+ , m_dontUseNativeDialog(new QCheckBox(tr("Don't use native dialog")))
+{
+ // Options
+ QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"), this);
+ QVBoxLayout *optionsLayout = new QVBoxLayout(optionsGroupBox);
+ optionsLayout->addWidget(m_showAlphaChannel);
+ optionsLayout->addWidget(m_noButtons);
+ optionsLayout->addWidget(m_dontUseNativeDialog);
+
+ // Color
+ QGroupBox *colorGroupBox = new QGroupBox(tr("Color"), this);
+ QVBoxLayout *colorLayout = new QVBoxLayout(colorGroupBox);
+ colorLayout->addWidget(m_colorComboBox);
+ m_colorComboBox->addItems(svgColorNames());
+ m_colorComboBox->setEditable(true);
+
+ QAbstractItemModel *sourceModel = m_colorComboBox->model();
+ ColorProxyModel* proxyModel = new ColorProxyModel(m_colorComboBox);
+ proxyModel->setSourceModel(sourceModel);
+ sourceModel->setParent(proxyModel);
+ m_colorComboBox->setModel(proxyModel);
+
+ // Buttons
+ QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
+ QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox);
+ addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal()));
+ addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal()));
+ m_deleteModalDialogButton =
+ addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog()));
+ addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal()));
+ m_deleteNonModalDialogButton =
+ addButton(tr("Delete non-modal"), buttonsLayout, this, SLOT(deleteNonModalDialog()));
+ addButton(tr("Restore defaults"), buttonsLayout, this, SLOT(restoreDefaults()));
+ buttonsLayout->addStretch();
+
+ // Main layout
+ QHBoxLayout *mainLayout = new QHBoxLayout(this);
+ QVBoxLayout *leftLayout = new QVBoxLayout;
+ leftLayout->addWidget(optionsGroupBox);
+ leftLayout->addWidget(colorGroupBox);
+ leftLayout->addStretch();
+ mainLayout->addLayout(leftLayout);
+ mainLayout->addWidget(buttonsGroupBox);
+
+ enableDeleteModalDialogButton();
+ enableDeleteNonModalDialogButton();
+ restoreDefaults();
+}
+
+void ColorDialogPanel::execModal()
+{
+ QColorDialog dialog(this);
+ applySettings(&dialog);
+ connect(&dialog, SIGNAL(accepted()), this, SLOT(accepted()));
+ dialog.setWindowTitle(tr("Modal Color Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
+ dialog.exec();
+}
+
+void ColorDialogPanel::showModal()
+{
+ if (m_modalDialog.isNull()) {
+ static int n = 0;
+ m_modalDialog = new QColorDialog(this);
+ m_modalDialog->setModal(true);
+ connect(m_modalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_modalDialog->setWindowTitle(tr("Modal Color Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteModalDialogButton();
+ }
+ applySettings(m_modalDialog);
+ m_modalDialog->show();
+}
+
+void ColorDialogPanel::showNonModal()
+{
+ if (m_nonModalDialog.isNull()) {
+ static int n = 0;
+ m_nonModalDialog = new QColorDialog(this);
+ connect(m_nonModalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_nonModalDialog->setWindowTitle(tr("Non-Modal Color Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteNonModalDialogButton();
+ }
+ applySettings(m_nonModalDialog);
+ m_nonModalDialog->show();
+}
+
+void ColorDialogPanel::deleteNonModalDialog()
+{
+ if (!m_nonModalDialog.isNull())
+ delete m_nonModalDialog;
+ enableDeleteNonModalDialogButton();
+}
+
+void ColorDialogPanel::deleteModalDialog()
+{
+ if (!m_modalDialog.isNull())
+ delete m_modalDialog;
+ enableDeleteModalDialogButton();
+}
+
+void ColorDialogPanel::accepted()
+{
+ const QColorDialog *d = qobject_cast<const QColorDialog *>(sender());
+ Q_ASSERT(d);
+ m_result.clear();
+ QDebug(&m_result).nospace()
+ << "Current color: " << d->currentColor()
+ << "\nSelected color: " << d->selectedColor();
+ QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
+}
+
+void ColorDialogPanel::showAcceptedResult()
+{
+ QMessageBox::information(this, tr("Color Dialog Accepted"), m_result, QMessageBox::Ok);
+}
+
+void ColorDialogPanel::restoreDefaults()
+{
+ QColorDialog d;
+ m_showAlphaChannel->setChecked(d.testOption(QColorDialog::ShowAlphaChannel));
+ m_noButtons->setChecked(d.testOption(QColorDialog::NoButtons));
+ m_dontUseNativeDialog->setChecked(d.testOption(QColorDialog::DontUseNativeDialog));
+}
+
+void ColorDialogPanel::enableDeleteNonModalDialogButton()
+{
+ m_deleteNonModalDialogButton->setEnabled(!m_nonModalDialog.isNull());
+}
+
+void ColorDialogPanel::enableDeleteModalDialogButton()
+{
+ m_deleteModalDialogButton->setEnabled(!m_modalDialog.isNull());
+}
+
+void ColorDialogPanel::applySettings(QColorDialog *d) const
+{
+ d->setOption(QColorDialog::ShowAlphaChannel, m_showAlphaChannel->isChecked());
+ d->setOption(QColorDialog::NoButtons, m_noButtons->isChecked());
+ d->setOption(QColorDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
+ d->setCurrentColor(QColor(m_colorComboBox->itemData(m_colorComboBox->currentIndex(), Qt::EditRole).toString()));
+}
diff --git a/tests/manual/dialogs/colordialogpanel.h b/tests/manual/dialogs/colordialogpanel.h
new file mode 100644
index 0000000000..bcd2cf6e52
--- /dev/null
+++ b/tests/manual/dialogs/colordialogpanel.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COLORDIALOGPANEL_H
+#define COLORDIALOGPANEL_H
+
+#include <QPointer>
+#include <QColorDialog>
+
+class QComboBox;
+class QCheckBox;
+class QPushButton;
+
+class ColorDialogPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ColorDialogPanel(QWidget *parent = 0);
+
+public slots:
+ void execModal();
+ void showModal();
+ void showNonModal();
+ void deleteNonModalDialog();
+ void deleteModalDialog();
+ void accepted();
+ void showAcceptedResult();
+ void restoreDefaults();
+
+private slots:
+ void enableDeleteNonModalDialogButton();
+ void enableDeleteModalDialogButton();
+
+private:
+ void applySettings(QColorDialog *d) const;
+
+ QComboBox *m_colorComboBox;
+ QCheckBox *m_showAlphaChannel;
+ QCheckBox *m_noButtons;
+ QCheckBox *m_dontUseNativeDialog;
+ QPushButton *m_deleteNonModalDialogButton;
+ QPushButton *m_deleteModalDialogButton;
+ QString m_result;
+ QPointer<QColorDialog> m_modalDialog;
+ QPointer<QColorDialog> m_nonModalDialog;
+};
+
+#endif // COLORDIALOGPANEL_H
diff --git a/tests/manual/dialogs/dialogs.pro b/tests/manual/dialogs/dialogs.pro
index ff916d3854..4ed200ab7f 100644
--- a/tests/manual/dialogs/dialogs.pro
+++ b/tests/manual/dialogs/dialogs.pro
@@ -4,5 +4,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = dialogs
TEMPLATE = app
-SOURCES += main.cpp filedialogpanel.cpp
-HEADERS += filedialogpanel.h
+SOURCES += main.cpp filedialogpanel.cpp colordialogpanel.cpp fontdialogpanel.cpp \
+ wizardpanel.cpp
+HEADERS += filedialogpanel.h colordialogpanel.h fontdialogpanel.h \
+ wizardpanel.h
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 66a5201db0..636e65b684 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -44,6 +44,7 @@
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
+#include <QGridLayout>
#include <QFormLayout>
#include <QSpacerItem>
#include <QGroupBox>
@@ -105,11 +106,13 @@ inline void setComboBoxValue(QComboBox *c, int v)
c->setCurrentIndex(c->findData(QVariant(v)));
}
-static inline void addButton(const QString &description, QBoxLayout *layout, QObject *receiver, const char *slotFunc)
+static inline QPushButton *addButton(const QString &description, QGridLayout *layout,
+ int &row, int column, QObject *receiver, const char *slotFunc)
{
QPushButton *button = new QPushButton(description);
QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
- layout->addWidget(button);
+ layout->addWidget(button, row++, column);
+ return button;
}
// A line edit for editing the label fields of the dialog, keeping track of whether it has
@@ -159,6 +162,8 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
, m_selectedFileName(new QLineEdit(this))
, m_nameFilters(new QPlainTextEdit)
, m_selectedNameFilter(new QLineEdit(this))
+ , m_deleteNonModalDialogButton(0)
+ , m_deleteModalDialogButton(0)
{
// Options
QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"));
@@ -197,19 +202,24 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
labelsLayout->addRow(tr("Reject label:"), m_labelLineEdits.back());
// Buttons
- QVBoxLayout *buttonLayout = new QVBoxLayout;
- buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
- addButton(tr("Show modal"), buttonLayout, this, SLOT(showModal()));
- addButton(tr("Show non-modal"), buttonLayout, this, SLOT(showNonModal()));
- addButton(tr("getOpenFileName"), buttonLayout, this, SLOT(getOpenFileName()));
- addButton(tr("getOpenFileNames"), buttonLayout, this, SLOT(getOpenFileNames()));
- addButton(tr("getSaveFileName"), buttonLayout, this, SLOT(getSaveFileName()));
- addButton(tr("getExistingDirectory"), buttonLayout, this, SLOT(getExistingDirectory()));
- addButton(tr("Restore defaults"), buttonLayout, this, SLOT(restoreDefaults()));
QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
- QHBoxLayout *buttonsGroupLayout = new QHBoxLayout(buttonsGroupBox);
- buttonsGroupLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
- buttonsGroupLayout->addLayout(buttonLayout);
+ QGridLayout *buttonLayout = new QGridLayout(buttonsGroupBox);
+ int row = 0;
+ int column = 0;
+ addButton(tr("Exec modal"), buttonLayout, row, column, this, SLOT(execModal()));
+ addButton(tr("Show modal"), buttonLayout, row, column, this, SLOT(showModal()));
+ m_deleteModalDialogButton =
+ addButton(tr("Delete modal"), buttonLayout, row, column, this, SLOT(deleteModalDialog()));
+ addButton(tr("Show non-modal"), buttonLayout, row, column, this, SLOT(showNonModal()));
+ m_deleteNonModalDialogButton =
+ addButton(tr("Delete non-modal"), buttonLayout, row, column, this, SLOT(deleteNonModalDialog()));
+ row = 0;
+ column++;
+ addButton(tr("getOpenFileName"), buttonLayout, row, column, this, SLOT(getOpenFileName()));
+ addButton(tr("getOpenFileNames"), buttonLayout, row, column, this, SLOT(getOpenFileNames()));
+ addButton(tr("getSaveFileName"), buttonLayout, row, column, this, SLOT(getSaveFileName()));
+ addButton(tr("getExistingDirectory"), buttonLayout, row, column, this, SLOT(getExistingDirectory()));
+ addButton(tr("Restore defaults"), buttonLayout, row, column, this, SLOT(restoreDefaults()));
// Main layout
QGridLayout *gridLayout = new QGridLayout(this);
@@ -218,26 +228,76 @@ FileDialogPanel::FileDialogPanel(QWidget *parent)
gridLayout->addWidget(labelsGroupBox, 1, 0);
gridLayout->addWidget(buttonsGroupBox, 1, 1);
+ enableDeleteModalDialogButton();
+ enableDeleteNonModalDialogButton();
restoreDefaults();
}
-void FileDialogPanel::showModal()
+void FileDialogPanel::execModal()
{
QFileDialog dialog(this);
applySettings(&dialog);
+ connect(&dialog, SIGNAL(accepted()), this, SLOT(accepted()));
dialog.setWindowTitle(tr("Modal File Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
dialog.exec();
}
+void FileDialogPanel::showModal()
+{
+ if (m_modalDialog.isNull()) {
+ static int n = 0;
+ m_modalDialog = new QFileDialog(this);
+ m_modalDialog->setModal(true);
+ connect(m_modalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_modalDialog->setWindowTitle(tr("Modal File Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteModalDialogButton();
+ }
+ applySettings(m_modalDialog);
+ m_modalDialog->show();
+}
+
void FileDialogPanel::showNonModal()
{
- QFileDialog *dialog = new QFileDialog(this);
- dialog->setAttribute(Qt::WA_DeleteOnClose);
- applySettings(dialog);
- dialog->setWindowTitle(tr("Non-Modal File Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
- dialog->show();
+ if (m_nonModalDialog.isNull()) {
+ static int n = 0;
+ m_nonModalDialog = new QFileDialog(this);
+ connect(m_nonModalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_nonModalDialog->setWindowTitle(tr("Non-Modal File Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteNonModalDialogButton();
+ }
+ applySettings(m_nonModalDialog);
+ m_nonModalDialog->show();
+}
+
+void FileDialogPanel::deleteNonModalDialog()
+{
+ if (!m_nonModalDialog.isNull())
+ delete m_nonModalDialog;
+ enableDeleteNonModalDialogButton();
}
+void FileDialogPanel::deleteModalDialog()
+{
+ if (!m_modalDialog.isNull())
+ delete m_modalDialog;
+ enableDeleteModalDialogButton();
+}
+
+void FileDialogPanel::enableDeleteNonModalDialogButton()
+{
+ m_deleteNonModalDialogButton->setEnabled(!m_nonModalDialog.isNull());
+}
+
+void FileDialogPanel::enableDeleteModalDialogButton()
+{
+ m_deleteModalDialogButton->setEnabled(!m_modalDialog.isNull());
+}
+
+
QString FileDialogPanel::filterString() const
{
return m_nameFilters->toPlainText().trimmed().replace(QLatin1String("\n"), QLatin1String(";;"));
@@ -340,7 +400,9 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
d->setFileMode(comboBoxValue<QFileDialog::FileMode>(m_fileMode));
d->setOptions(options());
d->setDefaultSuffix(m_defaultSuffix->text().trimmed());
- d->setDirectory(m_directory->text().trimmed());
+ const QString directory = m_directory->text().trimmed();
+ if (!directory.isEmpty())
+ d->setDirectory(directory);
const QString file = m_selectedFileName->text().trimmed();
if (!file.isEmpty())
d->selectFile(file);
@@ -350,7 +412,6 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
d->selectNameFilter(filter);
foreach (LabelLineEdit *l, m_labelLineEdits)
l->apply(d);
- connect(d, SIGNAL(accepted()), this, SLOT(accepted()));
}
void FileDialogPanel::accepted()
diff --git a/tests/manual/dialogs/filedialogpanel.h b/tests/manual/dialogs/filedialogpanel.h
index 699d917e4d..7ee7cb3f60 100644
--- a/tests/manual/dialogs/filedialogpanel.h
+++ b/tests/manual/dialogs/filedialogpanel.h
@@ -44,7 +44,9 @@
#include <QGroupBox>
#include <QFileDialog>
+#include <QPointer>
+class QPushButton;
class QCheckBox;
class QComboBox;
class QLineEdit;
@@ -58,8 +60,11 @@ public:
explicit FileDialogPanel(QWidget *parent = 0);
public slots:
+ void execModal();
void showModal();
void showNonModal();
+ void deleteNonModalDialog();
+ void deleteModalDialog();
void getOpenFileNames();
void getOpenFileName();
void getSaveFileName();
@@ -68,6 +73,10 @@ public slots:
void showAcceptedResult();
void restoreDefaults();
+private slots:
+ void enableDeleteNonModalDialogButton();
+ void enableDeleteModalDialogButton();
+
private:
QString filterString() const;
QFileDialog::Options options() const;
@@ -87,7 +96,11 @@ private:
QList<LabelLineEdit *> m_labelLineEdits;
QPlainTextEdit *m_nameFilters;
QLineEdit *m_selectedNameFilter;
+ QPushButton *m_deleteNonModalDialogButton;
+ QPushButton *m_deleteModalDialogButton;
QString m_result;
+ QPointer<QFileDialog> m_modalDialog;
+ QPointer<QFileDialog> m_nonModalDialog;
};
#endif // FILEDIALOGPANEL_H
diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp
new file mode 100644
index 0000000000..2bdbb0625a
--- /dev/null
+++ b/tests/manual/dialogs/fontdialogpanel.cpp
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "fontdialogpanel.h"
+
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QMessageBox>
+#include <QFontComboBox>
+#include <QDoubleSpinBox>
+#include <QTimer>
+#include <QDebug>
+
+static inline QPushButton *addButton(const QString &description, QVBoxLayout *layout,
+ QObject *receiver, const char *slotFunc)
+{
+ QPushButton *button = new QPushButton(description);
+ QObject::connect(button, SIGNAL(clicked()), receiver, slotFunc);
+ layout->addWidget(button);
+ return button;
+}
+
+FontDialogPanel::FontDialogPanel(QWidget *parent)
+ : QWidget(parent)
+ , m_fontFamilyBox(new QFontComboBox)
+ , m_fontSizeBox(new QDoubleSpinBox)
+ , m_noButtons(new QCheckBox(tr("Don't display OK/Cancel buttons")))
+ , m_dontUseNativeDialog(new QCheckBox(tr("Don't use native dialog")))
+{
+ // Options
+ QGroupBox *optionsGroupBox = new QGroupBox(tr("Options"), this);
+ QVBoxLayout *optionsLayout = new QVBoxLayout(optionsGroupBox);
+ optionsLayout->addWidget(m_noButtons);
+ optionsLayout->addWidget(m_dontUseNativeDialog);
+
+ // Font
+ QGroupBox *fontGroupBox = new QGroupBox(tr("Font"), this);
+ QHBoxLayout *fontLayout = new QHBoxLayout(fontGroupBox);
+ fontLayout->addWidget(m_fontFamilyBox);
+ fontLayout->addWidget(m_fontSizeBox);
+ m_fontSizeBox->setValue(QFont().pointSizeF());
+
+ // Buttons
+ QGroupBox *buttonsGroupBox = new QGroupBox(tr("Show"));
+ QVBoxLayout *buttonsLayout = new QVBoxLayout(buttonsGroupBox);
+ addButton(tr("Exec modal"), buttonsLayout, this, SLOT(execModal()));
+ addButton(tr("Show modal"), buttonsLayout, this, SLOT(showModal()));
+ m_deleteModalDialogButton =
+ addButton(tr("Delete modal"), buttonsLayout, this, SLOT(deleteModalDialog()));
+ addButton(tr("Show non-modal"), buttonsLayout, this, SLOT(showNonModal()));
+ m_deleteNonModalDialogButton =
+ addButton(tr("Delete non-modal"), buttonsLayout, this, SLOT(deleteNonModalDialog()));
+ addButton(tr("Restore defaults"), buttonsLayout, this, SLOT(restoreDefaults()));
+ buttonsLayout->addStretch();
+
+ // Main layout
+ QHBoxLayout *mainLayout = new QHBoxLayout(this);
+ QVBoxLayout *leftLayout = new QVBoxLayout;
+ leftLayout->addWidget(optionsGroupBox);
+ leftLayout->addWidget(fontGroupBox);
+ leftLayout->addStretch();
+ mainLayout->addLayout(leftLayout);
+ mainLayout->addWidget(buttonsGroupBox);
+
+ enableDeleteModalDialogButton();
+ enableDeleteNonModalDialogButton();
+ restoreDefaults();
+}
+
+void FontDialogPanel::execModal()
+{
+ QFontDialog dialog(this);
+ applySettings(&dialog);
+ connect(&dialog, SIGNAL(accepted()), this, SLOT(accepted()));
+ dialog.setWindowTitle(tr("Modal Font Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR)));
+ dialog.exec();
+}
+
+void FontDialogPanel::showModal()
+{
+ if (m_modalDialog.isNull()) {
+ static int n = 0;
+ m_modalDialog = new QFontDialog(this);
+ m_modalDialog->setModal(true);
+ connect(m_modalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_modalDialog->setWindowTitle(tr("Modal Font Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteModalDialogButton();
+ }
+ applySettings(m_modalDialog);
+ m_modalDialog->show();
+}
+
+void FontDialogPanel::showNonModal()
+{
+ if (m_nonModalDialog.isNull()) {
+ static int n = 0;
+ m_nonModalDialog = new QFontDialog(this);
+ connect(m_nonModalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted()));
+ m_nonModalDialog->setWindowTitle(tr("Non-Modal Font Dialog #%1 Qt %2")
+ .arg(++n)
+ .arg(QLatin1String(QT_VERSION_STR)));
+ enableDeleteNonModalDialogButton();
+ }
+ applySettings(m_nonModalDialog);
+ m_nonModalDialog->show();
+}
+
+void FontDialogPanel::deleteNonModalDialog()
+{
+ if (!m_nonModalDialog.isNull())
+ delete m_nonModalDialog;
+ enableDeleteNonModalDialogButton();
+}
+
+void FontDialogPanel::deleteModalDialog()
+{
+ if (!m_modalDialog.isNull())
+ delete m_modalDialog;
+ enableDeleteModalDialogButton();
+}
+
+void FontDialogPanel::accepted()
+{
+ const QFontDialog *d = qobject_cast<const QFontDialog *>(sender());
+ Q_ASSERT(d);
+ m_result.clear();
+ QDebug(&m_result).nospace()
+ << "Current font: " << d->currentFont()
+ << "\nSelected font: " << d->selectedFont();
+ QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
+}
+
+void FontDialogPanel::showAcceptedResult()
+{
+ QMessageBox::information(this, tr("Color Dialog Accepted"), m_result, QMessageBox::Ok);
+}
+
+void FontDialogPanel::restoreDefaults()
+{
+ QFontDialog d;
+ m_noButtons->setChecked(d.testOption(QFontDialog::NoButtons));
+ m_dontUseNativeDialog->setChecked(d.testOption(QFontDialog::DontUseNativeDialog));
+ m_fontFamilyBox->setCurrentFont(QFont());
+ m_fontSizeBox->setValue(QFont().pointSizeF());
+}
+
+void FontDialogPanel::enableDeleteNonModalDialogButton()
+{
+ m_deleteNonModalDialogButton->setEnabled(!m_nonModalDialog.isNull());
+}
+
+void FontDialogPanel::enableDeleteModalDialogButton()
+{
+ m_deleteModalDialogButton->setEnabled(!m_modalDialog.isNull());
+}
+
+void FontDialogPanel::applySettings(QFontDialog *d) const
+{
+ d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
+ d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
+
+ QFont font = m_fontFamilyBox->currentFont();
+ font.setPointSizeF(m_fontSizeBox->value());
+ d->setCurrentFont(font);
+}
diff --git a/tests/manual/dialogs/fontdialogpanel.h b/tests/manual/dialogs/fontdialogpanel.h
new file mode 100644
index 0000000000..92f2b7313f
--- /dev/null
+++ b/tests/manual/dialogs/fontdialogpanel.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FONTDIALOGPANEL_H
+#define FONTDIALOGPANEL_H
+
+#include <QPointer>
+#include <QFontDialog>
+
+class QCheckBox;
+class QPushButton;
+class QFontComboBox;
+class QDoubleSpinBox;
+
+class FontDialogPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit FontDialogPanel(QWidget *parent = 0);
+
+public slots:
+ void execModal();
+ void showModal();
+ void showNonModal();
+ void deleteNonModalDialog();
+ void deleteModalDialog();
+ void accepted();
+ void showAcceptedResult();
+ void restoreDefaults();
+
+private slots:
+ void enableDeleteNonModalDialogButton();
+ void enableDeleteModalDialogButton();
+
+private:
+ void applySettings(QFontDialog *d) const;
+
+ QFontComboBox *m_fontFamilyBox;
+ QDoubleSpinBox *m_fontSizeBox;
+ QCheckBox *m_noButtons;
+ QCheckBox *m_dontUseNativeDialog;
+ QPushButton *m_deleteNonModalDialogButton;
+ QPushButton *m_deleteModalDialogButton;
+ QString m_result;
+ QPointer<QFontDialog> m_modalDialog;
+ QPointer<QFontDialog> m_nonModalDialog;
+};
+
+#endif // FONTDIALOGPANEL_H
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index c1ea7b0d8f..86e6c90b3f 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "filedialogpanel.h"
+#include "colordialogpanel.h"
+#include "fontdialogpanel.h"
+#include "wizardpanel.h"
#include <QMainWindow>
#include <QApplication>
@@ -50,7 +53,6 @@
#include <QKeySequence>
// Test for dialogs, allowing to play with all dialog options for implementing native dialogs.
-// Currently, only QFileDialog is implemented.
// Compiles with Qt 4.8 and Qt 5.
class MainWindow : public QMainWindow {
@@ -68,6 +70,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
QTabWidget *tabWidget = new QTabWidget;
tabWidget->addTab(new FileDialogPanel, tr("QFileDialog"));
+ tabWidget->addTab(new ColorDialogPanel, tr("QColorDialog"));
+ tabWidget->addTab(new FontDialogPanel, tr("QFontDialog"));
+ tabWidget->addTab(new WizardPanel, tr("QWizard"));
setCentralWidget(tabWidget);
}
diff --git a/tests/manual/dialogs/wizardpanel.cpp b/tests/manual/dialogs/wizardpanel.cpp
new file mode 100644
index 0000000000..1306062426
--- /dev/null
+++ b/tests/manual/dialogs/wizardpanel.cpp
@@ -0,0 +1,361 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "wizardpanel.h"
+
+#include <QWizard>
+#include <QWizardPage>
+#include <QVBoxLayout>
+#include <QGridLayout>
+#include <QRadioButton>
+#include <QPushButton>
+#include <QCheckBox>
+#include <QButtonGroup>
+#include <QSpacerItem>
+#include <QGroupBox>
+#include <QLabel>
+#include <QStyle>
+#include <QIcon>
+#include <QImage>
+#include <QPainter>
+#include <QFont>
+#include <QFontMetrics>
+#include <QHash>
+
+static QIcon coloredIcon(const Qt::GlobalColor color)
+{
+ QImage image(QSize(24, 24), QImage::Format_RGB32);
+ image.fill(color);
+ return QIcon(QPixmap::fromImage(image));
+}
+
+static QPixmap pixmapWithText(const QString &text, const QColor color)
+{
+ QFont font;
+ QFontMetrics metric(font);
+ QRect rectangle = metric.boundingRect(text);
+ rectangle.setBottomRight(rectangle.bottomRight() + QPoint(20, 20));
+ QImage image(rectangle.size(), QImage::Format_RGB32);
+ image.fill(color);
+ QPainter painter(&image);
+ painter.setFont(font);
+ painter.drawText(rectangle, Qt::AlignHCenter | Qt::AlignVCenter, text);
+ return QPixmap::fromImage(image);
+}
+
+// A radio-group control for QWizard::WizardStyle.
+class WizardStyleControl : public QGroupBox
+{
+ Q_OBJECT
+public:
+ WizardStyleControl(QWidget *parent = 0);
+
+ void setWizardStyle(int style);
+ QWizard::WizardStyle wizardStyle() const;
+
+signals:
+ void wizardStyleChanged(int);
+
+private:
+ QButtonGroup *m_group;
+};
+
+WizardStyleControl::WizardStyleControl(QWidget *parent)
+ : QGroupBox(tr("Style"), parent)
+ , m_group(new QButtonGroup(this))
+{
+ m_group->setExclusive(true);
+ connect(m_group, SIGNAL(buttonClicked(int)), this, SIGNAL(wizardStyleChanged(int)));
+ QVBoxLayout *vLayout = new QVBoxLayout(this);
+ QRadioButton *radioButton = new QRadioButton(tr("None/OS Default"), this);
+ m_group->addButton(radioButton, QWizard::NStyles);
+ vLayout->addWidget(radioButton);
+ radioButton = new QRadioButton(tr("ClassicStyle"), this);
+ m_group->addButton(radioButton, QWizard::ClassicStyle);
+ vLayout->addWidget(radioButton);
+ radioButton = new QRadioButton(tr("ModernStyle"), this);
+ m_group->addButton(radioButton, QWizard::ModernStyle);
+ vLayout->addWidget(radioButton);
+ radioButton = new QRadioButton(tr("MacStyle"), this);
+ m_group->addButton(radioButton, QWizard::MacStyle);
+ vLayout->addWidget(radioButton);
+ radioButton = new QRadioButton(tr("AeroStyle"), this);
+ m_group->addButton(radioButton, QWizard::AeroStyle);
+ vLayout->addWidget(radioButton);
+ vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+
+ setWizardStyle(style()->styleHint(QStyle::SH_WizardStyle));
+}
+
+QWizard::WizardStyle WizardStyleControl::wizardStyle() const
+{
+ return static_cast<QWizard::WizardStyle>(m_group->checkedId());
+}
+
+void WizardStyleControl::setWizardStyle(int wizardStyle)
+{
+ if (wizardStyle < 0 || wizardStyle > QWizard::NStyles)
+ wizardStyle = QWizard::NStyles;
+ QAbstractButton *button = m_group->button(wizardStyle);
+ Q_ASSERT(button);
+ const bool blocked = m_group->blockSignals(true);
+ button->setChecked(true);
+ m_group->blockSignals(blocked);
+}
+
+// A control with checkboxes for QWizard::WizardOption.
+class WizardOptionsControl : public QGroupBox
+{
+public:
+ explicit WizardOptionsControl(QWidget *parent = 0);
+
+ QWizard::WizardOption wizardOptions() const;
+ void setWizardOptions(int options);
+
+private:
+ typedef QHash<int, QCheckBox *> CheckBoxHash;
+
+ void addCheckBox(QVBoxLayout *layout, int flag, const QString &title);
+
+ CheckBoxHash m_checkBoxes;
+};
+
+WizardOptionsControl::WizardOptionsControl(QWidget *parent)
+ : QGroupBox(tr("Options"), parent)
+{
+ QVBoxLayout *vLayout = new QVBoxLayout(this);
+ addCheckBox(vLayout, QWizard::IndependentPages, QLatin1String("IndependentPages"));
+ addCheckBox(vLayout, QWizard::IgnoreSubTitles, QLatin1String("IgnoreSubTitles"));
+ addCheckBox(vLayout, QWizard::ExtendedWatermarkPixmap, QLatin1String("ExtendedWatermarkPixmap"));
+ addCheckBox(vLayout, QWizard::NoDefaultButton, QLatin1String("NoDefaultButton"));
+ addCheckBox(vLayout, QWizard::NoBackButtonOnStartPage, QLatin1String("NoBackButtonOnStartPage"));
+ addCheckBox(vLayout, QWizard::NoBackButtonOnLastPage, QLatin1String("NoBackButtonOnLastPage"));
+ addCheckBox(vLayout, QWizard::DisabledBackButtonOnLastPage, QLatin1String("DisabledBackButtonOnLastPage"));
+ addCheckBox(vLayout, QWizard::HaveNextButtonOnLastPage, QLatin1String("HaveNextButtonOnLastPage"));
+ addCheckBox(vLayout, QWizard::HaveFinishButtonOnEarlyPages, QLatin1String("HaveFinishButtonOnEarlyPages"));
+ addCheckBox(vLayout, QWizard::NoCancelButton, QLatin1String("NoCancelButton"));
+ addCheckBox(vLayout, QWizard::CancelButtonOnLeft, QLatin1String("CancelButtonOnLeft"));
+ addCheckBox(vLayout, QWizard::HaveHelpButton, QLatin1String("HaveHelpButton"));
+ addCheckBox(vLayout, QWizard::HelpButtonOnRight, QLatin1String("HelpButtonOnRight"));
+ addCheckBox(vLayout, QWizard::HaveCustomButton1, QLatin1String("HaveCustomButton1"));
+ addCheckBox(vLayout, QWizard::HaveCustomButton2, QLatin1String("HaveCustomButton2"));
+ addCheckBox(vLayout, QWizard::HaveCustomButton3, QLatin1String("HaveCustomButton3"));
+ vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+}
+
+void WizardOptionsControl::addCheckBox(QVBoxLayout *layout, int flag, const QString &title)
+{
+ QCheckBox *checkBox = new QCheckBox(title, this);
+ layout->addWidget(checkBox);
+ m_checkBoxes.insert(flag, checkBox);
+}
+
+QWizard::WizardOption WizardOptionsControl::wizardOptions() const
+{
+ int result = 0;
+ typedef CheckBoxHash::const_iterator ConstIterator;
+ const ConstIterator cend = m_checkBoxes.constEnd();
+ for (ConstIterator it = m_checkBoxes.constBegin(); it != cend; ++it)
+ if (it.value()->isChecked())
+ result |= it.key();
+ return static_cast<QWizard::WizardOption>(result);
+}
+
+void WizardOptionsControl::setWizardOptions(int options)
+{
+ typedef CheckBoxHash::iterator Iterator;
+ const Iterator end = m_checkBoxes.end();
+ for (Iterator it = m_checkBoxes.begin(); it != end; ++it)
+ it.value()->setChecked(options & it.key());
+}
+
+// A test wizard with a slot to change its style.
+class Wizard : public QWizard {
+ Q_OBJECT
+public:
+ explicit Wizard(QWidget *parent = 0, Qt::WindowFlags flags = 0);
+
+public slots:
+ void changeWizardStyle(int newStyle);
+};
+
+void Wizard::changeWizardStyle(int newStyle)
+{
+ if (newStyle >= 0 && newStyle < int(QWizard::NStyles))
+ setWizardStyle(static_cast<QWizard::WizardStyle>(newStyle));
+}
+
+// A test wizard page with a WizardStyleControl.
+class WizardPage : public QWizardPage
+{
+public:
+ explicit WizardPage(const QString &title, QWidget *parent = 0);
+
+ void initializePage();
+
+private:
+ WizardStyleControl *m_styleControl;
+ bool m_firstTimeShown;
+};
+
+WizardPage::WizardPage(const QString &title, QWidget *parent)
+ : QWizardPage(parent)
+ , m_styleControl(new WizardStyleControl(this))
+ , m_firstTimeShown(true)
+{
+ setTitle(title);
+ setSubTitle(title + QLatin1String(" SubTitle"));
+ QVBoxLayout *vLayout = new QVBoxLayout(this);
+ vLayout->addWidget(m_styleControl);
+}
+
+void WizardPage::initializePage()
+{
+ m_styleControl->setWizardStyle(wizard()->wizardStyle());
+ if (m_firstTimeShown) {
+ m_firstTimeShown = false;
+ connect(m_styleControl, SIGNAL(wizardStyleChanged(int)),
+ wizard(), SLOT(changeWizardStyle(int)));
+ }
+}
+
+Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags)
+ : QWizard(parent, flags)
+{
+ setWindowIcon(coloredIcon(Qt::red));
+ setWindowTitle(QLatin1String("Wizard ") + QLatin1String(QT_VERSION_STR));
+ addPage(new WizardPage(tr("Page 1"), this));
+ addPage(new WizardPage(tr("Page 2"), this));
+ addPage(new WizardPage(tr("Page 3"), this));
+}
+
+// A dialog using a Wizard as child widget (emulating Qt Designer).
+class WizardEmbeddingDialog : public QDialog {
+public:
+ explicit WizardEmbeddingDialog(QWidget *parent = 0);
+
+ Wizard *wizard() const { return m_wizard; }
+
+private:
+ Wizard *m_wizard;
+};
+
+WizardEmbeddingDialog::WizardEmbeddingDialog(QWidget *parent)
+ : QDialog(parent)
+ , m_wizard(new Wizard)
+{
+ setWindowTitle(QString::fromLatin1("Dialog Embedding QWizard %1").arg(QT_VERSION_STR));
+ QGridLayout *gridLayout = new QGridLayout(this);
+ gridLayout->addWidget(new QLabel(tr("Above wizard")), 0, 0, 1, 3);
+ gridLayout->addWidget(new QLabel(tr("Left of wizard")), 1, 0);
+ m_wizard->setObjectName(QLatin1String("EmbeddedWizard"));
+ m_wizard->setParent(this, Qt::Widget);
+ gridLayout->addWidget(m_wizard, 1, 1);
+ gridLayout->addWidget(new QLabel(tr("Right of wizard")), 1, 2);
+ gridLayout->addWidget(new QLabel(tr("Below wizard")), 2, 0, 1, 3);
+}
+
+WizardPanel::WizardPanel(QWidget *parent)
+ : QWidget(parent)
+ , m_styleControl(new WizardStyleControl(this))
+ , m_optionsControl(new WizardOptionsControl(this))
+{
+ {
+ QWizard wizard;
+ m_optionsControl->setWizardOptions(wizard.options());
+ m_styleControl->setWizardStyle(wizard.wizardStyle());
+ }
+
+ QGridLayout *gridLayout = new QGridLayout(this);
+ gridLayout->addWidget(m_optionsControl, 0, 0, 2, 1);
+ gridLayout->addWidget(m_styleControl, 0, 1);
+ QGroupBox *buttonGroupBox = new QGroupBox(this);
+ QVBoxLayout *vLayout = new QVBoxLayout(buttonGroupBox);
+ QPushButton *button = new QPushButton(tr("Show modal"), this);
+ connect(button, SIGNAL(clicked()), this, SLOT(showModal()));
+ vLayout->addWidget(button);
+ button = new QPushButton(tr("Show non-modal"), this);
+ connect(button, SIGNAL(clicked()), this, SLOT(showNonModal()));
+ vLayout->addWidget(button);
+ button = new QPushButton(tr("Show embedded"), this);
+ button->setToolTip(tr("Test QWizard's behavior when used as a widget child."));
+ connect(button, SIGNAL(clicked()), this, SLOT(showEmbedded()));
+ vLayout->addWidget(button);
+ vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
+ gridLayout->addWidget(buttonGroupBox, 1, 1);
+}
+
+void WizardPanel::showModal()
+{
+ Wizard wizard(this);
+ applyParameters(&wizard);
+ wizard.exec();
+}
+
+void WizardPanel::showNonModal()
+{
+ Wizard *wizard = new Wizard(this);
+ applyParameters(wizard);
+ wizard->setModal(false);
+ wizard->setAttribute(Qt::WA_DeleteOnClose);
+ wizard->show();
+}
+
+void WizardPanel::showEmbedded()
+{
+ WizardEmbeddingDialog *dialog = new WizardEmbeddingDialog(this);
+ applyParameters(dialog->wizard());
+ dialog->setModal(false);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
+}
+
+void WizardPanel::applyParameters(QWizard *wizard) const
+{
+ wizard->setWizardStyle(m_styleControl->wizardStyle());
+ wizard->setOptions(m_optionsControl->wizardOptions());
+ wizard->setPixmap(QWizard::WatermarkPixmap, pixmapWithText(QLatin1String("Watermark"), QColor(Qt::blue).lighter()));
+ wizard->setPixmap(QWizard::LogoPixmap, pixmapWithText(QLatin1String("Logo"), Qt::green));
+ wizard->setPixmap(QWizard::BannerPixmap, pixmapWithText(QLatin1String("Banner"), Qt::green));
+ wizard->setPixmap(QWizard::BackgroundPixmap, pixmapWithText(QLatin1String("Background"), QColor(Qt::red).lighter()));
+}
+
+#include "wizardpanel.moc"
diff --git a/tests/manual/dialogs/wizardpanel.h b/tests/manual/dialogs/wizardpanel.h
new file mode 100644
index 0000000000..0a4ec8e467
--- /dev/null
+++ b/tests/manual/dialogs/wizardpanel.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIZARDPANEL_H
+#define WIZARDPANEL_H
+
+#include <QWidget>
+
+class WizardStyleControl;
+class WizardOptionsControl;
+class QWizard;
+
+class WizardPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit WizardPanel(QWidget *parent = 0);
+
+public slots:
+ void showModal();
+ void showNonModal();
+ void showEmbedded();
+
+private:
+ void applyParameters(QWizard *wizard) const;
+
+ WizardStyleControl *m_styleControl;
+ WizardOptionsControl *m_optionsControl;
+};
+
+#endif // WIZARDPANEL_H
diff --git a/tests/manual/filetest/main.cpp b/tests/manual/filetest/main.cpp
index 9d94265df7..2f7c5cdd06 100644
--- a/tests/manual/filetest/main.cpp
+++ b/tests/manual/filetest/main.cpp
@@ -46,6 +46,7 @@
#include <QDir>
#include <iostream>
+#include <string>
static const char usage1[] =
"\nTests various file functionality in Qt\n\n"
@@ -58,11 +59,46 @@ static const char usage2[] =" [KEYWORD] [ARGUMENTS]\n\n"
" rmr DIR remove directory recursively\n"
" using QDir::removeRecursively\n";
+static inline std::string permissions(QFile::Permissions permissions)
+{
+ std::string result(10, '-');
+ if (permissions & QFile::ReadOwner)
+ result[1] = 'r';
+ if (permissions & QFile::WriteOwner)
+ result[2] = 'w';
+ if (permissions & QFile::ExeOwner)
+ result[3] = 'x';
+ if (permissions & QFile::ReadGroup)
+ result[4] = 'r';
+ if (permissions & QFile::WriteGroup)
+ result[5] = 'w';
+ if (permissions & QFile::ExeGroup)
+ result[6] = 'x';
+ if (permissions & QFile::ReadOther)
+ result[7] = 'r';
+ if (permissions & QFile::WriteOther)
+ result[8] = 'w';
+ if (permissions & QFile::ExeOther)
+ result[9] = 'x';
+ return result;
+}
+
+static inline std::string permissions(const QFileInfo &fi)
+{
+ std::string result = permissions(fi.permissions());
+ if (fi.isSymLink())
+ result[0] = 'l';
+ else if (fi.isDir())
+ result[0] = 'd';
+ return result;
+}
+
static int ls(int argCount, char **args)
{
for (int i = 0 ; i < argCount; ++i) {
const QFileInfo fi(QString::fromLocal8Bit(args[i]));
- std::cout << QDir::toNativeSeparators(fi.absoluteFilePath()).toStdString() << ' ' << fi.size();
+ std::cout << QDir::toNativeSeparators(fi.absoluteFilePath()).toStdString() << ' ' << fi.size()
+ << ' ' << permissions(fi);
if (fi.exists())
std::cout << " [exists]";
if (fi.isFile())
@@ -73,6 +109,7 @@ static int ls(int argCount, char **args)
}
if (fi.isDir())
std::cout << " [dir]";
+
std::cout << std::endl;
}
return 0;
@@ -110,12 +147,18 @@ static int rm(const char *fileName)
static int rmr(const char *dirName)
{
+#if QT_VERSION < 0x050000
+ Q_UNUSED(dirName)
+ return 1;
+#else
QDir dir(QString::fromLocal8Bit(dirName));
if (!dir.removeRecursively()) {
qWarning().nospace() << "Failed to remove " << dir.absolutePath();
return -1;
}
+
return 0;
+#endif
}
int main(int argc, char *argv[])
diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp
index d6551e53bf..cc06cb1986 100644
--- a/tests/manual/gestures/graphicsview/main.cpp
+++ b/tests/manual/gestures/graphicsview/main.cpp
@@ -39,7 +39,16 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QMainWindow>
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QScrollBar>
+#include <QImageReader>
+#include <QVBoxLayout>
+#include <QGestureEvent>
+#include <QDir>
+#include <QFileDialog>
#include "imageitem.h"
#include "gestures.h"
diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp
index 7917b76418..3acce40d50 100644
--- a/tests/manual/gestures/scrollarea/main.cpp
+++ b/tests/manual/gestures/scrollarea/main.cpp
@@ -39,7 +39,17 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QSlider>
+#include <QScrollArea>
+#include <QScrollBar>
+#include <QMainWindow>
+#include <QLabel>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QGestureEvent>
+#include <QPanGesture>
+#include <QDebug>
#include "mousepangesturerecognizer.h"
diff --git a/tests/manual/highdpi/highdpi.qrc b/tests/manual/highdpi/highdpi.qrc
index b43c2c07ad..10efac44fa 100644
--- a/tests/manual/highdpi/highdpi.qrc
+++ b/tests/manual/highdpi/highdpi.qrc
@@ -1,7 +1,9 @@
<RCC>
<qresource prefix="/">
- <file>qticon.png</file>
- <file>qticon@2x.png</file>
- <file>qticon_large.png</file>
+ <file>qticon16.png</file>
+ <file>qticon16@2x.png</file>
+ <file>qticon32.png</file>
+ <file>qticon32@2x.png</file>
+ <file>qticon64.png</file>
</qresource>
</RCC>
diff --git a/tests/manual/highdpi/main.cpp b/tests/manual/highdpi/main.cpp
index fb1e06f0f1..d093569ea8 100644
--- a/tests/manual/highdpi/main.cpp
+++ b/tests/manual/highdpi/main.cpp
@@ -62,16 +62,16 @@ public:
PixmapPainter::PixmapPainter()
{
- pixmap1X = QPixmap(":/qticon.png");
- pixmap2X = QPixmap(":/qticon@2x.png");
- pixmapLarge = QPixmap(":/qticon_large.png");
+ pixmap1X = QPixmap(":/qticon32.png");
+ pixmap2X = QPixmap(":/qticon32@2x.png");
+ pixmapLarge = QPixmap(":/qticon64.png");
- image1X = QImage(":/qticon.png");
- image2X = QImage(":/qticon@2x.png");
- imageLarge = QImage(":/qticon_large.png");
+ image1X = QImage(":/qticon32.png");
+ image2X = QImage(":/qticon32@2x.png");
+ imageLarge = QImage(":/qticon64.png");
- qtIcon.addFile(":/qticon.png");
- qtIcon.addFile(":/qticon@2x.png");
+ qtIcon.addFile(":/qticon32.png");
+ qtIcon.addFile(":/qticon32@2x.png");
}
void PixmapPainter::paintEvent(QPaintEvent *event)
@@ -79,12 +79,12 @@ void PixmapPainter::paintEvent(QPaintEvent *event)
QPainter p(this);
p.fillRect(QRect(QPoint(0, 0), size()), QBrush(Qt::gray));
- int pixmapPointSize = 64;
+ int pixmapPointSize = 32;
int y = 30;
- int dy = 150;
+ int dy = 90;
int x = 10;
- int dx = 80;
+ int dx = 40;
// draw at point
// qDebug() << "paint pixmap" << pixmap1X.devicePixelRatio();
p.drawPixmap(x, y, pixmap1X);
@@ -95,7 +95,7 @@ void PixmapPainter::paintEvent(QPaintEvent *event)
x+=dx;p.drawImage(x, y, image2X);
x+=dx;p.drawImage(x, y, imageLarge);
- // draw at 64x64 rect
+ // draw at 32x32 rect
y+=dy;
x = 10;
p.drawPixmap(QRect(x, y, pixmapPointSize, pixmapPointSize), pixmap1X);
@@ -107,7 +107,7 @@ void PixmapPainter::paintEvent(QPaintEvent *event)
x+=dx;p.drawImage(QRect(x, y, pixmapPointSize, pixmapPointSize), imageLarge);
- // draw at 128x128 rect
+ // draw at 64x64 rect
y+=dy - 50;
x = 10;
p.drawPixmap(QRect(x, y, pixmapPointSize * 2, pixmapPointSize * 2), pixmap1X);
@@ -132,12 +132,12 @@ public:
Labels::Labels()
{
- pixmap1X = QPixmap(":/qticon.png");
- pixmap2X = QPixmap(":/qticon@2x.png");
- pixmapLarge = QPixmap(":/qticon_large.png");
+ pixmap1X = QPixmap(":/qticon32.png");
+ pixmap2X = QPixmap(":/qticon32@2x.png");
+ pixmapLarge = QPixmap(":/qticon64.png");
- qtIcon.addFile(":/qticon.png");
- qtIcon.addFile(":/qticon@2x.png");
+ qtIcon.addFile(":/qticon32.png");
+ qtIcon.addFile(":/qticon32@2x.png");
setWindowIcon(qtIcon);
setWindowTitle("Labels");
@@ -146,15 +146,15 @@ Labels::Labels()
QLabel *label2x = new QLabel();
label2x->setPixmap(pixmap2X);
QLabel *labelIcon = new QLabel();
- labelIcon->setPixmap(qtIcon.pixmap(QSize(64,64)));
+ labelIcon->setPixmap(qtIcon.pixmap(QSize(32,32)));
QLabel *labelLarge = new QLabel();
labelLarge->setPixmap(pixmapLarge);
QHBoxLayout *layout = new QHBoxLayout(this);
-// layout->addWidget(label1x); //expected low-res on high-dpi displays
- layout->addWidget(label2x);
-// layout->addWidget(labelIcon);
-// layout->addWidget(labelLarge); // expected large size and low-res
+ layout->addWidget(label1x); //expected low-res on high-dpi displays
+ layout->addWidget(label2x); //expected high-res on high-dpi displays
+ layout->addWidget(labelIcon); //expected high-res on high-dpi displays
+ layout->addWidget(labelLarge); // expected large size and low-res
setLayout(layout);
}
@@ -172,16 +172,14 @@ public:
MainWindow::MainWindow()
{
- qtIcon.addFile(":/qticon.png");
- qtIcon.addFile(":/qticon@2x.png");
- qtIcon1x.addFile(":/qticon.png");
- qtIcon2x.addFile(":/qticon@2x.png");
+ // beware that QIcon auto-loads the @2x versions.
+ qtIcon1x.addFile(":/qticon16.png");
+ qtIcon2x.addFile(":/qticon32.png");
setWindowIcon(qtIcon);
setWindowTitle("MainWindow");
fileToolBar = addToolBar(tr("File"));
// fileToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
- fileToolBar->addAction(new QAction(qtIcon, QString("1x and 2x"), this));
fileToolBar->addAction(new QAction(qtIcon1x, QString("1x"), this));
fileToolBar->addAction(new QAction(qtIcon2x, QString("2x"), this));
}
@@ -331,36 +329,165 @@ void apiTest()
apiTestdevicePixelRatioSetter<QPixmap>();
}
+// Request and draw an icon at different sizes
+class IconDrawing : public QWidget
+{
+public:
+ QIcon *iconHighDPI;
+ QIcon *iconNormalDpi;
+
+ IconDrawing()
+ {
+ QFile::copy(":/qticon32.png", "/tmp/qticon32-2.png");
+
+ QFile::copy(":/qticon32.png", "/tmp/qticon32.png");
+ QFile::copy(":/qticon32@2x.png", "/tmp/qticon32@2x.png");
+
+ iconHighDPI = new QIcon("/tmp/qticon32.png"); // will auto-load @2x version.
+ iconNormalDpi = new QIcon("/tmp/qticon32-2.png"); // does not have a 2x version.
+ }
+
+ ~IconDrawing()
+ {
+ delete iconHighDPI;
+ delete iconNormalDpi;
+// Qile::
+ }
+
+ void paintEvent(QPaintEvent *event)
+ {
+ int x = 10;
+ int y = 10;
+ int dx = 50;
+ int dy = 50;
+ int maxX = 600;
+ int minSize = 5;
+ int maxSize = 64;
+ int sizeIncrement = 5;
+
+ // Disable high-dpi icons
+ qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, false);
+
+ // normal icon
+ for (int size = minSize; size < maxSize; size += sizeIncrement) {
+ QPainter p(this);
+ p.drawPixmap(x, y, iconNormalDpi->pixmap(size, size));
+ if (x + dx > maxX)
+ y+=dy;
+ x = ((x + dx) % maxX);
+ }
+ x = 10;
+ y+=dy;
+
+ // high-dpi icon
+ for (int size = minSize; size < maxSize; size += sizeIncrement) {
+ QPainter p(this);
+ p.drawPixmap(x, y, iconHighDPI->pixmap(size, size));
+ if (x + dx > maxX)
+ y+=dy;
+ x = ((x + dx) % maxX);
+ }
+
+ x = 10;
+ y+=dy;
+
+ // Enable high-dpi icons
+ qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, true);
+
+ // normal icon
+ for (int size = minSize; size < maxSize; size += sizeIncrement) {
+ QPainter p(this);
+ p.drawPixmap(x, y, iconNormalDpi->pixmap(size, size));
+ if (x + dx > maxX)
+ y+=dy;
+ x = ((x + dx) % maxX);
+ }
+ x = 10;
+ y+=dy;
+
+ // high-dpi icon (draw point)
+ for (int size = minSize; size < maxSize; size += sizeIncrement) {
+ QPainter p(this);
+ p.drawPixmap(x, y, iconHighDPI->pixmap(size, size));
+ if (x + dx > maxX)
+ y+=dy;
+ x = ((x + dx) % maxX);
+ }
+
+ x = 10;
+ y+=dy;
+
+ };
+};
+
+// Icons on buttons
+class Buttons : public QWidget
+{
+public:
+ Buttons()
+ {
+ QIcon icon;
+ icon.addFile(":/qticon16@2x.png");
+
+ QPushButton *button = new QPushButton(this);
+ button->setIcon(icon);
+ button->setText("16@2x");
+
+ QTabBar *tab = new QTabBar(this);
+ tab->addTab(QIcon(":/qticon16.png"), "16@1x");
+ tab->addTab(QIcon(":/qticon16@2x.png"), "16@2x");
+ tab->addTab(QIcon(":/qticon16.png"), "");
+ tab->addTab(QIcon(":/qticon16@2x.png"), "");
+ tab->move(10, 100);
+ tab->show();
+
+ QToolBar *toolBar = new QToolBar(this);
+ toolBar->addAction(QIcon(":/qticon16.png"), "16");
+ toolBar->addAction(QIcon(":/qticon16@2x.png"), "16@2x");
+ toolBar->addAction(QIcon(":/qticon32.png"), "32");
+ toolBar->addAction(QIcon(":/qticon32@2x.png"), "32@2x");
+
+ toolBar->move(10, 200);
+ toolBar->show();
+ }
+};
+
+
int main(int argc, char **argv)
{
- qputenv("QT_HIGHDPI_AWARE", "1");
QApplication app(argc, argv);
+ qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
PixmapPainter pixmapPainter;
-
-// Enable for lots of pixmap drawing
pixmapPainter.show();
Labels label;
label.resize(200, 200);
- label.show();
+// label.show();
MainWindow mainWindow;
- mainWindow.show();
+// mainWindow.show();
StandardIcons icons;
icons.resize(510, 510);
- icons.show();
+// icons.show();
Caching caching;
caching.resize(300, 300);
- caching.show();
+// caching.show();
Style style;
- style.show();
+// style.show();
Fonts fonts;
- fonts.show();
+// fonts.show();
+
+ IconDrawing iconDrawing;
+// iconDrawing.show();
+
+ Buttons buttons;
+// buttons.show();
+
return app.exec();
}
diff --git a/tests/manual/highdpi/qticon16.png b/tests/manual/highdpi/qticon16.png
new file mode 100644
index 0000000000..b6b01a4d64
--- /dev/null
+++ b/tests/manual/highdpi/qticon16.png
Binary files differ
diff --git a/tests/manual/highdpi/qticon16@2x.png b/tests/manual/highdpi/qticon16@2x.png
new file mode 100644
index 0000000000..205461daf0
--- /dev/null
+++ b/tests/manual/highdpi/qticon16@2x.png
Binary files differ
diff --git a/tests/manual/highdpi/qticon32.png b/tests/manual/highdpi/qticon32.png
new file mode 100644
index 0000000000..205461daf0
--- /dev/null
+++ b/tests/manual/highdpi/qticon32.png
Binary files differ
diff --git a/tests/manual/highdpi/qticon.png b/tests/manual/highdpi/qticon32@2x.png
index 76f02c6c96..76f02c6c96 100644
--- a/tests/manual/highdpi/qticon.png
+++ b/tests/manual/highdpi/qticon32@2x.png
Binary files differ
diff --git a/tests/manual/highdpi/qticon64.png b/tests/manual/highdpi/qticon64.png
new file mode 100644
index 0000000000..76f02c6c96
--- /dev/null
+++ b/tests/manual/highdpi/qticon64.png
Binary files differ
diff --git a/tests/manual/highdpi/qticon@2x.png b/tests/manual/highdpi/qticon@2x.png
deleted file mode 100644
index 0b00c00c96..0000000000
--- a/tests/manual/highdpi/qticon@2x.png
+++ /dev/null
Binary files differ
diff --git a/tests/manual/highdpi/qticon_large.png b/tests/manual/highdpi/qticon_large.png
deleted file mode 100644
index 0b00c00c96..0000000000
--- a/tests/manual/highdpi/qticon_large.png
+++ /dev/null
Binary files differ
diff --git a/tests/manual/inputmethodhints/inputmethodhints.h b/tests/manual/inputmethodhints/inputmethodhints.h
index 09c6ca41f5..da1262da39 100644
--- a/tests/manual/inputmethodhints/inputmethodhints.h
+++ b/tests/manual/inputmethodhints/inputmethodhints.h
@@ -42,7 +42,7 @@
#ifndef INPUTMETHODHINTS_H
#define INPUTMETHODHINTS_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
#include "ui_inputmethodhints.h"
class inputmethodhints : public QMainWindow
@@ -52,7 +52,7 @@ class inputmethodhints : public QMainWindow
public:
inputmethodhints(QWidget *parent = 0);
~inputmethodhints();
-
+
public slots:
void checkboxChanged(int);
diff --git a/tests/manual/inputmethodhints/main.cpp b/tests/manual/inputmethodhints/main.cpp
index c96dc65633..fc294dfc43 100644
--- a/tests/manual/inputmethodhints/main.cpp
+++ b/tests/manual/inputmethodhints/main.cpp
@@ -41,7 +41,6 @@
#include "inputmethodhints.h"
-#include <QtWidgets>
#include <QApplication>
int main(int argc, char *argv[])
diff --git a/tests/manual/keypadnavigation/main.cpp b/tests/manual/keypadnavigation/main.cpp
index c631288d60..71a0072fba 100644
--- a/tests/manual/keypadnavigation/main.cpp
+++ b/tests/manual/keypadnavigation/main.cpp
@@ -39,7 +39,14 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QMainWindow>
+#include <QApplication>
+#include <QColorDialog>
+#include <QFileDialog>
+#include <QFontDialog>
+#include <QInputDialog>
+#include <QMessageBox>
+#include <QSignalMapper>
#include "ui_keypadnavigation.h"
class KeypadNavigation : public QMainWindow
diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro
index 177ca0e40e..430c9196e6 100644
--- a/tests/manual/lance/lance.pro
+++ b/tests/manual/lance/lance.pro
@@ -1,5 +1,6 @@
LANCELOT_DIR = $$PWD/../../auto/other/lancelot
CONFIG+=console moc
+CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += . $$LANCELOT_DIR
QT += core-private gui-private widgets printsupport
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 525f596d0e..5a974842a4 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -20,6 +20,7 @@ qlocale \
qnetworkaccessmanager/qget \
qnetworkconfigurationmanager \
qnetworkreply \
+qpainfo \
qscreen \
qssloptions \
qtabletevent \
@@ -34,11 +35,17 @@ windowflags \
windowgeometry \
windowmodality \
widgetgrab \
+xembed-raster \
+xembed-widgets \
dialogs
!contains(QT_CONFIG, openssl):!contains(QT_CONFIG, openssl-linked):SUBDIRS -= qssloptions
-# disable some tests on wince because of missing dependencies
-wince*:SUBDIRS -= \
- lance windowmodality \
- network_remote_stresstest network_stresstest
+win32 {
+ SUBDIRS -= network_remote_stresstest network_stresstest
+ # disable some tests on wince because of missing dependencies
+ wince*:SUBDIRS -= lance windowmodality
+}
+
+lessThan(QT_MAJOR_VERSION, 5): SUBDIRS -= bearerex lance qnetworkaccessmanager/qget qnetworkreply \
+qpainfo qscreen socketengine xembed-raster xembed-widgets
diff --git a/tests/manual/qcursor/allcursors/main.cpp b/tests/manual/qcursor/allcursors/main.cpp
index 5a9a172a2d..247841de31 100644
--- a/tests/manual/qcursor/allcursors/main.cpp
+++ b/tests/manual/qcursor/allcursors/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qcursor/allcursors/mainwindow.h b/tests/manual/qcursor/allcursors/mainwindow.h
index 4b7dc91a18..9c6adcaddd 100644
--- a/tests/manual/qcursor/allcursors/mainwindow.h
+++ b/tests/manual/qcursor/allcursors/mainwindow.h
@@ -42,7 +42,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
class QTimer;
diff --git a/tests/manual/qcursor/grab_override/main.cpp b/tests/manual/qcursor/grab_override/main.cpp
index 5a9a172a2d..247841de31 100644
--- a/tests/manual/qcursor/grab_override/main.cpp
+++ b/tests/manual/qcursor/grab_override/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qcursor/grab_override/mainwindow.h b/tests/manual/qcursor/grab_override/mainwindow.h
index c105e22850..31ecaee43f 100644
--- a/tests/manual/qcursor/grab_override/mainwindow.h
+++ b/tests/manual/qcursor/grab_override/mainwindow.h
@@ -42,7 +42,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtWidgets/QMainWindow>
+#include <QMainWindow>
class QTimer;
@@ -64,11 +64,11 @@ private slots:
private:
void keyPressEvent(QKeyEvent* event);
-
+
Ui::MainWindow *ui;
QTimer *timer;
int override;
-
+
QCursor ccurs;
QCursor bcurs;
};
diff --git a/tests/manual/qdesktopwidget/main.cpp b/tests/manual/qdesktopwidget/main.cpp
index 3873a6a1e1..1a10cbfbd2 100644
--- a/tests/manual/qdesktopwidget/main.cpp
+++ b/tests/manual/qdesktopwidget/main.cpp
@@ -39,7 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QGraphicsView>
+#include <QGraphicsRectItem>
+#include <QDesktopWidget>
+#include <QApplication>
+#include <QDebug>
class DesktopView : public QGraphicsView
{
diff --git a/tests/manual/qgraphicsitem/main.cpp b/tests/manual/qgraphicsitem/main.cpp
index 84364e6bc0..e21baa3d18 100644
--- a/tests/manual/qgraphicsitem/main.cpp
+++ b/tests/manual/qgraphicsitem/main.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QGraphicsView>
-#include <QtWidgets/QGraphicsScene>
-#include <QtWidgets/QGraphicsItem>
-#include <QtWidgets/QMessageBox>
+#include <QApplication>
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#include <QGraphicsItem>
+#include <QMessageBox>
class MyObject : public QObject
{
diff --git a/tests/manual/qgraphicsitemgroup/main.cpp b/tests/manual/qgraphicsitemgroup/main.cpp
index 97dbafd059..75f36e54af 100644
--- a/tests/manual/qgraphicsitemgroup/main.cpp
+++ b/tests/manual/qgraphicsitemgroup/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "widget.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qgraphicslayout/flicker/main.cpp b/tests/manual/qgraphicslayout/flicker/main.cpp
index 4b6589f9f8..2f4140e39a 100644
--- a/tests/manual/qgraphicslayout/flicker/main.cpp
+++ b/tests/manual/qgraphicslayout/flicker/main.cpp
@@ -39,7 +39,8 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QMainWindow>
+#include <QApplication>
#include "window.h"
int main(int argc, char **argv)
diff --git a/tests/manual/qgraphicslayout/flicker/window.h b/tests/manual/qgraphicslayout/flicker/window.h
index 3a0eb77fcc..190e9c4890 100644
--- a/tests/manual/qgraphicslayout/flicker/window.h
+++ b/tests/manual/qgraphicslayout/flicker/window.h
@@ -43,7 +43,21 @@
#define WINDOW_H
-#include <QtWidgets>
+#include <QGraphicsScene>
+#include <QGraphicsWidget>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsView>
+#include <QSpinBox>
+#include <QCheckBox>
+#include <QPushButton>
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QPainter>
+#include <QApplication>
+#include <QThread>
+#include <QMap>
+#include <QTime>
+#include <QDebug>
struct Statistics {
Statistics() : setGeometryCount(0), sleepMsecs(0), output(0),
@@ -57,7 +71,11 @@ struct Statistics {
QLabel *output;
void sleep()
{
+#if QT_VERSION >= 0x050000
QThread::msleep(sleepMsecs);
+#else
+ qWarning("%s unimplemented", Q_FUNC_INFO);
+#endif
}
int currentBenchmarkIteration;
bool relayoutClicked;
diff --git a/tests/manual/qimagereader/main.cpp b/tests/manual/qimagereader/main.cpp
index ea33ef1e01..4dc41ac542 100644
--- a/tests/manual/qimagereader/main.cpp
+++ b/tests/manual/qimagereader/main.cpp
@@ -39,7 +39,12 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QWidget>
+#include <QHBoxLayout>
+#include <QApplication>
+#include <QPainter>
+#include <QImage>
+#include <QImageReader>
class MyWidget : public QWidget
{
diff --git a/tests/manual/qlocale/calendar.cpp b/tests/manual/qlocale/calendar.cpp
index d91e181461..6b3d3c213d 100644
--- a/tests/manual/qlocale/calendar.cpp
+++ b/tests/manual/qlocale/calendar.cpp
@@ -38,10 +38,17 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "calendar.h"
+#include <QComboBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QCalendarWidget>
+#include <QLabel>
+#include <QDateEdit>
+#include <QCheckBox>
+#include <QTextCharFormat>
+
CalendarWidget::CalendarWidget()
{
createPreviewGroupBox();
@@ -397,9 +404,9 @@ void CalendarWidget::createTextFormatsGroupBox()
QComboBox *CalendarWidget::createColorComboBox()
{
QComboBox *comboBox = new QComboBox;
- comboBox->addItem(tr("Red"), Qt::red);
- comboBox->addItem(tr("Blue"), Qt::blue);
- comboBox->addItem(tr("Black"), Qt::black);
- comboBox->addItem(tr("Magenta"), Qt::magenta);
+ comboBox->addItem(tr("Red"), QColor(Qt::red));
+ comboBox->addItem(tr("Blue"), QColor(Qt::blue));
+ comboBox->addItem(tr("Black"), QColor(Qt::black));
+ comboBox->addItem(tr("Magenta"), QColor(Qt::magenta));
return comboBox;
}
diff --git a/tests/manual/qlocale/calendar.h b/tests/manual/qlocale/calendar.h
index fd5f2c3931..ec152a7f4e 100644
--- a/tests/manual/qlocale/calendar.h
+++ b/tests/manual/qlocale/calendar.h
@@ -41,7 +41,17 @@
#ifndef CALENDAR_H
#define CALENDAR_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QDate>
+#include <QLocale>
+
+class QComboBox;
+class QGridLayout;
+class QGroupBox;
+class QCalendarWidget;
+class QLabel;
+class QDateEdit;
+class QCheckBox;
class CalendarWidget : public QWidget
{
diff --git a/tests/manual/qlocale/currency.cpp b/tests/manual/qlocale/currency.cpp
index 46d1cd9b29..5be527ae91 100644
--- a/tests/manual/qlocale/currency.cpp
+++ b/tests/manual/qlocale/currency.cpp
@@ -39,6 +39,10 @@
****************************************************************************/
#include "currency.h"
+#include <QLineEdit>
+#include <QLabel>
+#include <QHBoxLayout>
+#include <QLocale>
CurrencyWidget::CurrencyWidget()
{
diff --git a/tests/manual/qlocale/currency.h b/tests/manual/qlocale/currency.h
index 5185a35983..b81a67e51e 100644
--- a/tests/manual/qlocale/currency.h
+++ b/tests/manual/qlocale/currency.h
@@ -41,7 +41,11 @@
#ifndef CURRENCY_H
#define CURRENCY_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLabel;
+class QLineEdit;
class CurrencyWidget : public QWidget
{
diff --git a/tests/manual/qlocale/dateformats.cpp b/tests/manual/qlocale/dateformats.cpp
index ffdef0993f..3b523ca863 100644
--- a/tests/manual/qlocale/dateformats.cpp
+++ b/tests/manual/qlocale/dateformats.cpp
@@ -40,6 +40,13 @@
#include "dateformats.h"
+#include <QLineEdit>
+#include <QScrollArea>
+#include <QGridLayout>
+#include <QComboBox>
+#include <QLabel>
+#include <QDateTime>
+
DateFormatsWidget::DateFormatsWidget()
{
scrollArea = new QScrollArea;
diff --git a/tests/manual/qlocale/dateformats.h b/tests/manual/qlocale/dateformats.h
index cd50e14cbc..ae3621403e 100644
--- a/tests/manual/qlocale/dateformats.h
+++ b/tests/manual/qlocale/dateformats.h
@@ -41,7 +41,13 @@
#ifndef DATEFORMATS_H
#define DATEFORMATS_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLineEdit;
+class QScrollArea;
+class QGridLayout;
+class QComboBox;
class DateFormatsWidget : public QWidget
{
diff --git a/tests/manual/qlocale/info.cpp b/tests/manual/qlocale/info.cpp
index 229d167209..e3d392fd46 100644
--- a/tests/manual/qlocale/info.cpp
+++ b/tests/manual/qlocale/info.cpp
@@ -40,6 +40,12 @@
#include "info.h"
+#include <QLineEdit>
+#include <QScrollArea>
+#include <QGridLayout>
+#include <QLabel>
+#include <QLocale>
+
InfoWidget::InfoWidget()
{
scrollArea = new QScrollArea;
diff --git a/tests/manual/qlocale/info.h b/tests/manual/qlocale/info.h
index 877151d53d..9657f3264c 100644
--- a/tests/manual/qlocale/info.h
+++ b/tests/manual/qlocale/info.h
@@ -41,7 +41,12 @@
#ifndef INFO_H
#define INFO_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLineEdit;
+class QScrollArea;
+class QGridLayout;
class InfoWidget : public QWidget
{
diff --git a/tests/manual/qlocale/languages.cpp b/tests/manual/qlocale/languages.cpp
index 9f285530b7..828b43ae62 100644
--- a/tests/manual/qlocale/languages.cpp
+++ b/tests/manual/qlocale/languages.cpp
@@ -40,6 +40,10 @@
#include "languages.h"
+#include <QLabel>
+#include <QListWidget>
+#include <QHBoxLayout>
+
LanguagesWidget::LanguagesWidget()
{
QVBoxLayout *l = new QVBoxLayout(this);
diff --git a/tests/manual/qlocale/languages.h b/tests/manual/qlocale/languages.h
index b685bd04c3..57fbf456f3 100644
--- a/tests/manual/qlocale/languages.h
+++ b/tests/manual/qlocale/languages.h
@@ -41,7 +41,11 @@
#ifndef LANGUAGES_H
#define LANGUAGES_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLabel;
+class QListWidget;
class LanguagesWidget : public QWidget
{
diff --git a/tests/manual/qlocale/main.cpp b/tests/manual/qlocale/main.cpp
index 0ca64d3d7c..cacc0c0181 100644
--- a/tests/manual/qlocale/main.cpp
+++ b/tests/manual/qlocale/main.cpp
@@ -38,7 +38,7 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
#include "window.h"
diff --git a/tests/manual/qlocale/miscellaneous.cpp b/tests/manual/qlocale/miscellaneous.cpp
index 374ee588a4..62ebac09e4 100644
--- a/tests/manual/qlocale/miscellaneous.cpp
+++ b/tests/manual/qlocale/miscellaneous.cpp
@@ -40,6 +40,10 @@
#include "miscellaneous.h"
+#include <QLineEdit>
+#include <QVBoxLayout>
+#include <QLabel>
+
MiscWidget::MiscWidget()
{
QGridLayout *l = new QGridLayout;
diff --git a/tests/manual/qlocale/miscellaneous.h b/tests/manual/qlocale/miscellaneous.h
index fe11ecd89b..29543a81e6 100644
--- a/tests/manual/qlocale/miscellaneous.h
+++ b/tests/manual/qlocale/miscellaneous.h
@@ -41,7 +41,11 @@
#ifndef MISCELLANEOUS_H
#define MISCELLANEOUS_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLineEdit;
+class QLabel;
class MiscWidget : public QWidget
{
diff --git a/tests/manual/qlocale/numberformats.cpp b/tests/manual/qlocale/numberformats.cpp
index 3882009f81..edab69b48c 100644
--- a/tests/manual/qlocale/numberformats.cpp
+++ b/tests/manual/qlocale/numberformats.cpp
@@ -40,6 +40,12 @@
#include "numberformats.h"
+#include <QGridLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QLocale>
+#include <QVBoxLayout>
+
NumberFormatsWidget::NumberFormatsWidget()
{
QGridLayout *l = new QGridLayout;
diff --git a/tests/manual/qlocale/numberformats.h b/tests/manual/qlocale/numberformats.h
index dde5f1fa2c..2a91dd3f81 100644
--- a/tests/manual/qlocale/numberformats.h
+++ b/tests/manual/qlocale/numberformats.h
@@ -41,7 +41,11 @@
#ifndef NUMBERFORMATS_H
#define NUMBERFORMATS_H
-#include <QtWidgets>
+#include <QWidget>
+#include <QLocale>
+
+class QLineEdit;
+class QLabel;
class NumberFormatsWidget : public QWidget
{
diff --git a/tests/manual/qlocale/window.cpp b/tests/manual/qlocale/window.cpp
index 9a2e3e3188..40d1316050 100644
--- a/tests/manual/qlocale/window.cpp
+++ b/tests/manual/qlocale/window.cpp
@@ -40,6 +40,13 @@
#include "window.h"
+#include <QComboBox>
+#include <QLocale>
+#include <QLabel>
+#include <QTabWidget>
+#include <QHBoxLayout>
+#include <QEvent>
+
Window::Window()
{
localeCombo = new QComboBox;
diff --git a/tests/manual/qlocale/window.h b/tests/manual/qlocale/window.h
index b7d3369e57..25b8de0ce5 100644
--- a/tests/manual/qlocale/window.h
+++ b/tests/manual/qlocale/window.h
@@ -41,7 +41,7 @@
#ifndef WINDOW_H
#define WINDOW_H
-#include <QtWidgets>
+#include <QMainWindow>
#include "calendar.h"
#include "currency.h"
@@ -51,6 +51,9 @@
#include "miscellaneous.h"
#include "info.h"
+class QLabel;
+class QComboBox;
+
class Window : public QMainWindow
{
Q_OBJECT
diff --git a/tests/manual/qnetworkreply/main.cpp b/tests/manual/qnetworkreply/main.cpp
index feb07b4c7d..2f47985261 100644
--- a/tests/manual/qnetworkreply/main.cpp
+++ b/tests/manual/qnetworkreply/main.cpp
@@ -49,7 +49,7 @@
#include <QtNetwork/qsslconfiguration.h>
#include "../../auto/network-settings.h"
-#ifdef QT_BUILD_INTERNAL
+#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_SSL)
#include "private/qsslsocket_p.h"
#endif
@@ -147,6 +147,9 @@ void tst_qnetworkreply::setSslConfiguration_data()
void tst_qnetworkreply::setSslConfiguration()
{
+#ifdef QT_NO_SSL
+ QSKIP("SSL is not enabled.");
+#else
QFETCH(QUrl, url);
QNetworkRequest request(url);
QSslConfiguration conf = request.sslConfiguration();
@@ -171,6 +174,7 @@ void tst_qnetworkreply::setSslConfiguration()
QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError);
}
#endif
+#endif // QT_NO_SSL
}
QTEST_MAIN(tst_qnetworkreply)
diff --git a/tests/manual/qpainfo/main.cpp b/tests/manual/qpainfo/main.cpp
new file mode 100644
index 0000000000..6b712304a0
--- /dev/null
+++ b/tests/manual/qpainfo/main.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QStyleHints>
+#include <QLibraryInfo>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformtheme.h>
+#include <QScreen>
+#include <QStringList>
+#include <QVariant>
+#include <QFont>
+#include <QSysInfo>
+#include <QLibraryInfo>
+#include <QStandardPaths>
+#include <QDir>
+
+#include <iostream>
+#include <string>
+
+std::ostream &operator<<(std::ostream &str, const QSize &s)
+{
+ str << s.width() << 'x' << s.height();
+ return str;
+}
+
+std::ostream &operator<<(std::ostream &str, const QSizeF &s)
+{
+ str << s.width() << 'x' << s.height();
+ return str;
+}
+
+std::ostream &operator<<(std::ostream &str, const QRect &r)
+{
+ str << r.size() << '+' << r.x() << '+' << r.y();
+ return str;
+}
+
+std::ostream &operator<<(std::ostream &str, const QStringList &l)
+{
+ for (int i = 0; i < l.size(); ++i) {
+ if (i)
+ str << ',';
+ str << l.at(i).toStdString();
+ }
+ return str;
+}
+
+static QStringList toNativeSeparators(QStringList in)
+{
+ for (int i = 0; i < in.size(); ++i)
+ in[i] = QDir::toNativeSeparators(in.at(i));
+ return in;
+}
+
+#define DUMP_CAPABILITY(integration, capability) \
+ if (platformIntegration->hasCapability(QPlatformIntegration::capability)) \
+ std::cout << ' ' << #capability;
+
+#define DUMP_STANDARDPATH(location) \
+ std::cout << " " << #location << ": \"" \
+ << QStandardPaths::displayName(QStandardPaths::location).toStdString() << '"' \
+ << ' ' << toNativeSeparators(QStandardPaths::standardLocations(QStandardPaths::location)) << '\n';
+
+#define DUMP_LIBRARYPATH(loc) \
+ std::cout << " " << #loc << ": " << QDir::toNativeSeparators(QLibraryInfo::location(QLibraryInfo::loc)).toStdString() << '\n';
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ const QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();
+ std::cout << "Qt " << QT_VERSION_STR << " on \"" << QGuiApplication::platformName().toStdString() << "\" "
+ << QSysInfo::WordSize << " bit/"
+ << (QSysInfo::ByteOrder == QSysInfo::LittleEndian ? "little endian" : "big endian") << '/'
+ << (QLibraryInfo::isDebugBuild() ? "debug" : "release")
+ << '\n';
+
+#if defined(Q_OS_WIN)
+ std::cout << std::hex << "Windows version: 0x" << QSysInfo::windowsVersion() << std::dec << '\n';
+#elif defined(Q_OS_MAC)
+ std::cout << std::hex << "Mac OS version: 0x" << QSysInfo::macVersion() << std::dec << '\n';
+#endif
+
+ std::cout << "\nLibrary info:\n";
+ DUMP_LIBRARYPATH(PrefixPath)
+ DUMP_LIBRARYPATH(DocumentationPath)
+ DUMP_LIBRARYPATH(HeadersPath)
+ DUMP_LIBRARYPATH(LibrariesPath)
+ DUMP_LIBRARYPATH(LibraryExecutablesPath)
+ DUMP_LIBRARYPATH(BinariesPath)
+ DUMP_LIBRARYPATH(PluginsPath)
+ DUMP_LIBRARYPATH(ImportsPath)
+ DUMP_LIBRARYPATH(Qml2ImportsPath)
+ DUMP_LIBRARYPATH(ArchDataPath)
+ DUMP_LIBRARYPATH(DataPath)
+ DUMP_LIBRARYPATH(TranslationsPath)
+ DUMP_LIBRARYPATH(ExamplesPath)
+ DUMP_LIBRARYPATH(TestsPath)
+
+ std::cout << "\nStandard paths:\n";
+ DUMP_STANDARDPATH(DesktopLocation)
+ DUMP_STANDARDPATH(DocumentsLocation)
+ DUMP_STANDARDPATH(FontsLocation)
+ DUMP_STANDARDPATH(ApplicationsLocation)
+ DUMP_STANDARDPATH(MusicLocation)
+ DUMP_STANDARDPATH(MoviesLocation)
+ DUMP_STANDARDPATH(PicturesLocation)
+ DUMP_STANDARDPATH(TempLocation)
+ DUMP_STANDARDPATH(HomeLocation)
+ DUMP_STANDARDPATH(DataLocation)
+ DUMP_STANDARDPATH(CacheLocation)
+ DUMP_STANDARDPATH(GenericDataLocation)
+ DUMP_STANDARDPATH(RuntimeLocation)
+ DUMP_STANDARDPATH(ConfigLocation)
+ DUMP_STANDARDPATH(DownloadLocation)
+ DUMP_STANDARDPATH(GenericCacheLocation)
+
+ std::cout << "\nPlatform capabilities:";
+ DUMP_CAPABILITY(platformIntegration, ThreadedPixmaps)
+ DUMP_CAPABILITY(platformIntegration, OpenGL)
+ DUMP_CAPABILITY(platformIntegration, ThreadedOpenGL)
+ DUMP_CAPABILITY(platformIntegration, SharedGraphicsCache)
+ DUMP_CAPABILITY(platformIntegration, BufferQueueingOpenGL)
+ DUMP_CAPABILITY(platformIntegration, WindowMasks)
+ DUMP_CAPABILITY(platformIntegration, MultipleWindows)
+ DUMP_CAPABILITY(platformIntegration, ApplicationState)
+ DUMP_CAPABILITY(platformIntegration, ForeignWindows)
+ std::cout << '\n';
+
+ const QStyleHints *styleHints = QGuiApplication::styleHints();
+ std::cout << "\nStyle hints: mouseDoubleClickInterval=" << styleHints->mouseDoubleClickInterval() << " startDragDistance="
+ << styleHints->startDragDistance() << " startDragTime=" << styleHints->startDragTime()
+ << " startDragVelocity=" << styleHints->startDragVelocity() << " keyboardInputInterval=" << styleHints->keyboardInputInterval()
+ << " keyboardAutoRepeatRate=" << styleHints->keyboardAutoRepeatRate() << " cursorFlashTime=" << styleHints->cursorFlashTime()
+ << " showIsFullScreen=" << styleHints->showIsFullScreen() << " passwordMaskDelay=" << styleHints->passwordMaskDelay()
+ << " fontSmoothingGamma=" << styleHints->fontSmoothingGamma() << " useRtlExtensions=" << styleHints->useRtlExtensions() << '\n';
+
+ const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
+ std::cout << "\nTheme:\n Styles: " << platformTheme->themeHint(QPlatformTheme::StyleNames).toStringList();
+ const QString iconTheme = platformTheme->themeHint(QPlatformTheme::SystemIconThemeName).toString();
+ if (!iconTheme.isEmpty()) {
+ std::cout << "\n Icon theme: " << iconTheme.toStdString()
+ << ", " << platformTheme->themeHint(QPlatformTheme::SystemIconFallbackThemeName).toString().toStdString()
+ << " from " << platformTheme->themeHint(QPlatformTheme::IconThemeSearchPaths).toStringList() << '\n';
+ }
+ if (const QFont *systemFont = platformTheme->font())
+ std::cout << " System font: \"" << systemFont->family().toStdString() << "\" " << systemFont->pointSize() << '\n';
+ if (platformTheme->usePlatformNativeDialog(QPlatformTheme::FileDialog))
+ std::cout << " Native file dialog\n";
+ if (platformTheme->usePlatformNativeDialog(QPlatformTheme::ColorDialog))
+ std::cout << " Native color dialog\n";
+ if (platformTheme->usePlatformNativeDialog(QPlatformTheme::FontDialog))
+ std::cout << " Native font dialog\n";
+
+ const QList<QScreen*> screens = QGuiApplication::screens();
+ const int screenCount = screens.size();
+ std::cout << "\nScreens: " << screenCount << '\n';
+ for (int s = 0; s < screenCount; ++s) {
+ const QScreen *screen = screens.at(s);
+ std::cout << (screen == QGuiApplication::primaryScreen() ? '*' : ' ')
+ << '#' << ' ' << s << " \"" << screen->name().toStdString() << '"'
+ << "\n Geometry: " << screen->geometry() << " Available: " << screen->availableGeometry();
+ if (screen->geometry() != screen->virtualGeometry())
+ std::cout << "\n Virtual geometry: " << screen->virtualGeometry() << " Available: " << screen->availableVirtualGeometry();
+ if (screen->virtualSiblings().size() > 1)
+ std::cout << "\n " << screen->virtualSiblings().size() << " virtual siblings";
+ std::cout << "\n Physical size: " << screen->physicalSize() << " mm"
+ << " Refresh: " << screen->refreshRate() << " Hz"
+ << "\n Physical DPI: " << screen->physicalDotsPerInchX()
+ << ',' << screen->physicalDotsPerInchY()
+ << " Logical DPI: " << screen->logicalDotsPerInchX()
+ << ',' << screen->logicalDotsPerInchY()
+ << "\n DevicePixelRatio: " << screen->devicePixelRatio()
+ << " Primary orientation: " << screen->primaryOrientation()
+ << "\n Orientation: " << screen->orientation()
+ << " OrientationUpdateMask: " << screen->orientationUpdateMask()
+ << "\n\n";
+ }
+ return 0;
+}
diff --git a/tests/manual/qpainfo/qpainfo.pro b/tests/manual/qpainfo/qpainfo.pro
new file mode 100644
index 0000000000..374f951300
--- /dev/null
+++ b/tests/manual/qpainfo/qpainfo.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET = qpainfo
+CONFIG+=console
+CONFIG -= app_bundle
+QT = core-private gui-private
+
+SOURCES += main.cpp
diff --git a/tests/manual/qtbug-8933/main.cpp b/tests/manual/qtbug-8933/main.cpp
index 97dbafd059..75f36e54af 100644
--- a/tests/manual/qtbug-8933/main.cpp
+++ b/tests/manual/qtbug-8933/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtWidgets/QApplication>
+#include <QApplication>
#include "widget.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qtouchevent/main.cpp b/tests/manual/qtouchevent/main.cpp
index e0bd9ad063..7c1ed81c37 100644
--- a/tests/manual/qtouchevent/main.cpp
+++ b/tests/manual/qtouchevent/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
#include <QtTest>
#include "ui_form.h"
@@ -55,6 +55,7 @@ public:
{
setAttribute(Qt::WA_QuitOnClose, false);
setupUi(this);
+ setWindowTitle(QT_VERSION_STR);
}
void closeEvent(QCloseEvent *event)
diff --git a/tests/manual/qtouchevent/qtouchevent.pro b/tests/manual/qtouchevent/qtouchevent.pro
index aa4339f693..6a1ca85335 100644
--- a/tests/manual/qtouchevent/qtouchevent.pro
+++ b/tests/manual/qtouchevent/qtouchevent.pro
@@ -1,4 +1,5 @@
-QT += widgets testlib
+QT += testlib
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES = main.cpp \
touchwidget.cpp
FORMS += form.ui
diff --git a/tests/manual/qtouchevent/touchwidget.cpp b/tests/manual/qtouchevent/touchwidget.cpp
index 68206aad22..e2834203f7 100644
--- a/tests/manual/qtouchevent/touchwidget.cpp
+++ b/tests/manual/qtouchevent/touchwidget.cpp
@@ -122,7 +122,7 @@ bool TouchWidget::event(QEvent *event)
case QEvent::MouseButtonRelease:
seenMouseRelease = true;
if (closeWindowOnMouseRelease)
- window()->close();
+ window()->close();
if (acceptMouseRelease) {
event->accept();
return true;
diff --git a/tests/manual/qwidget_zorder/main.cpp b/tests/manual/qwidget_zorder/main.cpp
index 7697cc1794..7773ecef9c 100644
--- a/tests/manual/qwidget_zorder/main.cpp
+++ b/tests/manual/qwidget_zorder/main.cpp
@@ -39,7 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QPushButton>
+#include <QPlainTextEdit>
+#include <QCalendarWidget>
+#include <QVBoxLayout>
class Widget : public QWidget
{
diff --git a/tests/manual/repaint/mainwindow/main.cpp b/tests/manual/repaint/mainwindow/main.cpp
index 173f81de06..abf5857afc 100644
--- a/tests/manual/repaint/mainwindow/main.cpp
+++ b/tests/manual/repaint/mainwindow/main.cpp
@@ -39,7 +39,14 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QMainWindow>
+#include <QToolBar>
+#include <QDockWidget>
+#include <QStatusBar>
+#include <QSpinBox>
+#include <QAction>
+
#include "../shared/shared.h"
int main(int argc, char **argv)
@@ -47,16 +54,16 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
QMainWindow mainWindow;
-
+
mainWindow.setCentralWidget(new StaticWidget());
mainWindow.setStatusBar(new QStatusBar());
-
+
QDockWidget *dockWidget = new QDockWidget();
dockWidget->setWidget(new StaticWidget());
mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
-
+
QToolBar *toolBar = new QToolBar();
-
+
toolBar->addWidget(new StaticWidget())->setVisible(true);;
toolBar->addWidget(new QSpinBox())->setVisible(true);;
@@ -64,6 +71,6 @@ int main(int argc, char **argv)
mainWindow.resize(600, 400);
mainWindow.show();
-
+
return app.exec();
}
diff --git a/tests/manual/repaint/scrollarea/main.cpp b/tests/manual/repaint/scrollarea/main.cpp
index 44b43c30f7..dbe5cab893 100644
--- a/tests/manual/repaint/scrollarea/main.cpp
+++ b/tests/manual/repaint/scrollarea/main.cpp
@@ -39,9 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets>
-#include "../shared/shared.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QScrollArea>
+#include "../shared/shared.h"
int main(int argc, char **argv)
{
@@ -57,8 +59,7 @@ int main(int argc, char **argv)
scrollView.resize(600, 400);
scrollView.show();
-
-
+
return app.exec();
}
diff --git a/tests/manual/repaint/shared/shared.h b/tests/manual/repaint/shared/shared.h
index 8cc5a61aca..8550e6e907 100644
--- a/tests/manual/repaint/shared/shared.h
+++ b/tests/manual/repaint/shared/shared.h
@@ -39,7 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QWidget>
+#include <QPainter>
+#include <QMouseEvent>
+#include <QDebug>
+
class StaticWidget : public QWidget
{
Q_OBJECT
diff --git a/tests/manual/repaint/splitter/main.cpp b/tests/manual/repaint/splitter/main.cpp
index 5ee1e19402..44f76eae2c 100644
--- a/tests/manual/repaint/splitter/main.cpp
+++ b/tests/manual/repaint/splitter/main.cpp
@@ -39,9 +39,12 @@
**
****************************************************************************/
-#include <QtWidgets>
#include "../shared/shared.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QSplitter>
+
int main(int argc, char **argv)
{
QApplication app(argc, argv);
@@ -53,6 +56,6 @@ int main(int argc, char **argv)
splitter.resize(600, 400);
splitter.show();
-
+
return app.exec();
}
diff --git a/tests/manual/repaint/tableview/main.cpp b/tests/manual/repaint/tableview/main.cpp
index 442b1668e0..c26c1264d7 100644
--- a/tests/manual/repaint/tableview/main.cpp
+++ b/tests/manual/repaint/tableview/main.cpp
@@ -39,13 +39,17 @@
**
****************************************************************************/
-#include <QtWidgets>
#include "../shared/shared.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QTableWidget>
+#include <QPaintEvent>
+
class CellWidget : public QWidget
{
public:
- CellWidget (QWidget *parent = 0) : QWidget(parent) { }
+ CellWidget(QWidget *parent = 0) : QWidget(parent) {}
void paintEvent(QPaintEvent * event)
{
static int value = 200;
@@ -69,8 +73,7 @@ int main(int argc, char **argv)
tableWidget.setCellWidget(row, col, new CellWidget());
tableWidget.resize(400, 600);
tableWidget.show();
-
-
+
return app.exec();
}
diff --git a/tests/manual/repaint/task141091/main.cpp b/tests/manual/repaint/task141091/main.cpp
index d2b0f76606..d8a37299be 100644
--- a/tests/manual/repaint/task141091/main.cpp
+++ b/tests/manual/repaint/task141091/main.cpp
@@ -39,17 +39,20 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QMainWindow>
+#include <QPaintEvent>
#include <QDebug>
class MyWidget : public QWidget
{
public:
- MyWidget() : QWidget() {
-
-
+ MyWidget() : QWidget()
+ {
setAttribute(Qt::WA_OpaquePaintEvent);
- setAttribute(Qt::WA_StaticContents); }
+ setAttribute(Qt::WA_StaticContents);
+ }
+
protected:
void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); }
};
@@ -60,4 +63,4 @@ int main(int argc, char **argv)
MyWidget w;
w.show();
return a.exec();
-} \ No newline at end of file
+}
diff --git a/tests/manual/repaint/toplevel/main.cpp b/tests/manual/repaint/toplevel/main.cpp
index 006da2635f..fd2902f21b 100644
--- a/tests/manual/repaint/toplevel/main.cpp
+++ b/tests/manual/repaint/toplevel/main.cpp
@@ -39,9 +39,10 @@
**
****************************************************************************/
-#include <QtWidgets>
#include "../shared/shared.h"
+#include <QApplication>
+
int main(int argc, char **argv)
{
QApplication app(argc, argv);
diff --git a/tests/manual/repaint/widget/main.cpp b/tests/manual/repaint/widget/main.cpp
index 520b3e22f5..e2370abf3e 100644
--- a/tests/manual/repaint/widget/main.cpp
+++ b/tests/manual/repaint/widget/main.cpp
@@ -39,9 +39,11 @@
**
****************************************************************************/
-#include <QtWidgets>
#include "../shared/shared.h"
+#include <QApplication>
+#include <QPushButton>
+
class Child : public StaticWidget
{
Q_OBJECT
@@ -108,24 +110,24 @@ protected:
QPushButton * resizeButton;
QPushButton * movebutton;
QPushButton * moveResizebutton;
- QPushButton * scrollbutton;
+ QPushButton * scrollbutton;
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
-
+
TopLevel bc;
bc.resize(500, 500);
c = new Child(&bc);
c->move(100, 100);
c->resize(100, 100);
-
+
QWidget *gc = new StaticWidget(c);
gc->move(20, 20);
gc->resize(50,50);
-
+
bc.show();
return app.exec();
diff --git a/tests/manual/textrendering/glyphshaping/main.cpp b/tests/manual/textrendering/glyphshaping/main.cpp
index 21e57152dd..e7720522fb 100644
--- a/tests/manual/textrendering/glyphshaping/main.cpp
+++ b/tests/manual/textrendering/glyphshaping/main.cpp
@@ -39,7 +39,15 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QStringList>
+#include <QVector>
+#include <QFile>
+#include <QDir>
+#include <QPainter>
+#include <QFontMetrics>
+#include <QImage>
+#include <QXmlStreamReader>
static const int fontPixelSize = 25;
static const QLatin1String fontFamily("Series 60 Sans");
diff --git a/tests/manual/textrendering/textperformance/main.cpp b/tests/manual/textrendering/textperformance/main.cpp
index 7d02c8c03b..373102436c 100644
--- a/tests/manual/textrendering/textperformance/main.cpp
+++ b/tests/manual/textrendering/textperformance/main.cpp
@@ -39,7 +39,12 @@
**
****************************************************************************/
-#include <QtWidgets>
+#include <QApplication>
+#include <QDialog>
+#include <QFontDatabase>
+#include <QPainter>
+#include <QTime>
+#include <QTimer>
static const int lastMeasurementsCount = 50;
diff --git a/tests/manual/transientwindow/main.cpp b/tests/manual/transientwindow/main.cpp
new file mode 100644
index 0000000000..aebb051688
--- /dev/null
+++ b/tests/manual/transientwindow/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/transientwindow/mainwindow.cpp b/tests/manual/transientwindow/mainwindow.cpp
new file mode 100644
index 0000000000..25123c4936
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwindow.h"
+#include <QDebug>
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent), m_showButton("Toggle visible", this), m_window(0)
+{
+ connect(&m_showButton, SIGNAL(clicked()), this, SLOT(toggleVisible()));
+ setWindowTitle(QString::fromLatin1("Main Window"));
+ m_showButton.setVisible(true);
+ setMinimumSize(300, 200);
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::toggleVisible()
+{
+ if (!m_window) {
+ m_window = new QWindow();
+ m_window->setTransientParent(windowHandle());
+ m_window->setMinimumSize(QSize(200, 100));
+ m_window->setTitle("Transient Window");
+ }
+ m_window->setVisible(!m_window->isVisible());
+}
diff --git a/tests/manual/transientwindow/mainwindow.h b/tests/manual/transientwindow/mainwindow.h
new file mode 100644
index 0000000000..352fc961e1
--- /dev/null
+++ b/tests/manual/transientwindow/mainwindow.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QPushButton>
+#include <QWindow>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+public slots:
+ void toggleVisible();
+
+private:
+ QPushButton m_showButton;
+ QWindow* m_window;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/transientwindow/transientwindow.pro b/tests/manual/transientwindow/transientwindow.pro
new file mode 100644
index 0000000000..a07ee09dbc
--- /dev/null
+++ b/tests/manual/transientwindow/transientwindow.pro
@@ -0,0 +1,6 @@
+QT += core gui widgets
+TARGET = transientwindow
+TEMPLATE = app
+SOURCES += main.cpp\
+ mainwindow.cpp
+HEADERS += mainwindow.h
diff --git a/tests/manual/widgets/itemviews/delegate/example.cpp b/tests/manual/widgets/itemviews/delegate/example.cpp
index ae45561f03..c65f49f266 100644
--- a/tests/manual/widgets/itemviews/delegate/example.cpp
+++ b/tests/manual/widgets/itemviews/delegate/example.cpp
@@ -39,7 +39,12 @@
**
****************************************************************************/
-#include <QtWidgets/QtWidgets>
+#include <QLineEdit>
+#include <QApplication>
+#include <QTableView>
+#include <QStandardItemModel>
+#include <QItemDelegate>
+#include <QDebug>
class ExampleEditor : public QLineEdit
{
diff --git a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp b/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp
index 7a8c1d159d..b5aeb023f4 100644
--- a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp
+++ b/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest1.cpp
@@ -99,6 +99,9 @@ int main(int argc, char *argv[])
m.setRowCount(500);
m.setColumnCount(250);
tv.setModel(&m);
+ tv.setSelectionMode(QAbstractItemView::SingleSelection);
+ // Comment in the line below to test selection with keyboard (space)
+ // tv.setEditTriggers(QAbstractItemView::NoEditTriggers);
SomeHandler handler(tv.horizontalHeader(), &tv);
tv.horizontalHeader()->setDefaultSectionSize(30);
tv.show();
diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
index 186203e7d8..aec2479239 100644
--- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
+++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
@@ -60,11 +60,12 @@ public:
class MyGraphicsView : public QGraphicsView
{
-
+ Q_OBJECT
public:
- MyGraphicsView() : QGraphicsView()
+ MyGraphicsView(QWidget *w, QLabel *l) : QGraphicsView(w), rubberbandLabel(l)
{
setDragMode(QGraphicsView::RubberBandDrag);
+ connect(this, SIGNAL(rubberBandChanged(QRect, QPointF, QPointF)), this, SLOT(updateRubberbandInfo(QRect, QPointF, QPointF)));
}
protected:
void mouseMoveEvent(QMouseEvent *event)
@@ -81,26 +82,46 @@ protected:
if (yglobal > bottomPos)
verticalScrollBar()->setValue(verticalScrollBar()->value() + 10);
}
+
+protected slots:
+ void updateRubberbandInfo(QRect r, QPointF from, QPointF to)
+ {
+ QString textToShow;
+ QDebug s(&textToShow);
+ s << r << from << to;
+ rubberbandLabel->setText(textToShow);
+ }
+protected:
+ QLabel *rubberbandLabel;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- MyGraphicsView v;
+
+ QWidget w;
+ w.setLayout(new QVBoxLayout);
+ QLabel *l = new QLabel(&w);
+ MyGraphicsView *v = new MyGraphicsView(&w, l);
+
+ w.layout()->addWidget(v);
+ w.layout()->addWidget(l);
QGraphicsScene s(0.0, 0.0, 5000.0, 5000.0);
- v.setScene(&s);
- v.setInteractive(true);
- v.setRubberBandSelectionMode(Qt::IntersectsItemBoundingRect);
- s.addRect( (qreal) 0.0, 0.0, 1000.0, 50.0, QPen(),QBrush(QColor(0,0,255)));
+ v->setScene(&s);
+ v->setInteractive(true);
+ v->setRubberBandSelectionMode(Qt::IntersectsItemBoundingRect);
for (int u = 0; u < 100; ++u)
- for (int v = 0; v < 100; ++v) {
+ for (int n = 0; n < 100; ++n) {
MyGraphicsItem *item = new MyGraphicsItem();
- item->setRect(QRectF(v * 80.0, u * 80.0, 50.0, 20.0));
+ item->setRect(QRectF(n * 80.0, u * 80.0, 50.0, 20.0));
s.addItem(item);
}
- v.show();
+
+ w.show();
app.exec();
return 0;
}
+
+#include "rubberbandtest.moc"
diff --git a/tests/manual/windowflags/controls.cpp b/tests/manual/windowflags/controls.cpp
index cad84617fc..422656ff03 100644
--- a/tests/manual/windowflags/controls.cpp
+++ b/tests/manual/windowflags/controls.cpp
@@ -123,8 +123,10 @@ Qt::WindowFlags HintControl::hints() const
flags |= Qt::WindowMinimizeButtonHint;
if (windowMaximizeButtonCheckBox->isChecked())
flags |= Qt::WindowMaximizeButtonHint;
+#if QT_VERSION >= 0x050000
if (windowFullscreenButtonCheckBox->isChecked())
flags |= Qt::WindowFullscreenButtonHint;
+#endif
if (windowCloseButtonCheckBox->isChecked())
flags |= Qt::WindowCloseButtonHint;
if (windowContextHelpButtonCheckBox->isChecked())
@@ -153,7 +155,9 @@ void HintControl::setHints(Qt::WindowFlags flags)
windowSystemMenuCheckBox->setChecked(flags & Qt::WindowSystemMenuHint);
windowMinimizeButtonCheckBox->setChecked(flags & Qt::WindowMinimizeButtonHint);
windowMaximizeButtonCheckBox->setChecked(flags & Qt::WindowMaximizeButtonHint);
+#if QT_VERSION >= 0x050000
windowFullscreenButtonCheckBox->setChecked(flags & Qt::WindowFullscreenButtonHint);
+#endif
windowCloseButtonCheckBox->setChecked(flags & Qt::WindowCloseButtonHint);
windowContextHelpButtonCheckBox->setChecked(flags & Qt::WindowContextHelpButtonHint);
windowShadeButtonCheckBox->setChecked(flags & Qt::WindowShadeButtonHint);
diff --git a/tests/manual/windowgeometry/controllerwidget.cpp b/tests/manual/windowgeometry/controllerwidget.cpp
index 8340b90654..d8c74ef8a3 100644
--- a/tests/manual/windowgeometry/controllerwidget.cpp
+++ b/tests/manual/windowgeometry/controllerwidget.cpp
@@ -311,7 +311,7 @@ public:
, m_backingStore(new QBackingStore(this))
{
setObjectName(QStringLiteral("window"));
- setWindowTitle(tr("TestWindow"));
+ setTitle(tr("TestWindow"));
}
protected:
@@ -363,9 +363,9 @@ private:
virtual QPoint objectMapToGlobal(const QObject *o, const QPoint &p) const
{ return static_cast<const QWindow *>(o)->mapToGlobal(p); }
virtual Qt::WindowFlags objectWindowFlags(const QObject *o) const
- { return static_cast<const QWindow *>(o)->windowFlags(); }
+ { return static_cast<const QWindow *>(o)->flags(); }
virtual void setObjectWindowFlags(QObject *o, Qt::WindowFlags f)
- { static_cast<QWindow *>(o)->setWindowFlags(f); }
+ { static_cast<QWindow *>(o)->setFlags(f); }
WindowStateControl *m_stateControl;
};
@@ -374,7 +374,7 @@ WindowControl::WindowControl(QWindow *w )
: BaseWindowControl(w)
, m_stateControl(new WindowStateControl(WindowStateControl::WantVisibleCheckBox | WindowStateControl::WantMinimizeRadioButton))
{
- setTitle(w->windowTitle());
+ setTitle(w->title());
QGroupBox *stateGroupBox = new QGroupBox(tr("State"));
QVBoxLayout *l = new QVBoxLayout(stateGroupBox);
l->addWidget(m_stateControl);
@@ -454,7 +454,7 @@ ControllerWidget::ControllerWidget(QWidget *parent)
#if QT_VERSION >= 0x050000
x += 300;
- m_testWindow->setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint
+ m_testWindow->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint
| Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint
| Qt::WindowTitleHint | Qt::WindowFullscreenButtonHint);
m_testWindow->setFramePosition(QPoint(x, y));
@@ -467,7 +467,7 @@ ControllerWidget::ControllerWidget(QWidget *parent)
m_testWindow->showFullScreen();
else
m_testWindow->show();
- m_testWindow->setWindowTitle(tr("TestWindow"));
+ m_testWindow->setTitle(tr("TestWindow"));
#endif
QWidget *central = new QWidget ;
diff --git a/tests/manual/xembed-raster/gtk-embedder.py b/tests/manual/xembed-raster/gtk-embedder.py
new file mode 100755
index 0000000000..bd19789f84
--- /dev/null
+++ b/tests/manual/xembed-raster/gtk-embedder.py
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+#############################################################################
+##
+## Copyright (C) 2013 Canonical Ltd.
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the test suite of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## 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 Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+from gi.repository import Gtk
+from subprocess import Popen
+
+window = Gtk.Window()
+
+box = Gtk.VBox(False, 0)
+window.add(box)
+
+child = None
+def on_button_clicked(button, socket):
+ global child
+ child = Popen(['./rasterwindow', str(socket.get_id())])
+
+button = Gtk.Button("Press me to embed a Qt client")
+box.pack_start(button, False, False, 0)
+
+socket = Gtk.Socket()
+socket.set_size_request(200, 200)
+box.add(socket)
+
+button.connect("clicked", on_button_clicked, socket)
+window.connect("destroy", Gtk.main_quit)
+
+def plugged_event(widget):
+ print("A window was embedded!")
+
+socket.connect("plug-added", plugged_event)
+
+window.show_all()
+Gtk.main()
+if child:
+ child.terminate()
diff --git a/tests/manual/xembed-raster/main.cpp b/tests/manual/xembed-raster/main.cpp
new file mode 100644
index 0000000000..dc5fb8a5ca
--- /dev/null
+++ b/tests/manual/xembed-raster/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#include "rasterwindow.h"
+#include <QDebug>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QStringList args = app.arguments();
+
+ WId winId = 0;
+ if (args.count() > 1) {
+ bool ok;
+ winId = args[1].toUInt(&ok);
+ Q_ASSERT(ok);
+ }
+
+ RasterWindow window;
+ window.show();
+
+ QWindow *foreign = QWindow::fromWinId(winId);
+ Q_ASSERT(foreign != 0);
+
+ window.setParent(foreign);
+
+ return app.exec();
+}
diff --git a/tests/manual/xembed-raster/rasterwindow.cpp b/tests/manual/xembed-raster/rasterwindow.cpp
new file mode 100644
index 0000000000..cad5081280
--- /dev/null
+++ b/tests/manual/xembed-raster/rasterwindow.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#include "rasterwindow.h"
+
+RasterWindow::RasterWindow(QWindow *parent)
+ : QWindow(parent)
+ , m_update_pending(false)
+{
+ m_backingStore = new QBackingStore(this);
+ create();
+
+ setGeometry(100, 100, 300, 200);
+}
+
+
+bool RasterWindow::event(QEvent *event)
+{
+ if (event->type() == QEvent::UpdateRequest) {
+ m_update_pending = false;
+ renderNow();
+ return true;
+ }
+ return QWindow::event(event);
+}
+
+void RasterWindow::renderLater()
+{
+ if (!m_update_pending) {
+ m_update_pending = true;
+ QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
+ }
+}
+
+void RasterWindow::resizeEvent(QResizeEvent *resizeEvent)
+{
+ m_backingStore->resize(resizeEvent->size());
+ if (isExposed())
+ renderNow();
+}
+
+void RasterWindow::exposeEvent(QExposeEvent *)
+{
+ if (isExposed()) {
+ renderNow();
+ }
+}
+
+void RasterWindow::renderNow()
+{
+ if (!isExposed())
+ return;
+
+ QRect rect(0, 0, width(), height());
+ m_backingStore->beginPaint(rect);
+
+ QPaintDevice *device = m_backingStore->paintDevice();
+ QPainter painter(device);
+
+ painter.fillRect(0, 0, width(), height(), Qt::white);
+ render(&painter);
+
+ m_backingStore->endPaint();
+ m_backingStore->flush(rect);
+}
+
+void RasterWindow::render(QPainter *painter)
+{
+ painter->drawText(QRectF(0, 0, width(), height()), Qt::AlignCenter, QStringLiteral("QWindow"));
+}
diff --git a/tests/manual/xembed-raster/rasterwindow.h b/tests/manual/xembed-raster/rasterwindow.h
new file mode 100644
index 0000000000..3fed06d7de
--- /dev/null
+++ b/tests/manual/xembed-raster/rasterwindow.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#ifndef RASTERWINDOW_H
+#define RASTERWINDOW_H
+
+#include <QtGui>
+
+class RasterWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ explicit RasterWindow(QWindow *parent = 0);
+
+ virtual void render(QPainter *painter);
+
+public slots:
+ void renderLater();
+ void renderNow();
+
+protected:
+ bool event(QEvent *event);
+
+ void resizeEvent(QResizeEvent *event);
+ void exposeEvent(QExposeEvent *event);
+
+private:
+ QBackingStore *m_backingStore;
+ bool m_update_pending;
+};
+
+#endif // RASTERWINDOW_H
diff --git a/tests/manual/xembed-raster/xembed-raster.pro b/tests/manual/xembed-raster/xembed-raster.pro
new file mode 100644
index 0000000000..adaf9c4d25
--- /dev/null
+++ b/tests/manual/xembed-raster/xembed-raster.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET= rasterwindow
+QT += gui
+
+SOURCES += \
+ main.cpp \
+ rasterwindow.cpp
+HEADERS += \
+ rasterwindow.h
diff --git a/tests/manual/xembed-widgets/gtk-embedder.py b/tests/manual/xembed-widgets/gtk-embedder.py
new file mode 100755
index 0000000000..bcb9813441
--- /dev/null
+++ b/tests/manual/xembed-widgets/gtk-embedder.py
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+#############################################################################
+##
+## Copyright (C) 2013 Canonical Ltd.
+## Contact: http://www.qt-project.org/legal
+##
+## This file is part of the test suite of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## 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 Digia. For licensing terms and
+## conditions see http://qt.digia.com/licensing. For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Digia gives you certain additional
+## rights. These rights are described in the Digia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+from gi.repository import Gtk
+from subprocess import Popen
+
+window = Gtk.Window()
+
+box = Gtk.VBox(False, 0)
+window.add(box)
+
+child = None
+def on_button_clicked(button, socket):
+ global child
+ child = Popen(['./lineedits', str(socket.get_id())])
+
+button = Gtk.Button("Press me to embed a Qt client")
+box.pack_start(button, False, False, 0)
+
+entry = Gtk.Entry()
+box.pack_start(entry, False, False, 0)
+
+socket = Gtk.Socket()
+socket.set_size_request(200, 200)
+box.add(socket)
+
+button.connect("clicked", on_button_clicked, socket)
+window.connect("destroy", Gtk.main_quit)
+
+def plugged_event(widget):
+ print("A window was embedded!")
+
+socket.connect("plug-added", plugged_event)
+
+window.show_all()
+Gtk.main()
+if child:
+ child.terminate()
diff --git a/tests/manual/xembed-widgets/main.cpp b/tests/manual/xembed-widgets/main.cpp
new file mode 100644
index 0000000000..fbd9773b61
--- /dev/null
+++ b/tests/manual/xembed-widgets/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QDebug>
+#include <QWindow>
+
+#include "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QStringList args = app.arguments();
+
+ WId winId = 0;
+ if (args.count() > 1) {
+ bool ok;
+ winId = args[1].toUInt(&ok);
+ Q_ASSERT(ok);
+ }
+
+ Window window;
+ window.show();
+
+ QWindow *foreign = QWindow::fromWinId(winId);
+ Q_ASSERT(foreign != 0);
+
+ window.windowHandle()->setParent(foreign);
+
+ return app.exec();
+}
diff --git a/tests/manual/xembed-widgets/window.cpp b/tests/manual/xembed-widgets/window.cpp
new file mode 100644
index 0000000000..92eccf50ba
--- /dev/null
+++ b/tests/manual/xembed-widgets/window.cpp
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+
+#include "window.h"
+
+Window::Window()
+{
+ QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
+
+ QLabel *echoLabel = new QLabel(tr("Mode:"));
+ QComboBox *echoComboBox = new QComboBox;
+ echoComboBox->addItem(tr("Normal"));
+ echoComboBox->addItem(tr("Password"));
+ echoComboBox->addItem(tr("PasswordEchoOnEdit"));
+ echoComboBox->addItem(tr("No Echo"));
+
+ echoLineEdit = new QLineEdit;
+ echoLineEdit->setFocus();
+
+ QGroupBox *validatorGroup = new QGroupBox(tr("Validator"));
+
+ QLabel *validatorLabel = new QLabel(tr("Type:"));
+ QComboBox *validatorComboBox = new QComboBox;
+ validatorComboBox->addItem(tr("No validator"));
+ validatorComboBox->addItem(tr("Integer validator"));
+ validatorComboBox->addItem(tr("Double validator"));
+
+ validatorLineEdit = new QLineEdit;
+
+ QGroupBox *alignmentGroup = new QGroupBox(tr("Alignment"));
+
+ QLabel *alignmentLabel = new QLabel(tr("Type:"));
+ QComboBox *alignmentComboBox = new QComboBox;
+ alignmentComboBox->addItem(tr("Left"));
+ alignmentComboBox->addItem(tr("Centered"));
+ alignmentComboBox->addItem(tr("Right"));
+
+ alignmentLineEdit = new QLineEdit;
+
+ QGroupBox *inputMaskGroup = new QGroupBox(tr("Input mask"));
+
+ QLabel *inputMaskLabel = new QLabel(tr("Type:"));
+ QComboBox *inputMaskComboBox = new QComboBox;
+ inputMaskComboBox->addItem(tr("No mask"));
+ inputMaskComboBox->addItem(tr("Phone number"));
+ inputMaskComboBox->addItem(tr("ISO date"));
+ inputMaskComboBox->addItem(tr("License key"));
+
+ inputMaskLineEdit = new QLineEdit;
+
+ QGroupBox *accessGroup = new QGroupBox(tr("Access"));
+
+ QLabel *accessLabel = new QLabel(tr("Read-only:"));
+ QComboBox *accessComboBox = new QComboBox;
+ accessComboBox->addItem(tr("False"));
+ accessComboBox->addItem(tr("True"));
+
+ accessLineEdit = new QLineEdit;
+
+ connect(echoComboBox, SIGNAL(activated(int)),
+ this, SLOT(echoChanged(int)));
+ connect(validatorComboBox, SIGNAL(activated(int)),
+ this, SLOT(validatorChanged(int)));
+ connect(alignmentComboBox, SIGNAL(activated(int)),
+ this, SLOT(alignmentChanged(int)));
+ connect(inputMaskComboBox, SIGNAL(activated(int)),
+ this, SLOT(inputMaskChanged(int)));
+ connect(accessComboBox, SIGNAL(activated(int)),
+ this, SLOT(accessChanged(int)));
+
+ QGridLayout *echoLayout = new QGridLayout;
+ echoLayout->addWidget(echoLabel, 0, 0);
+ echoLayout->addWidget(echoComboBox, 0, 1);
+ echoLayout->addWidget(echoLineEdit, 1, 0, 1, 2);
+ echoGroup->setLayout(echoLayout);
+
+ QGridLayout *validatorLayout = new QGridLayout;
+ validatorLayout->addWidget(validatorLabel, 0, 0);
+ validatorLayout->addWidget(validatorComboBox, 0, 1);
+ validatorLayout->addWidget(validatorLineEdit, 1, 0, 1, 2);
+ validatorGroup->setLayout(validatorLayout);
+
+ QGridLayout *alignmentLayout = new QGridLayout;
+ alignmentLayout->addWidget(alignmentLabel, 0, 0);
+ alignmentLayout->addWidget(alignmentComboBox, 0, 1);
+ alignmentLayout->addWidget(alignmentLineEdit, 1, 0, 1, 2);
+ alignmentGroup-> setLayout(alignmentLayout);
+
+ QGridLayout *inputMaskLayout = new QGridLayout;
+ inputMaskLayout->addWidget(inputMaskLabel, 0, 0);
+ inputMaskLayout->addWidget(inputMaskComboBox, 0, 1);
+ inputMaskLayout->addWidget(inputMaskLineEdit, 1, 0, 1, 2);
+ inputMaskGroup->setLayout(inputMaskLayout);
+
+ QGridLayout *accessLayout = new QGridLayout;
+ accessLayout->addWidget(accessLabel, 0, 0);
+ accessLayout->addWidget(accessComboBox, 0, 1);
+ accessLayout->addWidget(accessLineEdit, 1, 0, 1, 2);
+ accessGroup->setLayout(accessLayout);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(echoGroup, 0, 0);
+ layout->addWidget(validatorGroup, 1, 0);
+ layout->addWidget(alignmentGroup, 2, 0);
+ layout->addWidget(inputMaskGroup, 0, 1);
+ layout->addWidget(accessGroup, 1, 1);
+ setLayout(layout);
+
+ setWindowTitle(tr("Line Edits"));
+}
+
+void Window::echoChanged(int index)
+{
+ switch (index) {
+ case 0:
+ echoLineEdit->setEchoMode(QLineEdit::Normal);
+ break;
+ case 1:
+ echoLineEdit->setEchoMode(QLineEdit::Password);
+ break;
+ case 2:
+ echoLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ break;
+ case 3:
+ echoLineEdit->setEchoMode(QLineEdit::NoEcho);
+ }
+}
+
+void Window::validatorChanged(int index)
+{
+ switch (index) {
+ case 0:
+ validatorLineEdit->setValidator(0);
+ break;
+ case 1:
+ validatorLineEdit->setValidator(new QIntValidator(
+ validatorLineEdit));
+ break;
+ case 2:
+ validatorLineEdit->setValidator(new QDoubleValidator(-999.0,
+ 999.0, 2, validatorLineEdit));
+ }
+
+ validatorLineEdit->clear();
+}
+
+void Window::alignmentChanged(int index)
+{
+ switch (index) {
+ case 0:
+ alignmentLineEdit->setAlignment(Qt::AlignLeft);
+ break;
+ case 1:
+ alignmentLineEdit->setAlignment(Qt::AlignCenter);
+ break;
+ case 2:
+ alignmentLineEdit->setAlignment(Qt::AlignRight);
+ }
+}
+
+void Window::inputMaskChanged(int index)
+{
+ switch (index) {
+ case 0:
+ inputMaskLineEdit->setInputMask("");
+ break;
+ case 1:
+ inputMaskLineEdit->setInputMask("+99 99 99 99 99;_");
+ break;
+ case 2:
+ inputMaskLineEdit->setInputMask("0000-00-00");
+ inputMaskLineEdit->setText("00000000");
+ inputMaskLineEdit->setCursorPosition(0);
+ break;
+ case 3:
+ inputMaskLineEdit->setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#");
+ }
+}
+
+void Window::accessChanged(int index)
+{
+ switch (index) {
+ case 0:
+ accessLineEdit->setReadOnly(false);
+ break;
+ case 1:
+ accessLineEdit->setReadOnly(true);
+ }
+}
diff --git a/tests/manual/xembed-widgets/window.h b/tests/manual/xembed-widgets/window.h
new file mode 100644
index 0000000000..fbb9b82300
--- /dev/null
+++ b/tests/manual/xembed-widgets/window.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the 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 Digia Plc and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QLineEdit;
+QT_END_NAMESPACE
+
+class Window : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Window();
+
+public slots:
+ void echoChanged(int);
+ void validatorChanged(int);
+ void alignmentChanged(int);
+ void inputMaskChanged(int);
+ void accessChanged(int);
+
+private:
+ QLineEdit *echoLineEdit;
+ QLineEdit *validatorLineEdit;
+ QLineEdit *alignmentLineEdit;
+ QLineEdit *inputMaskLineEdit;
+ QLineEdit *accessLineEdit;
+};
+
+#endif
diff --git a/tests/manual/xembed-widgets/xembed-widgets.pro b/tests/manual/xembed-widgets/xembed-widgets.pro
new file mode 100644
index 0000000000..e406ee47fd
--- /dev/null
+++ b/tests/manual/xembed-widgets/xembed-widgets.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET= lineedits
+QT += widgets
+
+SOURCES += \
+ main.cpp \
+ window.cpp
+HEADERS += \
+ window.h