summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/corelib/serialization/convert/cborconverter.cpp4
-rw-r--r--examples/corelib/serialization/convert/datastreamconverter.cpp6
-rw-r--r--examples/corelib/serialization/convert/textconverter.cpp6
-rw-r--r--examples/corelib/serialization/convert/xmlconverter.cpp20
-rw-r--r--examples/gui/gui.pro2
-rw-r--r--examples/network/torrent/trackerclient.cpp2
-rw-r--r--examples/opengl/opengl.pro1
-rw-r--r--examples/opengl/openglwindow/main.cpp (renamed from examples/gui/openglwindow/main.cpp)0
-rw-r--r--examples/opengl/openglwindow/openglwindow.cpp (renamed from examples/gui/openglwindow/openglwindow.cpp)0
-rw-r--r--examples/opengl/openglwindow/openglwindow.h (renamed from examples/gui/openglwindow/openglwindow.h)0
-rw-r--r--examples/opengl/openglwindow/openglwindow.pri (renamed from examples/gui/openglwindow/openglwindow.pri)1
-rw-r--r--examples/opengl/openglwindow/openglwindow.pro (renamed from examples/gui/openglwindow/openglwindow.pro)2
-rw-r--r--examples/opengl/paintedwindow/paintedwindow.pro2
-rw-r--r--examples/sql/doc/src/drilldown.qdoc2
-rw-r--r--examples/widgets/animation/easing/window.cpp7
-rw-r--r--examples/widgets/animation/easing/window.h2
-rw-r--r--examples/widgets/doc/src/gallery.qdoc2
-rw-r--r--examples/widgets/graphicsview/chip/view.cpp4
-rw-r--r--examples/widgets/graphicsview/diagramscene/mainwindow.cpp17
-rw-r--r--examples/widgets/graphicsview/diagramscene/mainwindow.h4
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/window.cpp2
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp2
-rw-r--r--examples/widgets/painting/affine/xform.cpp4
-rw-r--r--examples/widgets/painting/deform/pathdeform.cpp2
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.cpp4
-rw-r--r--examples/widgets/painting/shared/arthurwidgets.cpp2
-rw-r--r--examples/widgets/tools/settingseditor/settingstree.cpp2
-rw-r--r--examples/widgets/tools/settingseditor/variantdelegate.cpp132
-rw-r--r--examples/widgets/tools/settingseditor/variantdelegate.h2
-rw-r--r--examples/widgets/windowcontainer/windowcontainer.cpp2
-rw-r--r--examples/widgets/windowcontainer/windowcontainer.pro2
31 files changed, 122 insertions, 118 deletions
diff --git a/examples/corelib/serialization/convert/cborconverter.cpp b/examples/corelib/serialization/convert/cborconverter.cpp
index 60410ed26a..77df367e50 100644
--- a/examples/corelib/serialization/convert/cborconverter.cpp
+++ b/examples/corelib/serialization/convert/cborconverter.cpp
@@ -134,7 +134,7 @@ static QVariant convertCborValue(const QCborValue &value)
enum TrimFloatingPoint { Double, Float, Float16 };
static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrimming)
{
- if (v.userType() == QVariant::List) {
+ if (v.userType() == QMetaType::QVariantList) {
const QVariantList list = v.toList();
QCborArray array;
for (const QVariant &v : list)
@@ -152,7 +152,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
return map;
}
- if (v.userType() == QVariant::Double && fpTrimming != Double) {
+ if (v.userType() == QMetaType::Double && fpTrimming != Double) {
float f = float(v.toDouble());
if (fpTrimming == Float16)
return float(qfloat16(f));
diff --git a/examples/corelib/serialization/convert/datastreamconverter.cpp b/examples/corelib/serialization/convert/datastreamconverter.cpp
index 7e9f5e1bdc..6f0ca41ff5 100644
--- a/examples/corelib/serialization/convert/datastreamconverter.cpp
+++ b/examples/corelib/serialization/convert/datastreamconverter.cpp
@@ -96,8 +96,8 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
QString indented = indent + QLatin1String(" ");
int type = v.userType();
- if (type == qMetaTypeId<VariantOrderedMap>() || type == QVariant::Map) {
- const auto map = (type == QVariant::Map) ?
+ if (type == qMetaTypeId<VariantOrderedMap>() || type == QMetaType::QVariantMap) {
+ const auto map = (type == QMetaType::QVariantMap) ?
VariantOrderedMap(v.toMap()) : qvariant_cast<VariantOrderedMap>(v);
result = QLatin1String("Map {");
@@ -109,7 +109,7 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
}
result.chop(1); // remove comma
result += indent + QLatin1String("},");
- } else if (type == QVariant::List) {
+ } else if (type == QMetaType::QVariantList) {
const QVariantList list = v.toList();
result = QLatin1String("List [");
diff --git a/examples/corelib/serialization/convert/textconverter.cpp b/examples/corelib/serialization/convert/textconverter.cpp
index 7aed08f96c..ae03b9a334 100644
--- a/examples/corelib/serialization/convert/textconverter.cpp
+++ b/examples/corelib/serialization/convert/textconverter.cpp
@@ -56,21 +56,21 @@
static void dumpVariant(QTextStream &out, const QVariant &v)
{
switch (v.userType()) {
- case QVariant::List: {
+ case QMetaType::QVariantList: {
const QVariantList list = v.toList();
for (const QVariant &item : list)
dumpVariant(out, item);
break;
}
- case QVariant::String: {
+ case QMetaType::QString: {
const QStringList list = v.toStringList();
for (const QString &s : list)
out << s << Qt::endl;
break;
}
- case QVariant::Map: {
+ case QMetaType::QVariantMap: {
const QVariantMap map = v.toMap();
for (auto it = map.begin(); it != map.end(); ++it) {
out << it.key() << " => ";
diff --git a/examples/corelib/serialization/convert/xmlconverter.cpp b/examples/corelib/serialization/convert/xmlconverter.cpp
index d9e724dfe1..42cb10100a 100644
--- a/examples/corelib/serialization/convert/xmlconverter.cpp
+++ b/examples/corelib/serialization/convert/xmlconverter.cpp
@@ -284,18 +284,18 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
ba.resize(n);
result = ba;
} else {
- int id = QVariant::Invalid;
+ int id = QMetaType::UnknownType;
if (type == QLatin1String("datetime"))
- id = QVariant::DateTime;
+ id = QMetaType::QDateTime;
else if (type == QLatin1String("url"))
- id = QVariant::Url;
+ id = QMetaType::QUrl;
else if (type == QLatin1String("uuid"))
- id = QVariant::Uuid;
+ id = QMetaType::QUuid;
else if (type == QLatin1String("regex"))
- id = QVariant::RegularExpression;
+ id = QMetaType::QRegularExpression;
else
id = QMetaType::type(type.toLatin1());
- if (id == QVariant::Invalid) {
+ if (id == QMetaType::UnknownType) {
fprintf(stderr, "%lld:%lld: Invalid XML: unknown type '%s'.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString()));
exit(EXIT_FAILURE);
@@ -327,14 +327,14 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
{
int type = v.userType();
- if (type == QVariant::List) {
+ if (type == QMetaType::QVariantList) {
QVariantList list = v.toList();
xml.writeStartElement("list");
for (const QVariant &v : list)
variantToXml(xml, v);
xml.writeEndElement();
- } else if (type == QVariant::Map || type == qMetaTypeId<VariantOrderedMap>()) {
- const VariantOrderedMap map = (type == QVariant::Map) ?
+ } else if (type == QMetaType::QVariantMap || type == qMetaTypeId<VariantOrderedMap>()) {
+ const VariantOrderedMap map = (type == QMetaType::QVariantMap) ?
VariantOrderedMap(v.toMap()) :
qvariant_cast<VariantOrderedMap>(v);
@@ -433,7 +433,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
// does this convert to string?
const char *typeName = v.typeName();
QVariant copy = v;
- if (copy.convert(QVariant::String)) {
+ if (copy.convert(QMetaType::QString)) {
xml.writeAttribute(typeString, QString::fromLatin1(typeName));
xml.writeCharacters(copy.toString());
} else {
diff --git a/examples/gui/gui.pro b/examples/gui/gui.pro
index b8080c2075..275adc804d 100644
--- a/examples/gui/gui.pro
+++ b/examples/gui/gui.pro
@@ -6,5 +6,3 @@ CONFIG += no_docs_target
SUBDIRS += analogclock
SUBDIRS += rasterwindow
-qtHaveModule(gui):qtConfig(opengl): \
- SUBDIRS += openglwindow
diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp
index 540ab31557..a50a49fd64 100644
--- a/examples/network/torrent/trackerclient.cpp
+++ b/examples/network/torrent/trackerclient.cpp
@@ -209,7 +209,7 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
// store it
peers.clear();
QVariant peerEntry = dict.value("peers");
- if (peerEntry.type() == QVariant::List) {
+ if (peerEntry.userType() == QMetaType::QVariantList) {
QList<QVariant> peerTmp = peerEntry.toList();
for (int i = 0; i < peerTmp.size(); ++i) {
TorrentPeer tmp;
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index 89b3e1d86e..74c39a1e27 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -2,6 +2,7 @@ TEMPLATE = subdirs
SUBDIRS = hellowindow \
paintedwindow \
+ openglwindow \
qopenglwindow
qtHaveModule(widgets) {
diff --git a/examples/gui/openglwindow/main.cpp b/examples/opengl/openglwindow/main.cpp
index 03a6ece06f..03a6ece06f 100644
--- a/examples/gui/openglwindow/main.cpp
+++ b/examples/opengl/openglwindow/main.cpp
diff --git a/examples/gui/openglwindow/openglwindow.cpp b/examples/opengl/openglwindow/openglwindow.cpp
index bac887dca0..bac887dca0 100644
--- a/examples/gui/openglwindow/openglwindow.cpp
+++ b/examples/opengl/openglwindow/openglwindow.cpp
diff --git a/examples/gui/openglwindow/openglwindow.h b/examples/opengl/openglwindow/openglwindow.h
index 8db943ddde..8db943ddde 100644
--- a/examples/gui/openglwindow/openglwindow.h
+++ b/examples/opengl/openglwindow/openglwindow.h
diff --git a/examples/gui/openglwindow/openglwindow.pri b/examples/opengl/openglwindow/openglwindow.pri
index 45b0b0cd29..30320df3b7 100644
--- a/examples/gui/openglwindow/openglwindow.pri
+++ b/examples/opengl/openglwindow/openglwindow.pri
@@ -1,3 +1,4 @@
+QT += opengl
INCLUDEPATH += $$PWD
SOURCES += $$PWD/openglwindow.cpp
HEADERS += $$PWD/openglwindow.h
diff --git a/examples/gui/openglwindow/openglwindow.pro b/examples/opengl/openglwindow/openglwindow.pro
index 93f18f3d3f..8b1ae71c14 100644
--- a/examples/gui/openglwindow/openglwindow.pro
+++ b/examples/opengl/openglwindow/openglwindow.pro
@@ -3,5 +3,5 @@ include(openglwindow.pri)
SOURCES += \
main.cpp
-target.path = $$[QT_INSTALL_EXAMPLES]/gui/openglwindow
+target.path = $$[QT_INSTALL_EXAMPLES]/opengl/openglwindow
INSTALLS += target
diff --git a/examples/opengl/paintedwindow/paintedwindow.pro b/examples/opengl/paintedwindow/paintedwindow.pro
index 1846aa4049..569eebe674 100644
--- a/examples/opengl/paintedwindow/paintedwindow.pro
+++ b/examples/opengl/paintedwindow/paintedwindow.pro
@@ -1,3 +1,5 @@
+QT += opengl
+
HEADERS += paintedwindow.h
SOURCES += paintedwindow.cpp main.cpp
diff --git a/examples/sql/doc/src/drilldown.qdoc b/examples/sql/doc/src/drilldown.qdoc
index 7a8aa2037a..8beb515a83 100644
--- a/examples/sql/doc/src/drilldown.qdoc
+++ b/examples/sql/doc/src/drilldown.qdoc
@@ -425,7 +425,7 @@
The \c findWindow() function simply searches through the list of
existing windows, returning a pointer to the window that matches
- the given item ID, or 0 if the window doesn't exists.
+ the given item ID, or \nullptr if the window doesn't exists.
Finally, let's take a quick look at our custom \c ImageItem class:
diff --git a/examples/widgets/animation/easing/window.cpp b/examples/widgets/animation/easing/window.cpp
index d1d6348361..378af07535 100644
--- a/examples/widgets/animation/easing/window.cpp
+++ b/examples/widgets/animation/easing/window.cpp
@@ -67,7 +67,7 @@ Window::Window(QWidget *parent)
connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged,
this, &Window::curveChanged);
- connect(m_ui.buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ connect(m_ui.buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &Window::pathChanged);
connect(m_ui.periodSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &Window::periodChanged);
@@ -180,9 +180,10 @@ void Window::curveChanged(int row)
m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack);
}
-void Window::pathChanged(int index)
+void Window::pathChanged(QAbstractButton *button)
{
- m_anim->setPathType((Animation::PathType)index);
+ const int index = m_ui.buttonGroup->id(button);
+ m_anim->setPathType(Animation::PathType(index));
}
void Window::periodChanged(double value)
diff --git a/examples/widgets/animation/easing/window.h b/examples/widgets/animation/easing/window.h
index 541377a981..0c49dd6e8a 100644
--- a/examples/widgets/animation/easing/window.h
+++ b/examples/widgets/animation/easing/window.h
@@ -69,7 +69,7 @@ public:
Window(QWidget *parent = nullptr);
private slots:
void curveChanged(int row);
- void pathChanged(int index);
+ void pathChanged(QAbstractButton *button);
void periodChanged(double);
void amplitudeChanged(double);
void overshootChanged(double);
diff --git a/examples/widgets/doc/src/gallery.qdoc b/examples/widgets/doc/src/gallery.qdoc
index a262374ce6..455099ddce 100644
--- a/examples/widgets/doc/src/gallery.qdoc
+++ b/examples/widgets/doc/src/gallery.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example widgets/gallery
+ \example gallery
\title Widgets Gallery Example
\ingroup examples-widgets
\brief The Widgets Gallery example shows widgets relevant for designing UIs.
diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp
index 77a6310778..f24cb738a3 100644
--- a/examples/widgets/graphicsview/chip/view.cpp
+++ b/examples/widgets/graphicsview/chip/view.cpp
@@ -220,11 +220,11 @@ void View::setupMatrix()
{
qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50));
- QMatrix matrix;
+ QTransform matrix;
matrix.scale(scale, scale);
matrix.rotate(rotateSlider->value());
- graphicsView->setMatrix(matrix);
+ graphicsView->setTransform(matrix);
setResetButtonEnabled();
}
diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
index 3327d4d5df..58b959dd10 100644
--- a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
+++ b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
@@ -113,13 +113,14 @@ void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button)
//! [1]
//! [2]
-void MainWindow::buttonGroupClicked(int id)
+void MainWindow::buttonGroupClicked(QAbstractButton *button)
{
const QList<QAbstractButton *> buttons = buttonGroup->buttons();
- for (QAbstractButton *button : buttons) {
- if (buttonGroup->button(id) != button)
+ for (QAbstractButton *myButton : buttons) {
+ if (myButton != button)
button->setChecked(false);
}
+ const int id = buttonGroup->id(button);
if (id == InsertTextButton) {
scene->setMode(DiagramScene::InsertText);
} else {
@@ -154,7 +155,7 @@ void MainWindow::deleteItem()
//! [3]
//! [4]
-void MainWindow::pointerGroupClicked(int)
+void MainWindow::pointerGroupClicked()
{
scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
}
@@ -231,8 +232,8 @@ void MainWindow::fontSizeChanged(const QString &)
void MainWindow::sceneScaleChanged(const QString &scale)
{
double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0;
- QMatrix oldMatrix = view->matrix();
- view->resetMatrix();
+ QTransform oldMatrix = view->transform();
+ view->resetTransform();
view->translate(oldMatrix.dx(), oldMatrix.dy());
view->scale(newScale, newScale);
}
@@ -334,7 +335,7 @@ void MainWindow::createToolBox()
{
buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(false);
- connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ connect(buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &MainWindow::buttonGroupClicked);
QGridLayout *layout = new QGridLayout;
layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0);
@@ -528,7 +529,7 @@ void MainWindow::createToolbars()
pointerTypeGroup = new QButtonGroup(this);
pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine));
- connect(pointerTypeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+ connect(pointerTypeGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
this, &MainWindow::pointerGroupClicked);
sceneScaleCombo = new QComboBox;
diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.h b/examples/widgets/graphicsview/diagramscene/mainwindow.h
index e04224fbc7..9fcd1884ca 100644
--- a/examples/widgets/graphicsview/diagramscene/mainwindow.h
+++ b/examples/widgets/graphicsview/diagramscene/mainwindow.h
@@ -82,9 +82,9 @@ public:
private slots:
void backgroundButtonGroupClicked(QAbstractButton *button);
- void buttonGroupClicked(int id);
+ void buttonGroupClicked(QAbstractButton *button);
void deleteItem();
- void pointerGroupClicked(int id);
+ void pointerGroupClicked();
void bringToFront();
void sendToBack();
void itemInserted(DiagramItem *item);
diff --git a/examples/widgets/itemviews/coloreditorfactory/window.cpp b/examples/widgets/itemviews/coloreditorfactory/window.cpp
index e4a9379d8f..25e196a80c 100644
--- a/examples/widgets/itemviews/coloreditorfactory/window.cpp
+++ b/examples/widgets/itemviews/coloreditorfactory/window.cpp
@@ -61,7 +61,7 @@ Window::Window()
QItemEditorCreatorBase *colorListCreator =
new QStandardItemEditorCreator<ColorListEditor>();
- factory->registerEditor(QVariant::Color, colorListCreator);
+ factory->registerEditor(QMetaType::QColor, colorListCreator);
QItemEditorFactory::setDefaultFactory(factory);
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
index 4753d04d9b..b0b4017e62 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
@@ -98,7 +98,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
//! [4]
//! [6]
- if (leftData.type() == QVariant::DateTime) {
+ if (leftData.userType() == QMetaType::QDateTime) {
return leftData.toDateTime() < rightData.toDateTime();
} else {
static const QRegularExpression emailPattern("[\\w\\.]*@[\\w\\.]*");
diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp
index 50acf0f814..4e7cb91ce1 100644
--- a/examples/widgets/painting/affine/xform.cpp
+++ b/examples/widgets/painting/affine/xform.cpp
@@ -223,7 +223,7 @@ void XFormView::setRotation(qreal r)
m_rotation = r;
QPointF center(pts->points().at(0));
- QMatrix m;
+ QTransform m;
m.translate(center.x(), center.y());
m.rotate(m_rotation - old_rot);
m.translate(-center.x(), -center.y());
@@ -236,7 +236,7 @@ void XFormView::timerEvent(QTimerEvent *e)
{
if (e->timerId() == timer.timerId()) {
QPointF center(pts->points().at(0));
- QMatrix m;
+ QTransform m;
m.translate(center.x(), center.y());
m.rotate(0.2);
m.translate(-center.x(), -center.y());
diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp
index d5c8746247..961d5e5e99 100644
--- a/examples/widgets/painting/deform/pathdeform.cpp
+++ b/examples/widgets/painting/deform/pathdeform.cpp
@@ -374,7 +374,7 @@ void PathDeformRenderer::setText(const QString &text)
}
for (int i=0; i<m_paths.size(); ++i)
- m_paths[i] = m_paths[i] * QMatrix(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y());
+ m_paths[i] = m_paths[i] * QTransform(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y());
update();
}
diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp
index a850ce2672..7dab6f95a2 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.cpp
+++ b/examples/widgets/painting/pathstroke/pathstroke.cpp
@@ -511,10 +511,10 @@ void PathStrokeRenderer::initializePoints()
m_points.clear();
m_vectors.clear();
- QMatrix m;
+ QTransform m;
qreal rot = 360.0 / count;
QPointF center(width() / 2, height() / 2);
- QMatrix vm;
+ QTransform vm;
vm.shear(2, -1);
vm.scale(3, 3);
diff --git a/examples/widgets/painting/shared/arthurwidgets.cpp b/examples/widgets/painting/shared/arthurwidgets.cpp
index c7c851270b..e24130e464 100644
--- a/examples/widgets/painting/shared/arthurwidgets.cpp
+++ b/examples/widgets/painting/shared/arthurwidgets.cpp
@@ -62,8 +62,8 @@
#include <QRegularExpression>
#include <QOffscreenSurface>
#include <QOpenGLContext>
-#include <QOpenGLPaintDevice>
#if QT_CONFIG(opengl)
+#include <QtOpenGL/QOpenGLPaintDevice>
#include <QtOpenGL/QOpenGLWindow>
#endif
diff --git a/examples/widgets/tools/settingseditor/settingstree.cpp b/examples/widgets/tools/settingseditor/settingstree.cpp
index 49d299bf72..9132368e4a 100644
--- a/examples/widgets/tools/settingseditor/settingstree.cpp
+++ b/examples/widgets/tools/settingseditor/settingstree.cpp
@@ -208,7 +208,7 @@ void SettingsTree::updateChildItems(QTreeWidgetItem *parent)
}
QVariant value = settings->value(key);
- if (value.type() == QVariant::Invalid) {
+ if (value.userType() == QMetaType::UnknownType) {
child->setText(1, "Invalid");
} else {
child->setText(1, value.typeName());
diff --git a/examples/widgets/tools/settingseditor/variantdelegate.cpp b/examples/widgets/tools/settingseditor/variantdelegate.cpp
index 9772fe8a41..eb822f0dc2 100644
--- a/examples/widgets/tools/settingseditor/variantdelegate.cpp
+++ b/examples/widgets/tools/settingseditor/variantdelegate.cpp
@@ -81,7 +81,7 @@ void VariantDelegate::paint(QPainter *painter,
{
if (index.column() == 2) {
QVariant value = index.model()->data(index, Qt::UserRole);
- if (!isSupportedType(value.type())) {
+ if (!isSupportedType(value.userType())) {
QStyleOptionViewItem myOption = option;
myOption.state &= ~QStyle::State_Enabled;
QStyledItemDelegate::paint(painter, myOption, index);
@@ -100,7 +100,7 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
return nullptr;
QVariant originalValue = index.model()->data(index, Qt::UserRole);
- if (!isSupportedType(originalValue.type()))
+ if (!isSupportedType(originalValue.userType()))
return nullptr;
QLineEdit *lineEdit = new QLineEdit(parent);
@@ -108,46 +108,46 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
QRegularExpression regExp;
- switch (originalValue.type()) {
- case QVariant::Bool:
+ switch (originalValue.userType()) {
+ case QMetaType::Bool:
regExp = boolExp;
break;
- case QVariant::ByteArray:
+ case QMetaType::QByteArray:
regExp = byteArrayExp;
break;
- case QVariant::Char:
+ case QMetaType::QChar:
regExp = charExp;
break;
- case QVariant::Color:
+ case QMetaType::QColor:
regExp = colorExp;
break;
- case QVariant::Date:
+ case QMetaType::QDate:
regExp = dateExp;
break;
- case QVariant::DateTime:
+ case QMetaType::QDateTime:
regExp = dateTimeExp;
break;
- case QVariant::Double:
+ case QMetaType::Double:
regExp = doubleExp;
break;
- case QVariant::Int:
- case QVariant::LongLong:
+ case QMetaType::Int:
+ case QMetaType::LongLong:
regExp = signedIntegerExp;
break;
- case QVariant::Point:
+ case QMetaType::QPoint:
regExp = pointExp;
break;
- case QVariant::Rect:
+ case QMetaType::QRect:
regExp = rectExp;
break;
- case QVariant::Size:
+ case QMetaType::QSize:
regExp = sizeExp;
break;
- case QVariant::Time:
+ case QMetaType::QTime:
regExp = timeExp;
break;
- case QVariant::UInt:
- case QVariant::ULongLong:
+ case QMetaType::UInt:
+ case QMetaType::ULongLong:
regExp = unsignedIntegerExp;
break;
default:
@@ -189,18 +189,18 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
QVariant value;
QRegularExpressionMatch match;
- switch (originalValue.type()) {
- case QVariant::Char:
+ switch (originalValue.userType()) {
+ case QMetaType::QChar:
value = text.at(0);
break;
- case QVariant::Color:
+ case QMetaType::QColor:
match = colorExp.match(text);
value = QColor(qMin(match.captured(1).toInt(), 255),
qMin(match.captured(2).toInt(), 255),
qMin(match.captured(3).toInt(), 255),
qMin(match.captured(4).toInt(), 255));
break;
- case QVariant::Date:
+ case QMetaType::QDate:
{
QDate date = QDate::fromString(text, Qt::ISODate);
if (!date.isValid())
@@ -208,7 +208,7 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
value = date;
}
break;
- case QVariant::DateTime:
+ case QMetaType::QDateTime:
{
QDateTime dateTime = QDateTime::fromString(text, Qt::ISODate);
if (!dateTime.isValid())
@@ -216,23 +216,23 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
value = dateTime;
}
break;
- case QVariant::Point:
+ case QMetaType::QPoint:
match = pointExp.match(text);
value = QPoint(match.captured(1).toInt(), match.captured(2).toInt());
break;
- case QVariant::Rect:
+ case QMetaType::QRect:
match = rectExp.match(text);
value = QRect(match.captured(1).toInt(), match.captured(2).toInt(),
match.captured(3).toInt(), match.captured(4).toInt());
break;
- case QVariant::Size:
+ case QMetaType::QSize:
match = sizeExp.match(text);
value = QSize(match.captured(1).toInt(), match.captured(2).toInt());
break;
- case QVariant::StringList:
+ case QMetaType::QStringList:
value = text.split(',');
break;
- case QVariant::Time:
+ case QMetaType::QTime:
{
QTime time = QTime::fromString(text, Qt::ISODate);
if (!time.isValid())
@@ -242,33 +242,33 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
break;
default:
value = text;
- value.convert(originalValue.type());
+ value.convert(originalValue.userType());
}
model->setData(index, displayText(value), Qt::DisplayRole);
model->setData(index, value, Qt::UserRole);
}
-bool VariantDelegate::isSupportedType(QVariant::Type type)
+bool VariantDelegate::isSupportedType(int type)
{
switch (type) {
- case QVariant::Bool:
- case QVariant::ByteArray:
- case QVariant::Char:
- case QVariant::Color:
- case QVariant::Date:
- case QVariant::DateTime:
- case QVariant::Double:
- case QVariant::Int:
- case QVariant::LongLong:
- case QVariant::Point:
- case QVariant::Rect:
- case QVariant::Size:
- case QVariant::String:
- case QVariant::StringList:
- case QVariant::Time:
- case QVariant::UInt:
- case QVariant::ULongLong:
+ case QMetaType::Bool:
+ case QMetaType::QByteArray:
+ case QMetaType::QChar:
+ case QMetaType::QColor:
+ case QMetaType::QDate:
+ case QMetaType::QDateTime:
+ case QMetaType::Double:
+ case QMetaType::Int:
+ case QMetaType::LongLong:
+ case QMetaType::QPoint:
+ case QMetaType::QRect:
+ case QMetaType::QSize:
+ case QMetaType::QString:
+ case QMetaType::QStringList:
+ case QMetaType::QTime:
+ case QMetaType::UInt:
+ case QMetaType::ULongLong:
return true;
default:
return false;
@@ -277,50 +277,50 @@ bool VariantDelegate::isSupportedType(QVariant::Type type)
QString VariantDelegate::displayText(const QVariant &value)
{
- switch (value.type()) {
- case QVariant::Bool:
- case QVariant::ByteArray:
- case QVariant::Char:
- case QVariant::Double:
- case QVariant::Int:
- case QVariant::LongLong:
- case QVariant::String:
- case QVariant::UInt:
- case QVariant::ULongLong:
+ switch (value.userType()) {
+ case QMetaType::Bool:
+ case QMetaType::QByteArray:
+ case QMetaType::QChar:
+ case QMetaType::Double:
+ case QMetaType::Int:
+ case QMetaType::LongLong:
+ case QMetaType::QString:
+ case QMetaType::UInt:
+ case QMetaType::ULongLong:
return value.toString();
- case QVariant::Color:
+ case QMetaType::QColor:
{
QColor color = qvariant_cast<QColor>(value);
return QString("(%1,%2,%3,%4)")
.arg(color.red()).arg(color.green())
.arg(color.blue()).arg(color.alpha());
}
- case QVariant::Date:
+ case QMetaType::QDate:
return value.toDate().toString(Qt::ISODate);
- case QVariant::DateTime:
+ case QMetaType::QDateTime:
return value.toDateTime().toString(Qt::ISODate);
- case QVariant::Invalid:
+ case QMetaType::UnknownType:
return "<Invalid>";
- case QVariant::Point:
+ case QMetaType::QPoint:
{
QPoint point = value.toPoint();
return QString("(%1,%2)").arg(point.x()).arg(point.y());
}
- case QVariant::Rect:
+ case QMetaType::QRect:
{
QRect rect = value.toRect();
return QString("(%1,%2,%3,%4)")
.arg(rect.x()).arg(rect.y())
.arg(rect.width()).arg(rect.height());
}
- case QVariant::Size:
+ case QMetaType::QSize:
{
QSize size = value.toSize();
return QString("(%1,%2)").arg(size.width()).arg(size.height());
}
- case QVariant::StringList:
+ case QMetaType::QStringList:
return value.toStringList().join(',');
- case QVariant::Time:
+ case QMetaType::QTime:
return value.toTime().toString(Qt::ISODate);
default:
break;
diff --git a/examples/widgets/tools/settingseditor/variantdelegate.h b/examples/widgets/tools/settingseditor/variantdelegate.h
index 68f21fa3f6..96e44fd181 100644
--- a/examples/widgets/tools/settingseditor/variantdelegate.h
+++ b/examples/widgets/tools/settingseditor/variantdelegate.h
@@ -69,7 +69,7 @@ public:
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
- static bool isSupportedType(QVariant::Type type);
+ static bool isSupportedType(int type);
static QString displayText(const QVariant &value);
private:
diff --git a/examples/widgets/windowcontainer/windowcontainer.cpp b/examples/widgets/windowcontainer/windowcontainer.cpp
index b920c85420..f7c146e2a9 100644
--- a/examples/widgets/windowcontainer/windowcontainer.cpp
+++ b/examples/widgets/windowcontainer/windowcontainer.cpp
@@ -60,7 +60,7 @@
#include <QWidget>
-// Making use of the class from the opengl example in gui.
+// Making use of the class from the openglwindow example
class Window : public OpenGLWindow
{
Q_OBJECT
diff --git a/examples/widgets/windowcontainer/windowcontainer.pro b/examples/widgets/windowcontainer/windowcontainer.pro
index 9ac7e4a5ab..664ac938a2 100644
--- a/examples/widgets/windowcontainer/windowcontainer.pro
+++ b/examples/widgets/windowcontainer/windowcontainer.pro
@@ -6,4 +6,4 @@ QT += widgets
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/windowcontainer
INSTALLS += target
-include(../../gui/openglwindow/openglwindow.pri)
+include(../../opengl/openglwindow/openglwindow.pri)