summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/browser/browserapplication.cpp4
-rw-r--r--demos/browser/cookiejar.cpp2
-rw-r--r--demos/browser/settings.cpp4
-rw-r--r--demos/embeddeddialogs/customproxy.cpp2
-rw-r--r--demos/interview/model.cpp2
-rw-r--r--demos/spectrum/app/settingsdialog.cpp8
-rw-r--r--demos/spreadsheet/spreadsheetitem.cpp6
-rw-r--r--dist/changes-4.6.02
-rw-r--r--doc/src/examples/customtype.qdoc2
-rw-r--r--doc/src/snippets/accessibilityslidersnippet.cpp2
-rw-r--r--doc/src/snippets/code/doc_src_qtscript.qdoc2
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qvariant.cpp2
-rw-r--r--doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp2
-rw-r--r--doc/src/xml-processing/xml-patterns.qdoc2
-rw-r--r--examples/draganddrop/puzzle/pieceslist.cpp2
-rw-r--r--examples/graphicsview/diagramscene/mainwindow.cpp12
-rw-r--r--examples/graphicsview/dragdroprobot/robot.cpp4
-rw-r--r--examples/graphicsview/padnavigator/padnavigator.cpp14
-rw-r--r--examples/itemviews/coloreditorfactory/colorlisteditor.cpp2
-rw-r--r--examples/itemviews/puzzle/piecesmodel.cpp2
-rw-r--r--examples/itemviews/stardelegate/main.cpp2
-rw-r--r--examples/itemviews/stardelegate/stardelegate.cpp18
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp2
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp2
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp2
-rw-r--r--examples/network/torrent/bencodeparser.cpp4
-rw-r--r--examples/network/torrent/metainfo.cpp4
-rw-r--r--examples/network/torrent/trackerclient.cpp2
-rw-r--r--examples/richtext/textobject/svgtextobject.cpp4
-rw-r--r--examples/script/context2d/context2d.cpp4
-rw-r--r--examples/script/context2d/domimage.cpp2
-rw-r--r--examples/script/customclass/bytearrayclass.cpp4
-rw-r--r--examples/sql/querymodel/customsqlmodel.cpp2
-rw-r--r--examples/tools/customtype/main.cpp2
-rw-r--r--examples/widgets/validators/localeselector.cpp4
-rw-r--r--src/3rdparty/phonon/phonon/mediacontroller.cpp4
-rw-r--r--src/3rdparty/phonon/phonon/qsettingsgroup_p.h4
-rw-r--r--src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp12
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp28
-rw-r--r--src/activeqt/container/qaxbase.cpp12
-rw-r--r--src/activeqt/control/qaxserverbase.cpp8
-rw-r--r--src/activeqt/shared/qaxtypes.cpp28
-rw-r--r--src/dbus/qdbusabstractinterface.cpp2
-rw-r--r--src/dbus/qdbusdemarshaller.cpp18
-rw-r--r--src/dbus/qdbusintegrator.cpp4
-rw-r--r--src/dbus/qdbusinternalfilters.cpp6
-rw-r--r--src/declarative/debugger/qdeclarativedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp30
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp8
-rw-r--r--src/declarative/qml/qdeclarativestringconverters.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp2
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp8
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp8
-rw-r--r--src/gui/accessible/qaccessiblewidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp42
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp8
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qmnghandler.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemdelegate.cpp4
-rw-r--r--src/gui/itemviews/qheaderview.cpp8
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp4
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/gui/kernel/qclipboard.cpp2
-rw-r--r--src/gui/kernel/qtooltip.cpp2
-rw-r--r--src/gui/painting/qpaintbuffer.cpp44
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp6
-rw-r--r--src/gui/text/qcssparser.cpp36
-rw-r--r--src/gui/text/qtextcontrol.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp6
-rw-r--r--src/gui/widgets/qcombobox.cpp4
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp26
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp2
-rw-r--r--src/network/access/qnetworkrequest.cpp4
-rw-r--r--src/plugins/accessible/widgets/qaccessiblewidgets.cpp2
-rw-r--r--src/plugins/accessible/widgets/rangecontrols.cpp4
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp2
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp12
-rw-r--r--src/script/api/qscriptengine.cpp2
-rw-r--r--src/script/bridge/qscriptclassobject.cpp6
-rw-r--r--src/script/bridge/qscriptqobject.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommand.cpp6
-rw-r--r--src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp8
-rw-r--r--src/scripttools/debugging/qscriptdebuggerevent.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerresponse.cpp16
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp6
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp14
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp4
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp4
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp4
-rw-r--r--src/testlib/qtest.h2
-rw-r--r--src/tools/uic3/converter.cpp2
-rw-r--r--src/tools/uic3/domtool.cpp14
-rw-r--r--src/tools/uic3/domtool.h2
-rw-r--r--src/xmlpatterns/api/quriloader.cpp2
-rw-r--r--src/xmlpatterns/api/qvariableloader.cpp14
-rw-r--r--src/xmlpatterns/api/qxmlquery.cpp6
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp2
-rw-r--r--tools/activeqt/testcon/changeproperties.cpp6
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp2
-rw-r--r--tools/assistant/tools/assistant/helpenginewrapper.cpp4
-rw-r--r--tools/designer/src/components/formeditor/dpi_chooser.cpp4
-rw-r--r--tools/designer/src/components/formeditor/formwindow.cpp10
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp94
-rw-r--r--tools/designer/src/components/objectinspector/objectinspectormodel.cpp2
-rw-r--r--tools/designer/src/components/propertyeditor/brushpropertymanager.cpp2
-rw-r--r--tools/designer/src/components/propertyeditor/designerpropertymanager.cpp112
-rw-r--r--tools/designer/src/components/propertyeditor/fontpropertymanager.cpp12
-rw-r--r--tools/designer/src/components/propertyeditor/paletteeditor.cpp14
-rw-r--r--tools/designer/src/components/propertyeditor/propertyeditor.cpp8
-rw-r--r--tools/designer/src/components/signalsloteditor/connectdialog.cpp4
-rw-r--r--tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp2
-rw-r--r--tools/designer/src/components/tabordereditor/tabordereditor.cpp2
-rw-r--r--tools/designer/src/components/taskmenu/button_taskmenu.cpp2
-rw-r--r--tools/designer/src/components/taskmenu/inplace_editor.cpp6
-rw-r--r--tools/designer/src/components/taskmenu/itemlisteditor.cpp40
-rw-r--r--tools/designer/src/components/taskmenu/tablewidgeteditor.cpp12
-rw-r--r--tools/designer/src/components/taskmenu/treewidgeteditor.cpp14
-rw-r--r--tools/designer/src/designer/qdesigner_settings.cpp2
-rw-r--r--tools/designer/src/lib/shared/actioneditor.cpp14
-rw-r--r--tools/designer/src/lib/shared/actionrepository.cpp2
-rw-r--r--tools/designer/src/lib/shared/formlayoutmenu.cpp6
-rw-r--r--tools/designer/src/lib/shared/formwindowbase.cpp4
-rw-r--r--tools/designer/src/lib/shared/grid.cpp2
-rw-r--r--tools/designer/src/lib/shared/morphmenu.cpp4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_command.cpp78
-rw-r--r--tools/designer/src/lib/shared/qdesigner_formbuilder.cpp4
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menu.cpp2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertycommand.cpp28
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertysheet.cpp94
-rw-r--r--tools/designer/src/lib/shared/qdesigner_tabwidget.cpp32
-rw-r--r--tools/designer/src/lib/shared/qdesigner_taskmenu.cpp10
-rw-r--r--tools/designer/src/lib/shared/qdesigner_toolbar.cpp6
-rw-r--r--tools/designer/src/lib/shared/qdesigner_toolbox.cpp24
-rw-r--r--tools/designer/src/lib/shared/qdesigner_utils.cpp16
-rw-r--r--tools/designer/src/lib/shared/qdesigner_utils_p.h8
-rw-r--r--tools/designer/src/lib/shared/stylesheeteditor.cpp4
-rw-r--r--tools/designer/src/lib/uilib/abstractformbuilder.cpp34
-rw-r--r--tools/designer/src/lib/uilib/properties.cpp20
-rw-r--r--tools/designer/src/lib/uilib/resourcebuilder.cpp6
-rw-r--r--tools/designer/src/uitools/quiloader.cpp28
-rw-r--r--tools/linguist/linguist/formpreviewview.cpp14
-rw-r--r--tools/linguist/linguist/mainwindow.cpp2
-rw-r--r--tools/linguist/linguist/messagemodel.cpp12
-rw-r--r--tools/makeqpf/mainwindow.cpp4
-rw-r--r--tools/qdbus/qdbus/qdbus.cpp8
-rw-r--r--tools/qdbus/qdbusviewer/qdbusviewer.cpp4
-rw-r--r--tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp8
-rw-r--r--tools/shared/qtpropertybrowser/qtvariantproperty.cpp94
-rw-r--r--tools/xmlpatterns/main.cpp14
151 files changed, 807 insertions, 807 deletions
diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp
index ed95d32..633307c 100644
--- a/demos/browser/browserapplication.cpp
+++ b/demos/browser/browserapplication.cpp
@@ -231,14 +231,14 @@ void BrowserApplication::loadSettings()
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
QFont standardFont = QFont(standardFontFamily, standardFontSize);
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
+ standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
+ fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());
diff --git a/demos/browser/cookiejar.cpp b/demos/browser/cookiejar.cpp
index 835b61b..d318e3a 100644
--- a/demos/browser/cookiejar.cpp
+++ b/demos/browser/cookiejar.cpp
@@ -186,7 +186,7 @@ void CookieJar::save()
if (cookies.at(i).isSessionCookie())
cookies.removeAt(i);
}
- cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QList<QNetworkCookie> >(cookies));
+ cookieSettings.setValue(QLatin1String("cookies"), QVariant::fromValue<QList<QNetworkCookie> >(cookies));
cookieSettings.beginGroup(QLatin1String("Exceptions"));
cookieSettings.setValue(QLatin1String("block"), m_exceptions_block);
cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow);
diff --git a/demos/browser/settings.cpp b/demos/browser/settings.cpp
index 5ceca67..d83e6a4 100644
--- a/demos/browser/settings.cpp
+++ b/demos/browser/settings.cpp
@@ -121,8 +121,8 @@ void SettingsDialog::loadFromSettings()
// Appearance
settings.beginGroup(QLatin1String("websettings"));
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
+ fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
+ standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp
index bd56f5a..a715f5e 100644
--- a/demos/embeddeddialogs/customproxy.cpp
+++ b/demos/embeddeddialogs/customproxy.cpp
@@ -113,7 +113,7 @@ QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &valu
{
if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
if (change == ItemChildAddedChange) {
- currentPopup = qVariantValue<QGraphicsItem *>(value);
+ currentPopup = qvariant_cast<QGraphicsItem *>(value);
currentPopup->setCacheMode(ItemCoordinateCache);
if (scene())
currentPopup->installSceneEventFilter(this);
diff --git a/demos/interview/model.cpp b/demos/interview/model.cpp
index 840bc60..88f200d 100644
--- a/demos/interview/model.cpp
+++ b/demos/interview/model.cpp
@@ -109,7 +109,7 @@ QVariant Model::headerData(int section, Qt::Orientation orientation, int role) c
if (role == Qt::DisplayRole)
return QString::number(section);
if (role == Qt::DecorationRole)
- return qVariantFromValue(services);
+ return QVariant::fromValue(services);
return QAbstractItemModel::headerData(section, orientation, role);
}
diff --git a/demos/spectrum/app/settingsdialog.cpp b/demos/spectrum/app/settingsdialog.cpp
index b5e8459..1f125c9 100644
--- a/demos/spectrum/app/settingsdialog.cpp
+++ b/demos/spectrum/app/settingsdialog.cpp
@@ -65,13 +65,13 @@ SettingsDialog::SettingsDialog(
QAudioDeviceInfo device;
foreach (device, availableInputDevices)
m_inputDeviceComboBox->addItem(device.deviceName(),
- qVariantFromValue(device));
+ QVariant::fromValue(device));
foreach (device, availableOutputDevices)
m_outputDeviceComboBox->addItem(device.deviceName(),
- qVariantFromValue(device));
+ QVariant::fromValue(device));
- m_windowFunctionComboBox->addItem(tr("None"), qVariantFromValue(int(NoWindow)));
- m_windowFunctionComboBox->addItem("Hann", qVariantFromValue(int(HannWindow)));
+ m_windowFunctionComboBox->addItem(tr("None"), QVariant::fromValue(int(NoWindow)));
+ m_windowFunctionComboBox->addItem("Hann", QVariant::fromValue(int(HannWindow)));
m_windowFunctionComboBox->setCurrentIndex(m_windowFunction);
// Initialize default devices
diff --git a/demos/spreadsheet/spreadsheetitem.cpp b/demos/spreadsheet/spreadsheetitem.cpp
index e1f0143..93c82a0 100644
--- a/demos/spreadsheet/spreadsheetitem.cpp
+++ b/demos/spreadsheet/spreadsheetitem.cpp
@@ -72,10 +72,10 @@ QVariant SpreadSheetItem::data(int role) const
if (role == Qt::TextColorRole) {
if (!isNumber)
- return qVariantFromValue(QColor(Qt::black));
+ return QVariant::fromValue(QColor(Qt::black));
else if (number < 0)
- return qVariantFromValue(QColor(Qt::red));
- return qVariantFromValue(QColor(Qt::blue));
+ return QVariant::fromValue(QColor(Qt::red));
+ return QVariant::fromValue(QColor(Qt::blue));
}
if (role == Qt::TextAlignmentRole)
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0
index 3e7d33b..2ebdc7c 100644
--- a/dist/changes-4.6.0
+++ b/dist/changes-4.6.0
@@ -177,7 +177,7 @@ QtCore
* Many optimisations.
* Added QVariant::toFloat() and QVariant::toReal().
* Added QVariant(float) constructor.
- * qvariant_cast<QVariant> and qVariantFromValue<QVariant> are now
+ * qvariant_cast<QVariant> and QVariant::fromValue<QVariant> are now
identity functions.
* Added support for math3d types.
diff --git a/doc/src/examples/customtype.qdoc b/doc/src/examples/customtype.qdoc
index e003129..0765c5f 100644
--- a/doc/src/examples/customtype.qdoc
+++ b/doc/src/examples/customtype.qdoc
@@ -117,7 +117,7 @@
\snippet examples/tools/customtype/main.cpp storing a custom value
- Alternatively, the qVariantFromValue() and qVariantSetValue() functions
+ Alternatively, the QVariant::fromValue() and qVariantSetValue() functions
can be used if you are using a compiler without support for member template
functions.
diff --git a/doc/src/snippets/accessibilityslidersnippet.cpp b/doc/src/snippets/accessibilityslidersnippet.cpp
index 466579d..05cbe40 100644
--- a/doc/src/snippets/accessibilityslidersnippet.cpp
+++ b/doc/src/snippets/accessibilityslidersnippet.cpp
@@ -227,7 +227,7 @@ QVariant QAccessibleAbstractSlider::invokeMethodEx(Method method, int child, con
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods;
- return qVariantFromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
+ return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
}
default:
diff --git a/doc/src/snippets/code/doc_src_qtscript.qdoc b/doc/src/snippets/code/doc_src_qtscript.qdoc
index 8effdf3..a81029e 100644
--- a/doc/src/snippets/code/doc_src_qtscript.qdoc
+++ b/doc/src/snippets/code/doc_src_qtscript.qdoc
@@ -964,7 +964,7 @@ QScriptValue constructXmlStreamReader(QScriptContext *context, QScriptEngine *en
XmlStreamReaderPointer pointer(reader);
// store the shared pointer in the script object that we are constructing
- return engine->newVariant(context->thisObject(), qVariantFromValue(pointer));
+ return engine->newVariant(context->thisObject(), QVariant::fromValue(pointer));
}
//! [93]
diff --git a/doc/src/snippets/code/src_corelib_kernel_qvariant.cpp b/doc/src/snippets/code/src_corelib_kernel_qvariant.cpp
index fd3f5d2..e81745c 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qvariant.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qvariant.cpp
@@ -132,5 +132,5 @@ return QVariant::fromValue(s);
//! [8]
QObject *object = getObjectFromSomewhere();
-QVariant data = qVariantFromValue(object);
+QVariant data = QVariant::fromValue(object);
//! [8]
diff --git a/doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp b/doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp
index 139e0a3..ef5cfb2 100644
--- a/doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp
+++ b/doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp
@@ -163,7 +163,7 @@
break;
default:
if (v.userType() == qMetaTypeId<QXmlName>()) {
- QXmlName n = qVariantValue<QXmlName>(v);
+ QXmlName n = qvariant_cast<QXmlName>(v);
// process QXmlName n...
}
else {
diff --git a/doc/src/xml-processing/xml-patterns.qdoc b/doc/src/xml-processing/xml-patterns.qdoc
index dcf92f6..3e591da 100644
--- a/doc/src/xml-processing/xml-patterns.qdoc
+++ b/doc/src/xml-processing/xml-patterns.qdoc
@@ -415,7 +415,7 @@
slight-of-hand using the \l{QMetaType} {Qt metatype system}. We
must modify our example to use a couple of template functions, a
friend of QMetaType (qMetaTypeId<T>()) and a friend of QVariant
- (qVariantValue<T>()):
+ (qvariant_cast<T>()):
\snippet doc/src/snippets/code/src_xmlpatterns_api_qxmlquery.cpp 6
diff --git a/examples/draganddrop/puzzle/pieceslist.cpp b/examples/draganddrop/puzzle/pieceslist.cpp
index 77e8723..6e82145 100644
--- a/examples/draganddrop/puzzle/pieceslist.cpp
+++ b/examples/draganddrop/puzzle/pieceslist.cpp
@@ -103,7 +103,7 @@ void PiecesList::startDrag(Qt::DropActions /*supportedActions*/)
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
- QPixmap pixmap = qVariantValue<QPixmap>(item->data(Qt::UserRole));
+ QPixmap pixmap = qvariant_cast<QPixmap>(item->data(Qt::UserRole));
QPoint location = item->data(Qt::UserRole+1).toPoint();
dataStream << pixmap << location;
diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp
index f09c552..e4fe633 100644
--- a/examples/graphicsview/diagramscene/mainwindow.cpp
+++ b/examples/graphicsview/diagramscene/mainwindow.cpp
@@ -224,7 +224,7 @@ void MainWindow::textColorChanged()
textAction = qobject_cast<QAction *>(sender());
fontColorToolButton->setIcon(createColorToolButtonIcon(
":/images/textpointer.png",
- qVariantValue<QColor>(textAction->data())));
+ qvariant_cast<QColor>(textAction->data())));
textButtonTriggered();
}
//! [12]
@@ -235,7 +235,7 @@ void MainWindow::itemColorChanged()
fillAction = qobject_cast<QAction *>(sender());
fillColorToolButton->setIcon(createColorToolButtonIcon(
":/images/floodfill.png",
- qVariantValue<QColor>(fillAction->data())));
+ qvariant_cast<QColor>(fillAction->data())));
fillButtonTriggered();
}
//! [13]
@@ -246,7 +246,7 @@ void MainWindow::lineColorChanged()
lineAction = qobject_cast<QAction *>(sender());
lineColorToolButton->setIcon(createColorToolButtonIcon(
":/images/linecolor.png",
- qVariantValue<QColor>(lineAction->data())));
+ qvariant_cast<QColor>(lineAction->data())));
lineButtonTriggered();
}
//! [14]
@@ -254,21 +254,21 @@ void MainWindow::lineColorChanged()
//! [15]
void MainWindow::textButtonTriggered()
{
- scene->setTextColor(qVariantValue<QColor>(textAction->data()));
+ scene->setTextColor(qvariant_cast<QColor>(textAction->data()));
}
//! [15]
//! [16]
void MainWindow::fillButtonTriggered()
{
- scene->setItemColor(qVariantValue<QColor>(fillAction->data()));
+ scene->setItemColor(qvariant_cast<QColor>(fillAction->data()));
}
//! [16]
//! [17]
void MainWindow::lineButtonTriggered()
{
- scene->setLineColor(qVariantValue<QColor>(lineAction->data()));
+ scene->setLineColor(qvariant_cast<QColor>(lineAction->data()));
}
//! [17]
diff --git a/examples/graphicsview/dragdroprobot/robot.cpp b/examples/graphicsview/dragdroprobot/robot.cpp
index 44ecda3..caca309 100644
--- a/examples/graphicsview/dragdroprobot/robot.cpp
+++ b/examples/graphicsview/dragdroprobot/robot.cpp
@@ -77,7 +77,7 @@ void RobotPart::dropEvent(QGraphicsSceneDragDropEvent *event)
{
dragOver = false;
if (event->mimeData()->hasColor())
- color = qVariantValue<QColor>(event->mimeData()->colorData());
+ color = qvariant_cast<QColor>(event->mimeData()->colorData());
update();
}
//! [3]
@@ -139,7 +139,7 @@ void RobotHead::dropEvent(QGraphicsSceneDragDropEvent *event)
{
if (event->mimeData()->hasImage()) {
dragOver = false;
- pixmap = qVariantValue<QPixmap>(event->mimeData()->imageData());
+ pixmap = qvariant_cast<QPixmap>(event->mimeData()->imageData());
update();
} else {
RobotPart::dropEvent(event);
diff --git a/examples/graphicsview/padnavigator/padnavigator.cpp b/examples/graphicsview/padnavigator/padnavigator.cpp
index 4988664..3ea68de 100644
--- a/examples/graphicsview/padnavigator/padnavigator.cpp
+++ b/examples/graphicsview/padnavigator/padnavigator.cpp
@@ -135,9 +135,9 @@ PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
- smoothFlipScale->setKeyValueAt(0, qVariantValue<qreal>(1.0));
- smoothFlipScale->setKeyValueAt(0.5, qVariantValue<qreal>(0.7));
- smoothFlipScale->setKeyValueAt(1, qVariantValue<qreal>(1.0));
+ smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
+ smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
+ smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
flipAnimation->addAnimation(smoothFlipXRotation);
@@ -172,13 +172,13 @@ PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
frontState->assignProperty(pad, "fill", false);
frontState->assignProperty(splash, "opacity", 0.0);
frontState->assignProperty(backItem, "visible", false);
- frontState->assignProperty(flipRotation, "angle", qVariantValue<qreal>(0.0));
+ frontState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(0.0));
frontState->assignProperty(selectionItem, "visible", true);
backState->assignProperty(pad, "fill", true);
backState->assignProperty(backItem, "visible", true);
- backState->assignProperty(xRotation, "angle", qVariantValue<qreal>(0.0));
- backState->assignProperty(yRotation, "angle", qVariantValue<qreal>(0.0));
- backState->assignProperty(flipRotation, "angle", qVariantValue<qreal>(180.0));
+ backState->assignProperty(xRotation, "angle", qvariant_cast<qreal>(0.0));
+ backState->assignProperty(yRotation, "angle", qvariant_cast<qreal>(0.0));
+ backState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(180.0));
backState->assignProperty(selectionItem, "visible", false);
stateMachine->addDefaultAnimation(smoothXRotation);
stateMachine->addDefaultAnimation(smoothYRotation);
diff --git a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp
index 1af5831..4f4a954 100644
--- a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp
+++ b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp
@@ -50,7 +50,7 @@ ColorListEditor::ColorListEditor(QWidget *widget) : QComboBox(widget)
//! [0]
QColor ColorListEditor::color() const
{
- return qVariantValue<QColor>(itemData(currentIndex(), Qt::DecorationRole));
+ return qvariant_cast<QColor>(itemData(currentIndex(), Qt::DecorationRole));
}
//! [0]
diff --git a/examples/itemviews/puzzle/piecesmodel.cpp b/examples/itemviews/puzzle/piecesmodel.cpp
index e110cf1..e55663b 100644
--- a/examples/itemviews/puzzle/piecesmodel.cpp
+++ b/examples/itemviews/puzzle/piecesmodel.cpp
@@ -124,7 +124,7 @@ QMimeData *PiecesModel::mimeData(const QModelIndexList &indexes) const
foreach (QModelIndex index, indexes) {
if (index.isValid()) {
- QPixmap pixmap = qVariantValue<QPixmap>(data(index, Qt::UserRole));
+ QPixmap pixmap = qvariant_cast<QPixmap>(data(index, Qt::UserRole));
QPoint location = data(index, Qt::UserRole+1).toPoint();
stream << pixmap << location;
}
diff --git a/examples/itemviews/stardelegate/main.cpp b/examples/itemviews/stardelegate/main.cpp
index d9f655d..444017e 100644
--- a/examples/itemviews/stardelegate/main.cpp
+++ b/examples/itemviews/stardelegate/main.cpp
@@ -71,7 +71,7 @@ void populateTableWidget(QTableWidget *tableWidget)
QTableWidgetItem *item2 = new QTableWidgetItem(staticData[row].artist);
QTableWidgetItem *item3 = new QTableWidgetItem;
item3->setData(0,
- qVariantFromValue(StarRating(staticData[row].rating)));
+ QVariant::fromValue(StarRating(staticData[row].rating)));
tableWidget->setItem(row, 0, item0);
tableWidget->setItem(row, 1, item1);
diff --git a/examples/itemviews/stardelegate/stardelegate.cpp b/examples/itemviews/stardelegate/stardelegate.cpp
index 44dd54f..ebb2e38 100644
--- a/examples/itemviews/stardelegate/stardelegate.cpp
+++ b/examples/itemviews/stardelegate/stardelegate.cpp
@@ -48,8 +48,8 @@
void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- if (qVariantCanConvert<StarRating>(index.data())) {
- StarRating starRating = qVariantValue<StarRating>(index.data());
+ if (index.data().canConvert<StarRating>()) {
+ StarRating starRating = qvariant_cast<StarRating>(index.data());
if (option.state & QStyle::State_Selected)
painter->fillRect(option.rect, option.palette.highlight());
@@ -66,8 +66,8 @@ void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
QSize StarDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- if (qVariantCanConvert<StarRating>(index.data())) {
- StarRating starRating = qVariantValue<StarRating>(index.data());
+ if (index.data().canConvert<StarRating>()) {
+ StarRating starRating = qvariant_cast<StarRating>(index.data());
return starRating.sizeHint();
} else {
return QStyledItemDelegate::sizeHint(option, index);
@@ -81,7 +81,7 @@ QWidget *StarDelegate::createEditor(QWidget *parent,
const QModelIndex &index) const
{
- if (qVariantCanConvert<StarRating>(index.data())) {
+ if (index.data().canConvert<StarRating>()) {
StarEditor *editor = new StarEditor(parent);
connect(editor, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
@@ -96,8 +96,8 @@ QWidget *StarDelegate::createEditor(QWidget *parent,
void StarDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
- if (qVariantCanConvert<StarRating>(index.data())) {
- StarRating starRating = qVariantValue<StarRating>(index.data());
+ if (index.data().canConvert<StarRating>()) {
+ StarRating starRating = qvariant_cast<StarRating>(index.data());
StarEditor *starEditor = qobject_cast<StarEditor *>(editor);
starEditor->setStarRating(starRating);
} else {
@@ -110,9 +110,9 @@ void StarDelegate::setEditorData(QWidget *editor,
void StarDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
- if (qVariantCanConvert<StarRating>(index.data())) {
+ if (index.data().canConvert<StarRating>()) {
StarEditor *starEditor = qobject_cast<StarEditor *>(editor);
- model->setData(index, qVariantFromValue(starEditor->starRating()));
+ model->setData(index, QVariant::fromValue(starEditor->starRating()));
} else {
QStyledItemDelegate::setModelData(editor, model, index);
}
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index 5ab4918..6eb0763 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -155,7 +155,7 @@ void AudioTest::modeChanged(int idx)
deviceBox->clear();
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
- deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
+ deviceBox->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
deviceBox->setCurrentIndex(0);
deviceChanged(0);
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 4e5f2a3..cf18335 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -237,7 +237,7 @@ void InputTest::initializeWindow()
m_deviceBox = new QComboBox(this);
QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for(int i = 0; i < devices.size(); ++i)
- m_deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
+ m_deviceBox->addItem(devices.at(i).deviceName(), QVariant::fromValue(devices.at(i)));
connect(m_deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
layout->addWidget(m_deviceBox);
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index bc2324e..4e74a25 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -176,7 +176,7 @@ void AudioTest::initializeWindow()
m_deviceBox = new QComboBox(this);
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
- m_deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
+ m_deviceBox->addItem(deviceInfo.deviceName(), QVariant::fromValue(deviceInfo));
connect(m_deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
layout->addWidget(m_deviceBox);
diff --git a/examples/network/torrent/bencodeparser.cpp b/examples/network/torrent/bencodeparser.cpp
index d6b6078..aa498d6 100644
--- a/examples/network/torrent/bencodeparser.cpp
+++ b/examples/network/torrent/bencodeparser.cpp
@@ -171,7 +171,7 @@ bool BencodeParser::getList(QList<QVariant> *list)
else if (getList(&tmpList))
tmp << tmpList;
else if (getDictionary(&dictionary))
- tmp << qVariantFromValue<QMap<QByteArray, QVariant> >(dictionary);
+ tmp << QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary);
else {
errString = QString("error at index %1").arg(index);
return false;
@@ -217,7 +217,7 @@ bool BencodeParser::getDictionary(QMap<QByteArray, QVariant> *dictionary)
else if (getList(&tmpList))
tmp.insert(key, tmpList);
else if (getDictionary(&dictionary))
- tmp.insert(key, qVariantFromValue<QMap<QByteArray, QVariant> >(dictionary));
+ tmp.insert(key, QVariant::fromValue<QMap<QByteArray, QVariant> >(dictionary));
else {
errString = QString("error at index %1").arg(index);
return false;
diff --git a/examples/network/torrent/metainfo.cpp b/examples/network/torrent/metainfo.cpp
index a6e7511..a7cd978 100644
--- a/examples/network/torrent/metainfo.cpp
+++ b/examples/network/torrent/metainfo.cpp
@@ -83,7 +83,7 @@ bool MetaInfo::parse(const QByteArray &data)
if (!dict.contains("info"))
return false;
- QMap<QByteArray, QVariant> info = qVariantValue<Dictionary>(dict.value("info"));
+ QMap<QByteArray, QVariant> info = qvariant_cast<Dictionary>(dict.value("info"));
if (info.contains("files")) {
metaInfoFileForm = MultiFileForm;
@@ -91,7 +91,7 @@ bool MetaInfo::parse(const QByteArray &data)
QList<QVariant> files = info.value("files").toList();
for (int i = 0; i < files.size(); ++i) {
- QMap<QByteArray, QVariant> file = qVariantValue<Dictionary>(files.at(i));
+ QMap<QByteArray, QVariant> file = qvariant_cast<Dictionary>(files.at(i));
QList<QVariant> pathElements = file.value("path").toList();
QByteArray path;
foreach (QVariant p, pathElements) {
diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp
index 61d7e95..07194fa 100644
--- a/examples/network/torrent/trackerclient.cpp
+++ b/examples/network/torrent/trackerclient.cpp
@@ -210,7 +210,7 @@ void TrackerClient::httpRequestDone(bool error)
QList<QVariant> peerTmp = peerEntry.toList();
for (int i = 0; i < peerTmp.size(); ++i) {
TorrentPeer tmp;
- QMap<QByteArray, QVariant> peer = qVariantValue<QMap<QByteArray, QVariant> >(peerTmp.at(i));
+ QMap<QByteArray, QVariant> peer = qvariant_cast<QMap<QByteArray, QVariant> >(peerTmp.at(i));
tmp.id = QString::fromUtf8(peer.value("peer id").toByteArray());
tmp.address.setAddress(QString::fromUtf8(peer.value("ip").toByteArray()));
tmp.port = peer.value("port").toInt();
diff --git a/examples/richtext/textobject/svgtextobject.cpp b/examples/richtext/textobject/svgtextobject.cpp
index c84725d..2442623 100644
--- a/examples/richtext/textobject/svgtextobject.cpp
+++ b/examples/richtext/textobject/svgtextobject.cpp
@@ -48,7 +48,7 @@
QSizeF SvgTextObject::intrinsicSize(QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
- QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
+ QImage bufferedImage = qvariant_cast<QImage>(format.property(Window::SvgData));
QSize size = bufferedImage.size();
if (size.height() > 25)
@@ -63,7 +63,7 @@ void SvgTextObject::drawObject(QPainter *painter, const QRectF &rect,
QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
- QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
+ QImage bufferedImage = qvariant_cast<QImage>(format.property(Window::SvgData));
painter->drawImage(rect, bufferedImage);
}
diff --git a/examples/script/context2d/context2d.cpp b/examples/script/context2d/context2d.cpp
index c408736..49fc3bc 100644
--- a/examples/script/context2d/context2d.cpp
+++ b/examples/script/context2d/context2d.cpp
@@ -278,7 +278,7 @@ QVariant Context2D::strokeStyle() const
void Context2D::setStrokeStyle(const QVariant &style)
{
- if (qVariantCanConvert<CanvasGradient>(style)) {
+ if (style.canConvert<CanvasGradient>()) {
CanvasGradient cg = qvariant_cast<CanvasGradient>(style);
m_state.strokeStyle = cg.value;
} else {
@@ -296,7 +296,7 @@ QVariant Context2D::fillStyle() const
//! [3]
void Context2D::setFillStyle(const QVariant &style)
{
- if (qVariantCanConvert<CanvasGradient>(style)) {
+ if (style.canConvert<CanvasGradient>()) {
CanvasGradient cg = qvariant_cast<CanvasGradient>(style);
m_state.fillStyle = cg.value;
} else {
diff --git a/examples/script/context2d/domimage.cpp b/examples/script/context2d/domimage.cpp
index 801e1a2..f655c6f 100644
--- a/examples/script/context2d/domimage.cpp
+++ b/examples/script/context2d/domimage.cpp
@@ -84,7 +84,7 @@ static QScriptValue Image(QScriptContext *context, QScriptEngine *env)
{
QScriptValue val = context->thisObject();
DomImage *image = new DomImage();
- QScriptValue klass = env->newVariant(qVariantFromValue(image));
+ QScriptValue klass = env->newVariant(QVariant::fromValue(image));
klass.setPrototype(DomImage::s_self);
return klass;
}
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 5ecee0a..0a1ad2d 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -204,7 +204,7 @@ QScriptValue ByteArrayClass::newInstance(int size)
//! [1]
QScriptValue ByteArrayClass::newInstance(const QByteArray &ba)
{
- QScriptValue data = engine()->newVariant(qVariantFromValue(ba));
+ QScriptValue data = engine()->newVariant(QVariant::fromValue(ba));
return engine()->newObject(this, data);
}
//! [1]
@@ -228,7 +228,7 @@ QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray
QScriptValue ctor = eng->globalObject().property("ByteArray");
ByteArrayClass *cls = qscriptvalue_cast<ByteArrayClass*>(ctor.data());
if (!cls)
- return eng->newVariant(qVariantFromValue(ba));
+ return eng->newVariant(QVariant::fromValue(ba));
return cls->newInstance(ba);
}
diff --git a/examples/sql/querymodel/customsqlmodel.cpp b/examples/sql/querymodel/customsqlmodel.cpp
index f444acf..75d16b4 100644
--- a/examples/sql/querymodel/customsqlmodel.cpp
+++ b/examples/sql/querymodel/customsqlmodel.cpp
@@ -58,7 +58,7 @@ QVariant CustomSqlModel::data(const QModelIndex &index, int role) const
return value.toString().toUpper();
}
if (role == Qt::TextColorRole && index.column() == 1)
- return qVariantFromValue(QColor(Qt::blue));
+ return QVariant::fromValue(QColor(Qt::blue));
return value;
}
//! [0]
diff --git a/examples/tools/customtype/main.cpp b/examples/tools/customtype/main.cpp
index 229cd18..430613a 100644
--- a/examples/tools/customtype/main.cpp
+++ b/examples/tools/customtype/main.cpp
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
//! [retrieving a custom value]
Message retrieved = stored.value<Message>();
qDebug() << "Retrieved:" << retrieved;
- retrieved = qVariantValue<Message>(stored);
+ retrieved = qvariant_cast<Message>(stored);
qDebug() << "Retrieved:" << retrieved;
//! [retrieving a custom value]
diff --git a/examples/widgets/validators/localeselector.cpp b/examples/widgets/validators/localeselector.cpp
index e4aae1a..0a48d66 100644
--- a/examples/widgets/validators/localeselector.cpp
+++ b/examples/widgets/validators/localeselector.cpp
@@ -294,7 +294,7 @@ LocaleSelector::LocaleSelector(QWidget *parent)
QString text = QLocale::languageToString(QLocale::Language(l.lang))
+ QLatin1Char('/')
+ QLocale::countryToString(QLocale::Country(l.country));
- addItem(text, qVariantFromValue(l));
+ addItem(text, QVariant::fromValue(l));
}
setCurrentIndex(curIndex);
@@ -307,6 +307,6 @@ void LocaleSelector::emitLocaleSelected(int index)
QVariant v = itemData(index);
if (!v.isValid())
return;
- SupportedLocale l = qVariantValue<SupportedLocale>(v);
+ SupportedLocale l = qvariant_cast<SupportedLocale>(v);
emit localeSelected(QLocale(QLocale::Language(l.lang), QLocale::Country(l.country)));
}
diff --git a/src/3rdparty/phonon/phonon/mediacontroller.cpp b/src/3rdparty/phonon/phonon/mediacontroller.cpp
index 59fd5c7..9f651d6 100644
--- a/src/3rdparty/phonon/phonon/mediacontroller.cpp
+++ b/src/3rdparty/phonon/phonon/mediacontroller.cpp
@@ -216,14 +216,14 @@ void MediaController::setCurrentAudioChannel(const Phonon::AudioChannelDescripti
{
IFACE;
iface->interfaceCall(AddonInterface::AudioChannelInterface,
- AddonInterface::setCurrentAudioChannel, QList<QVariant>() << qVariantFromValue(stream));
+ AddonInterface::setCurrentAudioChannel, QList<QVariant>() << QVariant::fromValue(stream));
}
void MediaController::setCurrentSubtitle(const Phonon::SubtitleDescription &stream)
{
IFACE;
iface->interfaceCall(AddonInterface::SubtitleInterface,
- AddonInterface::setCurrentSubtitle, QList<QVariant>() << qVariantFromValue(stream));
+ AddonInterface::setCurrentSubtitle, QList<QVariant>() << QVariant::fromValue(stream));
}
#undef IFACE
diff --git a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h
index f28ecaa..f25b15e 100644
--- a/src/3rdparty/phonon/phonon/qsettingsgroup_p.h
+++ b/src/3rdparty/phonon/phonon/qsettingsgroup_p.h
@@ -54,7 +54,7 @@ class QSettingsGroup
template<typename T>
inline T value(const QString &key, const T &def) const
{
- return qvariant_cast<T>(value(key, qVariantFromValue(def)));
+ return qvariant_cast<T>(value(key, QVariant::fromValue(def)));
}
inline QVariant value(const QString &key, const QVariant &def) const
@@ -66,7 +66,7 @@ class QSettingsGroup
inline void setValue(const QString &key, const T &value)
{
Q_ASSERT(m_mutableSettings);
- m_mutableSettings->setValue(m_group + key, qVariantFromValue(value));
+ m_mutableSettings->setValue(m_group + key, QVariant::fromValue(value));
}
inline void removeEntry(const QString &key)
diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
index a39dc7a..44c41c4 100644
--- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
+++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp
@@ -565,7 +565,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
if (qstring.mid(lastSlash + 1).contains(QLatin1Char('i')))
realRe.setCaseSensitivity(Qt::CaseInsensitive);
- ret = qVariantFromValue(realRe);
+ ret = QVariant::fromValue(realRe);
dist = 0;
} else {
qConvDebug() << "couldn't parse a JS regexp";
@@ -576,7 +576,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
QRegExp re(qstring);
if (re.isValid()) {
- ret = qVariantFromValue(re);
+ ret = QVariant::fromValue(re);
dist = 10;
}
}
@@ -588,7 +588,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
if (qtinst) {
if (qtinst->getObject()) {
qConvDebug() << "found instance, with object:" << (void*) qtinst->getObject();
- ret = qVariantFromValue(qtinst->getObject());
+ ret = QVariant::fromValue(qtinst->getObject());
qConvDebug() << ret;
dist = 0;
} else {
@@ -599,7 +599,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
}
} else if (type == Null) {
QObject* nullobj = 0;
- ret = qVariantFromValue(nullobj);
+ ret = QVariant::fromValue(nullobj);
dist = 0;
} else {
qConvDebug() << "previous type was not an object:" << type;
@@ -612,7 +612,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
if (qtinst) {
if (qtinst->getObject()) {
qConvDebug() << "found instance, with object:" << (void*) qtinst->getObject();
- ret = qVariantFromValue((void *)qtinst->getObject());
+ ret = QVariant::fromValue((void *)qtinst->getObject());
qConvDebug() << ret;
dist = 0;
} else {
@@ -622,7 +622,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type
qConvDebug() << "wasn't a qtinstance";
}
} else if (type == Null) {
- ret = qVariantFromValue((void*)0);
+ ret = QVariant::fromValue((void*)0);
dist = 0;
} else if (type == Number) {
// I don't think that converting a double to a pointer is a wise
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index 5db94a8..5004b67 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -185,7 +185,7 @@ void MediaPlayerPrivate::load(const String& url)
// Don't set the header if there are no cookies.
// This prevents a warning from being emitted.
if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+ request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies));
// Set the refferer, but not when requesting insecure content from a secure page
QUrl documentUrl = QUrl(QString(document->documentURI()));
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index e584f97..dcae35f 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -306,7 +306,7 @@ public:
}
Q_INVOKABLE QObjectList myInvokableWithQObjectListArg(const QObjectList &lst) {
m_qtFunctionInvoked = 14;
- m_actuals << qVariantFromValue(lst);
+ m_actuals << QVariant::fromValue(lst);
return lst;
}
Q_INVOKABLE QVariant myInvokableWithVariantArg(const QVariant &v) {
@@ -321,38 +321,38 @@ public:
}
Q_INVOKABLE QList<int> myInvokableWithListOfIntArg(const QList<int> &lst) {
m_qtFunctionInvoked = 17;
- m_actuals << qVariantFromValue(lst);
+ m_actuals << QVariant::fromValue(lst);
return lst;
}
Q_INVOKABLE QObject* myInvokableWithQObjectStarArg(QObject* obj) {
m_qtFunctionInvoked = 18;
- m_actuals << qVariantFromValue(obj);
+ m_actuals << QVariant::fromValue(obj);
return obj;
}
Q_INVOKABLE QBrush myInvokableWithQBrushArg(const QBrush &brush) {
m_qtFunctionInvoked = 19;
- m_actuals << qVariantFromValue(brush);
+ m_actuals << QVariant::fromValue(brush);
return brush;
}
Q_INVOKABLE void myInvokableWithBrushStyleArg(Qt::BrushStyle style) {
m_qtFunctionInvoked = 43;
- m_actuals << qVariantFromValue(style);
+ m_actuals << QVariant::fromValue(style);
}
Q_INVOKABLE void myInvokableWithVoidStarArg(void* arg) {
m_qtFunctionInvoked = 44;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
Q_INVOKABLE void myInvokableWithAmbiguousArg(int arg) {
m_qtFunctionInvoked = 45;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
Q_INVOKABLE void myInvokableWithAmbiguousArg(uint arg) {
m_qtFunctionInvoked = 46;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
Q_INVOKABLE void myInvokableWithDefaultArgs(int arg1, const QString &arg2 = "") {
m_qtFunctionInvoked = 47;
- m_actuals << qVariantFromValue(arg1) << qVariantFromValue(arg2);
+ m_actuals << QVariant::fromValue(arg1) << qVariantFromValue(arg2);
}
Q_INVOKABLE QObject& myInvokableReturningRef() {
m_qtFunctionInvoked = 48;
@@ -364,11 +364,11 @@ public:
}
Q_INVOKABLE void myInvokableWithPointArg(const QPoint &arg) {
const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 50;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
Q_INVOKABLE void myInvokableWithPointArg(const QPointF &arg) {
const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 51;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
Q_INVOKABLE void myInvokableWithBoolArg(bool arg) {
m_qtFunctionInvoked = 52;
@@ -416,7 +416,7 @@ public Q_SLOTS:
}
void myOverloadedSlot(QObject* arg) {
m_qtFunctionInvoked = 41;
- m_actuals << qVariantFromValue(arg);
+ m_actuals << QVariant::fromValue(arg);
}
void myOverloadedSlot(bool arg) {
m_qtFunctionInvoked = 25;
@@ -818,7 +818,7 @@ void tst_QWebFrame::getSetStaticProperty()
QCOMPARE(evalJS("myObject.variantProperty === 'bar'"), sTrue);
m_myObject->setVariantProperty(42);
QCOMPARE(evalJS("myObject.variantProperty === 42"), sTrue);
- m_myObject->setVariantProperty(qVariantFromValue(QBrush()));
+ m_myObject->setVariantProperty(QVariant::fromValue(QBrush()));
//XFAIL
// QCOMPARE(evalJS("typeof myObject.variantProperty"), sVariant);
@@ -1240,7 +1240,7 @@ void tst_QWebFrame::callQtInvokable()
/* XFAIL - variant support
m_myObject->resetQtFunctionInvoked();
{
- m_myObject->setVariantProperty(qVariantFromValue(QBrush()));
+ m_myObject->setVariantProperty(QVariant::fromValue(QBrush()));
QVariant ret = evalJS("myObject.myInvokableWithVariantArg(myObject.variantProperty)");
QVERIFY(ret.isVariant());
QCOMPARE(m_myObject->qtFunctionInvoked(), 15);
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 7692749..806e2b1 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -3540,7 +3540,7 @@ int QAxBase::internalProperty(QMetaObject::Call call, int index, void **v)
proptype = 0;
} else if (t == QVariant::UserType) {
qvar = QVariant(qRegisterMetaType<void*>(prop.typeName()), (void**)v[0]);
-// qVariantSetValue(qvar, *(void**)v[0], prop.typeName());
+// qvar.setValue(*(void**)v[0], prop.typeName());
} else {
proptype = d->metaObject()->propertyType(propname);
qvar = QVariant(t, v[0]);
@@ -3628,9 +3628,9 @@ int QAxBase::internalInvoke(QMetaObject::Call call, int index, void **v)
if (!qvar.isValid()) {
if (type == "IDispatch*")
- qVariantSetValue(qvar, *(IDispatch**)v[p+1]);
+ qvar.setValue(*(IDispatch**)v[p+1]);
else if (type == "IUnknown*")
- qVariantSetValue(qvar, *(IUnknown**)v[p+1]);
+ qvar.setValue(*(IUnknown**)v[p+1]);
else if (type == "QVariant")
qvar = *(QVariant*)v[p + 1];
else if (mo->indexOfEnumerator(type) != -1)
@@ -4395,15 +4395,15 @@ QVariant QAxBase::asVariant() const
QByteArray cn(className());
if (cn == "QAxObject" || cn == "QAxWidget" || cn == "QAxBase") {
if (d->dispatch())
- qVariantSetValue(qvar, d->dispatch());
+ qvar.setValue(d->dispatch());
else if (d->ptr)
- qVariantSetValue(qvar, d->ptr);
+ qvar.setValue(d->ptr);
} else {
cn = cn.mid(cn.lastIndexOf(':') + 1);
QObject *object = qObject();
if (QMetaType::type(cn))
qvar = QVariant(qRegisterMetaType<QObject*>(cn + '*'), &object);
-// qVariantSetValue(qvar, qObject(), cn + '*');
+// qvar.setValue(qObject(), cn + '*');
}
return qvar;
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 4d2d2f9..32e2cf2 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -2047,10 +2047,10 @@ int QAxServerBase::qt_metacall(QMetaObject::Call call, int index, void **argv)
if (vt == QVariant::UserType) {
if (ptype.endsWith('*')) {
variant = QVariant(QMetaType::type(ptype), (void**)argv[p+1]);
- // qVariantSetValue(variant, *(void**)(argv[p + 1]), ptype);
+ // variant.setValue(*(void**)(argv[p + 1]), ptype);
} else {
variant = QVariant(QMetaType::type(ptype), argv[p+1]);
- // qVariantSetValue(variant, argv[p + 1], ptype);
+ // variant.setValue(argv[p + 1], ptype);
}
} else {
variant = QVariant(vt, argv[p + 1]);
@@ -2537,7 +2537,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid,
if (!type.isEmpty() && pvarResult) {
if (!varp[0].isValid() && type != "QVariant")
varp[0] = QVariant(QMetaType::type(type), argv_pointer);
-// qVariantSetValue(varp[0], argv_pointer[0], type);
+// varp[0].setValue(argv_pointer[0], type);
ok = QVariantToVARIANT(varp[0], *pvarResult, type);
}
}
@@ -3312,7 +3312,7 @@ HRESULT WINAPI QAxServerBase::OnAmbientPropertyChange(DISPID dispID)
break;
{
QVariant qvar = VARIANTToQVariant(var, "QFont", QVariant::Font);
- QFont qfont = qVariantValue<QFont>(qvar);
+ QFont qfont = qvariant_cast<QFont>(qvar);
qt.widget->setFont(qfont);
}
break;
diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp
index 0cfc7eb..7b2e802 100644
--- a/src/activeqt/shared/qaxtypes.cpp
+++ b/src/activeqt/shared/qaxtypes.cpp
@@ -954,20 +954,20 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
break;
case VT_I4:
if (type == QVariant::Color || (!type && typeName == "QColor"))
- var = qVariantFromValue(OLEColorToQColor(arg.lVal));
+ var = QVariant::fromValue(OLEColorToQColor(arg.lVal));
#ifndef QT_NO_CURSOR
else if (type == QVariant::Cursor || (!type && (typeName == "QCursor" || typeName == "QCursor*")))
- var = qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(arg.lVal)));
+ var = QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(arg.lVal)));
#endif
else
var = (int)arg.lVal;
break;
case VT_I4|VT_BYREF:
if (type == QVariant::Color || (!type && typeName == "QColor"))
- var = qVariantFromValue(OLEColorToQColor((int)*arg.plVal));
+ var = QVariant::fromValue(OLEColorToQColor((int)*arg.plVal));
#ifndef QT_NO_CURSOR
else if (type == QVariant::Cursor || (!type && (typeName == "QCursor" || typeName == "QCursor*")))
- var = qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(*arg.plVal)));
+ var = QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(*arg.plVal)));
#endif
else
var = (int)*arg.plVal;
@@ -992,20 +992,20 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
break;
case VT_UI4:
if (type == QVariant::Color || (!type && typeName == "QColor"))
- var = qVariantFromValue(OLEColorToQColor(arg.ulVal));
+ var = QVariant::fromValue(OLEColorToQColor(arg.ulVal));
#ifndef QT_NO_CURSOR
else if (type == QVariant::Cursor || (!type && (typeName == "QCursor" || typeName == "QCursor*")))
- var = qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(arg.ulVal)));
+ var = QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(arg.ulVal)));
#endif
else
var = (int)arg.ulVal;
break;
case VT_UI4|VT_BYREF:
if (type == QVariant::Color || (!type && typeName == "QColor"))
- var = qVariantFromValue(OLEColorToQColor((uint)*arg.pulVal));
+ var = QVariant::fromValue(OLEColorToQColor((uint)*arg.pulVal));
#ifndef QT_NO_CURSOR
else if (type == QVariant::Cursor || (!type && (typeName == "QCursor" || typeName == "QCursor*")))
- var = qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(*arg.pulVal)));
+ var = QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(*arg.pulVal)));
#endif
else
var = (int)*arg.pulVal;
@@ -1084,20 +1084,20 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
if (disp)
disp->QueryInterface(IID_IFont, (void**)&ifont);
if (ifont) {
- var = qVariantFromValue(IFontToQFont(ifont));
+ var = QVariant::fromValue(IFontToQFont(ifont));
ifont->Release();
} else {
- var = qVariantFromValue(QFont());
+ var = QVariant::fromValue(QFont());
}
} else if (type == QVariant::Pixmap || (!type && (typeName == "QPixmap" || typeName == "QPixmap*"))) {
IPicture *ipic = 0;
if (disp)
disp->QueryInterface(IID_IPicture, (void**)&ipic);
if (ipic) {
- var = qVariantFromValue(IPictureToQPixmap(ipic));
+ var = QVariant::fromValue(IPictureToQPixmap(ipic));
ipic->Release();
} else {
- var = qVariantFromValue(QPixmap());
+ var = QVariant::fromValue(QPixmap());
}
} else {
#ifdef QAX_SERVER
@@ -1118,7 +1118,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
#ifndef QAX_SERVER
if (typeName == "QVariant") {
QAxObject *object = new QAxObject(disp);
- var = qVariantFromValue<QAxObject*>(object);
+ var = QVariant::fromValue<QAxObject*>(object);
} else if (typeName != "IDispatch*" && QMetaType::type(typeName)) {
QByteArray typeNameStr = QByteArray(typeName);
int pIndex = typeName.lastIndexOf('*');
@@ -1145,7 +1145,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint
unkn = *arg.ppunkVal;
else
unkn = arg.punkVal;
- qVariantSetValue(var, unkn);
+ var.setValue(unkn);
}
break;
case VT_ARRAY|VT_VARIANT:
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 4e9c1ad..9ff0ff1 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -208,7 +208,7 @@ bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const Q
QLatin1String(DBUS_INTERFACE_PROPERTIES),
QLatin1String("Set"));
QDBusMessagePrivate::setParametersValidated(msg, true);
- msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value));
+ msg << interface << QString::fromUtf8(mp.name()) << QVariant::fromValue(QDBusVariant(value));
QDBusMessage reply = connection.call(msg, QDBus::Block);
if (reply.type() != QDBusMessage::ReplyMessage) {
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index 6e19218..0df4c6b 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -188,11 +188,11 @@ QVariant QDBusDemarshaller::toVariantInternal()
{
switch (q_dbus_message_iter_get_arg_type(&iterator)) {
case DBUS_TYPE_BYTE:
- return qVariantFromValue(toByte());
+ return QVariant::fromValue(toByte());
case DBUS_TYPE_INT16:
- return qVariantFromValue(toShort());
+ return QVariant::fromValue(toShort());
case DBUS_TYPE_UINT16:
- return qVariantFromValue(toUShort());
+ return QVariant::fromValue(toUShort());
case DBUS_TYPE_INT32:
return toInt();
case DBUS_TYPE_UINT32:
@@ -208,11 +208,11 @@ QVariant QDBusDemarshaller::toVariantInternal()
case DBUS_TYPE_STRING:
return toString();
case DBUS_TYPE_OBJECT_PATH:
- return qVariantFromValue(toObjectPath());
+ return QVariant::fromValue(toObjectPath());
case DBUS_TYPE_SIGNATURE:
- return qVariantFromValue(toSignature());
+ return QVariant::fromValue(toSignature());
case DBUS_TYPE_VARIANT:
- return qVariantFromValue(toVariant());
+ return QVariant::fromValue(toVariant());
case DBUS_TYPE_ARRAY:
switch (q_dbus_message_iter_get_element_type(&iterator)) {
@@ -222,14 +222,14 @@ QVariant QDBusDemarshaller::toVariantInternal()
case DBUS_TYPE_STRING:
return toStringList();
case DBUS_TYPE_DICT_ENTRY:
- return qVariantFromValue(duplicate());
+ return QVariant::fromValue(duplicate());
default:
- return qVariantFromValue(duplicate());
+ return QVariant::fromValue(duplicate());
}
case DBUS_TYPE_STRUCT:
- return qVariantFromValue(duplicate());
+ return QVariant::fromValue(duplicate());
default:
qWarning("QDBusDemarshaller: Found unknown D-Bus type %d '%c'",
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 7951177..b479b32 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -806,14 +806,14 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu
slotData.slotIdx = -1;
slotData.metaTypes.clear();
slotCache.hash.insert(cacheKey, slotData);
- object->setProperty(cachePropertyName, qVariantFromValue(slotCache));
+ object->setProperty(cachePropertyName, QVariant::fromValue(slotCache));
return false;
}
}
// save to the cache
slotCache.hash.insert(cacheKey, slotData);
- object->setProperty(cachePropertyName, qVariantFromValue(slotCache));
+ object->setProperty(cachePropertyName, QVariant::fromValue(slotCache));
// found the slot to be called
deliverCall(object, flags, msg, slotData.metaTypes, slotData.slotIdx);
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 78abf94..b6cf1fd 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -264,7 +264,7 @@ QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node
return propertyNotFoundError(msg, interface_name, property_name);
}
- return msg.createReply(qVariantFromValue(QDBusVariant(value)));
+ return msg.createReply(QVariant::fromValue(QDBusVariant(value)));
}
enum PropertyWriteResult {
@@ -334,7 +334,7 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
// we have to demarshall before writing
void *null = 0;
QVariant other(id, null);
- if (!QDBusMetaType::demarshall(qVariantValue<QDBusArgument>(value), id, other.data())) {
+ if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) {
qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. "
"Use qDBusRegisterMetaType to register it",
mp.typeName(), id);
@@ -495,7 +495,7 @@ QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &n
return interfaceNotFoundError(msg, interface_name);
}
- return msg.createReply(qVariantFromValue(result));
+ return msg.createReply(QVariant::fromValue(result));
}
QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp
index b950aef..19d8ab3 100644
--- a/src/declarative/debugger/qdeclarativedebug.cpp
+++ b/src/declarative/debugger/qdeclarativedebug.cpp
@@ -194,7 +194,7 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugOb
{
QDeclarativeDebugObjectReference obj;
obj.m_debugId = prop.m_value.toInt();
- prop.m_value = qVariantFromValue(obj);
+ prop.m_value = QVariant::fromValue(obj);
break;
}
case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown:
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 346a2f4..a96e4f4 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1294,7 +1294,7 @@ QScriptValue QDeclarativeEnginePrivate::vector3d(QScriptContext *ctxt, QScriptEn
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
- return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QVector3D(x, y, z)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QVector3D(x, y, z)));
}
/*!
@@ -1314,14 +1314,14 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
QScriptValue formatArg = ctxt->argument(1);
if (formatArg.isString()) {
QString format = formatArg.toString();
- return engine->newVariant(qVariantFromValue(date.toString(format)));
+ return engine->newVariant(QVariant::fromValue(date.toString(format)));
} else if (formatArg.isNumber()) {
enumFormat = Qt::DateFormat(formatArg.toUInt32());
} else {
return ctxt->throwError(QLatin1String("Qt.formatDate(): Invalid date format"));
}
}
- return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
+ return engine->newVariant(QVariant::fromValue(date.toString(enumFormat)));
}
/*!
@@ -1342,14 +1342,14 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
QScriptValue formatArg = ctxt->argument(1);
if (formatArg.isString()) {
QString format = formatArg.toString();
- return engine->newVariant(qVariantFromValue(date.toString(format)));
+ return engine->newVariant(QVariant::fromValue(date.toString(format)));
} else if (formatArg.isNumber()) {
enumFormat = Qt::DateFormat(formatArg.toUInt32());
} else {
return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid time format"));
}
}
- return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
+ return engine->newVariant(QVariant::fromValue(date.toString(enumFormat)));
}
/*!
@@ -1433,14 +1433,14 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
QScriptValue formatArg = ctxt->argument(1);
if (formatArg.isString()) {
QString format = formatArg.toString();
- return engine->newVariant(qVariantFromValue(date.toString(format)));
+ return engine->newVariant(QVariant::fromValue(date.toString(format)));
} else if (formatArg.isNumber()) {
enumFormat = Qt::DateFormat(formatArg.toUInt32());
} else {
return ctxt->throwError(QLatin1String("Qt.formatDateTime(): Invalid datetime format"));
}
}
- return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
+ return engine->newVariant(QVariant::fromValue(date.toString(enumFormat)));
}
#endif // QT_NO_DATESTRING
@@ -1469,7 +1469,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a)));
+ return qScriptValueFromValue(engine, QVariant::fromValue(QColor::fromRgbF(r, g, b, a)));
}
/*!
@@ -1497,7 +1497,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a)));
+ return qScriptValueFromValue(engine, QVariant::fromValue(QColor::fromHslF(h, s, l, a)));
}
/*!
@@ -1520,7 +1520,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
if (w < 0 || h < 0)
return engine->nullValue();
- return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QRectF(x, y, w, h)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
/*!
@@ -1533,7 +1533,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin
return ctxt->throwError(QLatin1String("Qt.point(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
- return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QPointF(x, y)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QPointF(x, y)));
}
/*!
@@ -1546,7 +1546,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine
return ctxt->throwError(QLatin1String("Qt.size(): Invalid arguments"));
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
- return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QSizeF(w, h)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QSizeF(w, h)));
}
/*!
@@ -1582,7 +1582,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
if (ctxt->argumentCount() == 2)
factor = ctxt->argument(1).toNumber();
color = color.lighter(int(qRound(factor*100.)));
- return qScriptValueFromValue(engine, qVariantFromValue(color));
+ return qScriptValueFromValue(engine, QVariant::fromValue(color));
}
/*!
@@ -1619,7 +1619,7 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi
if (ctxt->argumentCount() == 2)
factor = ctxt->argument(1).toNumber();
color = color.darker(int(qRound(factor*100.)));
- return qScriptValueFromValue(engine, qVariantFromValue(color));
+ return qScriptValueFromValue(engine, QVariant::fromValue(color));
}
/*!
@@ -1854,7 +1854,7 @@ QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine
a + inv_a * color.alphaF());
}
- return qScriptValueFromValue(engine, qVariantFromValue(finalColor));
+ return qScriptValueFromValue(engine, QVariant::fromValue(finalColor));
}
QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &val)
diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 45f277e..42b596a 100644
--- a/src/declarative/qml/qdeclarativesqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -237,7 +237,7 @@ static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEn
if (!qmlengine->sqlQueryClass)
qmlengine->sqlQueryClass = new QDeclarativeSqlQueryScriptClass(engine);
QScriptValue rows = engine->newObject(qmlengine->sqlQueryClass);
- rows.setData(engine->newVariant(qVariantFromValue(query)));
+ rows.setData(engine->newVariant(QVariant::fromValue(query)));
rows.setProperty(QLatin1String("item"), engine->newFunction(qmlsqldatabase_item,1), QScriptValue::SkipInEnumeration);
result.setProperty(QLatin1String("rows"),rows);
result.setProperty(QLatin1String("rowsAffected"),query.numRowsAffected());
@@ -275,7 +275,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri
QScriptValue instance = engine->newObject();
instance.setProperty(QLatin1String("executeSql"), engine->newFunction(qmlsqldatabase_executeSql,1));
- QScriptValue tx = engine->newVariant(instance,qVariantFromValue(db));
+ QScriptValue tx = engine->newVariant(instance,QVariant::fromValue(db));
QString foundvers = context->thisObject().property(QLatin1String("version")).toString();
if (from_version!=foundvers) {
@@ -319,7 +319,7 @@ static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, Q
QScriptValue instance = engine->newObject();
instance.setProperty(QLatin1String("executeSql"),
engine->newFunction(readOnly ? qmlsqldatabase_executeSql_readonly : qmlsqldatabase_executeSql,1));
- QScriptValue tx = engine->newVariant(instance,qVariantFromValue(db));
+ QScriptValue tx = engine->newVariant(instance,QVariant::fromValue(db));
db.transaction();
callback.call(QScriptValue(), QScriptValueList() << tx);
@@ -403,7 +403,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
instance.setProperty(QLatin1String("version"), version, QScriptValue::ReadOnly);
instance.setProperty(QLatin1String("changeVersion"), engine->newFunction(qmlsqldatabase_change_version,3));
- QScriptValue result = engine->newVariant(instance,qVariantFromValue(database));
+ QScriptValue result = engine->newVariant(instance,QVariant::fromValue(database));
if (created && dbcreationCallback.isFunction()) {
dbcreationCallback.call(QScriptValue(), QScriptValueList() << result);
diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp
index 7534a2c..8ec68ff 100644
--- a/src/declarative/qml/qdeclarativestringconverters.cpp
+++ b/src/declarative/qml/qdeclarativestringconverters.cpp
@@ -92,7 +92,7 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s)
QSizeF sz = sizeFFromString(s, &ok);
if (ok) return QVariant(sz);
QVector3D v = vector3DFromString(s, &ok);
- if (ok) return qVariantFromValue(v);
+ if (ok) return QVariant::fromValue(v);
return QVariant(s);
}
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index aec84a6..a42f131 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -331,7 +331,7 @@ QVariant QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(const QScri
QDeclarativeListModelWorkerAgent *agent = lm->agent();
if (agent) {
QDeclarativeListModelWorkerAgent::VariantRef v(agent);
- return qVariantFromValue(v);
+ return QVariant::fromValue(v);
} else {
return QVariant();
}
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index acd1f51..ff3b13b 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -508,7 +508,7 @@ QScriptValue Node::create(QScriptEngine *engine, NodeImpl *data)
node.d = data;
if (data) A(data);
- return engine->newVariant(instance, qVariantFromValue(node));
+ return engine->newVariant(instance, QVariant::fromValue(node));
}
QScriptValue Element::prototype(QScriptEngine *engine)
@@ -708,7 +708,7 @@ QScriptValue Document::load(QScriptEngine *engine, const QByteArray &data)
instance.setPrototype(Document::prototype(engine));
Node documentNode;
documentNode.d = document;
- return engine->newVariant(instance, qVariantFromValue(documentNode));
+ return engine->newVariant(instance, QVariant::fromValue(documentNode));
}
Node::Node()
@@ -759,7 +759,7 @@ QScriptValue NamedNodeMap::create(QScriptEngine *engine, NodeImpl *data, QList<N
map.list = list;
if (data) A(data);
- instance.setData(engine->newVariant(qVariantFromValue(map)));
+ instance.setData(engine->newVariant(QVariant::fromValue(map)));
if (!QDeclarativeScriptEngine::get(engine)->namedNodeMapClass)
QDeclarativeScriptEngine::get(engine)->namedNodeMapClass= new NamedNodeMapClass(engine);
@@ -816,7 +816,7 @@ QScriptValue NodeList::create(QScriptEngine *engine, NodeImpl *data)
list.d = data;
if (data) A(data);
- instance.setData(engine->newVariant(qVariantFromValue(list)));
+ instance.setData(engine->newVariant(QVariant::fromValue(list)));
if (!QDeclarativeScriptEngine::get(engine)->nodeListClass)
QDeclarativeScriptEngine::get(engine)->nodeListClass= new NodeListClass(engine);
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3ede335..596c53b 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -708,7 +708,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray &
{
ModelNode *n = nodes.top();
ModelNode *n2 = new ModelNode;
- n->values << qVariantFromValue(n2);
+ n->values << QVariant::fromValue(n2);
nodes.push(n2);
if (processingSet)
n->isArray = true;
@@ -1072,7 +1072,7 @@ bool NestedListModel::insert(int index, const QScriptValue& valuemap)
ModelNode *mn = new ModelNode;
mn->setObjectValue(valuemap);
- _root->values.insert(index,qVariantFromValue(mn));
+ _root->values.insert(index,QVariant::fromValue(mn));
return true;
}
@@ -1103,7 +1103,7 @@ bool NestedListModel::append(const QScriptValue& valuemap)
_root = new ModelNode;
ModelNode *mn = new ModelNode;
mn->setObjectValue(valuemap);
- _root->values << qVariantFromValue(mn);
+ _root->values << QVariant::fromValue(mn);
return true;
}
@@ -1252,7 +1252,7 @@ void ModelNode::setListValue(const QScriptValue& valuelist) {
} else {
value->values << v.toVariant();
}
- values.append(qVariantFromValue(value));
+ values.append(QVariant::fromValue(value));
}
}
diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp
index 7c13367..5b439a9 100644
--- a/src/gui/accessible/qaccessiblewidget.cpp
+++ b/src/gui/accessible/qaccessiblewidget.cpp
@@ -1015,7 +1015,7 @@ QVariant QAccessibleWidgetEx::invokeMethodEx(Method method, int child, const QVa
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods << ForegroundColor << BackgroundColor;
- return qVariantFromValue(set);
+ return QVariant::fromValue(set);
}
case ForegroundColor:
return widget()->palette().color(widget()->foregroundRole());
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index d7a7c89..da69bee 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1700,12 +1700,12 @@ void QGraphicsItem::setParentItem(QGraphicsItem *newParent)
return;
const QVariant newParentVariant(itemChange(QGraphicsItem::ItemParentChange,
- qVariantFromValue<QGraphicsItem *>(newParent)));
- newParent = qVariantValue<QGraphicsItem *>(newParentVariant);
+ QVariant::fromValue<QGraphicsItem *>(newParent)));
+ newParent = qvariant_cast<QGraphicsItem *>(newParentVariant);
if (newParent == d_ptr->parent)
return;
- const QVariant thisPointerVariant(qVariantFromValue<QGraphicsItem *>(this));
+ const QVariant thisPointerVariant(QVariant::fromValue<QGraphicsItem *>(this));
d_ptr->setParentItemHelper(newParent, &newParentVariant, &thisPointerVariant);
}
@@ -2125,7 +2125,7 @@ void QGraphicsItem::setToolTip(const QString &toolTip)
*/
QCursor QGraphicsItem::cursor() const
{
- return qVariantValue<QCursor>(d_ptr->extra(QGraphicsItemPrivate::ExtraCursor));
+ return qvariant_cast<QCursor>(d_ptr->extra(QGraphicsItemPrivate::ExtraCursor));
}
/*!
@@ -2145,8 +2145,8 @@ QCursor QGraphicsItem::cursor() const
*/
void QGraphicsItem::setCursor(const QCursor &cursor)
{
- const QVariant cursorVariant(itemChange(ItemCursorChange, qVariantFromValue<QCursor>(cursor)));
- d_ptr->setExtra(QGraphicsItemPrivate::ExtraCursor, qVariantValue<QCursor>(cursorVariant));
+ const QVariant cursorVariant(itemChange(ItemCursorChange, QVariant::fromValue<QCursor>(cursor)));
+ d_ptr->setExtra(QGraphicsItemPrivate::ExtraCursor, qvariant_cast<QCursor>(cursorVariant));
d_ptr->hasCursor = 1;
if (d_ptr->scene) {
d_ptr->scene->d_func()->allItemsUseDefaultCursor = false;
@@ -2272,7 +2272,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
// Schedule redrawing
if (update) {
- QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
+ QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
if (c)
c->purge();
if (scene) {
@@ -3691,7 +3691,7 @@ void QGraphicsItem::setPos(const QPointF &pos)
}
// Notify the item that the position is changing.
- const QVariant newPosVariant(itemChange(ItemPositionChange, qVariantFromValue<QPointF>(pos)));
+ const QVariant newPosVariant(itemChange(ItemPositionChange, QVariant::fromValue<QPointF>(pos)));
QPointF newPos = newPosVariant.toPointF();
if (newPos == d_ptr->pos)
return;
@@ -4045,7 +4045,7 @@ void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
if (d_ptr->flags & ItemSendsGeometryChanges) {
// Notify the item that the origin point is changing.
const QVariant newOriginVariant(itemChange(ItemTransformOriginPointChange,
- qVariantFromValue<QPointF>(origin)));
+ QVariant::fromValue<QPointF>(origin)));
newOrigin = newOriginVariant.toPointF();
}
@@ -4064,7 +4064,7 @@ void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
// Send post-notification.
if (d_ptr->flags & ItemSendsGeometryChanges)
- itemChange(ItemTransformOriginPointHasChanged, qVariantFromValue<QPointF>(newOrigin));
+ itemChange(ItemTransformOriginPointHasChanged, QVariant::fromValue<QPointF>(newOrigin));
}
/*!
@@ -4326,8 +4326,8 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
}
// Notify the item that the transformation matrix is changing.
- const QVariant newMatrixVariant = qVariantFromValue<QMatrix>(newTransform.toAffine());
- newTransform = QTransform(qVariantValue<QMatrix>(itemChange(ItemMatrixChange, newMatrixVariant)));
+ const QVariant newMatrixVariant = QVariant::fromValue<QMatrix>(newTransform.toAffine());
+ newTransform = QTransform(qvariant_cast<QMatrix>(itemChange(ItemMatrixChange, newMatrixVariant)));
if (d_ptr->transformData->transform == newTransform)
return;
@@ -4335,7 +4335,7 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
d_ptr->setTransformHelper(newTransform);
// Send post-notification.
- itemChange(ItemTransformHasChanged, qVariantFromValue<QTransform>(newTransform));
+ itemChange(ItemTransformHasChanged, QVariant::fromValue<QTransform>(newTransform));
}
/*!
@@ -4376,8 +4376,8 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine)
// Notify the item that the transformation matrix is changing.
const QVariant newTransformVariant(itemChange(ItemTransformChange,
- qVariantFromValue<QTransform>(newTransform)));
- newTransform = qVariantValue<QTransform>(newTransformVariant);
+ QVariant::fromValue<QTransform>(newTransform)));
+ newTransform = qvariant_cast<QTransform>(newTransformVariant);
if (d_ptr->transformData->transform == newTransform)
return;
@@ -5230,7 +5230,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c
qreal QGraphicsItem::boundingRegionGranularity() const
{
return d_ptr->hasBoundingRegionGranularity
- ? qVariantValue<qreal>(d_ptr->extra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity))
+ ? qvariant_cast<qreal>(d_ptr->extra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity))
: 0;
}
@@ -5266,7 +5266,7 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
}
d_ptr->hasBoundingRegionGranularity = 1;
d_ptr->setExtra(QGraphicsItemPrivate::ExtraBoundingRegionGranularity,
- qVariantFromValue<qreal>(granularity));
+ QVariant::fromValue<qreal>(granularity));
}
/*!
@@ -5441,7 +5441,7 @@ void QGraphicsItemPrivate::removeChild(QGraphicsItem *child)
*/
QGraphicsItemCache *QGraphicsItemPrivate::maybeExtraItemCache() const
{
- return (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
+ return (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
}
/*!
@@ -5449,11 +5449,11 @@ QGraphicsItemCache *QGraphicsItemPrivate::maybeExtraItemCache() const
*/
QGraphicsItemCache *QGraphicsItemPrivate::extraItemCache() const
{
- QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
+ QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
if (!c) {
QGraphicsItemPrivate *that = const_cast<QGraphicsItemPrivate *>(this);
c = new QGraphicsItemCache;
- that->setExtra(ExtraCacheData, qVariantFromValue<void *>(c));
+ that->setExtra(ExtraCacheData, QVariant::fromValue<void *>(c));
}
return c;
}
@@ -5463,7 +5463,7 @@ QGraphicsItemCache *QGraphicsItemPrivate::extraItemCache() const
*/
void QGraphicsItemPrivate::removeExtraItemCache()
{
- QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue<void *>(extra(ExtraCacheData));
+ QGraphicsItemCache *c = (QGraphicsItemCache *)qvariant_cast<void *>(extra(ExtraCacheData));
if (c) {
c->purge();
delete c;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 48a0093..654f60f 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2543,8 +2543,8 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Notify the item that its scene is changing, and allow the item to
// react.
const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange,
- qVariantFromValue<QGraphicsScene *>(this)));
- QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(newSceneVariant);
+ QVariant::fromValue<QGraphicsScene *>(this)));
+ QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
if (targetScene != this) {
if (targetScene && item->d_ptr->scene != targetScene)
targetScene->addItem(item);
@@ -2955,8 +2955,8 @@ void QGraphicsScene::removeItem(QGraphicsItem *item)
// Notify the item that it's scene is changing to 0, allowing the item to
// react.
const QVariant newSceneVariant(item->itemChange(QGraphicsItem::ItemSceneChange,
- qVariantFromValue<QGraphicsScene *>(0)));
- QGraphicsScene *targetScene = qVariantValue<QGraphicsScene *>(newSceneVariant);
+ QVariant::fromValue<QGraphicsScene *>(0)));
+ QGraphicsScene *targetScene = qvariant_cast<QGraphicsScene *>(newSceneVariant);
if (targetScene != 0 && targetScene != this) {
targetScene->addItem(item);
return;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index ec56af2..03ee902 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1092,7 +1092,7 @@ QColor QImageReader::backgroundColor() const
if (!d->initHandler())
return QColor();
if (d->handler->supportsOption(QImageIOHandler::BackgroundColor))
- return qVariantValue<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
+ return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
return QColor();
}
diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp
index cf53af0..40f1b54 100644
--- a/src/gui/image/qmnghandler.cpp
+++ b/src/gui/image/qmnghandler.cpp
@@ -481,7 +481,7 @@ void QMngHandler::setOption(ImageOption option, const QVariant & value)
{
Q_D(QMngHandler);
if (option == QImageIOHandler::BackgroundColor)
- d->setBackgroundColor(qVariantValue<QColor>(value));
+ d->setBackgroundColor(qvariant_cast<QColor>(value));
}
/*! \reimp */
diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp
index 0ea6d67..edbeeb8 100644
--- a/src/gui/itemviews/qabstractitemdelegate.cpp
+++ b/src/gui/itemviews/qabstractitemdelegate.cpp
@@ -362,7 +362,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
case QEvent::ToolTip: {
QHelpEvent *he = static_cast<QHelpEvent*>(event);
QVariant tooltip = index.data(Qt::ToolTipRole);
- if (qVariantCanConvert<QString>(tooltip)) {
+ if (tooltip.canConvert<QString>()) {
QToolTip::showText(he->globalPos(), tooltip.toString(), view);
return true;
}
@@ -376,7 +376,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
case QEvent::WhatsThis: {
QHelpEvent *he = static_cast<QHelpEvent*>(event);
QVariant whatsthis = index.data(Qt::WhatsThisRole);
- if (qVariantCanConvert<QString>(whatsthis)) {
+ if (whatsthis.canConvert<QString>()) {
QWhatsThis::showText(he->globalPos(), whatsthis.toString(), view);
return true;
}
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 67854a3..7eb3ddc 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -2105,7 +2105,7 @@ void QHeaderView::paintEvent(QPaintEvent *e)
QVariant variant = d->model->headerData(logical, d->orientation,
Qt::FontRole);
- if (variant.isValid() && qVariantCanConvert<QFont>(variant)) {
+ if (variant.isValid() && variant.canConvert<QFont>()) {
QFont sectionFont = qvariant_cast<QFont>(variant);
painter.setFont(sectionFont);
}
@@ -2485,13 +2485,13 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical
opt.icon = qvariant_cast<QPixmap>(variant);
QVariant foregroundBrush = d->model->headerData(logicalIndex, d->orientation,
Qt::ForegroundRole);
- if (qVariantCanConvert<QBrush>(foregroundBrush))
+ if (foregroundBrush.canConvert<QBrush>())
opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush));
QPointF oldBO = painter->brushOrigin();
QVariant backgroundBrush = d->model->headerData(logicalIndex, d->orientation,
Qt::BackgroundRole);
- if (qVariantCanConvert<QBrush>(backgroundBrush)) {
+ if (backgroundBrush.canConvert<QBrush>()) {
opt.palette.setBrush(QPalette::Button, qvariant_cast<QBrush>(backgroundBrush));
opt.palette.setBrush(QPalette::Window, qvariant_cast<QBrush>(backgroundBrush));
painter->setBrushOrigin(opt.rect.topLeft());
@@ -2552,7 +2552,7 @@ QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const
QVariant var = d->model->headerData(logicalIndex, d->orientation,
Qt::FontRole);
QFont fnt;
- if (var.isValid() && qVariantCanConvert<QFont>(var))
+ if (var.isValid() && var.canConvert<QFont>())
fnt = qvariant_cast<QFont>(var);
else
fnt = font();
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 9bbfc23..bd2b401 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -850,7 +850,7 @@ void QItemDelegate::drawBackground(QPainter *painter,
painter->fillRect(option.rect, option.palette.brush(cg, QPalette::Highlight));
} else {
QVariant value = index.data(Qt::BackgroundRole);
- if (qVariantCanConvert<QBrush>(value)) {
+ if (value.canConvert<QBrush>()) {
QPointF oldBO = painter->brushOrigin();
painter->setBrushOrigin(option.rect.topLeft());
painter->fillRect(option.rect, qvariant_cast<QBrush>(value));
@@ -1326,7 +1326,7 @@ QStyleOptionViewItem QItemDelegate::setOptions(const QModelIndex &index,
// set foreground brush
value = index.data(Qt::ForegroundRole);
- if (qVariantCanConvert<QBrush>(value))
+ if (value.canConvert<QBrush>())
opt.palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
return opt;
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index 880f8ab..115c734 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -326,7 +326,7 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
option->displayAlignment = Qt::Alignment(value.toInt());
value = index.data(Qt::ForegroundRole);
- if (qVariantCanConvert<QBrush>(value))
+ if (value.canConvert<QBrush>())
option->palette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
if (QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *>(option)) {
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index f7c0b6e..8c7c333 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -631,7 +631,7 @@ QByteArray QMimeDataWrapper::encodedData(const char *format) const
return data->data(QLatin1String(format));
} else{
QVariant variant = data->imageData();
- QImage img = qVariantValue<QImage>(variant);
+ QImage img = qvariant_cast<QImage>(variant);
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp
index c8fcf45..88fdbc6 100644
--- a/src/gui/kernel/qtooltip.cpp
+++ b/src/gui/kernel/qtooltip.cpp
@@ -353,7 +353,7 @@ void QTipLabel::placeTip(const QPoint &pos, QWidget *w)
#ifndef QT_NO_STYLE_STYLESHEET
if (testAttribute(Qt::WA_StyleSheet) || (w && qobject_cast<QStyleSheetStyle *>(w->style()))) {
//the stylesheet need to know the real parent
- QTipLabel::instance->setProperty("_q_stylesheet_parent", qVariantFromValue(w));
+ QTipLabel::instance->setProperty("_q_stylesheet_parent", QVariant::fromValue(w));
//we force the style to be the QStyleSheetStyle, and force to clear the cache as well.
QTipLabel::instance->setStyleSheet(QLatin1String("/* */"));
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index 3a4c94c..d4a8213 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -130,7 +130,7 @@ QPaintBufferPrivate::~QPaintBufferPrivate()
for (int i = 0; i < commands.size(); ++i) {
const QPaintBufferCommand &cmd = commands.at(i);
if (cmd.id == QPaintBufferPrivate::Cmd_DrawTextItem)
- delete reinterpret_cast<QTextItemIntCopy *>(qVariantValue<void *>(variants.at(cmd.offset)));
+ delete reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(variants.at(cmd.offset)));
}
}
@@ -330,7 +330,7 @@ QString QPaintBuffer::commandDescription(int command) const
break; }
case QPaintBufferPrivate::Cmd_SetBrush: {
- QBrush brush = qVariantValue<QBrush>(d_ptr->variants.at(cmd.offset));
+ QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.offset));
debug << "Cmd_SetBrush: " << brush;
break; }
@@ -354,27 +354,27 @@ QString QPaintBuffer::commandDescription(int command) const
break; }
case QPaintBufferPrivate::Cmd_StrokeVectorPath: {
- QPen pen = qVariantValue<QPen>(d_ptr->variants.at(cmd.extra));
+ QPen pen = qvariant_cast<QPen>(d_ptr->variants.at(cmd.extra));
debug << "ExCmd_StrokeVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
<< "pts/elms:" << cmd.offset << cmd.offset2 << pen;
break; }
case QPaintBufferPrivate::Cmd_FillVectorPath: {
- QBrush brush = qVariantValue<QBrush>(d_ptr->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.extra));
debug << "ExCmd_FillVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
<< "pts/elms:" << cmd.offset << cmd.offset2 << brush;
break; }
case QPaintBufferPrivate::Cmd_FillRectBrush: {
- QBrush brush = qVariantValue<QBrush>(d_ptr->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d_ptr->floats.constData() + cmd.offset);
debug << "ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
break; }
case QPaintBufferPrivate::Cmd_FillRectColor: {
- QColor color = qVariantValue<QColor>(d_ptr->variants.at(cmd.extra));
+ QColor color = qvariant_cast<QColor>(d_ptr->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d_ptr->floats.constData() + cmd.offset);
debug << "ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
break; }
@@ -451,12 +451,12 @@ QString QPaintBuffer::commandDescription(int command) const
break; }
case QPaintBufferPrivate::Cmd_SetPen: {
- QPen pen = qVariantValue<QPen>(d_ptr->variants.at(cmd.offset));
+ QPen pen = qvariant_cast<QPen>(d_ptr->variants.at(cmd.offset));
debug << "Cmd_SetPen: " << pen;
break; }
case QPaintBufferPrivate::Cmd_SetTransform: {
- QTransform xform = qVariantValue<QTransform>(d_ptr->variants.at(cmd.offset));
+ QTransform xform = qvariant_cast<QTransform>(d_ptr->variants.at(cmd.offset));
debug << "Cmd_SetTransform, offset: " << cmd.offset << xform;
break; }
@@ -532,7 +532,7 @@ QString QPaintBuffer::commandDescription(int command) const
case QPaintBufferPrivate::Cmd_DrawTextItem: {
QPointF pos(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1));
- QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qVariantValue<void *>(d_ptr->variants.at(cmd.offset)));
+ QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(d_ptr->variants.at(cmd.offset)));
QTextItemInt &ti = (*tiCopy)();
QString text(ti.text());
@@ -1287,7 +1287,7 @@ void QPaintBufferEngine::drawTextItem(const QPointF &pos, const QTextItem &ti)
qDebug() << "QPaintBufferEngine: drawTextItem: pos:" << pos << ti.text();
#endif
if (m_stream_raw_text_items) {
- QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTextItem, qVariantFromValue<void *>(new QTextItemIntCopy(ti)));
+ QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTextItem, QVariant::fromValue<void *>(new QTextItemIntCopy(ti)));
QFont font(ti.font());
font.setUnderline(false);
@@ -1429,7 +1429,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_SetPen: {
- QPen pen = qVariantValue<QPen>(d->variants.at(cmd.offset));
+ QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.offset));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_SetPen: " << pen;
#endif
@@ -1437,7 +1437,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_SetBrush: {
- QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.offset));
+ QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.offset));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_SetBrush: " << brush;
#endif
@@ -1452,7 +1452,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_SetTransform: {
- QTransform xform = qVariantValue<QTransform>(d->variants.at(cmd.offset));
+ QTransform xform = qvariant_cast<QTransform>(d->variants.at(cmd.offset));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_SetTransform, offset: " << cmd.offset << xform;
#endif
@@ -1520,7 +1520,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_StrokeVectorPath: {
- QPen pen = qVariantValue<QPen>(d->variants.at(cmd.extra));
+ QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.extra));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_StrokeVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
@@ -1531,7 +1531,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillVectorPath: {
- QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_FillVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
@@ -1705,7 +1705,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillRectBrush: {
- QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
@@ -1714,7 +1714,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillRectColor: {
- QColor color = qVariantValue<QColor>(d->variants.at(cmd.extra));
+ QColor color = qvariant_cast<QColor>(d->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
@@ -1790,7 +1790,7 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd)
case QPaintBufferPrivate::Cmd_DrawTextItem: {
QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
- QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qVariantValue<void *>(d->variants.at(cmd.offset)));
+ QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(d->variants.at(cmd.offset)));
QTextItemInt &ti = (*tiCopy)();
QString text(ti.text());
@@ -1885,7 +1885,7 @@ void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_StrokeVectorPath: {
- QPen pen = qVariantValue<QPen>(d->variants.at(cmd.extra));
+ QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.extra));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> ExCmd_StrokeVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
@@ -1896,7 +1896,7 @@ void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillVectorPath: {
- QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> ExCmd_FillVectorPath: size: " << cmd.size
// << ", hints:" << d->ints[cmd.offset2+cmd.size]
@@ -1907,7 +1907,7 @@ void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillRectBrush: {
- QBrush brush = qVariantValue<QBrush>(d->variants.at(cmd.extra));
+ QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
@@ -1916,7 +1916,7 @@ void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
break; }
case QPaintBufferPrivate::Cmd_FillRectColor: {
- QColor color = qVariantValue<QColor>(d->variants.at(cmd.extra));
+ QColor color = qvariant_cast<QColor>(d->variants.at(cmd.extra));
QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
#ifdef QPAINTBUFFER_DEBUG_DRAW
qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 5d984cf..272fb26 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -2583,7 +2583,7 @@ void QStyleSheetStyle::unsetPalette(QWidget *w)
}
QVariant oldFont = w->property("_q_styleSheetWidgetFont");
if (oldFont.isValid()) {
- w->setFont(qVariantValue<QFont>(oldFont));
+ w->setFont(qvariant_cast<QFont>(oldFont));
}
if (autoFillDisabledWidgets->contains(w)) {
embeddedWidget(w)->setAutoFillBackground(true);
@@ -5067,7 +5067,7 @@ QIcon QStyleSheetStyle::standardIconImplementation(StandardPixmap standardIcon,
if (!s.isEmpty()) {
QRenderRule rule = renderRule(w, opt);
if (rule.hasStyleHint(s))
- return qVariantValue<QIcon>(rule.styleHint(s));
+ return qvariant_cast<QIcon>(rule.styleHint(s));
}
return baseStyle()->standardIcon(standardIcon, opt, w);
}
@@ -5085,7 +5085,7 @@ QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QS
if (!s.isEmpty()) {
QRenderRule rule = renderRule(w, opt);
if (rule.hasStyleHint(s)) {
- QIcon icon = qVariantValue<QIcon>(rule.styleHint(s));
+ QIcon icon = qvariant_cast<QIcon>(rule.styleHint(s));
return icon.pixmap(16, 16); // ###: unhard-code this if someone complains
}
}
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 39c4053..3fc6722 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -403,7 +403,7 @@ int ValueExtractor::lengthValue(const Declaration &decl)
if (decl.d->values.count() < 1)
return 0;
LengthData data = lengthValue(decl.d->values.at(0));
- decl.d->parsed = qVariantFromValue<LengthData>(data);
+ decl.d->parsed = QVariant::fromValue<LengthData>(data);
return lengthValueFromData(data,f);
}
@@ -435,7 +435,7 @@ void ValueExtractor::lengthValues(const Declaration &decl, int *m)
QList<QVariant> v;
for (i = 0; i < 4; i++) {
- v += qVariantFromValue<LengthData>(datas[i]);
+ v += QVariant::fromValue<LengthData>(datas[i]);
m[i] = lengthValueFromData(datas[i], f);
}
decl.d->parsed = v;
@@ -541,7 +541,7 @@ QSize ValueExtractor::sizeValue(const Declaration &decl)
else
x[1] = x[0];
QList<QVariant> v;
- v << qVariantFromValue<LengthData>(x[0]) << qVariantFromValue<LengthData>(x[1]);
+ v << QVariant::fromValue<LengthData>(x[0]) << qVariantFromValue<LengthData>(x[1]);
decl.d->parsed = v;
return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f));
}
@@ -916,7 +916,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
data.width = lengthValue(decl.d->values.at(i));
*width = lengthValueFromData(data.width, f);
if (++i >= decl.d->values.count()) {
- decl.d->parsed = qVariantFromValue<BorderData>(data);
+ decl.d->parsed = QVariant::fromValue<BorderData>(data);
return;
}
}
@@ -925,7 +925,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
if (data.style != BorderStyle_Unknown) {
*style = data.style;
if (++i >= decl.d->values.count()) {
- decl.d->parsed = qVariantFromValue<BorderData>(data);
+ decl.d->parsed = QVariant::fromValue<BorderData>(data);
return;
}
} else {
@@ -935,7 +935,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord
data.color = parseBrushValue(decl.d->values.at(i), pal);
*color = brushFromData(data.color, pal);
if (data.color.type != BrushData::DependsOnThePalette)
- decl.d->parsed = qVariantFromValue<BorderData>(data);
+ decl.d->parsed = QVariant::fromValue<BorderData>(data);
}
static void parseShorthandBackgroundProperty(const QVector<Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal)
@@ -1033,7 +1033,7 @@ bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *re
*brush = brushFromData(brushData, pal);
if (brushData.type != BrushData::DependsOnThePalette) {
BackgroundData data = { brushData, *image, *repeat, *alignment };
- decl.d->parsed = qVariantFromValue<BackgroundData>(data);
+ decl.d->parsed = QVariant::fromValue<BackgroundData>(data);
}
}
break;
@@ -1311,10 +1311,10 @@ QColor Declaration::colorValue(const QPalette &pal) const
ColorData color = parseColorValue(d->values.at(0));
if(color.type == ColorData::Role) {
- d->parsed = qVariantFromValue<int>(color.role);
+ d->parsed = QVariant::fromValue<int>(color.role);
return pal.color((QPalette::ColorRole)(color.role));
} else {
- d->parsed = qVariantFromValue<QColor>(color.color);
+ d->parsed = QVariant::fromValue<QColor>(color.color);
return color.color;
}
}
@@ -1334,11 +1334,11 @@ QBrush Declaration::brushValue(const QPalette &pal) const
BrushData data = parseBrushValue(d->values.at(0), pal);
if(data.type == BrushData::Role) {
- d->parsed = qVariantFromValue<int>(data.role);
+ d->parsed = QVariant::fromValue<int>(data.role);
return pal.color((QPalette::ColorRole)(data.role));
} else {
if (data.type != BrushData::DependsOnThePalette)
- d->parsed = qVariantFromValue<QBrush>(data.brush);
+ d->parsed = QVariant::fromValue<QBrush>(data.brush);
return data.brush;
}
}
@@ -1368,11 +1368,11 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const
continue;
BrushData data = parseBrushValue(d->values.at(i), pal);
if(data.type == BrushData::Role) {
- v += qVariantFromValue<int>(data.role);
+ v += QVariant::fromValue<int>(data.role);
c[i] = pal.color((QPalette::ColorRole)(data.role));
} else {
if (data.type != BrushData::DependsOnThePalette) {
- v += qVariantFromValue<QBrush>(data.brush);
+ v += QVariant::fromValue<QBrush>(data.brush);
} else {
v += QVariant();
}
@@ -1445,7 +1445,7 @@ QSize Declaration::sizeValue() const
else
x[1] = x[0];
QSize size(x[0], x[1]);
- d->parsed = qVariantFromValue<QSize>(size);
+ d->parsed = QVariant::fromValue<QSize>(size);
return size;
}
@@ -1467,7 +1467,7 @@ QRect Declaration::rectValue() const
if (args.count() != 4)
return QRect();
QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
- d->parsed = qVariantFromValue<QRect>(rect);
+ d->parsed = QVariant::fromValue<QRect>(rect);
return rect;
}
@@ -1488,10 +1488,10 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const
for (i = 0; i < qMin(d->values.count(), 4); i++) {
ColorData color = parseColorValue(d->values.at(i));
if(color.type == ColorData::Role) {
- v += qVariantFromValue<int>(color.role);
+ v += QVariant::fromValue<int>(color.role);
c[i] = pal.color((QPalette::ColorRole)(color.role));
} else {
- v += qVariantFromValue<QColor>(color.color);
+ v += QVariant::fromValue<QColor>(color.color);
c[i] = color.color;
}
}
@@ -1683,7 +1683,7 @@ QIcon Declaration::iconValue() const
i++;
}
- d->parsed = qVariantFromValue<QIcon>(icon);
+ d->parsed = QVariant::fromValue<QIcon>(icon);
return icon;
}
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 3d34687..32b1df9 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -2908,7 +2908,7 @@ QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext(QWidget
if (widget)
style = widget->style();
style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret);
- selection.format = qVariantValue<QTextFormat>(ret.variant).toCharFormat();
+ selection.format = qvariant_cast<QTextFormat>(ret.variant).toCharFormat();
} else {
QPalette::ColorGroup cg = d->hasFocus ? QPalette::Active : QPalette::Inactive;
selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight));
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 46db253..e0a4096 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -925,7 +925,7 @@ qreal QTextFormat::doubleProperty(int propertyId) const
const QVariant prop = d->property(propertyId);
if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float)
return 0.;
- return qVariantValue<qreal>(prop);
+ return qvariant_cast<qreal>(prop);
}
/*!
@@ -1895,7 +1895,7 @@ void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs)
QList<QTextOption::Tab>::ConstIterator iter = tabs.constBegin();
while (iter != tabs.constEnd()) {
QVariant v;
- qVariantSetValue<QTextOption::Tab>(v, *iter);
+ v.setValue<QTextOption::Tab>(*iter);
list.append(v);
++iter;
}
@@ -1917,7 +1917,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant);
QList<QVariant>::Iterator iter = variantsList.begin();
while(iter != variantsList.end()) {
- answer.append( qVariantValue<QTextOption::Tab>(*iter));
+ answer.append( qvariant_cast<QTextOption::Tab>(*iter));
++iter;
}
return answer;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 88b3467..bb2da9a 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -116,7 +116,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu"));
QVariant value = index.data(Qt::ForegroundRole);
- if (qVariantCanConvert<QBrush>(value)) {
+ if (value.canConvert<QBrush>()) {
resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast<QBrush>(value));
resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(value));
resolvedpalette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value));
@@ -152,7 +152,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
menuOption.icon = qvariant_cast<QPixmap>(variant);
break;
}
- if (qVariantCanConvert<QBrush>(index.data(Qt::BackgroundRole))) {
+ if (index.data(Qt::BackgroundRole).canConvert<QBrush>()) {
menuOption.palette.setBrush(QPalette::All, QPalette::Background,
qvariant_cast<QBrush>(index.data(Qt::BackgroundRole)));
}
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
index 1fc13a6..6cdf7c0 100644
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ b/src/multimedia/video/qvideosurfaceformat.cpp
@@ -502,11 +502,11 @@ QList<QByteArray> QVideoSurfaceFormat::propertyNames() const
QVariant QVideoSurfaceFormat::property(const char *name) const
{
if (qstrcmp(name, "handleType") == 0) {
- return qVariantFromValue(d->handleType);
+ return QVariant::fromValue(d->handleType);
} else if (qstrcmp(name, "pixelFormat") == 0) {
- return qVariantFromValue(d->pixelFormat);
+ return QVariant::fromValue(d->pixelFormat);
} else if (qstrcmp(name, "handleType") == 0) {
- return qVariantFromValue(d->handleType);
+ return QVariant::fromValue(d->handleType);
} else if (qstrcmp(name, "frameSize") == 0) {
return d->frameSize;
} else if (qstrcmp(name, "frameWidth") == 0) {
@@ -516,15 +516,15 @@ QVariant QVideoSurfaceFormat::property(const char *name) const
} else if (qstrcmp(name, "viewport") == 0) {
return d->viewport;
} else if (qstrcmp(name, "scanLineDirection") == 0) {
- return qVariantFromValue(d->scanLineDirection);
+ return QVariant::fromValue(d->scanLineDirection);
} else if (qstrcmp(name, "frameRate") == 0) {
- return qVariantFromValue(d->frameRate);
+ return QVariant::fromValue(d->frameRate);
} else if (qstrcmp(name, "pixelAspectRatio") == 0) {
- return qVariantFromValue(d->pixelAspectRatio);
+ return QVariant::fromValue(d->pixelAspectRatio);
} else if (qstrcmp(name, "sizeHint") == 0) {
return sizeHint();
} else if (qstrcmp(name, "yCbCrColorSpace") == 0) {
- return qVariantFromValue(d->ycbcrColorSpace);
+ return QVariant::fromValue(d->ycbcrColorSpace);
} else {
int id = 0;
for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {}
@@ -546,7 +546,7 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value)
} else if (qstrcmp(name, "pixelFormat") == 0) {
// read only.
} else if (qstrcmp(name, "frameSize") == 0) {
- if (qVariantCanConvert<QSize>(value)) {
+ if (value.canConvert<QSize>()) {
d->frameSize = qvariant_cast<QSize>(value);
d->viewport = QRect(QPoint(0, 0), d->frameSize);
}
@@ -555,21 +555,21 @@ void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value)
} else if (qstrcmp(name, "frameHeight") == 0) {
// read only.
} else if (qstrcmp(name, "viewport") == 0) {
- if (qVariantCanConvert<QRect>(value))
+ if (value.canConvert<QRect>())
d->viewport = qvariant_cast<QRect>(value);
} else if (qstrcmp(name, "scanLineDirection") == 0) {
- if (qVariantCanConvert<Direction>(value))
+ if (value.canConvert<Direction>())
d->scanLineDirection = qvariant_cast<Direction>(value);
} else if (qstrcmp(name, "frameRate") == 0) {
- if (qVariantCanConvert<qreal>(value))
+ if (value.canConvert<qreal>())
d->frameRate = qvariant_cast<qreal>(value);
} else if (qstrcmp(name, "pixelAspectRatio") == 0) {
- if (qVariantCanConvert<QSize>(value))
+ if (value.canConvert<QSize>())
d->pixelAspectRatio = qvariant_cast<QSize>(value);
} else if (qstrcmp(name, "sizeHint") == 0) {
// read only.
} else if (qstrcmp(name, "yCbCrColorSpace") == 0) {
- if (qVariantCanConvert<YCbCrColorSpace>(value))
+ if (value.canConvert<YCbCrColorSpace>())
d->ycbcrColorSpace = qvariant_cast<YCbCrColorSpace>(value);
} else {
int id = 0;
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 80b74c7..f1054bd 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -991,7 +991,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
if (d->cookieJar) {
QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+ request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookies));
}
}
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index fa592c2..f4284b8 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -768,7 +768,7 @@ static QVariant parseCookieHeader(const QByteArray &raw)
result += parsed;
}
- return qVariantFromValue(result);
+ return QVariant::fromValue(result);
}
static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QByteArray &value)
@@ -801,7 +801,7 @@ static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QBy
return parseCookieHeader(value);
case QNetworkRequest::SetCookieHeader:
- return qVariantFromValue(QNetworkCookie::parseCookies(value));
+ return QVariant::fromValue(QNetworkCookie::parseCookies(value));
default:
Q_ASSERT(0);
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
index 662663d..6eb0617 100644
--- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp
@@ -348,7 +348,7 @@ QVariant QAccessibleTextEdit::invokeMethodEx(QAccessible::Method method, int chi
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods << SetCursorPosition << GetCursorPosition;
- return qVariantFromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
+ return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
}
case SetCursorPosition:
diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp
index 4cd171b..bf7b561 100644
--- a/src/plugins/accessible/widgets/rangecontrols.cpp
+++ b/src/plugins/accessible/widgets/rangecontrols.cpp
@@ -233,7 +233,7 @@ QVariant QAccessibleAbstractSpinBox::invokeMethodEx(Method method, int child, co
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods;
- return qVariantFromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
+ return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
}
default:
@@ -814,7 +814,7 @@ QVariant QAccessibleAbstractSlider::invokeMethodEx(Method method, int child, con
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods;
- return qVariantFromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
+ return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
}
default:
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index f39d538..d8b57af 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -732,7 +732,7 @@ QVariant QAccessibleLineEdit::invokeMethodEx(QAccessible::Method method, int chi
case ListSupportedMethods: {
QSet<QAccessible::Method> set;
set << ListSupportedMethods << SetCursorPosition << GetCursorPosition;
- return qVariantFromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
+ return QVariant::fromValue(set | qvariant_cast<QSet<QAccessible::Method> >(
QAccessibleWidgetEx::invokeMethodEx(method, child, params)));
}
case SetCursorPosition:
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index b20e7c1..da421bc 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -953,10 +953,10 @@ bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVarian
// QList<QVariant> args;
qWarning() << __FUNCTION__ << name << value.variant();
-// args << qVariantFromValue(name);
-// args << qVariantFromValue(value);
+// args << QVariant::fromValue(name);
+// args << QVariant::fromValue(value);
- QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, qVariantFromValue(value));
+ QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, QVariant::fromValue(value));
qWarning() << reply.errorMessage();
return true;
@@ -1020,7 +1020,7 @@ quint16 QConnmanDeviceInterface::getScanInterval()
bool QConnmanDeviceInterface::setScanInterval(const QString & interval)
{
// QList<QVariant> args;
-// args << qVariantFromValue(name)
+// args << QVariant::fromValue(name)
// << value.variant();
// QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args);
@@ -1043,8 +1043,8 @@ QStringList QConnmanDeviceInterface::getNetworks()
bool QConnmanDeviceInterface::setEnabled(bool powered)
{
QList<QVariant> args;
- args << qVariantFromValue(QString("Powered"))
- << qVariantFromValue(QDBusVariant(powered));
+ args << QVariant::fromValue(QString("Powered"))
+ << QVariant::fromValue(QDBusVariant(powered));
QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args);
qWarning() << reply.errorMessage() << reply.errorName();
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 01f3c51..a7a20c1 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -1711,7 +1711,7 @@ QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue valu
return variantValue(value);
#ifndef QT_NO_QOBJECT
else if (isQObject(value))
- return qVariantFromValue(toQObject(exec, value));
+ return QVariant::fromValue(toQObject(exec, value));
#endif
else if (isDate(value))
return QVariant(toDateTime(exec, value));
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index dd229f1..28f7bd1 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -211,7 +211,7 @@ JSC::JSValue JSC_HOST_CALL ClassObjectDelegate::call(JSC::ExecState *exec, JSC::
eng_p->pushContext(exec, thisValue, args, callee);
QScriptContext *ctx = eng_p->contextForFrame(eng_p->currentFrame);
QScriptValue scriptObject = eng_p->scriptValueFromJSCValue(obj);
- QVariant result = scriptClass->extension(QScriptClass::Callable, qVariantFromValue(ctx));
+ QVariant result = scriptClass->extension(QScriptClass::Callable, QVariant::fromValue(ctx));
eng_p->popContext();
eng_p->currentFrame = oldFrame;
return QScriptEnginePrivate::jscValueFromVariant(exec, result);
@@ -239,7 +239,7 @@ JSC::JSObject* ClassObjectDelegate::construct(JSC::ExecState *exec, JSC::JSObjec
QScriptContext *ctx = eng_p->contextForFrame(eng_p->currentFrame);
QScriptValue defaultObject = ctx->thisObject();
- QScriptValue result = qvariant_cast<QScriptValue>(scriptClass->extension(QScriptClass::Callable, qVariantFromValue(ctx)));
+ QScriptValue result = qvariant_cast<QScriptValue>(scriptClass->extension(QScriptClass::Callable, QVariant::fromValue(ctx)));
if (!result.isObject())
result = defaultObject;
eng_p->popContext();
@@ -256,7 +256,7 @@ bool ClassObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecState *exe
QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec);
QScript::SaveFrameHelper saveFrame(eng_p, exec);
args << eng_p->scriptValueFromJSCValue(object) << eng_p->scriptValueFromJSCValue(value);
- QVariant result = scriptClass()->extension(QScriptClass::HasInstance, qVariantFromValue(args));
+ QVariant result = scriptClass()->extension(QScriptClass::HasInstance, QVariant::fromValue(args));
return result.toBool();
}
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 9e26fbf..d24f2fe 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -664,7 +664,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c
if (actual.isNumber()) {
int ival = QScriptEnginePrivate::toInt32(exec, actual);
if (m.valueToKey(ival) != 0) {
- qVariantSetValue(v, ival);
+ v.setValue(ival);
converted = true;
matchDistance += 10;
}
@@ -672,7 +672,7 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c
JSC::UString sval = QScriptEnginePrivate::toString(exec, actual);
int ival = m.keyToValue(convertToLatin1(sval));
if (ival != -1) {
- qVariantSetValue(v, ival);
+ v.setValue(ival);
converted = true;
matchDistance += 10;
}
diff --git a/src/scripttools/debugging/qscriptdebuggercommand.cpp b/src/scripttools/debugging/qscriptdebuggercommand.cpp
index fa223ec..5ca0535 100644
--- a/src/scripttools/debugging/qscriptdebuggercommand.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercommand.cpp
@@ -256,7 +256,7 @@ QScriptBreakpointData QScriptDebuggerCommand::breakpointData() const
void QScriptDebuggerCommand::setBreakpointData(const QScriptBreakpointData &data)
{
Q_D(QScriptDebuggerCommand);
- d->attributes[BreakpointData] = qVariantFromValue(data);
+ d->attributes[BreakpointData] = QVariant::fromValue(data);
}
QScriptDebuggerValue QScriptDebuggerCommand::scriptValue() const
@@ -268,7 +268,7 @@ QScriptDebuggerValue QScriptDebuggerCommand::scriptValue() const
void QScriptDebuggerCommand::setScriptValue(const QScriptDebuggerValue &value)
{
Q_D(QScriptDebuggerCommand);
- d->attributes[ScriptValue] = qVariantFromValue(value);
+ d->attributes[ScriptValue] = QVariant::fromValue(value);
}
int QScriptDebuggerCommand::contextIndex() const
@@ -316,7 +316,7 @@ QScriptDebuggerValue QScriptDebuggerCommand::subordinateScriptValue() const
void QScriptDebuggerCommand::setSubordinateScriptValue(const QScriptDebuggerValue &value)
{
Q_D(QScriptDebuggerCommand);
- d->attributes[SubordinateScriptValue] = qVariantFromValue(value);
+ d->attributes[SubordinateScriptValue] = QVariant::fromValue(value);
}
int QScriptDebuggerCommand::snapshotId() const
diff --git a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
index 568af59..7616148 100644
--- a/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercommandexecutor.cpp
@@ -229,11 +229,11 @@ QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute(
case QScriptDebuggerCommand::ScriptsCheckpoint:
backend->scriptsCheckpoint();
- response.setResult(qVariantFromValue(backend->scriptsDelta()));
+ response.setResult(QVariant::fromValue(backend->scriptsDelta()));
break;
case QScriptDebuggerCommand::GetScriptsDelta:
- response.setResult(qVariantFromValue(backend->scriptsDelta()));
+ response.setResult(QVariant::fromValue(backend->scriptsDelta()));
break;
case QScriptDebuggerCommand::ResolveScript:
@@ -302,7 +302,7 @@ QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute(
} break;
case QScriptDebuggerCommand::ContextsCheckpoint: {
- response.setResult(qVariantFromValue(backend->contextsCheckpoint()));
+ response.setResult(QVariant::fromValue(backend->contextsCheckpoint()));
} break;
case QScriptDebuggerCommand::GetPropertyExpressionValue: {
@@ -441,7 +441,7 @@ QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute(
result.addedProperties.append(dest);
}
backend->setIgnoreExceptions(didIgnoreExceptions);
- response.setResult(qVariantFromValue(result));
+ response.setResult(QVariant::fromValue(result));
} break;
case QScriptDebuggerCommand::DeleteScriptObjectSnapshot: {
diff --git a/src/scripttools/debugging/qscriptdebuggerevent.cpp b/src/scripttools/debugging/qscriptdebuggerevent.cpp
index f5f20cf..55df35b 100644
--- a/src/scripttools/debugging/qscriptdebuggerevent.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerevent.cpp
@@ -216,7 +216,7 @@ QScriptDebuggerValue QScriptDebuggerEvent::scriptValue() const
void QScriptDebuggerEvent::setScriptValue(const QScriptDebuggerValue &value)
{
Q_D(QScriptDebuggerEvent);
- d->attributes[Value] = qVariantFromValue(value);
+ d->attributes[Value] = QVariant::fromValue(value);
}
void QScriptDebuggerEvent::setNestedEvaluate(bool nested)
diff --git a/src/scripttools/debugging/qscriptdebuggerresponse.cpp b/src/scripttools/debugging/qscriptdebuggerresponse.cpp
index 0caa3e2..382e604e 100644
--- a/src/scripttools/debugging/qscriptdebuggerresponse.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerresponse.cpp
@@ -162,49 +162,49 @@ void QScriptDebuggerResponse::setResult(const QString &value)
void QScriptDebuggerResponse::setResult(const QScriptBreakpointData &data)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(data);
+ d->result = QVariant::fromValue(data);
}
void QScriptDebuggerResponse::setResult(const QScriptBreakpointMap &breakpoints)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(breakpoints);
+ d->result = QVariant::fromValue(breakpoints);
}
void QScriptDebuggerResponse::setResult(const QScriptScriptMap &scripts)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(scripts);
+ d->result = QVariant::fromValue(scripts);
}
void QScriptDebuggerResponse::setResult(const QScriptScriptData &data)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(data);
+ d->result = QVariant::fromValue(data);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValue &value)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(value);
+ d->result = QVariant::fromValue(value);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValueList &values)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(values);
+ d->result = QVariant::fromValue(values);
}
void QScriptDebuggerResponse::setResult(const QScriptDebuggerValuePropertyList &props)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(props);
+ d->result = QVariant::fromValue(props);
}
void QScriptDebuggerResponse::setResult(const QScriptContextInfo &info)
{
Q_D(QScriptDebuggerResponse);
- d->result = qVariantFromValue(info);
+ d->result = QVariant::fromValue(info);
}
int QScriptDebuggerResponse::resultAsInt() const
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 2261887..a060a01 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -420,10 +420,10 @@ QVariant QMYSQLResult::handle() const
{
#if MYSQL_VERSION_ID >= 40108
if(d->preparedQuery)
- return d->meta ? qVariantFromValue(d->meta) : qVariantFromValue(d->stmt);
+ return d->meta ? QVariant::fromValue(d->meta) : qVariantFromValue(d->stmt);
else
#endif
- return qVariantFromValue(d->result);
+ return QVariant::fromValue(d->result);
}
void QMYSQLResult::cleanup()
@@ -1432,7 +1432,7 @@ QSqlRecord QMYSQLDriver::record(const QString& tablename) const
QVariant QMYSQLDriver::handle() const
{
- return qVariantFromValue(d->mysql);
+ return QVariant::fromValue(d->mysql);
}
bool QMYSQLDriver::beginTransaction()
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index e11cf75..6870055 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -293,9 +293,9 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
SQLT_FLT, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
break;
case QVariant::UserType:
- if (qVariantCanConvert<QOCIRowIdPointer>(val) && !isOutValue(pos)) {
+ if (val.canConvert<QOCIRowIdPointer>() && !isOutValue(pos)) {
// use a const pointer to prevent a detach
- const QOCIRowIdPointer rptr = qVariantValue<QOCIRowIdPointer>(val);
+ const QOCIRowIdPointer rptr = qvariant_cast<QOCIRowIdPointer>(val);
r = OCIBindByPos(sql, hbnd, err,
pos + 1,
// it's an IN value, so const_cast is ok
@@ -1364,8 +1364,8 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
break;
}
case QVariant::UserType:
- if (qVariantCanConvert<QOCIRowIdPointer>(val)) {
- const QOCIRowIdPointer rptr = qVariantValue<QOCIRowIdPointer>(val);
+ if (val.canConvert<QOCIRowIdPointer>()) {
+ const QOCIRowIdPointer rptr = qvariant_cast<QOCIRowIdPointer>(val);
*reinterpret_cast<OCIRowid**>(dataPtr) = rptr->id;
columns[i].lengths[row] = 0;
break;
@@ -1704,7 +1704,7 @@ QOCIResult::~QOCIResult()
QVariant QOCIResult::handle() const
{
- return qVariantFromValue(d->sql);
+ return QVariant::fromValue(d->sql);
}
bool QOCIResult::reset (const QString& query)
@@ -1932,7 +1932,7 @@ QVariant QOCIResult::lastInsertId() const
int r = OCIAttrGet(d->sql, OCI_HTYPE_STMT, ptr.constData()->id,
0, OCI_ATTR_ROWID, d->err);
if (r == OCI_SUCCESS)
- return qVariantFromValue(ptr);
+ return QVariant::fromValue(ptr);
}
return QVariant();
}
@@ -2534,7 +2534,7 @@ QString QOCIDriver::formatValue(const QSqlField &field, bool trimStrings) const
QVariant QOCIDriver::handle() const
{
- return qVariantFromValue(d->env);
+ return QVariant::fromValue(d->env);
}
QString QOCIDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 2a4e595..179f7ba 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -279,7 +279,7 @@ QPSQLResult::~QPSQLResult()
QVariant QPSQLResult::handle() const
{
- return qVariantFromValue(d->result);
+ return QVariant::fromValue(d->result);
}
void QPSQLResult::cleanup()
@@ -706,7 +706,7 @@ QPSQLDriver::~QPSQLDriver()
QVariant QPSQLDriver::handle() const
{
- return qVariantFromValue(d->connection);
+ return QVariant::fromValue(d->connection);
}
bool QPSQLDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 4344af4..e5cc614 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -452,7 +452,7 @@ QSqlRecord QSQLiteResult::record() const
QVariant QSQLiteResult::handle() const
{
- return qVariantFromValue(d->stmt);
+ return QVariant::fromValue(d->stmt);
}
/////////////////////////////////////////////////////////
@@ -697,7 +697,7 @@ QSqlRecord QSQLiteDriver::record(const QString &tbl) const
QVariant QSQLiteDriver::handle() const
{
- return qVariantFromValue(d->access);
+ return QVariant::fromValue(d->access);
}
QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index ea476e5..89f3ed3 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -342,7 +342,7 @@ QSqlRecord QSQLite2Result::record() const
QVariant QSQLite2Result::handle() const
{
- return qVariantFromValue(d->currentMachine);
+ return QVariant::fromValue(d->currentMachine);
}
/////////////////////////////////////////////////////////
@@ -558,7 +558,7 @@ QSqlRecord QSQLite2Driver::record(const QString &tbl) const
QVariant QSQLite2Driver::handle() const
{
- return qVariantFromValue(d->access);
+ return QVariant::fromValue(d->access);
}
QString QSQLite2Driver::escapeIdentifier(const QString &identifier, IdentifierType /*type*/) const
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 633d635..aa9b2bd 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -159,7 +159,7 @@ template<> inline char *toString(const QVariant &v)
if (!v.isNull()) {
vstring.append(',');
if (v.canConvert(QVariant::String)) {
- vstring.append(qVariantValue<QString>(v).toLatin1());
+ vstring.append(qvariant_cast<QString>(v).toLatin1());
}
else {
vstring.append("<value not representable as string>");
diff --git a/src/tools/uic3/converter.cpp b/src/tools/uic3/converter.cpp
index 2ee939d..8fac4d1 100644
--- a/src/tools/uic3/converter.cpp
+++ b/src/tools/uic3/converter.cpp
@@ -864,7 +864,7 @@ DomLayoutItem *Ui3Reader::createLayoutItem(const QDomElement &e)
Variant var;
var.createSize(0, 0);
- QVariant def = qVariantFromValue(var);
+ QVariant def = QVariant::fromValue(var);
Size size = asVariant(DomTool::readProperty(e, QLatin1String("sizeHint"), def)).size;
QString sizeType = QLatin1String("QSizePolicy::") + DomTool::readProperty(e, QLatin1String("sizeType"), QLatin1String("Expanding")).toString();
diff --git a/src/tools/uic3/domtool.cpp b/src/tools/uic3/domtool.cpp
index 526b41c..cefbbb4 100644
--- a/src/tools/uic3/domtool.cpp
+++ b/src/tools/uic3/domtool.cpp
@@ -169,7 +169,7 @@ QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValu
n3 = n3.nextSibling().toElement();
}
var.createRect(x, y, w, h);
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("point")) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0;
@@ -181,7 +181,7 @@ QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValu
n3 = n3.nextSibling().toElement();
}
var.createPoint(x,y);
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("size")) {
QDomElement n3 = e.firstChild().toElement();
int w = 0, h = 0;
@@ -193,10 +193,10 @@ QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValu
n3 = n3.nextSibling().toElement();
}
var.createSize(w, h);
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("color")) {
var.color = readColor(e);
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("font")) {
QDomElement n3 = e.firstChild().toElement();
Font f;
@@ -217,7 +217,7 @@ QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValu
n3 = n3.nextSibling().toElement();
}
var.font = f;
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("string")) {
v = QVariant(e.firstChild().toText().data());
QDomElement n = e;
@@ -258,10 +258,10 @@ QVariant DomTool::elementToVariant(const QDomElement& e, const QVariant& defValu
var.sizePolicy.verstretch = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("cursor")) {
var.createCursor(e.firstChild().toText().data().toInt());
- qVariantSetValue(v, var);
+ v.setValue(var);
} else if (e.tagName() == QLatin1String("stringlist")) {
QStringList lst;
QDomElement n;
diff --git a/src/tools/uic3/domtool.h b/src/tools/uic3/domtool.h
index ad597a1..8fe0793 100644
--- a/src/tools/uic3/domtool.h
+++ b/src/tools/uic3/domtool.h
@@ -266,7 +266,7 @@ QT_BEGIN_NAMESPACE
inline Variant asVariant(const QVariant &v)
{
Variant var;
- var = qVariantValue<Variant>(v);
+ var = qvariant_cast<Variant>(v);
return var;
}
diff --git a/src/xmlpatterns/api/quriloader.cpp b/src/xmlpatterns/api/quriloader.cpp
index e0a7542..c653661 100644
--- a/src/xmlpatterns/api/quriloader.cpp
+++ b/src/xmlpatterns/api/quriloader.cpp
@@ -69,7 +69,7 @@ QNetworkReply *URILoader::createRequest(Operation op, const QNetworkRequest &req
const QVariant variant(m_variableLoader->valueFor(m_namePool->allocateQName(QString(), name, QString())));
if(!variant.isNull() && variant.userType() == qMetaTypeId<QIODevice *>())
- return new QIODeviceDelegate(qVariantValue<QIODevice *>(variant));
+ return new QIODeviceDelegate(qvariant_cast<QIODevice *>(variant));
else
{
/* If we're entering this code path, the variable URI identified a variable
diff --git a/src/xmlpatterns/api/qvariableloader.cpp b/src/xmlpatterns/api/qvariableloader.cpp
index 612fa67..648fda4 100644
--- a/src/xmlpatterns/api/qvariableloader.cpp
+++ b/src/xmlpatterns/api/qvariableloader.cpp
@@ -131,12 +131,12 @@ SequenceType::Ptr VariableLoader::announceExternalVariable(const QXmlName name,
return CommonSequenceTypes::ExactlyOneAnyURI;
else if(variant.userType() == qMetaTypeId<QXmlQuery>())
{
- const QXmlQuery variableQuery(qVariantValue<QXmlQuery>(variant));
+ const QXmlQuery variableQuery(qvariant_cast<QXmlQuery>(variant));
return variableQuery.d->expression()->staticType();
}
else
{
- return makeGenericSequenceType(AtomicValue::qtToXDMType(qVariantValue<QXmlItem>(variant)),
+ return makeGenericSequenceType(AtomicValue::qtToXDMType(qvariant_cast<QXmlItem>(variant)),
Cardinality::exactlyOne());
}
}
@@ -154,12 +154,12 @@ Item::Iterator::Ptr VariableLoader::evaluateSequence(const QXmlName name,
return makeSingletonIterator(itemForName(name));
else if(variant.userType() == qMetaTypeId<QXmlQuery>())
{
- const QXmlQuery variableQuery(qVariantValue<QXmlQuery>(variant));
+ const QXmlQuery variableQuery(qvariant_cast<QXmlQuery>(variant));
return variableQuery.d->expression()->evaluateSequence(DynamicContext::Ptr(new TemporaryTreesRedirectingContext(variableQuery.d->dynamicContext(), context)));
}
- const QVariant v(qVariantValue<QXmlItem>(variant).toAtomicValue());
+ const QVariant v(qvariant_cast<QXmlItem>(variant).toAtomicValue());
switch(v.type())
{
@@ -179,7 +179,7 @@ Item VariableLoader::itemForName(const QXmlName &name) const
if(variant.userType() == qMetaTypeId<QIODevice *>())
return Item(AnyURI::fromValue(QLatin1String("tag:trolltech.com,2007:QtXmlPatterns:QIODeviceVariable:") + m_namePool->stringForLocalName(name.localName())));
- const QXmlItem item(qVariantValue<QXmlItem>(variant));
+ const QXmlItem item(qvariant_cast<QXmlItem>(variant));
if(item.isNode())
return Item::fromPublic(item);
@@ -210,8 +210,8 @@ bool VariableLoader::isSameType(const QVariant &v1,
return true;
/* Ok, we have two QXmlItems. */
- const QXmlItem i1(qVariantValue<QXmlItem>(v1));
- const QXmlItem i2(qVariantValue<QXmlItem>(v2));
+ const QXmlItem i1(qvariant_cast<QXmlItem>(v1));
+ const QXmlItem i2(qvariant_cast<QXmlItem>(v2));
if(i1.isNode())
{
diff --git a/src/xmlpatterns/api/qxmlquery.cpp b/src/xmlpatterns/api/qxmlquery.cpp
index e106d74..0129af7 100644
--- a/src/xmlpatterns/api/qxmlquery.cpp
+++ b/src/xmlpatterns/api/qxmlquery.cpp
@@ -535,7 +535,7 @@ void QXmlQuery::bindVariable(const QXmlName &name, const QXmlItem &value)
}
const QPatternist::VariableLoader::Ptr vl(d->variableLoader());
- const QVariant variant(qVariantFromValue(value));
+ const QVariant variant(QVariant::fromValue(value));
/* If the type of the variable changed(as opposed to only the value),
* we will have to recompile. */
@@ -611,7 +611,7 @@ void QXmlQuery::bindVariable(const QXmlName &name, QIODevice *device)
if(device)
{
- const QVariant variant(qVariantFromValue(device));
+ const QVariant variant(QVariant::fromValue(device));
if(vl->invalidationRequired(name, variant))
d->recompileRequired();
@@ -1185,7 +1185,7 @@ void QXmlQuery::bindVariable(const QXmlName &name, const QXmlQuery &query)
Q_ASSERT_X(query.isValid(), Q_FUNC_INFO, "The query being bound must be valid.");
const QPatternist::VariableLoader::Ptr vl(d->variableLoader());
- const QVariant variant(qVariantFromValue(query));
+ const QVariant variant(QVariant::fromValue(query));
if(vl->invalidationRequired(name, variant))
d->recompileRequired();
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index c4f3578..5bb9a4f 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -121,7 +121,7 @@ QVariant AtomicValue::toQt(const AtomicValue *const value)
|| BuiltinTypes::xsHexBinary->xdtTypeMatches(t))
return QVariant(value->as<Base64Binary>()->asByteArray());
else if(BuiltinTypes::xsQName->xdtTypeMatches(t))
- return qVariantFromValue(value->as<QNameValue>()->qName());
+ return QVariant::fromValue(value->as<QNameValue>()->qName());
else
{
/* A type we don't support in Qt. Includes xs:time currently. */
diff --git a/tools/activeqt/testcon/changeproperties.cpp b/tools/activeqt/testcon/changeproperties.cpp
index e2ad601..b0609b0 100644
--- a/tools/activeqt/testcon/changeproperties.cpp
+++ b/tools/activeqt/testcon/changeproperties.cpp
@@ -108,7 +108,7 @@ void ChangeProperties::on_buttonSet_clicked()
QColor col;
col.setNamedColor(editValue->text());
if (col.isValid()) {
- value = qVariantFromValue(col);
+ value = QVariant::fromValue(col);
} else {
QMessageBox::warning(this, tr("Can't parse input"),
QString(tr("Failed to create a color from %1\n"
@@ -122,7 +122,7 @@ void ChangeProperties::on_buttonSet_clicked()
{
QFont fnt;
if (fnt.fromString(editValue->text())) {
- value = qVariantFromValue(fnt);
+ value = QVariant::fromValue(fnt);
} else {
QMessageBox::warning(this, tr("Can't parse input"),
(tr("Failed to create a font from %1\n"
@@ -141,7 +141,7 @@ void ChangeProperties::on_buttonSet_clicked()
if (pm.isNull())
return;
- value = qVariantFromValue(pm);
+ value = QVariant::fromValue(pm);
}
break;
case QVariant::Bool:
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 23632b1..65888fe 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -283,7 +283,7 @@ void BookmarkManager::buildBookmarksMenu(const QModelIndex &index, QMenu* menu)
return;
const QString &text = index.data().toString();
- const QIcon &icon = qVariantValue<QIcon>(index.data(Qt::DecorationRole));
+ const QIcon &icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
if (index.data(UserRoleFolder).toBool()) {
if (QMenu* subMenu = menu->addMenu(icon, text)) {
for (int i = 0; i < bookmarkModel->rowCount(index); ++i)
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp
index 60b83f7..0a5445a 100644
--- a/tools/assistant/tools/assistant/helpenginewrapper.cpp
+++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp
@@ -643,7 +643,7 @@ void HelpEngineWrapper::setUseBrowserFont(bool useBrowserFont)
const QFont HelpEngineWrapper::appFont() const
{
TRACE_OBJ
- return qVariantValue<QFont>(d->m_helpEngine->customValue(AppFontKey));
+ return qvariant_cast<QFont>(d->m_helpEngine->customValue(AppFontKey));
}
void HelpEngineWrapper::setAppFont(const QFont &font)
@@ -668,7 +668,7 @@ void HelpEngineWrapper::setAppWritingSystem(QFontDatabase::WritingSystem system)
const QFont HelpEngineWrapper::browserFont() const
{
TRACE_OBJ
- return qVariantValue<QFont>(d->m_helpEngine->customValue(BrowserFontKey));
+ return qvariant_cast<QFont>(d->m_helpEngine->customValue(BrowserFontKey));
}
void HelpEngineWrapper::setBrowserFont(const QFont &font)
diff --git a/tools/designer/src/components/formeditor/dpi_chooser.cpp b/tools/designer/src/components/formeditor/dpi_chooser.cpp
index e79c757..1eadfa5 100644
--- a/tools/designer/src/components/formeditor/dpi_chooser.cpp
+++ b/tools/designer/src/components/formeditor/dpi_chooser.cpp
@@ -97,13 +97,13 @@ DPI_Chooser::DPI_Chooser(QWidget *parent) :
m_systemEntry->description = 0;
const struct DPI_Entry *systemEntry = m_systemEntry;
//: System resolution
- m_predefinedCombo->addItem(tr("System (%1 x %2)").arg(m_systemEntry->dpiX).arg(m_systemEntry->dpiY), qVariantFromValue(systemEntry));
+ m_predefinedCombo->addItem(tr("System (%1 x %2)").arg(m_systemEntry->dpiX).arg(m_systemEntry->dpiY), QVariant::fromValue(systemEntry));
// Devices. Exclude the system values as not to duplicate the entries
const int predefinedCount = sizeof(dpiEntries)/sizeof(DPI_Entry);
const struct DPI_Entry *ecend = dpiEntries + predefinedCount;
for (const struct DPI_Entry *it = dpiEntries; it < ecend; ++it)
if (it->dpiX != m_systemEntry->dpiX || it->dpiY != m_systemEntry->dpiY)
- m_predefinedCombo->addItem(tr(it->description), qVariantFromValue(it));
+ m_predefinedCombo->addItem(tr(it->description), QVariant::fromValue(it));
m_predefinedCombo->addItem(tr("User defined"));
setFocusProxy(m_predefinedCombo);
diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp
index eeb63e5..ebf00f9 100644
--- a/tools/designer/src/components/formeditor/formwindow.cpp
+++ b/tools/designer/src/components/formeditor/formwindow.cpp
@@ -1523,7 +1523,7 @@ void ArrowKeyPropertyCommand::init(QWidgetList &l, const ArrowKeyOperation &op)
QObjectList ol;
foreach(QWidget *w, l)
ol.push_back(w);
- SetPropertyCommand::init(ol, QLatin1String("geometry"), qVariantFromValue(op));
+ SetPropertyCommand::init(ol, QLatin1String("geometry"), QVariant::fromValue(op));
setText(op.resize ? FormWindow::tr("Key Resize") : FormWindow::tr("Key Move"));
}
@@ -1531,14 +1531,14 @@ void ArrowKeyPropertyCommand::init(QWidgetList &l, const ArrowKeyOperation &op)
QVariant ArrowKeyPropertyCommand::mergeValue(const QVariant &newMergeValue)
{
// Merge move operations of the same arrow key
- if (!qVariantCanConvert<ArrowKeyOperation>(newMergeValue))
+ if (!newMergeValue.canConvert<ArrowKeyOperation>())
return QVariant();
ArrowKeyOperation mergedOperation = qvariant_cast<ArrowKeyOperation>(newValue());
const ArrowKeyOperation newMergeOperation = qvariant_cast<ArrowKeyOperation>(newMergeValue);
if (mergedOperation.resize != newMergeOperation.resize || mergedOperation.arrowKey != newMergeOperation.arrowKey)
return QVariant();
mergedOperation.distance += newMergeOperation.distance;
- return qVariantFromValue(mergedOperation);
+ return QVariant::fromValue(mergedOperation);
}
void FormWindow::handleArrowKeyEvent(int key, Qt::KeyboardModifiers modifiers)
@@ -2241,7 +2241,7 @@ QAction *FormWindow::createSelectAncestorSubMenu(QWidget *w)
for (int i = 0; i < size; i++) {
QWidget *w = parents.at(i);
QAction *a = ag->addAction(objectNameOf(w));
- a->setData(qVariantFromValue(w));
+ a->setData(QVariant::fromValue(w));
menu->addAction(a);
}
QAction *ma = new QAction(tr("Select Ancestor"), 0);
@@ -2796,7 +2796,7 @@ bool FormWindow::dropDockWidget(QDesignerDnDItemInterface *item, const QPoint &g
PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(propertySheet->property(propertySheet->indexOf(dockWidgetAreaName)));
e.value = area;
QVariant v;
- qVariantSetValue(v, e);
+ v.setValue(e);
SetPropertyCommand *cmd = new SetPropertyCommand(this);
cmd->init(widget, dockWidgetAreaName, v);
m_undoStack.push(cmd);
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index 135e23b..6c458f3 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -197,7 +197,7 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co
m_loadedQrcFiles.insert(QFileInfo(workingDirectory, dp->attributeResource()).absoluteFilePath(), false);
#endif
}
- return qVariantFromValue(pixmap);
+ return QVariant::fromValue(pixmap);
}
case DomProperty::IconSet: {
@@ -227,7 +227,7 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co
m_loadedQrcFiles.insert(QFileInfo(workingDirectory, di->attributeResource()).absoluteFilePath(), false);
#endif
}
- return qVariantFromValue(icon);
+ return QVariant::fromValue(icon);
}
default:
break;
@@ -237,12 +237,12 @@ QVariant QDesignerResourceBuilder::loadResource(const QDir &workingDirectory, co
QVariant QDesignerResourceBuilder::toNativeValue(const QVariant &value) const
{
- if (qVariantCanConvert<PropertySheetPixmapValue>(value)) {
+ if (value.canConvert<PropertySheetPixmapValue>()) {
if (m_pixmapCache)
- return m_pixmapCache->pixmap(qVariantValue<PropertySheetPixmapValue>(value));
- } else if (qVariantCanConvert<PropertySheetIconValue>(value)) {
+ return m_pixmapCache->pixmap(qvariant_cast<PropertySheetPixmapValue>(value));
+ } else if (value.canConvert<PropertySheetIconValue>()) {
if (m_iconCache)
- return m_iconCache->icon(qVariantValue<PropertySheetIconValue>(value));
+ return m_iconCache->icon(qvariant_cast<PropertySheetIconValue>(value));
}
return value;
}
@@ -250,7 +250,7 @@ QVariant QDesignerResourceBuilder::toNativeValue(const QVariant &value) const
DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory, const QVariant &value) const
{
DomProperty *p = new DomProperty;
- if (qVariantCanConvert<PropertySheetPixmapValue>(value)) {
+ if (value.canConvert<PropertySheetPixmapValue>()) {
const PropertySheetPixmapValue pix = qvariant_cast<PropertySheetPixmapValue>(value);
DomResourcePixmap *rp = new DomResourcePixmap;
const QString pixPath = pix.path();
@@ -275,7 +275,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
}
p->setElementPixmap(rp);
return p;
- } else if (qVariantCanConvert<PropertySheetIconValue>(value)) {
+ } else if (value.canConvert<PropertySheetIconValue>()) {
const PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(value);
const QMap<QPair<QIcon::Mode, QIcon::State>, PropertySheetPixmapValue> pixmaps = icon.paths();
if (!pixmaps.isEmpty()) {
@@ -331,7 +331,7 @@ DomProperty *QDesignerResourceBuilder::saveResource(const QDir &workingDirectory
bool QDesignerResourceBuilder::isResourceType(const QVariant &value) const
{
- if (qVariantCanConvert<PropertySheetPixmapValue>(value) || qVariantCanConvert<PropertySheetIconValue>(value))
+ if (value.canConvert<PropertySheetPixmapValue>() || value.canConvert<PropertySheetIconValue>())
return true;
return false;
}
@@ -364,26 +364,26 @@ QVariant QDesignerTextBuilder::loadText(const DomProperty *text) const
if (!translatable)
strVal.setTranslatable(translatable);
}
- return qVariantFromValue(strVal);
+ return QVariant::fromValue(strVal);
}
QVariant QDesignerTextBuilder::toNativeValue(const QVariant &value) const
{
- if (qVariantCanConvert<PropertySheetStringValue>(value))
- return qVariantFromValue(qVariantValue<PropertySheetStringValue>(value).value());
+ if (value.canConvert<PropertySheetStringValue>())
+ return QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(value).value());
return value;
}
DomProperty *QDesignerTextBuilder::saveText(const QVariant &value) const
{
- if (!qVariantCanConvert<PropertySheetStringValue>(value) && !qVariantCanConvert<QString>(value))
+ if (!value.canConvert<PropertySheetStringValue>() && !value.canConvert<QString>())
return 0;
DomProperty *property = new DomProperty();
DomString *domStr = new DomString();
- if (qVariantCanConvert<PropertySheetStringValue>(value)) {
- PropertySheetStringValue str = qVariantValue<PropertySheetStringValue>(value);
+ if (value.canConvert<PropertySheetStringValue>()) {
+ PropertySheetStringValue str = qvariant_cast<PropertySheetStringValue>(value);
domStr->setText(str.value());
@@ -475,7 +475,7 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
if (classVar.canConvert(QVariant::String))
classStr = classVar.toString();
else
- classStr = qVariantValue<PropertySheetStringValue>(classVar).value();
+ classStr = qvariant_cast<PropertySheetStringValue>(classVar).value();
ui->setElementClass(classStr);
for (int index = 0; index < m_formWindow->toolCount(); ++index) {
@@ -1045,7 +1045,7 @@ static bool readDomEnumerationValue(const DomProperty *p,
switch (p->kind()) {
case DomProperty::Set: {
const QVariant sheetValue = sheet->property(index);
- if (qVariantCanConvert<PropertySheetFlagValue>(sheetValue)) {
+ if (sheetValue.canConvert<PropertySheetFlagValue>()) {
const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(sheetValue);
bool ok = false;
v = f.metaFlags.parseFlags(p->elementSet(), &ok);
@@ -1057,7 +1057,7 @@ static bool readDomEnumerationValue(const DomProperty *p,
break;
case DomProperty::Enum: {
const QVariant sheetValue = sheet->property(index);
- if (qVariantCanConvert<PropertySheetEnumValue>(sheetValue)) {
+ if (sheetValue.canConvert<PropertySheetEnumValue>()) {
const PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(sheetValue);
bool ok = false;
v = e.metaEnum.parseEnum(p->elementEnum(), &ok);
@@ -1110,7 +1110,7 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
if (!translatable)
keyVal.setTranslatable(translatable);
}
- v = qVariantFromValue(keyVal);
+ v = QVariant::fromValue(keyVal);
} else {
const DomString *str = p->elementString();
PropertySheetStringValue strVal(v.toString());
@@ -1124,7 +1124,7 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
if (!translatable)
strVal.setTranslatable(translatable);
}
- v = qVariantFromValue(strVal);
+ v = QVariant::fromValue(strVal);
}
}
@@ -1135,18 +1135,18 @@ void QDesignerResource::applyProperties(QObject *o, const QList<DomProperty*> &p
} else if (dynamicPropertiesAllowed) {
QVariant defaultValue = QVariant(v.type());
bool isDefault = (v == defaultValue);
- if (qVariantCanConvert<PropertySheetIconValue>(v)) {
+ if (v.canConvert<PropertySheetIconValue>()) {
defaultValue = QVariant(QVariant::Icon);
- isDefault = (qVariantValue<PropertySheetIconValue>(v) == PropertySheetIconValue());
- } else if (qVariantCanConvert<PropertySheetPixmapValue>(v)) {
+ isDefault = (qvariant_cast<PropertySheetIconValue>(v) == PropertySheetIconValue());
+ } else if (v.canConvert<PropertySheetPixmapValue>()) {
defaultValue = QVariant(QVariant::Pixmap);
- isDefault = (qVariantValue<PropertySheetPixmapValue>(v) == PropertySheetPixmapValue());
- } else if (qVariantCanConvert<PropertySheetStringValue>(v)) {
+ isDefault = (qvariant_cast<PropertySheetPixmapValue>(v) == PropertySheetPixmapValue());
+ } else if (v.canConvert<PropertySheetStringValue>()) {
defaultValue = QVariant(QVariant::String);
- isDefault = (qVariantValue<PropertySheetStringValue>(v) == PropertySheetStringValue());
- } else if (qVariantCanConvert<PropertySheetKeySequenceValue>(v)) {
+ isDefault = (qvariant_cast<PropertySheetStringValue>(v) == PropertySheetStringValue());
+ } else if (v.canConvert<PropertySheetKeySequenceValue>()) {
defaultValue = QVariant(QVariant::KeySequence);
- isDefault = (qVariantValue<PropertySheetKeySequenceValue>(v) == PropertySheetKeySequenceValue());
+ isDefault = (qvariant_cast<PropertySheetKeySequenceValue>(v) == PropertySheetKeySequenceValue());
}
if (defaultValue.type() != QVariant::UserType) {
const int idx = dynamicSheet->addDynamicProperty(p->attributeName(), defaultValue);
@@ -1185,12 +1185,12 @@ QWidget *QDesignerResource::createWidget(const QString &widgetName, QWidget *par
if (!qobject_cast<QMenu*>(w) && (!parentWidget || !container)) {
m_formWindow->manageWidget(w);
if (parentWidget) {
- QList<QWidget *> list = qVariantValue<QWidgetList>(parentWidget->property("_q_widgetOrder"));
+ QList<QWidget *> list = qvariant_cast<QWidgetList>(parentWidget->property("_q_widgetOrder"));
list.append(w);
- parentWidget->setProperty("_q_widgetOrder", qVariantFromValue(list));
- QList<QWidget *> zOrder = qVariantValue<QWidgetList>(parentWidget->property("_q_zOrder"));
+ parentWidget->setProperty("_q_widgetOrder", QVariant::fromValue(list));
+ QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(parentWidget->property("_q_zOrder"));
zOrder.append(w);
- parentWidget->setProperty("_q_zOrder", qVariantFromValue(list));
+ parentWidget->setProperty("_q_zOrder", QVariant::fromValue(list));
}
} else {
core()->metaDataBase()->add(w);
@@ -1605,8 +1605,8 @@ DomWidget *QDesignerResource::saveWidget(QTabWidget *widget, DomWidget *ui_paren
// attribute `icon'
widget->setCurrentIndex(i);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), widget);
- PropertySheetIconValue icon = qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String("currentTabIcon"))));
- DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), qVariantFromValue(icon));
+ PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String("currentTabIcon"))));
+ DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
if (p) {
p->setAttributeName(strings.iconAttribute);
ui_attribute_list.append(p);
@@ -1620,7 +1620,7 @@ DomWidget *QDesignerResource::saveWidget(QTabWidget *widget, DomWidget *ui_paren
// attribute `toolTip'
QVariant v = sheet->property(sheet->indexOf(QLatin1String("currentTabToolTip")));
- if (!qVariantValue<PropertySheetStringValue>(v).value().isEmpty()) {
+ if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
p->setAttributeName(strings.toolTipAttribute);
@@ -1630,7 +1630,7 @@ DomWidget *QDesignerResource::saveWidget(QTabWidget *widget, DomWidget *ui_paren
// attribute `whatsThis'
v = sheet->property(sheet->indexOf(QLatin1String("currentTabWhatsThis")));
- if (!qVariantValue<PropertySheetStringValue>(v).value().isEmpty()) {
+ if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
p->setAttributeName(strings.whatsThisAttribute);
@@ -1676,8 +1676,8 @@ DomWidget *QDesignerResource::saveWidget(QToolBox *widget, DomWidget *ui_parentW
// attribute `icon'
widget->setCurrentIndex(i);
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), widget);
- PropertySheetIconValue icon = qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String("currentItemIcon"))));
- DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), qVariantFromValue(icon));
+ PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String("currentItemIcon"))));
+ DomProperty *p = resourceBuilder()->saveResource(workingDirectory(), QVariant::fromValue(icon));
if (p) {
p->setAttributeName(strings.iconAttribute);
ui_attribute_list.append(p);
@@ -1690,7 +1690,7 @@ DomWidget *QDesignerResource::saveWidget(QToolBox *widget, DomWidget *ui_parentW
// attribute `toolTip'
QVariant v = sheet->property(sheet->indexOf(QLatin1String("currentItemToolTip")));
- if (!qVariantValue<PropertySheetStringValue>(v).value().isEmpty()) {
+ if (!qvariant_cast<PropertySheetStringValue>(v).value().isEmpty()) {
p = textBuilder()->saveText(v);
if (p) {
p->setAttributeName(strings.toolTipAttribute);
@@ -2209,8 +2209,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
return 0;
}
- if (qVariantCanConvert<PropertySheetFlagValue>(value)) {
- const PropertySheetFlagValue f = qVariantValue<PropertySheetFlagValue>(value);
+ if (value.canConvert<PropertySheetFlagValue>()) {
+ const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(value);
const QString flagString = f.metaFlags.toString(f.value, DesignerMetaFlags::FullyQualified);
if (flagString.isEmpty())
return 0;
@@ -2222,8 +2222,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
p->setElementSet(flagString);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (qVariantCanConvert<PropertySheetEnumValue>(value)) {
- const PropertySheetEnumValue e = qVariantValue<PropertySheetEnumValue>(value);
+ } else if (value.canConvert<PropertySheetEnumValue>()) {
+ const PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(value);
bool ok;
const QString id = e.metaEnum.toString(e.value, DesignerMetaEnum::FullyQualified, &ok);
if (!ok)
@@ -2238,8 +2238,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
p->setAttributeName(propertyName);
p->setElementEnum(id);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (qVariantCanConvert<PropertySheetStringValue>(value)) {
- const PropertySheetStringValue strVal = qVariantValue<PropertySheetStringValue>(value);
+ } else if (value.canConvert<PropertySheetStringValue>()) {
+ const PropertySheetStringValue strVal = qvariant_cast<PropertySheetStringValue>(value);
DomProperty *p = new DomProperty;
if (!hasSetter(core(), object, propertyName))
p->setAttributeStdset(0);
@@ -2249,8 +2249,8 @@ DomProperty *QDesignerResource::createProperty(QObject *object, const QString &p
saveStringProperty(p, strVal);
return applyProperStdSetAttribute(object, propertyName, p);
- } else if (qVariantCanConvert<PropertySheetKeySequenceValue>(value)) {
- const PropertySheetKeySequenceValue keyVal = qVariantValue<PropertySheetKeySequenceValue>(value);
+ } else if (value.canConvert<PropertySheetKeySequenceValue>()) {
+ const PropertySheetKeySequenceValue keyVal = qvariant_cast<PropertySheetKeySequenceValue>(value);
DomProperty *p = new DomProperty;
if (!hasSetter(core(), object, propertyName))
p->setAttributeStdset(0);
diff --git a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
index 93e1df1..4bbacdb 100644
--- a/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
+++ b/tools/designer/src/components/objectinspector/objectinspectormodel.cpp
@@ -273,7 +273,7 @@ namespace qdesigner_internal {
void ObjectData::setItems(const StandardItemList &row, const ObjectInspectorIcons &icons) const
{
- const QVariant object = qVariantFromValue(m_object);
+ const QVariant object = QVariant::fromValue(m_object);
row[ObjectInspectorModel::ObjectNameColumn]->setData(object, DataRole);
row[ObjectInspectorModel::ClassNameColumn]->setData(object, DataRole);
setItemsDisplayData(row, icons, ClassNameChanged|ObjectNameChanged|ClassIconChanged|TypeChanged|LayoutTypeChanged);
diff --git a/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp b/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
index 2300b47..fffdc29 100644
--- a/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
+++ b/tools/designer/src/components/propertyeditor/brushpropertymanager.cpp
@@ -163,7 +163,7 @@ void BrushPropertyManager::initializeProperty(QtVariantPropertyManager *vm, QtPr
for (int i = 0; i < brushStyleCount; i++)
styles.push_back(QCoreApplication::translate("BrushPropertyManager", brushStyles[i]));
styleSubProperty->setAttribute(QLatin1String("enumNames"), styles);
- styleSubProperty->setAttribute(QLatin1String("enumIcons"), qVariantFromValue(brushStyleIcons()));
+ styleSubProperty->setAttribute(QLatin1String("enumIcons"), QVariant::fromValue(brushStyleIcons()));
m_brushPropertyToStyleSubProperty.insert(property, styleSubProperty);
m_brushStyleSubPropertyToProperty.insert(styleSubProperty, property);
// color
diff --git a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
index 9ab2940..e251511 100644
--- a/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
+++ b/tools/designer/src/components/propertyeditor/designerpropertymanager.cpp
@@ -740,7 +740,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
m_changingSubValue = false;
data.val = newValue;
QVariant v;
- qVariantSetValue(v, data.val);
+ v.setValue(data.val);
variantProperty(flagProperty)->setValue(v);
} else if (QtProperty *alignProperty = m_alignHToProperty.value(property, 0)) {
const uint v = m_alignValues.value(alignProperty);
@@ -763,7 +763,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(stringProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(stringProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *stringProperty = m_translatableToString.value(property, 0)) {
const PropertySheetStringValue v = m_stringValues.value(stringProperty);
PropertySheetStringValue newValue = v;
@@ -771,7 +771,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(stringProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(stringProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *stringProperty = m_disambiguationToString.value(property, 0)) {
const PropertySheetStringValue v = m_stringValues.value(stringProperty);
PropertySheetStringValue newValue = v;
@@ -779,7 +779,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(stringProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(stringProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *keySequenceProperty = m_commentToKeySequence.value(property, 0)) {
const PropertySheetKeySequenceValue v = m_keySequenceValues.value(keySequenceProperty);
PropertySheetKeySequenceValue newValue = v;
@@ -787,7 +787,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(keySequenceProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(keySequenceProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *keySequenceProperty = m_translatableToKeySequence.value(property, 0)) {
const PropertySheetKeySequenceValue v = m_keySequenceValues.value(keySequenceProperty);
PropertySheetKeySequenceValue newValue = v;
@@ -795,7 +795,7 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(keySequenceProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(keySequenceProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *keySequenceProperty = m_disambiguationToKeySequence.value(property, 0)) {
const PropertySheetKeySequenceValue v = m_keySequenceValues.value(keySequenceProperty);
PropertySheetKeySequenceValue newValue = v;
@@ -803,16 +803,16 @@ void DesignerPropertyManager::slotValueChanged(QtProperty *property, const QVari
if (v == newValue)
return;
- variantProperty(keySequenceProperty)->setValue(qVariantFromValue(newValue));
+ variantProperty(keySequenceProperty)->setValue(QVariant::fromValue(newValue));
} else if (QtProperty *iProperty = m_iconSubPropertyToProperty.value(property, 0)) {
QtVariantProperty *iconProperty = variantProperty(iProperty);
- PropertySheetIconValue icon = qVariantValue<PropertySheetIconValue>(iconProperty->value());
+ PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(iconProperty->value());
QPair<QIcon::Mode, QIcon::State> pair = m_iconSubPropertyToState.value(property);
- icon.setPixmap(pair.first, pair.second, qVariantValue<PropertySheetPixmapValue>(value));
+ icon.setPixmap(pair.first, pair.second, qvariant_cast<PropertySheetPixmapValue>(value));
QtProperty *origSourceOfChange = m_sourceOfChange;
if (!origSourceOfChange)
m_sourceOfChange = property;
- iconProperty->setValue(qVariantFromValue(icon));
+ iconProperty->setValue(QVariant::fromValue(icon));
if (!origSourceOfChange)
m_sourceOfChange = origSourceOfChange;
} else if (m_iconValues.contains(property)) {
@@ -933,7 +933,7 @@ QVariant DesignerPropertyManager::attributeValue(const QtProperty *property, con
PropertyFlagDataMap::const_iterator it = m_flagValues.constFind(prop);
if (it != m_flagValues.constEnd()) {
QVariant v;
- qVariantSetValue(v, it.value().flags);
+ v.setValue(it.value().flags);
return v;
}
}
@@ -985,7 +985,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != designerFlagListTypeId())
return;
- const DesignerFlagList flags = qVariantValue<DesignerFlagList>(value);
+ const DesignerFlagList flags = qvariant_cast<DesignerFlagList>(value);
PropertyFlagDataMap::iterator fit = m_flagValues.find(property);
FlagData data = fit.value();
if (data.flags == flags)
@@ -1022,7 +1022,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
fit.value() = data;
QVariant v;
- qVariantSetValue(v, flags);
+ v.setValue(flags);
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
@@ -1061,7 +1061,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QVariant::Palette)
return;
- QPalette superPalette = qVariantValue<QPalette>(value);
+ QPalette superPalette = qvariant_cast<QPalette>(value);
const PropertyPaletteDataMap::iterator it = m_paletteValues.find(property);
PaletteData data = it.value();
@@ -1077,7 +1077,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = data;
QVariant v;
- qVariantSetValue(v, superPalette);
+ v.setValue(superPalette);
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
@@ -1086,7 +1086,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QVariant::Pixmap)
return;
- QPixmap defaultPixmap = qVariantValue<QPixmap>(value);
+ QPixmap defaultPixmap = qvariant_cast<QPixmap>(value);
const QMap<QtProperty *, QPixmap>::iterator it = m_defaultPixmaps.find(property);
QPixmap oldDefaultPixmap = it.value();
@@ -1095,7 +1095,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
it.value() = defaultPixmap;
- QVariant v = qVariantFromValue(defaultPixmap);
+ QVariant v = QVariant::fromValue(defaultPixmap);
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
@@ -1103,7 +1103,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
if (value.userType() != QVariant::Icon)
return;
- QIcon defaultIcon = qVariantValue<QIcon>(value);
+ QIcon defaultIcon = qvariant_cast<QIcon>(value);
const QMap<QtProperty *, QIcon>::iterator it = m_defaultIcons.find(property);
QIcon oldDefaultIcon = it.value();
@@ -1124,7 +1124,7 @@ void DesignerPropertyManager::setAttribute(QtProperty *property,
}
}
- QVariant v = qVariantFromValue(defaultIcon);
+ QVariant v = QVariant::fromValue(defaultIcon);
emit attributeChanged(property, attribute, v);
emit propertyChanged(property);
@@ -1265,12 +1265,12 @@ QString DesignerPropertyManager::valueText(const QtProperty *property) const
return m_stringListValues.value(const_cast<QtProperty *>(property)).join(QLatin1String("; "));
}
if (QtVariantPropertyManager::valueType(property) == QVariant::String || QtVariantPropertyManager::valueType(property) == designerStringTypeId()) {
- const QString str = (QtVariantPropertyManager::valueType(property) == QVariant::String) ? value(property).toString() : qVariantValue<PropertySheetStringValue>(value(property)).value();
+ const QString str = (QtVariantPropertyManager::valueType(property) == QVariant::String) ? value(property).toString() : qvariant_cast<PropertySheetStringValue>(value(property)).value();
const int validationMode = attributeValue(property, QLatin1String(validationModesAttributeC)).toInt();
return TextPropertyEditor::stringToEditorString(str, static_cast<TextPropertyValidationMode>(validationMode));
}
if (QtVariantPropertyManager::valueType(property) == designerKeySequenceTypeId()) {
- return qVariantValue<PropertySheetKeySequenceValue>(value(property)).value();
+ return qvariant_cast<PropertySheetKeySequenceValue>(value(property)).value();
}
if (QtVariantPropertyManager::valueType(property) == QVariant::Bool) {
return QString();
@@ -1313,13 +1313,13 @@ void DesignerPropertyManager::reloadResourceProperties()
}
emit propertyChanged(property);
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(itIcon.value()));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(itIcon.value()));
}
QMapIterator<QtProperty *, qdesigner_internal::PropertySheetPixmapValue> itPix(m_pixmapValues);
while (itPix.hasNext()) {
QtProperty *property = itPix.next().key();
emit propertyChanged(property);
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(itPix.value()));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(itPix.value()));
}
}
@@ -1357,13 +1357,13 @@ QVariant DesignerPropertyManager::value(const QtProperty *property) const
if (m_paletteValues.contains(const_cast<QtProperty *>(property)))
return m_paletteValues.value(const_cast<QtProperty *>(property)).val;
if (m_iconValues.contains(const_cast<QtProperty *>(property)))
- return qVariantFromValue(m_iconValues.value(const_cast<QtProperty *>(property)));
+ return QVariant::fromValue(m_iconValues.value(const_cast<QtProperty *>(property)));
if (m_pixmapValues.contains(const_cast<QtProperty *>(property)))
- return qVariantFromValue(m_pixmapValues.value(const_cast<QtProperty *>(property)));
+ return QVariant::fromValue(m_pixmapValues.value(const_cast<QtProperty *>(property)));
if (m_stringValues.contains(const_cast<QtProperty *>(property)))
- return qVariantFromValue(m_stringValues.value(const_cast<QtProperty *>(property)));
+ return QVariant::fromValue(m_stringValues.value(const_cast<QtProperty *>(property)));
if (m_keySequenceValues.contains(const_cast<QtProperty *>(property)))
- return qVariantFromValue(m_keySequenceValues.value(const_cast<QtProperty *>(property)));
+ return QVariant::fromValue(m_keySequenceValues.value(const_cast<QtProperty *>(property)));
if (m_uintValues.contains(const_cast<QtProperty *>(property)))
return m_uintValues.value(const_cast<QtProperty *>(property));
if (m_longLongValues.contains(const_cast<QtProperty *>(property)))
@@ -1497,7 +1497,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (value.userType() != designerStringTypeId())
return;
- const PropertySheetStringValue v = qVariantValue<PropertySheetStringValue>(value);
+ const PropertySheetStringValue v = qvariant_cast<PropertySheetStringValue>(value);
const PropertySheetStringValue val = m_stringValues.value(property);
@@ -1517,7 +1517,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
m_stringValues[property] = v;
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(v));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(v));
emit propertyChanged(property);
return;
@@ -1525,7 +1525,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (value.userType() != designerKeySequenceTypeId())
return;
- const PropertySheetKeySequenceValue v = qVariantValue<PropertySheetKeySequenceValue>(value);
+ const PropertySheetKeySequenceValue v = qvariant_cast<PropertySheetKeySequenceValue>(value);
const PropertySheetKeySequenceValue val = m_keySequenceValues.value(property);
@@ -1545,7 +1545,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
m_keySequenceValues[property] = v;
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(v));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(v));
emit propertyChanged(property);
return;
@@ -1553,7 +1553,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (value.type() != QVariant::Palette && !value.canConvert(QVariant::Palette))
return;
- QPalette p = qVariantValue<QPalette>(value);
+ QPalette p = qvariant_cast<QPalette>(value);
PaletteData data = m_paletteValues.value(property);
@@ -1575,7 +1575,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (value.userType() != designerIconTypeId())
return;
- const PropertySheetIconValue icon = qVariantValue<PropertySheetIconValue>(value);
+ const PropertySheetIconValue icon = qvariant_cast<PropertySheetIconValue>(value);
const PropertySheetIconValue oldIcon = m_iconValues.value(property);
if (icon == oldIcon)
@@ -1600,12 +1600,12 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
QtVariantProperty *subProperty = variantProperty(itSub.value());
bool hasPath = iconPaths.contains(pair);
subProperty->setModified(hasPath);
- subProperty->setValue(qVariantFromValue(iconPaths.value(pair)));
+ subProperty->setValue(QVariant::fromValue(iconPaths.value(pair)));
subProperty->setAttribute(QLatin1String(defaultResourceAttributeC),
defaultIcon.pixmap(16, 16, pair.first, pair.second));
}
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(icon));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(icon));
emit propertyChanged(property);
QString toolTip;
@@ -1620,7 +1620,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (value.userType() != designerPixmapTypeId())
return;
- const PropertySheetPixmapValue pixmap = qVariantValue<PropertySheetPixmapValue>(value);
+ const PropertySheetPixmapValue pixmap = qvariant_cast<PropertySheetPixmapValue>(value);
const PropertySheetPixmapValue oldPixmap = m_pixmapValues.value(property);
if (pixmap == oldPixmap)
@@ -1628,7 +1628,7 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
m_pixmapValues[property] = pixmap;
- emit QtVariantPropertyManager::valueChanged(property, qVariantFromValue(pixmap));
+ emit QtVariantPropertyManager::valueChanged(property, QVariant::fromValue(pixmap));
emit propertyChanged(property);
property->setToolTip(pixmap.path());
@@ -1746,9 +1746,9 @@ void DesignerPropertyManager::setValue(QtProperty *property, const QVariant &val
if (QtVariantPropertyManager::valueType(property) == QVariant::String)
property->setToolTip(DesignerPropertyManager::value(property).toString());
else if (QtVariantPropertyManager::valueType(property) == designerStringTypeId())
- property->setToolTip(qVariantValue<PropertySheetStringValue>(DesignerPropertyManager::value(property)).value());
+ property->setToolTip(qvariant_cast<PropertySheetStringValue>(DesignerPropertyManager::value(property)).value());
else if (QtVariantPropertyManager::valueType(property) == designerKeySequenceTypeId())
- property->setToolTip(qVariantValue<PropertySheetKeySequenceValue>(DesignerPropertyManager::value(property)).value());
+ property->setToolTip(qvariant_cast<PropertySheetKeySequenceValue>(DesignerPropertyManager::value(property)).value());
else if (QtVariantPropertyManager::valueType(property) == QVariant::Bool)
property->setToolTip(QtVariantPropertyManager::valueText(property));
}
@@ -2017,7 +2017,7 @@ bool DesignerPropertyManager::resetIconSubProperty(QtProperty *property)
return false;
QtVariantProperty *pixmapProperty = variantProperty(property);
- pixmapProperty->setValue(qVariantFromValue(PropertySheetPixmapValue()));
+ pixmapProperty->setValue(QVariant::fromValue(PropertySheetPixmapValue()));
return true;
}
@@ -2131,7 +2131,7 @@ void DesignerEditorFactory::slotPropertyChanged(QtProperty *property)
if (!property->isModified())
defaultPixmap = qvariant_cast<QIcon>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC))).pixmap(16, 16);
else if (m_fwb)
- defaultPixmap = m_fwb->iconCache()->icon(qVariantValue<PropertySheetIconValue>(manager->value(property))).pixmap(16, 16);
+ defaultPixmap = m_fwb->iconCache()->icon(qvariant_cast<PropertySheetIconValue>(manager->value(property))).pixmap(16, 16);
QList<PixmapEditor *> editors = m_iconPropertyToEditors.value(property);
QListIterator<PixmapEditor *> it(editors);
while (it.hasNext()) {
@@ -2175,13 +2175,13 @@ void DesignerEditorFactory::slotValueChanged(QtProperty *property, const QVarian
break;
default:
if (type == DesignerPropertyManager::designerIconTypeId())
- applyToEditors(m_iconPropertyToEditors.value(property), &PixmapEditor::setPath, qVariantValue<PropertySheetIconValue>(value).pixmap(QIcon::Normal, QIcon::Off).path());
+ applyToEditors(m_iconPropertyToEditors.value(property), &PixmapEditor::setPath, qvariant_cast<PropertySheetIconValue>(value).pixmap(QIcon::Normal, QIcon::Off).path());
else if (type == DesignerPropertyManager::designerPixmapTypeId())
- applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setPath, qVariantValue<PropertySheetPixmapValue>(value).path());
+ applyToEditors(m_pixmapPropertyToEditors.value(property), &PixmapEditor::setPath, qvariant_cast<PropertySheetPixmapValue>(value).path());
else if (type == DesignerPropertyManager::designerStringTypeId())
- applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setText, qVariantValue<PropertySheetStringValue>(value).value());
+ applyToEditors(m_stringPropertyToEditors.value(property), &TextEditor::setText, qvariant_cast<PropertySheetStringValue>(value).value());
else if (type == DesignerPropertyManager::designerKeySequenceTypeId())
- applyToEditors(m_keySequencePropertyToEditors.value(property), &QtKeySequenceEdit::setKeySequence, qVariantValue<PropertySheetKeySequenceValue>(value).value());
+ applyToEditors(m_keySequencePropertyToEditors.value(property), &QtKeySequenceEdit::setKeySequence, qvariant_cast<PropertySheetKeySequenceValue>(value).value());
break;
}
}
@@ -2324,7 +2324,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
} else if (type == DesignerPropertyManager::designerStringTypeId()) {
const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt());
- TextEditor *ed = createTextEditor(parent, tvm, qVariantValue<PropertySheetStringValue>(manager->value(property)).value());
+ TextEditor *ed = createTextEditor(parent, tvm, qvariant_cast<PropertySheetStringValue>(manager->value(property)).value());
const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC));
if (richTextDefaultFont.type() == QVariant::Font)
ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont));
@@ -2335,7 +2335,7 @@ QWidget *DesignerEditorFactory::createEditor(QtVariantPropertyManager *manager,
editor = ed;
} else if (type == DesignerPropertyManager::designerKeySequenceTypeId()) {
QtKeySequenceEdit *ed = new QtKeySequenceEdit(parent);
- ed->setKeySequence(qVariantValue<PropertySheetKeySequenceValue>(manager->value(property)).value());
+ ed->setKeySequence(qvariant_cast<PropertySheetKeySequenceValue>(manager->value(property)).value());
m_keySequencePropertyToEditors[property].append(ed);
m_editorToKeySequenceProperty[ed] = property;
connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*)));
@@ -2456,12 +2456,12 @@ void DesignerEditorFactory::slotStringTextChanged(const QString &value)
QtVariantProperty *varProp = manager->variantProperty(prop);
QVariant val = varProp->value();
if (val.userType() == DesignerPropertyManager::designerStringTypeId()) {
- PropertySheetStringValue strVal = qVariantValue<PropertySheetStringValue>(val);
+ PropertySheetStringValue strVal = qvariant_cast<PropertySheetStringValue>(val);
strVal.setValue(value);
// Disable translation if no translation subproperties exist.
if (varProp->subProperties().empty())
strVal.setTranslatable(false);
- val = qVariantFromValue(strVal);
+ val = QVariant::fromValue(strVal);
} else {
val = QVariant(value);
}
@@ -2482,11 +2482,11 @@ void DesignerEditorFactory::slotKeySequenceChanged(const QKeySequence &value)
QtVariantProperty *varProp = manager->variantProperty(prop);
QVariant val = varProp->value();
if (val.userType() == DesignerPropertyManager::designerKeySequenceTypeId()) {
- PropertySheetKeySequenceValue keyVal = qVariantValue<PropertySheetKeySequenceValue>(val);
+ PropertySheetKeySequenceValue keyVal = qvariant_cast<PropertySheetKeySequenceValue>(val);
keyVal.setValue(value);
- val = qVariantFromValue(keyVal);
+ val = QVariant::fromValue(keyVal);
} else {
- val = qVariantFromValue(value);
+ val = QVariant::fromValue(value);
}
m_changingPropertyValue = true;
manager->variantProperty(prop)->setValue(val);
@@ -2497,24 +2497,24 @@ void DesignerEditorFactory::slotKeySequenceChanged(const QKeySequence &value)
void DesignerEditorFactory::slotPaletteChanged(const QPalette &value)
{
- updateManager(this, &m_changingPropertyValue, m_editorToPaletteProperty, qobject_cast<QWidget *>(sender()), qVariantFromValue(value));
+ updateManager(this, &m_changingPropertyValue, m_editorToPaletteProperty, qobject_cast<QWidget *>(sender()), QVariant::fromValue(value));
}
void DesignerEditorFactory::slotPixmapChanged(const QString &value)
{
updateManager(this, &m_changingPropertyValue, m_editorToPixmapProperty, qobject_cast<QWidget *>(sender()),
- qVariantFromValue(PropertySheetPixmapValue(value)));
+ QVariant::fromValue(PropertySheetPixmapValue(value)));
}
void DesignerEditorFactory::slotIconChanged(const QString &value)
{
updateManager(this, &m_changingPropertyValue, m_editorToIconProperty, qobject_cast<QWidget *>(sender()),
- qVariantFromValue(PropertySheetIconValue(PropertySheetPixmapValue(value))));
+ QVariant::fromValue(PropertySheetIconValue(PropertySheetPixmapValue(value))));
}
void DesignerEditorFactory::slotStringListChanged(const QStringList &value)
{
- updateManager(this, &m_changingPropertyValue, m_editorToStringListProperty, qobject_cast<QWidget *>(sender()), qVariantFromValue(value));
+ updateManager(this, &m_changingPropertyValue, m_editorToStringListProperty, qobject_cast<QWidget *>(sender()), QVariant::fromValue(value));
}
ResetDecorator::~ResetDecorator()
diff --git a/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp b/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp
index 9442b01..419834e 100644
--- a/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp
+++ b/tools/designer/src/components/propertyeditor/fontpropertymanager.cpp
@@ -123,7 +123,7 @@ namespace qdesigner_internal {
// This will cause a recursion
QtVariantProperty *antialiasing = vm->addProperty(enumTypeId, QCoreApplication::translate("FontPropertyManager", "Antialiasing"));
- const QFont font = qVariantValue<QFont>(vm->variantProperty(property)->value());
+ const QFont font = qvariant_cast<QFont>(vm->variantProperty(property)->value());
antialiasing->setAttribute(QLatin1String("enumNames"), m_aliasingEnumNames);
antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
@@ -196,7 +196,7 @@ namespace qdesigner_internal {
mask &= ~flag;
font.resolve(mask);
- qVariantSetValue(v, font);
+ v.setValue(font);
fontProperty->setValue(v);
return true;
}
@@ -250,13 +250,13 @@ namespace qdesigner_internal {
QtVariantProperty *fontProperty = vm->variantProperty(antialiasingProperty);
const QFont::StyleStrategy newValue = indexToAntialiasing(value.toInt());
- QFont font = qVariantValue<QFont>(fontProperty->value());
+ QFont font = qvariant_cast<QFont>(fontProperty->value());
const QFont::StyleStrategy oldValue = font.styleStrategy();
if (newValue == oldValue)
return Unchanged;
font.setStyleStrategy(newValue);
- fontProperty->setValue(qVariantFromValue(font));
+ fontProperty->setValue(QVariant::fromValue(font));
return Changed;
}
@@ -268,7 +268,7 @@ namespace qdesigner_internal {
const PropertyList &subProperties = it.value();
- QFont font = qVariantValue<QFont>(value);
+ QFont font = qvariant_cast<QFont>(value);
const unsigned mask = font.resolve();
const int count = subProperties.size();
@@ -285,7 +285,7 @@ namespace qdesigner_internal {
if (QtProperty *antialiasingProperty = m_propertyToAntialiasing.value(property, 0)) {
QtVariantProperty *antialiasing = vm->variantProperty(antialiasingProperty);
if (antialiasing) {
- QFont font = qVariantValue<QFont>(value);
+ QFont font = qvariant_cast<QFont>(value);
antialiasing->setValue(antialiasingToIndex(font.styleStrategy()));
}
}
diff --git a/tools/designer/src/components/propertyeditor/paletteeditor.cpp b/tools/designer/src/components/propertyeditor/paletteeditor.cpp
index 067946b..5c4cbcc 100644
--- a/tools/designer/src/components/propertyeditor/paletteeditor.cpp
+++ b/tools/designer/src/components/propertyeditor/paletteeditor.cpp
@@ -294,7 +294,7 @@ bool PaletteModel::setData(const QModelIndex &index, const QVariant &value, int
return false;
if (index.column() != 0 && role == BrushRole) {
- const QBrush br = qVariantValue<QBrush>(value);
+ const QBrush br = qvariant_cast<QBrush>(value);
const QPalette::ColorRole r = static_cast<QPalette::ColorRole>(index.row());
const QPalette::ColorGroup g = columnToGroup(index.column());
m_palette.setBrush(g, r, br);
@@ -336,7 +336,7 @@ bool PaletteModel::setData(const QModelIndex &index, const QVariant &value, int
}
if (index.column() == 0 && role == Qt::EditRole) {
uint mask = m_palette.resolve();
- const bool isMask = qVariantValue<bool>(value);
+ const bool isMask = qvariant_cast<bool>(value);
const int r = index.row();
if (isMask)
mask |= (1 << r);
@@ -532,13 +532,13 @@ QWidget *ColorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem
void ColorDelegate::setEditorData(QWidget *ed, const QModelIndex &index) const
{
if (index.column() == 0) {
- const bool mask = qVariantValue<bool>(index.model()->data(index, Qt::EditRole));
+ const bool mask = qvariant_cast<bool>(index.model()->data(index, Qt::EditRole));
RoleEditor *editor = static_cast<RoleEditor *>(ed);
editor->setEdited(mask);
- const QString colorName = qVariantValue<QString>(index.model()->data(index, Qt::DisplayRole));
+ const QString colorName = qvariant_cast<QString>(index.model()->data(index, Qt::DisplayRole));
editor->setLabel(colorName);
} else {
- const QBrush br = qVariantValue<QBrush>(index.model()->data(index, BrushRole));
+ const QBrush br = qvariant_cast<QBrush>(index.model()->data(index, BrushRole));
BrushEditor *editor = static_cast<BrushEditor *>(ed);
editor->setBrush(br);
}
@@ -571,11 +571,11 @@ void ColorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt,
const QModelIndex &index) const
{
QStyleOptionViewItem option = opt;
- const bool mask = qVariantValue<bool>(index.model()->data(index, Qt::EditRole));
+ const bool mask = qvariant_cast<bool>(index.model()->data(index, Qt::EditRole));
if (index.column() == 0 && mask) {
option.font.setBold(true);
}
- QBrush br = qVariantValue<QBrush>(index.model()->data(index, BrushRole));
+ QBrush br = qvariant_cast<QBrush>(index.model()->data(index, BrushRole));
if (br.style() == Qt::LinearGradientPattern ||
br.style() == Qt::RadialGradientPattern ||
br.style() == Qt::ConicalGradientPattern) {
diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.cpp b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
index a8ca8ad..7296636 100644
--- a/tools/designer/src/components/propertyeditor/propertyeditor.cpp
+++ b/tools/designer/src/components/propertyeditor/propertyeditor.cpp
@@ -872,12 +872,12 @@ void PropertyEditor::updateBrowserValue(QtVariantProperty *property, const QVari
int PropertyEditor::toBrowserType(const QVariant &value, const QString &propertyName) const
{
- if (qVariantCanConvert<PropertySheetFlagValue>(value)) {
+ if (value.canConvert<PropertySheetFlagValue>()) {
if (m_strings.m_alignmentProperties.contains(propertyName))
return DesignerPropertyManager::designerAlignmentTypeId();
return DesignerPropertyManager::designerFlagTypeId();
}
- if (qVariantCanConvert<PropertySheetEnumValue>(value))
+ if (value.canConvert<PropertySheetEnumValue>())
return DesignerPropertyManager::enumTypeId();
return value.userType();
@@ -1034,7 +1034,7 @@ void PropertyEditor::setObject(QObject *object)
}
m_updatingBrowser = true;
QVariant v;
- qVariantSetValue(v, flags);
+ v.setValue(flags);
property->setAttribute(m_strings.m_flagsAttribute, v);
m_updatingBrowser = false;
}
@@ -1223,7 +1223,7 @@ void PropertyEditor::slotValueChanged(QtProperty *property, const QVariant &valu
e.value = e.metaEnum.parseEnum(valName, &ok);
Q_ASSERT(ok);
QVariant v;
- qVariantSetValue(v, e);
+ v.setValue(e);
emitPropertyValueChanged(property->propertyName(), v, true);
return;
}
diff --git a/tools/designer/src/components/signalsloteditor/connectdialog.cpp b/tools/designer/src/components/signalsloteditor/connectdialog.cpp
index ff6be16..abd2e83 100644
--- a/tools/designer/src/components/signalsloteditor/connectdialog.cpp
+++ b/tools/designer/src/components/signalsloteditor/connectdialog.cpp
@@ -231,7 +231,7 @@ void ConnectDialog::populateSlotList(const QString &signal)
QFont font = QApplication::font();
font.setItalic(true);
- QVariant variantFont = qVariantFromValue(font);
+ QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = 0;
QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
@@ -271,7 +271,7 @@ void ConnectDialog::populateSignalList()
QFont font = QApplication::font();
font.setItalic(true);
- QVariant variantFont = qVariantFromValue(font);
+ QVariant variantFont = QVariant::fromValue(font);
QListWidgetItem *curr = 0;
QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin();
diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
index 530f176..6cfc286 100644
--- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
+++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
@@ -473,7 +473,7 @@ void InlineEditorModel::addTextList(const QMap<QString, bool> &text_list)
insertRows(cnt, text_list.size());
QFont font = QApplication::font();
font.setItalic(true);
- QVariant fontVariant = qVariantFromValue(font);
+ QVariant fontVariant = QVariant::fromValue(font);
QMap<QString, bool>::ConstIterator it = text_list.constBegin();
const QMap<QString, bool>::ConstIterator itEnd = text_list.constEnd();
while (it != itEnd) {
diff --git a/tools/designer/src/components/tabordereditor/tabordereditor.cpp b/tools/designer/src/components/tabordereditor/tabordereditor.cpp
index 37acabc..f877654 100644
--- a/tools/designer/src/components/tabordereditor/tabordereditor.cpp
+++ b/tools/designer/src/components/tabordereditor/tabordereditor.cpp
@@ -239,7 +239,7 @@ void TabOrderEditor::initTabOrder()
childQueue.append(formWindow()->mainContainer());
while (!childQueue.isEmpty()) {
QWidget *child = childQueue.takeFirst();
- childQueue += qVariantValue<QWidgetList>(child->property("_q_widgetOrder"));
+ childQueue += qvariant_cast<QWidgetList>(child->property("_q_widgetOrder"));
if (skipWidget(child))
continue;
diff --git a/tools/designer/src/components/taskmenu/button_taskmenu.cpp b/tools/designer/src/components/taskmenu/button_taskmenu.cpp
index 6b91c60..e178ebc 100644
--- a/tools/designer/src/components/taskmenu/button_taskmenu.cpp
+++ b/tools/designer/src/components/taskmenu/button_taskmenu.cpp
@@ -508,7 +508,7 @@ bool ButtonTaskMenu::refreshAssignMenu(const QDesignerFormWindowInterface *fw, i
QButtonGroup *bg = *it;
if (*it != currentGroup) {
QAction *a = new QAction(bg->objectName(), m_assignGroupSubMenu);
- a->setData(qVariantFromValue(bg));
+ a->setData(QVariant::fromValue(bg));
m_assignActionGroup->addAction(a);
m_assignGroupSubMenu->addAction(a);
}
diff --git a/tools/designer/src/components/taskmenu/inplace_editor.cpp b/tools/designer/src/components/taskmenu/inplace_editor.cpp
index 5732500..810df23 100644
--- a/tools/designer/src/components/taskmenu/inplace_editor.cpp
+++ b/tools/designer/src/components/taskmenu/inplace_editor.cpp
@@ -106,7 +106,7 @@ void TaskMenuInlineEditor::editText()
const int index = sheet->indexOf(m_property);
if (index == -1)
return;
- m_value = qVariantValue<PropertySheetStringValue>(sheet->property(index));
+ m_value = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
const QString oldValue = m_value.value();
m_editor = new InPlaceEditor(m_widget, m_vm, m_formWindow, oldValue, editRectangle());
@@ -119,9 +119,9 @@ void TaskMenuInlineEditor::updateText(const QString &text)
// do not use the cursor selection
m_value.setValue(text);
if (m_managed) {
- m_formWindow->cursor()->setProperty(m_property, qVariantFromValue(m_value));
+ m_formWindow->cursor()->setProperty(m_property, QVariant::fromValue(m_value));
} else {
- m_formWindow->cursor()->setWidgetProperty(m_widget, m_property, qVariantFromValue(m_value));
+ m_formWindow->cursor()->setWidgetProperty(m_widget, m_property, QVariant::fromValue(m_value));
}
}
diff --git a/tools/designer/src/components/taskmenu/itemlisteditor.cpp b/tools/designer/src/components/taskmenu/itemlisteditor.cpp
index 94959fd..29fe0c9 100644
--- a/tools/designer/src/components/taskmenu/itemlisteditor.cpp
+++ b/tools/designer/src/components/taskmenu/itemlisteditor.cpp
@@ -191,8 +191,8 @@ void AbstractItemEditor::propertyChanged(QtProperty *property)
return;
if ((role == ItemFlagsShadowRole && prop->value().toInt() == (int)QListWidgetItem().flags())
- || (role == Qt::DecorationPropertyRole && !qVariantValue<PropertySheetIconValue>(prop->value()).mask())
- || (role == Qt::FontRole && !qVariantValue<QFont>(prop->value()).resolve())) {
+ || (role == Qt::DecorationPropertyRole && !qvariant_cast<PropertySheetIconValue>(prop->value()).mask())
+ || (role == Qt::FontRole && !qvariant_cast<QFont>(prop->value()).resolve())) {
prop->setModified(false);
setItemData(role, QVariant());
} else {
@@ -202,19 +202,19 @@ void AbstractItemEditor::propertyChanged(QtProperty *property)
switch (role) {
case Qt::DecorationPropertyRole:
- setItemData(Qt::DecorationRole, qVariantFromValue(iconCache()->icon(qVariantValue<PropertySheetIconValue>(prop->value()))));
+ setItemData(Qt::DecorationRole, QVariant::fromValue(iconCache()->icon(qvariant_cast<PropertySheetIconValue>(prop->value()))));
break;
case Qt::DisplayPropertyRole:
- setItemData(Qt::EditRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
+ setItemData(Qt::EditRole, QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::ToolTipPropertyRole:
- setItemData(Qt::ToolTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
+ setItemData(Qt::ToolTipRole, QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::StatusTipPropertyRole:
- setItemData(Qt::StatusTipRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
+ setItemData(Qt::StatusTipRole, QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(prop->value()).value()));
break;
case Qt::WhatsThisPropertyRole:
- setItemData(Qt::WhatsThisRole, qVariantFromValue(qVariantValue<PropertySheetStringValue>(prop->value()).value()));
+ setItemData(Qt::WhatsThisRole, QVariant::fromValue(qvariant_cast<PropertySheetStringValue>(prop->value()).value()));
break;
default:
break;
@@ -236,22 +236,22 @@ void AbstractItemEditor::resetProperty(QtProperty *property)
QtVariantProperty *prop = m_propertyManager->variantProperty(property);
int role = m_propertyToRole.value(prop);
if (role == ItemFlagsShadowRole)
- prop->setValue(qVariantFromValue((int)QListWidgetItem().flags()));
+ prop->setValue(QVariant::fromValue((int)QListWidgetItem().flags()));
else
prop->setValue(QVariant(prop->valueType(), (void *)0));
prop->setModified(false);
setItemData(role, QVariant());
if (role == Qt::DecorationPropertyRole)
- setItemData(Qt::DecorationRole, qVariantFromValue(QIcon()));
+ setItemData(Qt::DecorationRole, QVariant::fromValue(QIcon()));
if (role == Qt::DisplayPropertyRole)
- setItemData(Qt::EditRole, qVariantFromValue(QString()));
+ setItemData(Qt::EditRole, QVariant::fromValue(QString()));
if (role == Qt::ToolTipPropertyRole)
- setItemData(Qt::ToolTipRole, qVariantFromValue(QString()));
+ setItemData(Qt::ToolTipRole, QVariant::fromValue(QString()));
if (role == Qt::StatusTipPropertyRole)
- setItemData(Qt::StatusTipRole, qVariantFromValue(QString()));
+ setItemData(Qt::StatusTipRole, QVariant::fromValue(QString()));
if (role == Qt::WhatsThisPropertyRole)
- setItemData(Qt::WhatsThisRole, qVariantFromValue(QString()));
+ setItemData(Qt::WhatsThisRole, QVariant::fromValue(QString()));
}
void AbstractItemEditor::cacheReloaded()
@@ -268,7 +268,7 @@ void AbstractItemEditor::updateBrowser()
QVariant val = getItemData(role);
if (!val.isValid()) {
if (role == ItemFlagsShadowRole)
- val = qVariantFromValue((int)QListWidgetItem().flags());
+ val = QVariant::fromValue((int)QListWidgetItem().flags());
else
val = QVariant((int)prop->value().userType(), (void *)0);
prop->setModified(false);
@@ -340,7 +340,7 @@ void ItemListEditor::on_newListItemButton_clicked()
int row = ui.listWidget->currentRow() + 1;
QListWidgetItem *item = new QListWidgetItem(m_newItemText);
- item->setData(Qt::DisplayPropertyRole, qVariantFromValue(PropertySheetStringValue(m_newItemText)));
+ item->setData(Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(m_newItemText)));
item->setFlags(item->flags() | Qt::ItemIsEditable);
if (row < ui.listWidget->count())
ui.listWidget->insertItem(row, item);
@@ -403,15 +403,15 @@ void ItemListEditor::on_listWidget_itemChanged(QListWidgetItem *item)
if (m_updatingBrowser)
return;
- PropertySheetStringValue val = qVariantValue<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole));
+ PropertySheetStringValue val = qvariant_cast<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole));
val.setValue(item->text());
BoolBlocker block(m_updatingBrowser);
- item->setData(Qt::DisplayPropertyRole, qVariantFromValue(val));
+ item->setData(Qt::DisplayPropertyRole, QVariant::fromValue(val));
// The checkState could change, too, but if this signal is connected,
// checkState is not in the list anyway, as we are editing a header item.
emit itemChanged(ui.listWidget->currentRow(), Qt::DisplayPropertyRole,
- qVariantFromValue(val));
+ QVariant::fromValue(val));
updateBrowser();
}
@@ -438,8 +438,8 @@ void ItemListEditor::setItemData(int role, const QVariant &v)
QVariant newValue = v;
if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
QFont oldFont = ui.listWidget->font();
- QFont newFont = qVariantValue<QFont>(newValue).resolve(oldFont);
- newValue = qVariantFromValue(newFont);
+ QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
+ newValue = QVariant::fromValue(newFont);
item->setData(role, QVariant()); // force the right font with the current resolve mask is set (item view bug)
}
item->setData(role, newValue);
diff --git a/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp b/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
index 7dd5442..cd8b188 100644
--- a/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
+++ b/tools/designer/src/components/taskmenu/tablewidgeteditor.cpp
@@ -152,8 +152,8 @@ void TableWidgetEditor::setItemData(int role, const QVariant &v)
QVariant newValue = v;
if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
QFont oldFont = ui.tableWidget->font();
- QFont newFont = qVariantValue<QFont>(newValue).resolve(oldFont);
- newValue = qVariantFromValue(newFont);
+ QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
+ newValue = QVariant::fromValue(newFont);
item->setData(role, QVariant()); // force the right font with the current resolve mask is set (item view bug)
}
item->setData(role, newValue);
@@ -179,10 +179,10 @@ void TableWidgetEditor::on_tableWidget_itemChanged(QTableWidgetItem *item)
if (m_updatingBrowser)
return;
- PropertySheetStringValue val = qVariantValue<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole));
+ PropertySheetStringValue val = qvariant_cast<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole));
val.setValue(item->text());
BoolBlocker block(m_updatingBrowser);
- item->setData(Qt::DisplayPropertyRole, qVariantFromValue(val));
+ item->setData(Qt::DisplayPropertyRole, QVariant::fromValue(val));
updateBrowser();
}
@@ -317,7 +317,7 @@ void TableWidgetEditor::on_columnEditor_itemInserted(int idx)
ui.tableWidget->setColumnCount(columnCount + 1);
QTableWidgetItem *newItem = new QTableWidgetItem(m_columnEditor->newItemText());
- newItem->setData(Qt::DisplayPropertyRole, qVariantFromValue(PropertySheetStringValue(m_columnEditor->newItemText())));
+ newItem->setData(Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(m_columnEditor->newItemText())));
ui.tableWidget->setHorizontalHeaderItem(columnCount, newItem);
moveColumnsLeft(idx, columnCount);
@@ -359,7 +359,7 @@ void TableWidgetEditor::on_rowEditor_itemInserted(int idx)
ui.tableWidget->setRowCount(rowCount + 1);
QTableWidgetItem *newItem = new QTableWidgetItem(m_rowEditor->newItemText());
- newItem->setData(Qt::DisplayPropertyRole, qVariantFromValue(PropertySheetStringValue(m_rowEditor->newItemText())));
+ newItem->setData(Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(m_rowEditor->newItemText())));
ui.tableWidget->setVerticalHeaderItem(rowCount, newItem);
moveRowsDown(idx, rowCount);
diff --git a/tools/designer/src/components/taskmenu/treewidgeteditor.cpp b/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
index c4063d1..8fab2ad 100644
--- a/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
+++ b/tools/designer/src/components/taskmenu/treewidgeteditor.cpp
@@ -171,8 +171,8 @@ void TreeWidgetEditor::setItemData(int role, const QVariant &v)
BoolBlocker block(m_updatingBrowser);
if (role == Qt::FontRole && newValue.type() == QVariant::Font) {
QFont oldFont = ui.treeWidget->font();
- QFont newFont = qVariantValue<QFont>(newValue).resolve(oldFont);
- newValue = qVariantFromValue(newFont);
+ QFont newFont = qvariant_cast<QFont>(newValue).resolve(oldFont);
+ newValue = QVariant::fromValue(newFont);
ui.treeWidget->currentItem()->setData(col, role, QVariant()); // force the right font with the current resolve mask is set (item view bug)
}
ui.treeWidget->currentItem()->setData(col, role, newValue);
@@ -198,7 +198,7 @@ void TreeWidgetEditor::on_newItemButton_clicked()
newItem = new QTreeWidgetItem(ui.treeWidget);
const QString newItemText = tr("New Item");
newItem->setText(0, newItemText);
- newItem->setData(0, Qt::DisplayPropertyRole, qVariantFromValue(PropertySheetStringValue(newItemText)));
+ newItem->setData(0, Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(newItemText)));
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
ui.treeWidget->blockSignals(false);
@@ -217,7 +217,7 @@ void TreeWidgetEditor::on_newSubItemButton_clicked()
QTreeWidgetItem *newItem = new QTreeWidgetItem(curItem);
const QString newItemText = tr("New Subitem");
newItem->setText(0, newItemText);
- newItem->setData(0, Qt::DisplayPropertyRole, qVariantFromValue(PropertySheetStringValue(newItemText)));
+ newItem->setData(0, Qt::DisplayPropertyRole, QVariant::fromValue(PropertySheetStringValue(newItemText)));
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
ui.treeWidget->blockSignals(false);
@@ -408,10 +408,10 @@ void TreeWidgetEditor::on_treeWidget_itemChanged(QTreeWidgetItem *item, int colu
if (m_updatingBrowser)
return;
- PropertySheetStringValue val = qVariantValue<PropertySheetStringValue>(item->data(column, Qt::DisplayPropertyRole));
+ PropertySheetStringValue val = qvariant_cast<PropertySheetStringValue>(item->data(column, Qt::DisplayPropertyRole));
val.setValue(item->text(column));
BoolBlocker block(m_updatingBrowser);
- item->setData(column, Qt::DisplayPropertyRole, qVariantFromValue(val));
+ item->setData(column, Qt::DisplayPropertyRole, QVariant::fromValue(val));
updateBrowser();
}
@@ -425,7 +425,7 @@ void TreeWidgetEditor::on_columnEditor_indexChanged(int idx)
void TreeWidgetEditor::on_columnEditor_itemChanged(int idx, int role, const QVariant &v)
{
if (role == Qt::DisplayPropertyRole)
- ui.treeWidget->headerItem()->setData(idx, Qt::EditRole, qVariantValue<PropertySheetStringValue>(v).value());
+ ui.treeWidget->headerItem()->setData(idx, Qt::EditRole, qvariant_cast<PropertySheetStringValue>(v).value());
ui.treeWidget->headerItem()->setData(idx, role, v);
}
diff --git a/tools/designer/src/designer/qdesigner_settings.cpp b/tools/designer/src/designer/qdesigner_settings.cpp
index cc6cec5..9404e50 100644
--- a/tools/designer/src/designer/qdesigner_settings.cpp
+++ b/tools/designer/src/designer/qdesigner_settings.cpp
@@ -241,7 +241,7 @@ ToolWindowFontSettings QDesignerSettings::toolWindowFont() const
fontSettings.m_writingSystem =
static_cast<QFontDatabase::WritingSystem>(value(QLatin1String("UI/writingSystem"),
QFontDatabase::Any).toInt());
- fontSettings.m_font = qVariantValue<QFont>(value(QLatin1String("UI/font")));
+ fontSettings.m_font = qvariant_cast<QFont>(value(QLatin1String("UI/font")));
fontSettings.m_useFont =
settings()->value(QLatin1String("UI/useFont"), QVariant(false)).toBool();
return fontSettings;
diff --git a/tools/designer/src/lib/shared/actioneditor.cpp b/tools/designer/src/lib/shared/actioneditor.cpp
index 664921e..d3716ca 100644
--- a/tools/designer/src/lib/shared/actioneditor.cpp
+++ b/tools/designer/src/lib/shared/actioneditor.cpp
@@ -459,9 +459,9 @@ void ActionEditor::slotNewAction()
setInitialProperty(sheet, QLatin1String(checkablePropertyC), QVariant(true));
if (!actionData.keysequence.value().isEmpty())
- setInitialProperty(sheet, QLatin1String(shortcutPropertyC), qVariantFromValue(actionData.keysequence));
+ setInitialProperty(sheet, QLatin1String(shortcutPropertyC), QVariant::fromValue(actionData.keysequence));
- sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), qVariantFromValue(actionData.icon));
+ sheet->setProperty(sheet->indexOf(QLatin1String(iconPropertyC)), QVariant::fromValue(actionData.icon));
AddActionCommand *cmd = new AddActionCommand(formWindow());
cmd->init(action);
@@ -486,7 +486,7 @@ static QDesignerFormWindowCommand *setIconPropertyCommand(const PropertySheetIco
return cmd;
}
SetPropertyCommand *cmd = new SetPropertyCommand(fw);
- cmd->init(action, iconProperty, qVariantFromValue(newIcon));
+ cmd->init(action, iconProperty, QVariant::fromValue(newIcon));
return cmd;
}
@@ -502,7 +502,7 @@ static QDesignerFormWindowCommand *setKeySequencePropertyCommand(const PropertyS
return cmd;
}
SetPropertyCommand *cmd = new SetPropertyCommand(fw);
- cmd->init(action, shortcutProperty, qVariantFromValue(ks));
+ cmd->init(action, shortcutProperty, QVariant::fromValue(ks));
return cmd;
}
@@ -528,7 +528,7 @@ static inline QString textPropertyValue(const QDesignerPropertySheetExtension *s
{
const int index = sheet->indexOf(name);
Q_ASSERT(index != -1);
- const PropertySheetStringValue ps = qVariantValue<PropertySheetStringValue>(sheet->property(index));
+ const PropertySheetStringValue ps = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
return ps.value();
}
@@ -545,7 +545,7 @@ void ActionEditor::editAction(QAction *action)
oldActionData.name = action->objectName();
oldActionData.text = action->text();
oldActionData.toolTip = textPropertyValue(sheet, QLatin1String(toolTipPropertyC));
- oldActionData.icon = qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
+ oldActionData.icon = qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
oldActionData.keysequence = ActionModel::actionShortCut(sheet);
oldActionData.checkable = action->isCheckable();
dlg.setActionData(oldActionData);
@@ -677,7 +677,7 @@ void ActionEditor::resourceImageDropped(const QString &path, QAction *action)
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(core()->extensionManager(), action);
const PropertySheetIconValue oldIcon =
- qVariantValue<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
+ qvariant_cast<PropertySheetIconValue>(sheet->property(sheet->indexOf(QLatin1String(iconPropertyC))));
PropertySheetIconValue newIcon;
newIcon.setPixmap(QIcon::Normal, QIcon::Off, PropertySheetPixmapValue(path));
if (newIcon.paths().isEmpty() || newIcon.paths() == oldIcon.paths())
diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp
index 1076ff4..8df6f83 100644
--- a/tools/designer/src/lib/shared/actionrepository.cpp
+++ b/tools/designer/src/lib/shared/actionrepository.cpp
@@ -136,7 +136,7 @@ QModelIndex ActionModel::addAction(QAction *action)
const Qt::ItemFlags flags = Qt::ItemIsSelectable|Qt::ItemIsDropEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsEnabled;
QVariant itemData;
- qVariantSetValue(itemData, action);
+ itemData.setValue(action);
for (int i = 0; i < NumColumns; i++) {
QStandardItem *item = new QStandardItem;
diff --git a/tools/designer/src/lib/shared/formlayoutmenu.cpp b/tools/designer/src/lib/shared/formlayoutmenu.cpp
index 8d9f9a6..ff909a7 100644
--- a/tools/designer/src/lib/shared/formlayoutmenu.cpp
+++ b/tools/designer/src/lib/shared/formlayoutmenu.cpp
@@ -432,16 +432,16 @@ static QPair<QWidget *,QWidget *>
const QString objectNameProperty = QLatin1String("objectName");
QDesignerPropertySheetExtension *labelSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), rc.first);
int nameIndex = labelSheet->indexOf(objectNameProperty);
- labelSheet->setProperty(nameIndex, qVariantFromValue(PropertySheetStringValue(row.labelName)));
+ labelSheet->setProperty(nameIndex, QVariant::fromValue(PropertySheetStringValue(row.labelName)));
labelSheet->setChanged(nameIndex, true);
formWindow->ensureUniqueObjectName(rc.first);
const int textIndex = labelSheet->indexOf(QLatin1String("text"));
- labelSheet->setProperty(textIndex, qVariantFromValue(PropertySheetStringValue(row.labelText)));
+ labelSheet->setProperty(textIndex, QVariant::fromValue(PropertySheetStringValue(row.labelText)));
labelSheet->setChanged(textIndex, true);
// Set up properties of the control
QDesignerPropertySheetExtension *controlSheet = qt_extension<QDesignerPropertySheetExtension*>(core->extensionManager(), rc.second);
nameIndex = controlSheet->indexOf(objectNameProperty);
- controlSheet->setProperty(nameIndex, qVariantFromValue(PropertySheetStringValue(row.fieldName)));
+ controlSheet->setProperty(nameIndex, QVariant::fromValue(PropertySheetStringValue(row.fieldName)));
controlSheet->setChanged(nameIndex, true);
formWindow->ensureUniqueObjectName(rc.second);
return rc;
diff --git a/tools/designer/src/lib/shared/formwindowbase.cpp b/tools/designer/src/lib/shared/formwindowbase.cpp
index 5292f5f..7e65d6b 100644
--- a/tools/designer/src/lib/shared/formwindowbase.cpp
+++ b/tools/designer/src/lib/shared/formwindowbase.cpp
@@ -184,11 +184,11 @@ void FormWindowBase::reloadProperties()
const int index = itIndex.next().key();
const QVariant newValue = sheet->property(index);
if (qobject_cast<QLabel *>(sheet->object()) && sheet->propertyName(index) == QLatin1String("text")) {
- const PropertySheetStringValue newString = qVariantValue<PropertySheetStringValue>(newValue);
+ const PropertySheetStringValue newString = qvariant_cast<PropertySheetStringValue>(newValue);
// optimize a bit, reset only if the text value might contain a reference to qt resources
// (however reloading of icons other than taken from resources might not work here)
if (newString.value().contains(QLatin1String(":/"))) {
- const QVariant resetValue = qVariantFromValue(PropertySheetStringValue());
+ const QVariant resetValue = QVariant::fromValue(PropertySheetStringValue());
sheet->setProperty(index, resetValue);
}
}
diff --git a/tools/designer/src/lib/shared/grid.cpp b/tools/designer/src/lib/shared/grid.cpp
index 42296e1..67b8d5c 100644
--- a/tools/designer/src/lib/shared/grid.cpp
+++ b/tools/designer/src/lib/shared/grid.cpp
@@ -71,7 +71,7 @@ template <class T>
const QVariantMap::const_iterator it = v.constFind(key);
const bool found = it != v.constEnd();
if (found)
- value = qVariantValue<T>(it.value());
+ value = qvariant_cast<T>(it.value());
return found;
}
diff --git a/tools/designer/src/lib/shared/morphmenu.cpp b/tools/designer/src/lib/shared/morphmenu.cpp
index 6dfac47..80eac0c 100644
--- a/tools/designer/src/lib/shared/morphmenu.cpp
+++ b/tools/designer/src/lib/shared/morphmenu.cpp
@@ -256,11 +256,11 @@ static void replaceWidgetListDynamicProperty(QWidget *parentWidget,
QWidget *oldWidget, QWidget *newWidget,
const char *name)
{
- QWidgetList list = qVariantValue<QWidgetList>(parentWidget->property(name));
+ QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(name));
const int index = list.indexOf(oldWidget);
if (index != -1) {
list.replace(index, newWidget);
- parentWidget->setProperty(name, qVariantFromValue(list));
+ parentWidget->setProperty(name, QVariant::fromValue(list));
}
}
diff --git a/tools/designer/src/lib/shared/qdesigner_command.cpp b/tools/designer/src/lib/shared/qdesigner_command.cpp
index 9fe0e89..8c01000 100644
--- a/tools/designer/src/lib/shared/qdesigner_command.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_command.cpp
@@ -107,23 +107,23 @@ static const char *zOrderPropertyC = "_q_zOrder";
static void addToWidgetListDynamicProperty(QWidget *parentWidget, QWidget *widget, const char *name, int index = -1)
{
- QWidgetList list = qVariantValue<QWidgetList>(parentWidget->property(name));
+ QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(name));
list.removeAll(widget);
if (index >= 0 && index < list.size()) {
list.insert(index, widget);
} else {
list.append(widget);
}
- parentWidget->setProperty(name, qVariantFromValue(list));
+ parentWidget->setProperty(name, QVariant::fromValue(list));
}
static int removeFromWidgetListDynamicProperty(QWidget *parentWidget, QWidget *widget, const char *name)
{
- QWidgetList list = qVariantValue<QWidgetList>(parentWidget->property(name));
+ QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(name));
const int firstIndex = list.indexOf(widget);
if (firstIndex != -1) {
list.removeAll(widget);
- parentWidget->setProperty(name, qVariantFromValue(list));
+ parentWidget->setProperty(name, QVariant::fromValue(list));
}
return firstIndex;
}
@@ -281,7 +281,7 @@ void ChangeZOrderCommand::init(QWidget *widget)
setText(QApplication::translate("Command", "Change Z-order of '%1'").arg(widget->objectName()));
- m_oldParentZOrder = qVariantValue<QWidgetList>(widget->parentWidget()->property("_q_zOrder"));
+ m_oldParentZOrder = qvariant_cast<QWidgetList>(widget->parentWidget()->property("_q_zOrder"));
const int index = m_oldParentZOrder.indexOf(m_widget);
if (index != -1 && index + 1 < m_oldParentZOrder.count())
m_oldPreceding = m_oldParentZOrder.at(index + 1);
@@ -289,14 +289,14 @@ void ChangeZOrderCommand::init(QWidget *widget)
void ChangeZOrderCommand::redo()
{
- m_widget->parentWidget()->setProperty("_q_zOrder", qVariantFromValue(reorderWidget(m_oldParentZOrder, m_widget)));
+ m_widget->parentWidget()->setProperty("_q_zOrder", QVariant::fromValue(reorderWidget(m_oldParentZOrder, m_widget)));
reorder(m_widget);
}
void ChangeZOrderCommand::undo()
{
- m_widget->parentWidget()->setProperty("_q_zOrder", qVariantFromValue(m_oldParentZOrder));
+ m_widget->parentWidget()->setProperty("_q_zOrder", QVariant::fromValue(m_oldParentZOrder));
if (m_oldPreceding)
m_widget->stackUnder(m_oldPreceding);
@@ -580,8 +580,8 @@ void ReparentWidgetCommand::init(QWidget *widget, QWidget *parentWidget)
setText(QApplication::translate("Command", "Reparent '%1'").arg(widget->objectName()));
- m_oldParentList = qVariantValue<QWidgetList>(m_oldParentWidget->property("_q_widgetOrder"));
- m_oldParentZOrder = qVariantValue<QWidgetList>(m_oldParentWidget->property("_q_zOrder"));
+ m_oldParentList = qvariant_cast<QWidgetList>(m_oldParentWidget->property("_q_widgetOrder"));
+ m_oldParentZOrder = qvariant_cast<QWidgetList>(m_oldParentWidget->property("_q_zOrder"));
}
void ReparentWidgetCommand::redo()
@@ -591,19 +591,19 @@ void ReparentWidgetCommand::redo()
QWidgetList oldList = m_oldParentList;
oldList.removeAll(m_widget);
- m_oldParentWidget->setProperty("_q_widgetOrder", qVariantFromValue(oldList));
+ m_oldParentWidget->setProperty("_q_widgetOrder", QVariant::fromValue(oldList));
- QWidgetList newList = qVariantValue<QWidgetList>(m_newParentWidget->property("_q_widgetOrder"));
+ QWidgetList newList = qvariant_cast<QWidgetList>(m_newParentWidget->property("_q_widgetOrder"));
newList.append(m_widget);
- m_newParentWidget->setProperty("_q_widgetOrder", qVariantFromValue(newList));
+ m_newParentWidget->setProperty("_q_widgetOrder", QVariant::fromValue(newList));
QWidgetList oldZOrder = m_oldParentZOrder;
oldZOrder.removeAll(m_widget);
- m_oldParentWidget->setProperty("_q_zOrder", qVariantFromValue(oldZOrder));
+ m_oldParentWidget->setProperty("_q_zOrder", QVariant::fromValue(oldZOrder));
- QWidgetList newZOrder = qVariantValue<QWidgetList>(m_newParentWidget->property("_q_zOrder"));
+ QWidgetList newZOrder = qvariant_cast<QWidgetList>(m_newParentWidget->property("_q_zOrder"));
newZOrder.append(m_widget);
- m_newParentWidget->setProperty("_q_zOrder", qVariantFromValue(newZOrder));
+ m_newParentWidget->setProperty("_q_zOrder", QVariant::fromValue(newZOrder));
m_widget->show();
core()->objectInspector()->setFormWindow(formWindow());
@@ -614,16 +614,16 @@ void ReparentWidgetCommand::undo()
m_widget->setParent(m_oldParentWidget);
m_widget->move(m_oldPos);
- m_oldParentWidget->setProperty("_q_widgetOrder", qVariantFromValue(m_oldParentList));
+ m_oldParentWidget->setProperty("_q_widgetOrder", QVariant::fromValue(m_oldParentList));
- QWidgetList newList = qVariantValue<QWidgetList>(m_newParentWidget->property("_q_widgetOrder"));
+ QWidgetList newList = qvariant_cast<QWidgetList>(m_newParentWidget->property("_q_widgetOrder"));
newList.removeAll(m_widget);
- m_newParentWidget->setProperty("_q_widgetOrder", qVariantFromValue(newList));
+ m_newParentWidget->setProperty("_q_widgetOrder", QVariant::fromValue(newList));
- m_oldParentWidget->setProperty("_q_zOrder", qVariantFromValue(m_oldParentZOrder));
+ m_oldParentWidget->setProperty("_q_zOrder", QVariant::fromValue(m_oldParentZOrder));
- QWidgetList newZOrder = qVariantValue<QWidgetList>(m_newParentWidget->property("_q_zOrder"));
- m_newParentWidget->setProperty("_q_zOrder", qVariantFromValue(newZOrder));
+ QWidgetList newZOrder = qvariant_cast<QWidgetList>(m_newParentWidget->property("_q_zOrder"));
+ m_newParentWidget->setProperty("_q_zOrder", QVariant::fromValue(newZOrder));
m_widget->show();
core()->objectInspector()->setFormWindow(formWindow());
@@ -1016,7 +1016,7 @@ void ToolBoxCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_toolBox);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QLatin1String("currentItemText")), qVariantFromValue(itemText));
+ sheet->setProperty(sheet->indexOf(QLatin1String("currentItemText")), QVariant::fromValue(itemText));
}
m_widget->show();
@@ -1176,7 +1176,7 @@ void TabWidgetCommand::addPage()
QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(formWindow()->core()->extensionManager(), m_tabWidget);
if (sheet) {
qdesigner_internal::PropertySheetStringValue itemText(m_itemText);
- sheet->setProperty(sheet->indexOf(QLatin1String("currentTabText")), qVariantFromValue(itemText));
+ sheet->setProperty(sheet->indexOf(QLatin1String("currentTabText")), QVariant::fromValue(itemText));
}
formWindow()->clearSelection();
@@ -2193,7 +2193,7 @@ static void copyRolesFromItem(ItemData *id, const T *item, bool editor)
if (editor)
copyRoleFromItem<T>(id, ItemFlagsShadowRole, item);
else if (item->flags() != defaultFlags)
- id->m_properties.insert(ItemFlagsShadowRole, qVariantFromValue((int)item->flags()));
+ id->m_properties.insert(ItemFlagsShadowRole, QVariant::fromValue((int)item->flags()));
}
template<class T>
@@ -2210,19 +2210,19 @@ static void copyRolesToItem(const ItemData *id, T *item, DesignerIconCache *icon
switch (it.key()) {
case Qt::DecorationPropertyRole:
if (iconCache)
- item->setIcon(iconCache->icon(qVariantValue<PropertySheetIconValue>(it.value())));
+ item->setIcon(iconCache->icon(qvariant_cast<PropertySheetIconValue>(it.value())));
break;
case Qt::DisplayPropertyRole:
- item->setText(qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setText(qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::ToolTipPropertyRole:
- item->setToolTip(qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setToolTip(qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::StatusTipPropertyRole:
- item->setStatusTip(qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setStatusTip(qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::WhatsThisPropertyRole:
- item->setWhatsThis(qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setWhatsThis(qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
}
}
@@ -2267,7 +2267,7 @@ ItemData::ItemData(const QTreeWidgetItem *item, int column)
{
copyRoleFromItem(this, Qt::EditRole, item, column);
PropertySheetStringValue str(item->text(column));
- m_properties.insert(Qt::DisplayPropertyRole, qVariantFromValue(str));
+ m_properties.insert(Qt::DisplayPropertyRole, QVariant::fromValue(str));
for (int i = 0; itemRoles[i] != -1; i++)
copyRoleFromItem(this, itemRoles[i], item, column);
@@ -2282,19 +2282,19 @@ void ItemData::fillTreeItemColumn(QTreeWidgetItem *item, int column, DesignerIco
switch (it.key()) {
case Qt::DecorationPropertyRole:
if (iconCache)
- item->setIcon(column, iconCache->icon(qVariantValue<PropertySheetIconValue>(it.value())));
+ item->setIcon(column, iconCache->icon(qvariant_cast<PropertySheetIconValue>(it.value())));
break;
case Qt::DisplayPropertyRole:
- item->setText(column, qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setText(column, qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::ToolTipPropertyRole:
- item->setToolTip(column, qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setToolTip(column, qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::StatusTipPropertyRole:
- item->setStatusTip(column, qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setStatusTip(column, qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
case Qt::WhatsThisPropertyRole:
- item->setWhatsThis(column, qVariantValue<PropertySheetStringValue>(it.value()).value());
+ item->setWhatsThis(column, qvariant_cast<PropertySheetStringValue>(it.value()).value());
break;
}
}
@@ -2364,10 +2364,10 @@ void ListContents::applyToComboBox(QComboBox *comboBox, DesignerIconCache *iconC
foreach (const ItemData &hash, m_items) {
QIcon icon;
if (iconCache)
- icon = iconCache->icon(qVariantValue<PropertySheetIconValue>(
+ icon = iconCache->icon(qvariant_cast<PropertySheetIconValue>(
hash.m_properties[Qt::DecorationPropertyRole]));
QVariant var = hash.m_properties[Qt::DisplayPropertyRole];
- PropertySheetStringValue str = qVariantValue<PropertySheetStringValue>(var);
+ PropertySheetStringValue str = qvariant_cast<PropertySheetStringValue>(var);
comboBox->addItem(icon, str.value());
comboBox->setItemData(comboBox->count() - 1,
var,
@@ -2407,7 +2407,7 @@ bool TableWidgetContents::nonEmpty(const QTableWidgetItem *item, int headerColum
if (item->flags() != defaultFlags)
return true;
- QString text = qVariantValue<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole)).value();
+ QString text = qvariant_cast<PropertySheetStringValue>(item->data(Qt::DisplayPropertyRole)).value();
if (!text.isEmpty()) {
if (headerColumn < 0 || text != defaultHeaderText(headerColumn))
return true;
@@ -2545,7 +2545,7 @@ QTreeWidgetItem *TreeWidgetContents::ItemContents::createTreeItem(DesignerIconCa
if (m_itemFlags != -1) {
if (editor)
- item->setData(0, ItemFlagsShadowRole, qVariantFromValue(m_itemFlags));
+ item->setData(0, ItemFlagsShadowRole, QVariant::fromValue(m_itemFlags));
else
item->setFlags((Qt::ItemFlags)m_itemFlags);
}
diff --git a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
index 14e0d81..b881589 100644
--- a/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_formbuilder.cpp
@@ -243,7 +243,7 @@ static bool readDomEnumerationValue(const DomProperty *p,
if (index == -1)
return false;
const QVariant sheetValue = sheet->property(index);
- if (qVariantCanConvert<PropertySheetFlagValue>(sheetValue)) {
+ if (sheetValue.canConvert<PropertySheetFlagValue>()) {
const PropertySheetFlagValue f = qvariant_cast<PropertySheetFlagValue>(sheetValue);
bool ok = false;
v = f.metaFlags.parseFlags(p->elementSet(), &ok);
@@ -258,7 +258,7 @@ static bool readDomEnumerationValue(const DomProperty *p,
if (index == -1)
return false;
const QVariant sheetValue = sheet->property(index);
- if (qVariantCanConvert<PropertySheetEnumValue>(sheetValue)) {
+ if (sheetValue.canConvert<PropertySheetEnumValue>()) {
const PropertySheetEnumValue e = qvariant_cast<PropertySheetEnumValue>(sheetValue);
bool ok = false;
v = e.metaEnum.parseEnum(p->elementEnum(), &ok);
diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp
index bbab032..3d9fdf1 100644
--- a/tools/designer/src/lib/shared/qdesigner_menu.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp
@@ -477,7 +477,7 @@ bool QDesignerMenu::handleContextMenuEvent(QWidget *, QContextMenuEvent *event)
QMenu menu;
QVariant itemData;
- qVariantSetValue(itemData, action);
+ itemData.setValue(action);
QAction *addSeparatorAction = menu.addAction(tr("Insert separator"));
addSeparatorAction->setData(itemData);
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index 8d53037..b017264 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -403,7 +403,7 @@ ActionList QDesignerMenuBar::contextMenuActions()
if (QAction *action = safeActionAt(m_currentIndex)) {
if (!qobject_cast<SpecialMenuAction*>(action)) {
QVariant itemData;
- qVariantSetValue(itemData, action);
+ itemData.setValue(action);
QAction *remove_action = new QAction(tr("Remove Menu '%1'").arg(action->menu()->objectName()), 0);
remove_action->setData(itemData);
diff --git a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
index 6cc054c..08385b5 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertycommand.cpp
@@ -505,7 +505,7 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant
case QVariant::Size:
return PropertyHelper::Value(applySizeSubProperty(oldValue.toSize(), newValue.toSize(), mask), changed);
case QVariant::SizePolicy:
- return PropertyHelper::Value(qVariantFromValue(applySizePolicySubProperty(qvariant_cast<QSizePolicy>(oldValue), qvariant_cast<QSizePolicy>(newValue), mask)), changed);
+ return PropertyHelper::Value(QVariant::fromValue(applySizePolicySubProperty(qvariant_cast<QSizePolicy>(oldValue), qvariant_cast<QSizePolicy>(newValue), mask)), changed);
case QVariant::Font: {
// Changed flag in case of font and palette depends on resolve mask only, not on the passed "changed" value.
@@ -524,27 +524,27 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant
// He press reset button for the whole font property. In result whole font properties for both
// widgets should be marked as unchanged.
QFont font = applyFontSubProperty(qvariant_cast<QFont>(oldValue), qvariant_cast<QFont>(newValue), mask);
- return PropertyHelper::Value(qVariantFromValue(font), font.resolve());
+ return PropertyHelper::Value(QVariant::fromValue(font), font.resolve());
}
case QVariant::Palette: {
QPalette palette = applyPaletteSubProperty(qvariant_cast<QPalette>(oldValue), qvariant_cast<QPalette>(newValue), mask);
- return PropertyHelper::Value(qVariantFromValue(palette), palette.resolve());
+ return PropertyHelper::Value(QVariant::fromValue(palette), palette.resolve());
}
default:
if (oldValue.userType() == qMetaTypeId<qdesigner_internal::PropertySheetIconValue>()) {
PropertySheetIconValue icon = qvariant_cast<qdesigner_internal::PropertySheetIconValue>(oldValue);
icon.assign(qvariant_cast<qdesigner_internal::PropertySheetIconValue>(newValue), mask);
- return PropertyHelper::Value(qVariantFromValue(icon), icon.mask());
+ return PropertyHelper::Value(QVariant::fromValue(icon), icon.mask());
} else if (oldValue.userType() == qMetaTypeId<qdesigner_internal::PropertySheetStringValue>()) {
qdesigner_internal::PropertySheetStringValue str = applyStringSubProperty(
qvariant_cast<qdesigner_internal::PropertySheetStringValue>(oldValue),
qvariant_cast<qdesigner_internal::PropertySheetStringValue>(newValue), mask);
- return PropertyHelper::Value(qVariantFromValue(str), changed);
+ return PropertyHelper::Value(QVariant::fromValue(str), changed);
} else if (oldValue.userType() == qMetaTypeId<qdesigner_internal::PropertySheetKeySequenceValue>()) {
qdesigner_internal::PropertySheetKeySequenceValue key = applyKeySequenceSubProperty(
qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(oldValue),
qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(newValue), mask);
- return PropertyHelper::Value(qVariantFromValue(key), changed);
+ return PropertyHelper::Value(QVariant::fromValue(key), changed);
}
// Enumerations, flags
switch (specialProperty) {
@@ -552,7 +552,7 @@ PropertyHelper::Value applySubProperty(const QVariant &oldValue, const QVariant
qdesigner_internal::PropertySheetFlagValue f = qvariant_cast<qdesigner_internal::PropertySheetFlagValue>(oldValue);
f.value = applyAlignmentSubProperty(variantToAlignment(oldValue), variantToAlignment(newValue), mask);
QVariant v;
- qVariantSetValue(v, f);
+ v.setValue(f);
return PropertyHelper::Value(v, changed);
}
default:
@@ -651,7 +651,7 @@ void PropertyHelper::checkApplyWidgetValue(QDesignerFormWindowInterface *fw, QWi
switch (specialProperty) {
case SP_MinimumSize: {
const QSize size = checkSize(value.toSize());
- qVariantSetValue(value, size);
+ value.setValue(size);
}
break;
@@ -660,7 +660,7 @@ void PropertyHelper::checkApplyWidgetValue(QDesignerFormWindowInterface *fw, QWi
checkSizes(fw, value.toSize(), &fs, &cs);
container->setMaximumSize(cs);
fw->mainContainer()->setMaximumSize(fs);
- qVariantSetValue(value, fs);
+ value.setValue(fs);
}
break;
@@ -670,7 +670,7 @@ void PropertyHelper::checkApplyWidgetValue(QDesignerFormWindowInterface *fw, QWi
checkSizes(fw, r.size(), &fs, &cs);
container->resize(cs);
r.setSize(fs);
- qVariantSetValue(value, r);
+ value.setValue(r);
}
break;
default:
@@ -727,8 +727,8 @@ void PropertyHelper::updateObject(QDesignerFormWindowInterface *fw, const QVaria
case OT_Widget: {
switch (m_specialProperty) {
case SP_ObjectName: {
- const QString oldName = qVariantValue<PropertySheetStringValue>(oldValue).value();
- const QString newName = qVariantValue<PropertySheetStringValue>(newValue).value();
+ const QString oldName = qvariant_cast<PropertySheetStringValue>(oldValue).value();
+ const QString newName = qvariant_cast<PropertySheetStringValue>(newValue).value();
QDesignerFormWindowCommand::updateBuddies(fw, oldName, newName);
}
break;
@@ -751,8 +751,8 @@ void PropertyHelper::updateObject(QDesignerFormWindowInterface *fw, const QVaria
case SP_LayoutName:
case SP_SpacerName:
if (QDesignerIntegration *integr = integration(fw)) {
- const QString oldName = qVariantValue<PropertySheetStringValue>(oldValue).value();
- const QString newName = qVariantValue<PropertySheetStringValue>(newValue).value();
+ const QString oldName = qvariant_cast<PropertySheetStringValue>(oldValue).value();
+ const QString newName = qvariant_cast<PropertySheetStringValue>(newValue).value();
integr->emitObjectNameChanged(fw, m_object, newName, oldName);
}
break;
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 086f46d..72ecb8f 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -290,18 +290,18 @@ bool QDesignerPropertySheetPrivate::isResourceProperty(int index) const
void QDesignerPropertySheetPrivate::addResourceProperty(int index, QVariant::Type type)
{
if (type == QVariant::Pixmap)
- m_resourceProperties.insert(index, qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue()));
+ m_resourceProperties.insert(index, QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue()));
else if (type == QVariant::Icon)
- m_resourceProperties.insert(index, qVariantFromValue(qdesigner_internal::PropertySheetIconValue()));
+ m_resourceProperties.insert(index, QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
}
QVariant QDesignerPropertySheetPrivate::emptyResourceProperty(int index) const
{
QVariant v = m_resourceProperties.value(index);
- if (qVariantCanConvert<qdesigner_internal::PropertySheetPixmapValue>(v))
- return qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue());
- if (qVariantCanConvert<qdesigner_internal::PropertySheetIconValue>(v))
- return qVariantFromValue(qdesigner_internal::PropertySheetIconValue());
+ if (v.canConvert<qdesigner_internal::PropertySheetPixmapValue>())
+ return QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue());
+ if (v.canConvert<qdesigner_internal::PropertySheetIconValue>())
+ return QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
return v;
}
@@ -320,8 +320,8 @@ void QDesignerPropertySheetPrivate::setResourceProperty(int index, const QVarian
Q_ASSERT(isResourceProperty(index));
QVariant &v = m_resourceProperties[index];
- if ((qVariantCanConvert<qdesigner_internal::PropertySheetPixmapValue>(value) && qVariantCanConvert<qdesigner_internal::PropertySheetPixmapValue>(v))
- || (qVariantCanConvert<qdesigner_internal::PropertySheetIconValue>(value) && qVariantCanConvert<qdesigner_internal::PropertySheetIconValue>(v)))
+ if ((value.canConvert<qdesigner_internal::PropertySheetPixmapValue>() && v.canConvert<qdesigner_internal::PropertySheetPixmapValue>())
+ || (value.canConvert<qdesigner_internal::PropertySheetIconValue>() && v.canConvert<qdesigner_internal::PropertySheetIconValue>()))
v = value;
}
@@ -722,14 +722,14 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV
QVariant v = value;
if (value.type() == QVariant::Icon)
- v = qVariantFromValue(qdesigner_internal::PropertySheetIconValue());
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
else if (value.type() == QVariant::Pixmap)
- v = qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue());
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetPixmapValue());
else if (value.type() == QVariant::String)
- v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue(value.toString()));
else if (value.type() == QVariant::KeySequence) {
- const QKeySequence keySequence = qVariantValue<QKeySequence>(value);
- v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+ const QKeySequence keySequence = qvariant_cast<QKeySequence>(value);
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
}
if (d->m_addIndex.contains(propName)) {
@@ -873,9 +873,9 @@ int QDesignerPropertySheet::createFakeProperty(const QString &propertyName, cons
info.kind = QDesignerPropertySheetPrivate::FakeProperty;
QVariant v = value.isValid() ? value : metaProperty(index);
if (v.type() == QVariant::String)
- v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
if (v.type() == QVariant::KeySequence)
- v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue());
+ v = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue());
d->m_fakeProperties.insert(index, v);
return index;
}
@@ -1002,17 +1002,17 @@ QVariant QDesignerPropertySheet::property(int index) const
value.setValue(strValue);
d->setStringProperty(index, value); // cache it
}
- return qVariantFromValue(value);
+ return QVariant::fromValue(value);
}
if (d->isKeySequenceProperty(index)) {
- QKeySequence keyValue = qVariantValue<QKeySequence>(metaProperty(index));
+ QKeySequence keyValue = qvariant_cast<QKeySequence>(metaProperty(index));
qdesigner_internal::PropertySheetKeySequenceValue value = d->keySequenceProperty(index);
if (keyValue != value.value()) {
value.setValue(keyValue);
d->setKeySequenceProperty(index, value); // cache it
}
- return qVariantFromValue(value);
+ return QVariant::fromValue(value);
}
return metaProperty(index);
@@ -1027,12 +1027,12 @@ QVariant QDesignerPropertySheet::metaProperty(int index) const
switch (p->kind()) {
case QDesignerMetaPropertyInterface::FlagKind: {
qdesigner_internal::PropertySheetFlagValue psflags = qdesigner_internal::PropertySheetFlagValue(v.toInt(), designerMetaFlagsFor(p->enumerator()));
- qVariantSetValue(v, psflags);
+ v.setValue(psflags);
}
break;
case QDesignerMetaPropertyInterface::EnumKind: {
qdesigner_internal::PropertySheetEnumValue pse = qdesigner_internal::PropertySheetEnumValue(v.toInt(), designerMetaEnumFor(p->enumerator()));
- qVariantSetValue(v, pse);
+ v.setValue(pse);
}
break;
case QDesignerMetaPropertyInterface::OtherKind:
@@ -1043,20 +1043,20 @@ QVariant QDesignerPropertySheet::metaProperty(int index) const
QVariant QDesignerPropertySheet::resolvePropertyValue(int index, const QVariant &value) const
{
- if (qVariantCanConvert<qdesigner_internal::PropertySheetEnumValue>(value))
+ if (value.canConvert<qdesigner_internal::PropertySheetEnumValue>())
return qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(value).value;
- if (qVariantCanConvert<qdesigner_internal::PropertySheetFlagValue>(value))
+ if (value.canConvert<qdesigner_internal::PropertySheetFlagValue>())
return qvariant_cast<qdesigner_internal::PropertySheetFlagValue>(value).value;
- if (qVariantCanConvert<qdesigner_internal::PropertySheetStringValue>(value))
- return qVariantValue<qdesigner_internal::PropertySheetStringValue>(value).value();
+ if (value.canConvert<qdesigner_internal::PropertySheetStringValue>())
+ return qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value).value();
- if (qVariantCanConvert<qdesigner_internal::PropertySheetKeySequenceValue>(value))
- return qVariantValue<qdesigner_internal::PropertySheetKeySequenceValue>(value).value();
+ if (value.canConvert<qdesigner_internal::PropertySheetKeySequenceValue>())
+ return qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value).value();
- if (qVariantCanConvert<qdesigner_internal::PropertySheetPixmapValue>(value)) {
- const QString path = qVariantValue<qdesigner_internal::PropertySheetPixmapValue>(value).path();
+ if (value.canConvert<qdesigner_internal::PropertySheetPixmapValue>()) {
+ const QString path = qvariant_cast<qdesigner_internal::PropertySheetPixmapValue>(value).path();
if (path.isEmpty())
return defaultResourceProperty(index);
if (d->m_pixmapCache) {
@@ -1064,8 +1064,8 @@ QVariant QDesignerPropertySheet::resolvePropertyValue(int index, const QVariant
}
}
- if (qVariantCanConvert<qdesigner_internal::PropertySheetIconValue>(value)) {
- const int pathCount = qVariantValue<qdesigner_internal::PropertySheetIconValue>(value).paths().count();
+ if (value.canConvert<qdesigner_internal::PropertySheetIconValue>()) {
+ const int pathCount = qvariant_cast<qdesigner_internal::PropertySheetIconValue>(value).paths().count();
if (pathCount == 0)
return defaultResourceProperty(index);
if (d->m_iconCache)
@@ -1082,17 +1082,17 @@ void QDesignerPropertySheet::setFakeProperty(int index, const QVariant &value)
QVariant &v = d->m_fakeProperties[index];
// set resource properties also (if we are going to have fake resource properties)
- if (qVariantCanConvert<qdesigner_internal::PropertySheetFlagValue>(value) || qVariantCanConvert<qdesigner_internal::PropertySheetEnumValue>(value)) {
+ if (value.canConvert<qdesigner_internal::PropertySheetFlagValue>() || value.canConvert<qdesigner_internal::PropertySheetEnumValue>()) {
v = value;
- } else if (qVariantCanConvert<qdesigner_internal::PropertySheetFlagValue>(v)) {
+ } else if (v.canConvert<qdesigner_internal::PropertySheetFlagValue>()) {
qdesigner_internal::PropertySheetFlagValue f = qvariant_cast<qdesigner_internal::PropertySheetFlagValue>(v);
f.value = value.toInt();
- qVariantSetValue(v, f);
+ v.setValue(f);
Q_ASSERT(value.type() == QVariant::Int);
- } else if (qVariantCanConvert<qdesigner_internal::PropertySheetEnumValue>(v)) {
+ } else if (v.canConvert<qdesigner_internal::PropertySheetEnumValue>()) {
qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(v);
e.value = value.toInt();
- qVariantSetValue(v, e);
+ v.setValue(e);
Q_ASSERT(value.type() == QVariant::Int);
} else {
v = value;
@@ -1139,9 +1139,9 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value)
if (d->isResourceProperty(index))
d->setResourceProperty(index, value);
if (d->isStringProperty(index))
- d->setStringProperty(index, qVariantValue<qdesigner_internal::PropertySheetStringValue>(value));
+ d->setStringProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value));
if (d->isKeySequenceProperty(index))
- d->setKeySequenceProperty(index, qVariantValue<qdesigner_internal::PropertySheetKeySequenceValue>(value));
+ d->setKeySequenceProperty(index, qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value));
d->m_object->setProperty(propertyName(index).toUtf8(), resolvePropertyValue(index, value));
if (d->m_object->isWidgetType()) {
QWidget *w = qobject_cast<QWidget *>(d->m_object);
@@ -1155,26 +1155,26 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value)
if (d->isResourceProperty(index))
d->setResourceProperty(index, value);
if (d->isStringProperty(index))
- d->setStringProperty(index, qVariantValue<qdesigner_internal::PropertySheetStringValue>(value));
+ d->setStringProperty(index, qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value));
if (d->isKeySequenceProperty(index))
- d->setKeySequenceProperty(index, qVariantValue<qdesigner_internal::PropertySheetKeySequenceValue>(value));
+ d->setKeySequenceProperty(index, qvariant_cast<qdesigner_internal::PropertySheetKeySequenceValue>(value));
const QDesignerMetaPropertyInterface *p = d->m_meta->property(index);
p->write(d->m_object, resolvePropertyValue(index, value));
if (qobject_cast<QGroupBox *>(d->m_object) && propertyType(index) == PropertyCheckable) {
const int idx = indexOf(QLatin1String("focusPolicy"));
if (!isChanged(idx)) {
- qdesigner_internal::PropertySheetEnumValue e = qVariantValue<qdesigner_internal::PropertySheetEnumValue>(property(idx));
+ qdesigner_internal::PropertySheetEnumValue e = qvariant_cast<qdesigner_internal::PropertySheetEnumValue>(property(idx));
if (value.toBool()) {
const QDesignerMetaPropertyInterface *p = d->m_meta->property(idx);
p->write(d->m_object, Qt::NoFocus);
e.value = Qt::StrongFocus;
QVariant v;
- qVariantSetValue(v, e);
+ v.setValue(e);
setFakeProperty(idx, v);
} else {
e.value = Qt::NoFocus;
QVariant v;
- qVariantSetValue(v, e);
+ v.setValue(e);
setFakeProperty(idx, v);
}
}
@@ -1196,9 +1196,9 @@ bool QDesignerPropertySheet::reset(int index)
if (d->invalidIndex(Q_FUNC_INFO, index))
return false;
if (d->isStringProperty(index))
- setProperty(index, qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
+ setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
if (d->isKeySequenceProperty(index))
- setProperty(index, qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue()));
+ setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue()));
if (d->isResourceProperty(index)) {
setProperty(index, d->emptyResourceProperty(index));
return true;
@@ -1208,10 +1208,10 @@ bool QDesignerPropertySheet::reset(int index)
const QVariant defaultValue = d->m_info.value(index).defaultValue;
QVariant newValue = defaultValue;
if (d->isStringProperty(index)) {
- newValue = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString()));
+ newValue = QVariant::fromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString()));
} else if (d->isKeySequenceProperty(index)) {
- const QKeySequence keySequence = qVariantValue<QKeySequence>(newValue);
- newValue = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
+ const QKeySequence keySequence = qvariant_cast<QKeySequence>(newValue);
+ newValue = QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence));
}
if (oldValue == newValue)
return true;
diff --git a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
index 78c6bd9..461212c 100644
--- a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp
@@ -405,13 +405,13 @@ QTabWidgetPropertySheet::QTabWidgetPropertySheet(QTabWidget *object, QObject *pa
QDesignerPropertySheet(object, parent),
m_tabWidget(object)
{
- createFakeProperty(QLatin1String(currentTabTextKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(QLatin1String(currentTabTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
createFakeProperty(QLatin1String(currentTabNameKey), QString());
- createFakeProperty(QLatin1String(currentTabIconKey), qVariantFromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(QLatin1String(currentTabIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentTabIconKey)));
- createFakeProperty(QLatin1String(currentTabToolTipKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
- createFakeProperty(QLatin1String(currentTabWhatsThisKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(QLatin1String(currentTabToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(QLatin1String(currentTabWhatsThisKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
// Prevent the tab widget's drag and drop handling from interfering with Designer's
createFakeProperty(QLatin1String(tabMovableKey), QVariant(false));
}
@@ -447,22 +447,22 @@ void QTabWidgetPropertySheet::setProperty(int index, const QVariant &value)
switch (tabWidgetProperty) {
case PropertyCurrentTabText:
m_tabWidget->setTabText(currentIndex, qvariant_cast<QString>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].text = qVariantValue<qdesigner_internal::PropertySheetStringValue>(value);
+ m_pageToData[currentWidget].text = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value);
break;
case PropertyCurrentTabName:
currentWidget->setObjectName(value.toString());
break;
case PropertyCurrentTabIcon:
m_tabWidget->setTabIcon(currentIndex, qvariant_cast<QIcon>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].icon = qVariantValue<qdesigner_internal::PropertySheetIconValue>(value);
+ m_pageToData[currentWidget].icon = qvariant_cast<qdesigner_internal::PropertySheetIconValue>(value);
break;
case PropertyCurrentTabToolTip:
m_tabWidget->setTabToolTip(currentIndex, qvariant_cast<QString>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].tooltip = qVariantValue<qdesigner_internal::PropertySheetStringValue>(value);
+ m_pageToData[currentWidget].tooltip = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value);
break;
case PropertyCurrentTabWhatsThis:
m_tabWidget->setTabWhatsThis(currentIndex, qvariant_cast<QString>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].whatsthis = qVariantValue<qdesigner_internal::PropertySheetStringValue>(value);
+ m_pageToData[currentWidget].whatsthis = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value);
break;
case PropertyTabWidgetNone:
break;
@@ -486,28 +486,28 @@ QVariant QTabWidgetPropertySheet::property(int index) const
QWidget *currentWidget = m_tabWidget->currentWidget();
if (!currentWidget) {
if (tabWidgetProperty == PropertyCurrentTabIcon)
- return qVariantFromValue(qdesigner_internal::PropertySheetIconValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
if (tabWidgetProperty == PropertyCurrentTabText)
- return qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
if (tabWidgetProperty == PropertyCurrentTabToolTip)
- return qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
if (tabWidgetProperty == PropertyCurrentTabWhatsThis)
- return qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
return QVariant(QString());
}
// index-dependent
switch (tabWidgetProperty) {
case PropertyCurrentTabText:
- return qVariantFromValue(m_pageToData.value(currentWidget).text);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).text);
case PropertyCurrentTabName:
return currentWidget->objectName();
case PropertyCurrentTabIcon:
- return qVariantFromValue(m_pageToData.value(currentWidget).icon);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).icon);
case PropertyCurrentTabToolTip:
- return qVariantFromValue(m_pageToData.value(currentWidget).tooltip);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).tooltip);
case PropertyCurrentTabWhatsThis:
- return qVariantFromValue(m_pageToData.value(currentWidget).whatsthis);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).whatsthis);
case PropertyTabWidgetNone:
break;
}
diff --git a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
index cd95f5b..a607f35 100644
--- a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp
@@ -132,7 +132,7 @@ static QString objName(const QDesignerFormEditorInterface *core, QObject *object
const QString objectNameProperty = QLatin1String("objectName");
const int index = sheet->indexOf(objectNameProperty);
const qdesigner_internal::PropertySheetStringValue objectNameValue
- = qVariantValue<qdesigner_internal::PropertySheetStringValue>(sheet->property(index));
+ = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(sheet->property(index));
return objectNameValue.value();
}
@@ -447,7 +447,7 @@ void QDesignerTaskMenu::changeObjectName()
const QString objectNameProperty = QLatin1String("objectName");
PropertySheetStringValue objectNameValue;
objectNameValue.setValue(newObjectName);
- setProperty(fw, CurrentWidgetMode, objectNameProperty, qVariantFromValue(objectNameValue));
+ setProperty(fw, CurrentWidgetMode, objectNameProperty, QVariant::fromValue(objectNameValue));
}
}
}
@@ -465,7 +465,7 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS
qDebug() << "** WARNING Invalid property" << propertyName << " passed to changeTextProperty!";
return;
}
- PropertySheetStringValue textValue = qVariantValue<PropertySheetStringValue>(sheet->property(index));
+ PropertySheetStringValue textValue = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
const QString oldText = textValue.value();
// Pop up respective dialog
bool accepted = false;
@@ -498,7 +498,7 @@ void QDesignerTaskMenu::changeTextProperty(const QString &propertyName, const QS
textValue.setValue(newText);
- setProperty(fw, pm, propertyName, qVariantFromValue(textValue));
+ setProperty(fw, pm, propertyName, QVariant::fromValue(textValue));
}
void QDesignerTaskMenu::changeToolTip()
@@ -673,7 +673,7 @@ void QDesignerTaskMenu::navigateToSlot(QDesignerFormEditorInterface *core,
if (selectSignalDialog.exec() == QDialog::Accepted) {
QTreeWidgetItem *selectedItem = dialogUi.signalList->selectedItems().first();
const QString signalSignature = selectedItem->text(0);
- const QStringList parameterNames = qVariantValue<QStringList>(selectedItem->data(0, Qt::UserRole));
+ const QStringList parameterNames = qvariant_cast<QStringList>(selectedItem->data(0, Qt::UserRole));
// TODO: Check whether signal is connected to slot
integr->emitNavigateToSlot(objectName, signalSignature, parameterNames);
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
index e3bc64c..629c810 100644
--- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp
@@ -146,7 +146,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
// Insert before
if (action && index != 0 && !action->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0);
- qVariantSetValue(itemData, action);
+ itemData.setValue(action);
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
@@ -155,7 +155,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
// Append separator
if (actions.empty() || !actions.back()->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0);
- qVariantSetValue(itemData, static_cast<QAction*>(0));
+ itemData.setValue(static_cast<QAction*>(0));
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
@@ -167,7 +167,7 @@ ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
// Remove
if (action) {
QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0);
- qVariantSetValue(itemData, action);
+ itemData.setValue(action);
a->setData(itemData);
connect(a, SIGNAL(triggered()), this, SLOT(slotRemoveSelectedAction()));
rc.push_back(a);
diff --git a/tools/designer/src/lib/shared/qdesigner_toolbox.cpp b/tools/designer/src/lib/shared/qdesigner_toolbox.cpp
index 986bfbe..c0f7c20 100644
--- a/tools/designer/src/lib/shared/qdesigner_toolbox.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_toolbox.cpp
@@ -260,12 +260,12 @@ QToolBoxWidgetPropertySheet::QToolBoxWidgetPropertySheet(QToolBox *object, QObje
QDesignerPropertySheet(object, parent),
m_toolBox(object)
{
- createFakeProperty(QLatin1String(currentItemTextKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(QLatin1String(currentItemTextKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
createFakeProperty(QLatin1String(currentItemNameKey), QString());
- createFakeProperty(QLatin1String(currentItemIconKey), qVariantFromValue(qdesigner_internal::PropertySheetIconValue()));
+ createFakeProperty(QLatin1String(currentItemIconKey), QVariant::fromValue(qdesigner_internal::PropertySheetIconValue()));
if (formWindowBase())
formWindowBase()->addReloadableProperty(this, indexOf(QLatin1String(currentItemIconKey)));
- createFakeProperty(QLatin1String(currentItemToolTipKey), qVariantFromValue(qdesigner_internal::PropertySheetStringValue()));
+ createFakeProperty(QLatin1String(currentItemToolTipKey), QVariant::fromValue(qdesigner_internal::PropertySheetStringValue()));
createFakeProperty(QLatin1String(tabSpacingKey), QVariant(tabSpacingDefault));
}
@@ -306,18 +306,18 @@ void QToolBoxWidgetPropertySheet::setProperty(int index, const QVariant &value)
switch (toolBoxProperty) {
case PropertyCurrentItemText:
m_toolBox->setItemText(currentIndex, qvariant_cast<QString>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].text = qVariantValue<qdesigner_internal::PropertySheetStringValue>(value);
+ m_pageToData[currentWidget].text = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value);
break;
case PropertyCurrentItemName:
currentWidget->setObjectName(value.toString());
break;
case PropertyCurrentItemIcon:
m_toolBox->setItemIcon(currentIndex, qvariant_cast<QIcon>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].icon = qVariantValue<qdesigner_internal::PropertySheetIconValue>(value);
+ m_pageToData[currentWidget].icon = qvariant_cast<qdesigner_internal::PropertySheetIconValue>(value);
break;
case PropertyCurrentItemToolTip:
m_toolBox->setItemToolTip(currentIndex, qvariant_cast<QString>(resolvePropertyValue(index, value)));
- m_pageToData[currentWidget].tooltip = qVariantValue<qdesigner_internal::PropertySheetStringValue>(value);
+ m_pageToData[currentWidget].tooltip = qvariant_cast<qdesigner_internal::PropertySheetStringValue>(value);
break;
case PropertyTabSpacing:
case PropertyToolBoxNone:
@@ -353,24 +353,24 @@ QVariant QToolBoxWidgetPropertySheet::property(int index) const
QWidget *currentWidget = m_toolBox->currentWidget();
if (!currentWidget) {
if (toolBoxProperty == PropertyCurrentItemIcon)
- return qVariantFromValue(qdesigner_internal::PropertySheetIconValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetIconValue());
if (toolBoxProperty == PropertyCurrentItemText)
- return qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
if (toolBoxProperty == PropertyCurrentItemToolTip)
- return qVariantFromValue(qdesigner_internal::PropertySheetStringValue());
+ return QVariant::fromValue(qdesigner_internal::PropertySheetStringValue());
return QVariant(QString());
}
// index-dependent
switch (toolBoxProperty) {
case PropertyCurrentItemText:
- return qVariantFromValue(m_pageToData.value(currentWidget).text);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).text);
case PropertyCurrentItemName:
return currentWidget->objectName();
case PropertyCurrentItemIcon:
- return qVariantFromValue(m_pageToData.value(currentWidget).icon);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).icon);
case PropertyCurrentItemToolTip:
- return qVariantFromValue(m_pageToData.value(currentWidget).tooltip);
+ return QVariant::fromValue(m_pageToData.value(currentWidget).tooltip);
case PropertyTabSpacing:
case PropertyToolBoxNone:
break;
diff --git a/tools/designer/src/lib/shared/qdesigner_utils.cpp b/tools/designer/src/lib/shared/qdesigner_utils.cpp
index 3bd0704..de3e387 100644
--- a/tools/designer/src/lib/shared/qdesigner_utils.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_utils.cpp
@@ -82,8 +82,8 @@ namespace qdesigner_internal
for (int c = 0; c < item->columnCount(); c++) {
const QVariant v = item->data(c, Qt::DecorationPropertyRole);
- if (qVariantCanConvert<PropertySheetIconValue>(v))
- item->setIcon(c, iconCache->icon(qVariantValue<PropertySheetIconValue>(v)));
+ if (v.canConvert<PropertySheetIconValue>())
+ item->setIcon(c, iconCache->icon(qvariant_cast<PropertySheetIconValue>(v)));
}
}
@@ -93,8 +93,8 @@ namespace qdesigner_internal
return;
const QVariant v = item->data(Qt::DecorationPropertyRole);
- if (qVariantCanConvert<PropertySheetIconValue>(v))
- item->setIcon(iconCache->icon(qVariantValue<PropertySheetIconValue>(v)));
+ if (v.canConvert<PropertySheetIconValue>())
+ item->setIcon(iconCache->icon(qvariant_cast<PropertySheetIconValue>(v)));
}
void reloadTableItem(DesignerIconCache *iconCache, QTableWidgetItem *item)
@@ -103,8 +103,8 @@ namespace qdesigner_internal
return;
const QVariant v = item->data(Qt::DecorationPropertyRole);
- if (qVariantCanConvert<PropertySheetIconValue>(v))
- item->setIcon(iconCache->icon(qVariantValue<PropertySheetIconValue>(v)));
+ if (v.canConvert<PropertySheetIconValue>())
+ item->setIcon(iconCache->icon(qvariant_cast<PropertySheetIconValue>(v)));
}
void reloadIconResources(DesignerIconCache *iconCache, QObject *object)
@@ -115,8 +115,8 @@ namespace qdesigner_internal
} else if (QComboBox *comboBox = qobject_cast<QComboBox *>(object)) {
for (int i = 0; i < comboBox->count(); i++) {
const QVariant v = comboBox->itemData(i, Qt::DecorationPropertyRole);
- if (qVariantCanConvert<PropertySheetIconValue>(v)) {
- QIcon icon = iconCache->icon(qVariantValue<PropertySheetIconValue>(v));
+ if (v.canConvert<PropertySheetIconValue>()) {
+ QIcon icon = iconCache->icon(qvariant_cast<PropertySheetIconValue>(v));
comboBox->setItemIcon(i, icon);
comboBox->setItemData(i, icon);
}
diff --git a/tools/designer/src/lib/shared/qdesigner_utils_p.h b/tools/designer/src/lib/shared/qdesigner_utils_p.h
index fac0697..bed1d05 100644
--- a/tools/designer/src/lib/shared/qdesigner_utils_p.h
+++ b/tools/designer/src/lib/shared/qdesigner_utils_p.h
@@ -432,15 +432,15 @@ namespace Utils {
inline int valueOf(const QVariant &value, bool *ok = 0)
{
- if (qVariantCanConvert<PropertySheetEnumValue>(value)) {
+ if (value.canConvert<PropertySheetEnumValue>()) {
if (ok)
*ok = true;
- return qVariantValue<PropertySheetEnumValue>(value).value;
+ return qvariant_cast<PropertySheetEnumValue>(value).value;
}
- else if (qVariantCanConvert<PropertySheetFlagValue>(value)) {
+ else if (value.canConvert<PropertySheetFlagValue>()) {
if (ok)
*ok = true;
- return qVariantValue<PropertySheetFlagValue>(value).value;
+ return qvariant_cast<PropertySheetFlagValue>(value).value;
}
return value.toInt(ok);
}
diff --git a/tools/designer/src/lib/shared/stylesheeteditor.cpp b/tools/designer/src/lib/shared/stylesheeteditor.cpp
index b76d700..955f8e4 100644
--- a/tools/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/tools/designer/src/lib/shared/stylesheeteditor.cpp
@@ -393,14 +393,14 @@ StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent,
qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget);
Q_ASSERT(sheet != 0);
const int index = sheet->indexOf(QLatin1String(styleSheetProperty));
- const PropertySheetStringValue value = qVariantValue<PropertySheetStringValue>(sheet->property(index));
+ const PropertySheetStringValue value = qvariant_cast<PropertySheetStringValue>(sheet->property(index));
setText(value.value());
}
void StyleSheetPropertyEditorDialog::applyStyleSheet()
{
const PropertySheetStringValue value(text(), false);
- m_fw->cursor()->setWidgetProperty(m_widget, QLatin1String(styleSheetProperty), qVariantFromValue(value));
+ m_fw->cursor()->setWidgetProperty(m_widget, QLatin1String(styleSheetProperty), QVariant::fromValue(value));
}
} // namespace qdesigner_internal
diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
index a280876..ad2aa05 100644
--- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp
+++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp
@@ -363,7 +363,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
const QStringList zOrderNames = ui_widget->elementZOrder();
if (!zOrderNames.isEmpty()) {
- QList<QWidget *> zOrder = qVariantValue<QWidgetList>(w->property("_q_zOrder"));
+ QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(w->property("_q_zOrder"));
foreach (const QString &widgetName, zOrderNames) {
if (QWidget *child = w->findChild<QWidget*>(widgetName)) {
if (child->parentWidget() == w) {
@@ -373,7 +373,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge
}
}
}
- w->setProperty("_q_zOrder", qVariantFromValue(zOrder));
+ w->setProperty("_q_zOrder", QVariant::fromValue(zOrder));
}
return w;
@@ -1287,7 +1287,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
{
QList<QObject *> childObjects = widget->children();
- const QList<QWidget *> list = qVariantValue<QWidgetList>(widget->property("_q_widgetOrder"));
+ const QList<QWidget *> list = qvariant_cast<QWidgetList>(widget->property("_q_widgetOrder"));
foreach (QWidget *w, list) {
if (childObjects.contains(w)) {
children.append(w);
@@ -1296,7 +1296,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent
}
children += childObjects;
- const QList<QWidget *> zOrder = qVariantValue<QWidgetList>(widget->property("_q_zOrder"));
+ const QList<QWidget *> zOrder = qvariant_cast<QWidgetList>(widget->property("_q_zOrder"));
if (list != zOrder) {
QStringList zOrderList;
QListIterator<QWidget* > itZOrder(zOrder);
@@ -1747,7 +1747,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, T *item,
if ((p = properties.value(it.second))) {
v = formBuilder->textBuilder()->loadText(p);
QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
- item->setData(it.first.first, qVariantValue<QString>(nativeValue));
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
item->setData(it.first.second, v);
}
@@ -1759,7 +1759,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, T *item,
if ((p = properties.value(strings.iconAttribute))) {
v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
- item->setIcon(qVariantValue<QIcon>(nativeValue));
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
item->setData(Qt::DecorationPropertyRole, v);
}
}
@@ -1855,7 +1855,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QTableWidge
if ((p = properties.value(it.second))) {
v = formBuilder->textBuilder()->loadText(p);
QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
- item->setData(it.first.first, qVariantValue<QString>(nativeValue));
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
item->setData(it.first.second, v);
}
@@ -1867,7 +1867,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QTableWidge
if ((p = properties.value(strings.iconAttribute))) {
v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
- item->setIcon(qVariantValue<QIcon>(nativeValue));
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
item->setData(Qt::DecorationPropertyRole, v);
}
}
@@ -1885,7 +1885,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QListWidget
if ((p = properties.value(it.second))) {
v = formBuilder->textBuilder()->loadText(p);
QVariant nativeValue = formBuilder->textBuilder()->toNativeValue(v);
- item->setData(it.first.first, qVariantValue<QString>(nativeValue));
+ item->setData(it.first.first, qvariant_cast<QString>(nativeValue));
item->setData(it.first.second, v);
}
@@ -1897,7 +1897,7 @@ static void loadItemProps(QAbstractFormBuilder *abstractFormBuilder, QListWidget
if ((p = properties.value(strings.iconAttribute))) {
v = formBuilder->resourceBuilder()->loadResource(formBuilder->workingDirectory(), p);
QVariant nativeValue = formBuilder->resourceBuilder()->toNativeValue(v);
- item->setIcon(qVariantValue<QIcon>(nativeValue));
+ item->setIcon(qvariant_cast<QIcon>(nativeValue));
item->setData(Qt::DecorationPropertyRole, v);
}
}
@@ -2337,14 +2337,14 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
if ((p = properties.value(it.second))) {
v = textBuilder()->loadText(p);
QVariant nativeValue = textBuilder()->toNativeValue(v);
- treeWidget->headerItem()->setData(i, it.first.first, qVariantValue<QString>(nativeValue));
+ treeWidget->headerItem()->setData(i, it.first.first, qvariant_cast<QString>(nativeValue));
treeWidget->headerItem()->setData(i, it.first.second, v);
}
if ((p = properties.value(strings.iconAttribute))) {
v = resourceBuilder()->loadResource(workingDirectory(), p);
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
- treeWidget->headerItem()->setIcon(i, qVariantValue<QIcon>(nativeValue));
+ treeWidget->headerItem()->setIcon(i, qvariant_cast<QIcon>(nativeValue));
treeWidget->headerItem()->setData(i, Qt::DecorationPropertyRole, v);
}
}
@@ -2374,14 +2374,14 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
col++;
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
- currentItem->setText(col, qVariantValue<QString>(nativeValue));
+ currentItem->setText(col, qvariant_cast<QString>(nativeValue));
currentItem->setData(col, Qt::DisplayPropertyRole, textV);
} else if (col >= 0) {
if (property->attributeName() == strings.iconAttribute) {
QVariant v = resourceBuilder()->loadResource(workingDirectory(), property);
if (v.isValid()) {
QVariant nativeValue = resourceBuilder()->toNativeValue(v);
- currentItem->setIcon(col, qVariantValue<QIcon>(nativeValue));
+ currentItem->setIcon(col, qvariant_cast<QIcon>(nativeValue));
currentItem->setData(col, Qt::DecorationPropertyRole, v);
}
} else {
@@ -2397,7 +2397,7 @@ void QAbstractFormBuilder::loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWi
if (rolePair.first >= 0) {
QVariant textV = textBuilder()->loadText(property);
QVariant nativeValue = textBuilder()->toNativeValue(textV);
- currentItem->setData(col, rolePair.first, qVariantValue<QString>(nativeValue));
+ currentItem->setData(col, rolePair.first, qvariant_cast<QString>(nativeValue));
currentItem->setData(col, rolePair.second, textV);
}
}
@@ -2475,13 +2475,13 @@ void QAbstractFormBuilder::loadComboBoxExtraInfo(DomWidget *ui_widget, QComboBox
p = properties.value(strings.textAttribute);
if (p && p->elementString()) {
textData = textBuilder()->loadText(p);
- text = qVariantValue<QString>(textBuilder()->toNativeValue(textData));
+ text = qvariant_cast<QString>(textBuilder()->toNativeValue(textData));
}
p = properties.value(strings.iconAttribute);
if (p) {
iconData = resourceBuilder()->loadResource(workingDirectory(), p);
- icon = qVariantValue<QIcon>(resourceBuilder()->toNativeValue(iconData));
+ icon = qvariant_cast<QIcon>(resourceBuilder()->toNativeValue(iconData));
}
comboBox->addItem(icon, text);
diff --git a/tools/designer/src/lib/uilib/properties.cpp b/tools/designer/src/lib/uilib/properties.cpp
index 615aa8a..b660dc4 100644
--- a/tools/designer/src/lib/uilib/properties.cpp
+++ b/tools/designer/src/lib/uilib/properties.cpp
@@ -78,7 +78,7 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
case DomProperty::String: {
const int index = meta->indexOfProperty(p->attributeName().toUtf8());
if (index != -1 && meta->property(index).type() == QVariant::KeySequence)
- return qVariantFromValue(QKeySequence(p->elementString()->text()));
+ return QVariant::fromValue(QKeySequence(p->elementString()->text()));
}
break;
@@ -96,7 +96,7 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
afb->setupColorGroup(palette, QPalette::Disabled, dom->elementDisabled());
palette.setCurrentColorGroup(QPalette::Active);
- return qVariantFromValue(palette);
+ return QVariant::fromValue(palette);
}
case DomProperty::Set: {
@@ -135,7 +135,7 @@ QVariant domPropertyToVariant(QAbstractFormBuilder *afb,const QMetaObject *meta,
return QVariant(e.keyToValue(enumValue.toUtf8()));
}
case DomProperty::Brush:
- return qVariantFromValue(afb->setupBrush(p->elementBrush()));
+ return QVariant::fromValue(afb->setupBrush(p->elementBrush()));
default:
if (afb->resourceBuilder()->isResourceProperty(p)) {
return afb->resourceBuilder()->loadResource(afb->workingDirectory(), p);
@@ -212,7 +212,7 @@ QVariant domPropertyToVariant(const DomProperty *p)
case DomProperty::Char: {
const DomChar *character = p->elementChar();
const QChar c(character->elementUnicode());
- return qVariantFromValue(c);
+ return QVariant::fromValue(c);
}
case DomProperty::Color: {
@@ -220,7 +220,7 @@ QVariant domPropertyToVariant(const DomProperty *p)
QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
if (color->hasAttributeAlpha())
c.setAlpha(color->attributeAlpha());
- return qVariantFromValue(c);
+ return QVariant::fromValue(c);
}
case DomProperty::Font: {
@@ -248,7 +248,7 @@ QVariant domPropertyToVariant(const DomProperty *p)
if (font->hasElementStyleStrategy()) {
f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
}
- return qVariantFromValue(f);
+ return QVariant::fromValue(f);
}
case DomProperty::Date: {
@@ -275,15 +275,15 @@ QVariant domPropertyToVariant(const DomProperty *p)
#ifndef QT_NO_CURSOR
case DomProperty::Cursor:
- return qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
+ return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
case DomProperty::CursorShape:
- return qVariantFromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
+ return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif
case DomProperty::Locale: {
const DomLocale *locale = p->elementLocale();
- return qVariantFromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
+ return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
}
case DomProperty::SizePolicy: {
@@ -309,7 +309,7 @@ QVariant domPropertyToVariant(const DomProperty *p)
sizePolicy.setVerticalPolicy(sp);
}
- return qVariantFromValue(sizePolicy);
+ return QVariant::fromValue(sizePolicy);
}
case DomProperty::StringList:
diff --git a/tools/designer/src/lib/uilib/resourcebuilder.cpp b/tools/designer/src/lib/uilib/resourcebuilder.cpp
index 810bea0..d19a09a 100644
--- a/tools/designer/src/lib/uilib/resourcebuilder.cpp
+++ b/tools/designer/src/lib/uilib/resourcebuilder.cpp
@@ -91,7 +91,7 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
case DomProperty::Pixmap: {
const DomResourcePixmap *dpx = property->elementPixmap();
QPixmap pixmap(QFileInfo(workingDirectory, dpx->text()).absoluteFilePath());
- return qVariantFromValue(pixmap);
+ return QVariant::fromValue(pixmap);
}
case DomProperty::IconSet: {
const DomResourceIcon *dpi = property->elementIconSet();
@@ -113,10 +113,10 @@ QVariant QResourceBuilder::loadResource(const QDir &workingDirectory, const DomP
icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOff()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::Off);
if (flags & SelectedOn)
icon.addFile(QFileInfo(workingDirectory, dpi->elementSelectedOn()->text()).absoluteFilePath(), QSize(), QIcon::Selected, QIcon::On);
- return qVariantFromValue(icon);
+ return QVariant::fromValue(icon);
} else { // 4.3 legacy
const QIcon icon(QFileInfo(workingDirectory, dpi->text()).absoluteFilePath());
- return qVariantFromValue(icon);
+ return QVariant::fromValue(icon);
}
}
break;
diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp
index c7e7829..411059e 100644
--- a/tools/designer/src/uitools/quiloader.cpp
+++ b/tools/designer/src/uitools/quiloader.cpp
@@ -102,27 +102,27 @@ QVariant TranslatingTextBuilder::loadText(const DomProperty *text) const
if (str->hasAttributeNotr()) {
const QString notr = str->attributeNotr();
if (notr == QLatin1String("true") || notr == QLatin1String("yes"))
- return qVariantFromValue(str->text());
+ return QVariant::fromValue(str->text());
}
QUiTranslatableStringValue strVal;
strVal.setValue(str->text().toUtf8());
if (str->hasAttributeComment())
strVal.setComment(str->attributeComment().toUtf8());
- return qVariantFromValue(strVal);
+ return QVariant::fromValue(strVal);
}
QVariant TranslatingTextBuilder::toNativeValue(const QVariant &value) const
{
- if (qVariantCanConvert<QUiTranslatableStringValue>(value)) {
- QUiTranslatableStringValue tsv = qVariantValue<QUiTranslatableStringValue>(value);
+ if (value.canConvert<QUiTranslatableStringValue>()) {
+ QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(value);
if (!m_trEnabled)
return QString::fromUtf8(tsv.value().data());
- return qVariantFromValue(
+ return QVariant::fromValue(
QApplication::translate(m_className, tsv.value(), tsv.comment(),
QCoreApplication::UnicodeUTF8));
}
- if (qVariantCanConvert<QString>(value))
- return qVariantFromValue(qVariantValue<QString>(value));
+ if (value.canConvert<QString>())
+ return QVariant::fromValue(qvariant_cast<QString>(value));
return value;
}
@@ -150,7 +150,7 @@ static void recursiveReTranslate(QTreeWidgetItem *item, const QByteArray &class_
for (unsigned j = 0; irs[j].shadowRole >= 0; j++) {
QVariant v = item->data(i, irs[j].shadowRole);
if (v.isValid()) {
- QUiTranslatableStringValue tsv = qVariantValue<QUiTranslatableStringValue>(v);
+ QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
const QString text = QApplication::translate(class_name,
tsv.value(), tsv.comment(),
QCoreApplication::UnicodeUTF8);
@@ -172,7 +172,7 @@ static void reTranslateWidgetItem(T *item, const QByteArray &class_name)
for (unsigned j = 0; irs[j].shadowRole >= 0; j++) {
QVariant v = item->data(irs[j].shadowRole);
if (v.isValid()) {
- QUiTranslatableStringValue tsv = qVariantValue<QUiTranslatableStringValue>(v);
+ QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
const QString text = QApplication::translate(class_name,
tsv.value(), tsv.comment(),
QCoreApplication::UnicodeUTF8);
@@ -191,7 +191,7 @@ static void reTranslateTableItem(QTableWidgetItem *item, const QByteArray &class
do { \
QVariant v = mainWidget->widget(i)->property(propName); \
if (v.isValid()) { \
- QUiTranslatableStringValue tsv = qVariantValue<QUiTranslatableStringValue>(v); \
+ QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v); \
const QString text = QApplication::translate(m_className, \
tsv.value(), tsv.comment(), \
QCoreApplication::UnicodeUTF8); \
@@ -217,7 +217,7 @@ public:
if (prop.startsWith(PROP_GENERIC_PREFIX)) {
const QByteArray propName = prop.mid(sizeof(PROP_GENERIC_PREFIX) - 1);
const QUiTranslatableStringValue tsv =
- qVariantValue<QUiTranslatableStringValue>(o->property(prop));
+ qvariant_cast<QUiTranslatableStringValue>(o->property(prop));
const QString text = QApplication::translate(m_className,
tsv.value(), tsv.comment(),
QCoreApplication::UnicodeUTF8);
@@ -273,7 +273,7 @@ public:
for (int i = 0; i < cnt; ++i) {
const QVariant v = combow->itemData(i, Qt::DisplayPropertyRole);
if (v.isValid()) {
- QUiTranslatableStringValue tsv = qVariantValue<QUiTranslatableStringValue>(v);
+ QUiTranslatableStringValue tsv = qvariant_cast<QUiTranslatableStringValue>(v);
const QString text = QApplication::translate(m_className,
tsv.value(), tsv.comment(),
QCoreApplication::UnicodeUTF8);
@@ -430,7 +430,7 @@ void FormBuilderPrivate::applyProperties(QObject *o, const QList<DomProperty*> &
continue;
const QByteArray name = p->attributeName().toUtf8();
if (dynamicTr) {
- o->setProperty(PROP_GENERIC_PREFIX + name, qVariantFromValue(strVal));
+ o->setProperty(PROP_GENERIC_PREFIX + name, QVariant::fromValue(strVal));
anyTrs = trEnabled;
}
o->setProperty(name, text);
@@ -489,7 +489,7 @@ QWidget *FormBuilderPrivate::create(DomWidget *ui_widget, QWidget *parentWidget)
const QString text = convertTranslatable(p##attribute, m_class, &strVal); \
if (!text.isEmpty()) { \
if (dynamicTr) \
- mainWidget->widget(i)->setProperty(propName, qVariantFromValue(strVal)); \
+ mainWidget->widget(i)->setProperty(propName, QVariant::fromValue(strVal)); \
mainWidget->setter(i, text); \
} \
} \
diff --git a/tools/linguist/linguist/formpreviewview.cpp b/tools/linguist/linguist/formpreviewview.cpp
index f360a16..3f3f82a 100644
--- a/tools/linguist/linguist/formpreviewview.cpp
+++ b/tools/linguist/linguist/formpreviewview.cpp
@@ -83,7 +83,7 @@ static bool operator==(const QUiTranslatableStringValue &tsv1, const QUiTranslat
target.type = _type; \
target.target._target; \
target.prop._prop; \
- (*targets)[qVariantValue<QUiTranslatableStringValue>(_tsv)].append(target); \
+ (*targets)[qvariant_cast<QUiTranslatableStringValue>(_tsv)].append(target); \
} while (0)
static void registerTreeItem(QTreeWidgetItem *item, TargetsHash *targets)
@@ -350,14 +350,14 @@ static void highlightAction(QAction *a, bool on)
if (on) {
if (!bak.isValid()) {
QFont fnt = qApp->font();
- a->setProperty(FONT_BACKUP_PROP, qVariantFromValue(a->font().resolve(fnt)));
+ a->setProperty(FONT_BACKUP_PROP, QVariant::fromValue(a->font().resolve(fnt)));
fnt.setBold(true);
fnt.setItalic(true);
a->setFont(fnt);
}
} else {
if (bak.isValid()) {
- a->setFont(qVariantValue<QFont>(bak));
+ a->setFont(qvariant_cast<QFont>(bak));
a->setProperty(FONT_BACKUP_PROP, QVariant());
}
}
@@ -374,8 +374,8 @@ static void highlightWidget(QWidget *w, bool on)
foreach (QObject *co, w->children())
if (QWidget *cw = qobject_cast<QWidget *>(co))
cw->setPalette(cw->palette().resolve(pal));
- w->setProperty(PALETTE_BACKUP_PROP, qVariantFromValue(w->palette().resolve(pal)));
- w->setProperty(AUTOFILL_BACKUP_PROP, qVariantFromValue(w->autoFillBackground()));
+ w->setProperty(PALETTE_BACKUP_PROP, QVariant::fromValue(w->palette().resolve(pal)));
+ w->setProperty(AUTOFILL_BACKUP_PROP, QVariant::fromValue(w->autoFillBackground()));
QColor col1 = pal.color(QPalette::Dark);
QColor col2 = pal.color(QPalette::Light);
pal.setColor(QPalette::Base, col1);
@@ -390,8 +390,8 @@ static void highlightWidget(QWidget *w, bool on)
}
} else {
if (bak.isValid()) {
- w->setPalette(qVariantValue<QPalette>(bak));
- w->setAutoFillBackground(qVariantValue<bool>(w->property(AUTOFILL_BACKUP_PROP)));
+ w->setPalette(qvariant_cast<QPalette>(bak));
+ w->setAutoFillBackground(qvariant_cast<bool>(w->property(AUTOFILL_BACKUP_PROP)));
w->setProperty(PALETTE_BACKUP_PROP, QVariant());
w->setProperty(AUTOFILL_BACKUP_PROP, QVariant());
}
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp
index 1611699..9072bab 100644
--- a/tools/linguist/linguist/mainwindow.cpp
+++ b/tools/linguist/linguist/mainwindow.cpp
@@ -184,7 +184,7 @@ private:
static const QVariant &pxObsolete()
{
static const QVariant v =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png")));
return v;
}
diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp
index 39ba9fd..36202ab 100644
--- a/tools/linguist/linguist/messagemodel.cpp
+++ b/tools/linguist/linguist/messagemodel.cpp
@@ -1231,17 +1231,17 @@ int MessageModel::columnCount(const QModelIndex &) const
QVariant MessageModel::data(const QModelIndex &index, int role) const
{
static QVariant pxOn =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_on.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_on.png")));
static QVariant pxOff =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_off.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_off.png")));
static QVariant pxObsolete =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_obsolete.png")));
static QVariant pxDanger =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_danger.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_danger.png")));
static QVariant pxWarning =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_warning.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_warning.png")));
static QVariant pxEmpty =
- qVariantFromValue(QPixmap(QLatin1String(":/images/s_check_empty.png")));
+ QVariant::fromValue(QPixmap(QLatin1String(":/images/s_check_empty.png")));
int row = index.row();
int column = index.column() - 1;
diff --git a/tools/makeqpf/mainwindow.cpp b/tools/makeqpf/mainwindow.cpp
index 166a193..ae723f5 100644
--- a/tools/makeqpf/mainwindow.cpp
+++ b/tools/makeqpf/mainwindow.cpp
@@ -199,7 +199,7 @@ void MainWindow::on_generate_clicked()
if (item->checkState() != Qt::Checked)
continue;
- QPF::CharacterRange range = qVariantValue<QPF::CharacterRange>(item->data(Qt::UserRole));
+ QPF::CharacterRange range = qvariant_cast<QPF::CharacterRange>(item->data(Qt::UserRole));
ranges.append(range);
}
}
@@ -297,7 +297,7 @@ void MainWindow::populateCharacterRanges()
item->setText(text);
item->setCheckState(Qt::Checked);
- item->setData(Qt::UserRole, qVariantFromValue(range));
+ item->setData(Qt::UserRole, QVariant::fromValue(range));
}
}
diff --git a/tools/qdbus/qdbus/qdbus.cpp b/tools/qdbus/qdbus/qdbus.cpp
index ce18cb9..c93288c 100644
--- a/tools/qdbus/qdbus/qdbus.cpp
+++ b/tools/qdbus/qdbus/qdbus.cpp
@@ -324,7 +324,7 @@ static int placeCall(const QString &service, const QString &path, const QString
if (id == int(QMetaType::UChar)) {
// special case: QVariant::convert doesn't convert to/from
// UChar because it can't decide if it's a character or a number
- p = qVariantFromValue<uchar>(p.toUInt());
+ p = QVariant::fromValue<uchar>(p.toUInt());
} else if (id < int(QMetaType::User) && id != int(QVariant::Map)) {
p.convert(QVariant::Type(id));
if (p.type() == QVariant::Invalid) {
@@ -334,7 +334,7 @@ static int placeCall(const QString &service, const QString &path, const QString
}
} else if (id == qMetaTypeId<QDBusVariant>()) {
QDBusVariant tmp(p);
- p = qVariantFromValue(tmp);
+ p = QVariant::fromValue(tmp);
} else if (id == qMetaTypeId<QDBusObjectPath>()) {
QDBusObjectPath path(argument);
if (path.path().isNull()) {
@@ -342,7 +342,7 @@ static int placeCall(const QString &service, const QString &path, const QString
qPrintable(argument));
return 1;
}
- p = qVariantFromValue(path);
+ p = QVariant::fromValue(path);
} else if (id == qMetaTypeId<QDBusSignature>()) {
QDBusSignature sig(argument);
if (sig.signature().isNull()) {
@@ -350,7 +350,7 @@ static int placeCall(const QString &service, const QString &path, const QString
qPrintable(argument));
return 1;
}
- p = qVariantFromValue(sig);
+ p = QVariant::fromValue(sig);
} else {
fprintf(stderr, "Sorry, can't pass arg of type '%s'.\n",
types.at(i).constData());
diff --git a/tools/qdbus/qdbusviewer/qdbusviewer.cpp b/tools/qdbus/qdbusviewer/qdbusviewer.cpp
index 9878aff..9bc5a15 100644
--- a/tools/qdbus/qdbusviewer/qdbusviewer.cpp
+++ b/tools/qdbus/qdbusviewer/qdbusviewer.cpp
@@ -217,7 +217,7 @@ void QDBusViewer::setProperty(const BusSignature &sig)
QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Set"));
QList<QVariant> arguments;
- arguments << sig.mInterface << sig.mName << qVariantFromValue(QDBusVariant(value));
+ arguments << sig.mInterface << sig.mName << QVariant::fromValue(QDBusVariant(value));
message.setArguments(arguments);
c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)));
@@ -283,7 +283,7 @@ void QDBusViewer::callMethod(const BusSignature &sig)
// interface wants a variant
for (int i = 0; i < args.count(); ++i) {
if (types.at(i) == qMetaTypeId<QDBusVariant>())
- args[i] = qVariantFromValue(QDBusVariant(args.at(i)));
+ args[i] = QVariant::fromValue(QDBusVariant(args.at(i)));
}
QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, sig.mInterface,
diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
index d9343e3..31667dc 100644
--- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -617,7 +617,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
if (property.access != QDBusIntrospection::Property::Read) {
hs << " inline void " << setter << "(" << constRefArg(type) << "value)" << endl
<< " { setProperty(\"" << property.name
- << "\", qVariantFromValue(value)); }" << endl;
+ << "\", QVariant::fromValue(value)); }" << endl;
}
hs << endl;
@@ -660,7 +660,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
if (!method.inputArgs.isEmpty()) {
hs << " argumentList";
for (int argPos = 0; argPos < method.inputArgs.count(); ++argPos)
- hs << " << qVariantFromValue(" << argNames.at(argPos) << ')';
+ hs << " << QVariant::fromValue(" << argNames.at(argPos) << ')';
hs << ";" << endl;
}
@@ -693,7 +693,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
if (!method.inputArgs.isEmpty()) {
hs << " argumentList";
for (argPos = 0; argPos < method.inputArgs.count(); ++argPos)
- hs << " << qVariantFromValue(" << argNames.at(argPos) << ')';
+ hs << " << QVariant::fromValue(" << argNames.at(argPos) << ')';
hs << ";" << endl;
}
@@ -940,7 +940,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
cs << "void " << className << "::" << setter << "(" << constRefType << "value)" << endl
<< "{" << endl
<< " // set the value of property " << property.name << endl
- << " parent()->setProperty(\"" << property.name << "\", qVariantFromValue(value";
+ << " parent()->setProperty(\"" << property.name << "\", QVariant::fromValue(value";
if (constRefType.contains(QLatin1String("QDBusVariant")))
cs << ".variant()";
cs << "));" << endl
diff --git a/tools/shared/qtpropertybrowser/qtvariantproperty.cpp b/tools/shared/qtpropertybrowser/qtvariantproperty.cpp
index 15b0ced..948fa1e 100644
--- a/tools/shared/qtpropertybrowser/qtvariantproperty.cpp
+++ b/tools/shared/qtpropertybrowser/qtvariantproperty.cpp
@@ -549,7 +549,7 @@ void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, con
void QtVariantPropertyManagerPrivate::slotValueChanged(QtProperty *property, const QKeySequence &val)
{
QVariant v;
- qVariantSetValue(v, val);
+ v.setValue(val);
valueChanged(property, v);
}
@@ -636,7 +636,7 @@ void QtVariantPropertyManagerPrivate::slotEnumIconsChanged(QtProperty *property,
{
if (QtVariantProperty *varProp = m_internalToProperty.value(property, 0)) {
QVariant v;
- qVariantSetValue(v, enumIcons);
+ v.setValue(enumIcons);
emit q_ptr->attributeChanged(varProp, m_enumIconsAttribute, v);
}
}
@@ -1488,7 +1488,7 @@ QVariant QtVariantPropertyManager::attributeValue(const QtProperty *property, co
return enumManager->enumNames(internProp);
if (attribute == d_ptr->m_enumIconsAttribute) {
QVariant v;
- qVariantSetValue(v, enumManager->enumIcons(internProp));
+ v.setValue(enumManager->enumIcons(internProp));
return v;
}
return QVariant();
@@ -1568,73 +1568,73 @@ void QtVariantPropertyManager::setValue(QtProperty *property, const QVariant &va
QtAbstractPropertyManager *manager = internProp->propertyManager();
if (QtIntPropertyManager *intManager = qobject_cast<QtIntPropertyManager *>(manager)) {
- intManager->setValue(internProp, qVariantValue<int>(val));
+ intManager->setValue(internProp, qvariant_cast<int>(val));
return;
} else if (QtDoublePropertyManager *doubleManager = qobject_cast<QtDoublePropertyManager *>(manager)) {
- doubleManager->setValue(internProp, qVariantValue<double>(val));
+ doubleManager->setValue(internProp, qvariant_cast<double>(val));
return;
} else if (QtBoolPropertyManager *boolManager = qobject_cast<QtBoolPropertyManager *>(manager)) {
- boolManager->setValue(internProp, qVariantValue<bool>(val));
+ boolManager->setValue(internProp, qvariant_cast<bool>(val));
return;
} else if (QtStringPropertyManager *stringManager = qobject_cast<QtStringPropertyManager *>(manager)) {
- stringManager->setValue(internProp, qVariantValue<QString>(val));
+ stringManager->setValue(internProp, qvariant_cast<QString>(val));
return;
} else if (QtDatePropertyManager *dateManager = qobject_cast<QtDatePropertyManager *>(manager)) {
- dateManager->setValue(internProp, qVariantValue<QDate>(val));
+ dateManager->setValue(internProp, qvariant_cast<QDate>(val));
return;
} else if (QtTimePropertyManager *timeManager = qobject_cast<QtTimePropertyManager *>(manager)) {
- timeManager->setValue(internProp, qVariantValue<QTime>(val));
+ timeManager->setValue(internProp, qvariant_cast<QTime>(val));
return;
} else if (QtDateTimePropertyManager *dateTimeManager = qobject_cast<QtDateTimePropertyManager *>(manager)) {
- dateTimeManager->setValue(internProp, qVariantValue<QDateTime>(val));
+ dateTimeManager->setValue(internProp, qvariant_cast<QDateTime>(val));
return;
} else if (QtKeySequencePropertyManager *keySequenceManager = qobject_cast<QtKeySequencePropertyManager *>(manager)) {
- keySequenceManager->setValue(internProp, qVariantValue<QKeySequence>(val));
+ keySequenceManager->setValue(internProp, qvariant_cast<QKeySequence>(val));
return;
} else if (QtCharPropertyManager *charManager = qobject_cast<QtCharPropertyManager *>(manager)) {
- charManager->setValue(internProp, qVariantValue<QChar>(val));
+ charManager->setValue(internProp, qvariant_cast<QChar>(val));
return;
} else if (QtLocalePropertyManager *localeManager = qobject_cast<QtLocalePropertyManager *>(manager)) {
- localeManager->setValue(internProp, qVariantValue<QLocale>(val));
+ localeManager->setValue(internProp, qvariant_cast<QLocale>(val));
return;
} else if (QtPointPropertyManager *pointManager = qobject_cast<QtPointPropertyManager *>(manager)) {
- pointManager->setValue(internProp, qVariantValue<QPoint>(val));
+ pointManager->setValue(internProp, qvariant_cast<QPoint>(val));
return;
} else if (QtPointFPropertyManager *pointFManager = qobject_cast<QtPointFPropertyManager *>(manager)) {
- pointFManager->setValue(internProp, qVariantValue<QPointF>(val));
+ pointFManager->setValue(internProp, qvariant_cast<QPointF>(val));
return;
} else if (QtSizePropertyManager *sizeManager = qobject_cast<QtSizePropertyManager *>(manager)) {
- sizeManager->setValue(internProp, qVariantValue<QSize>(val));
+ sizeManager->setValue(internProp, qvariant_cast<QSize>(val));
return;
} else if (QtSizeFPropertyManager *sizeFManager = qobject_cast<QtSizeFPropertyManager *>(manager)) {
- sizeFManager->setValue(internProp, qVariantValue<QSizeF>(val));
+ sizeFManager->setValue(internProp, qvariant_cast<QSizeF>(val));
return;
} else if (QtRectPropertyManager *rectManager = qobject_cast<QtRectPropertyManager *>(manager)) {
- rectManager->setValue(internProp, qVariantValue<QRect>(val));
+ rectManager->setValue(internProp, qvariant_cast<QRect>(val));
return;
} else if (QtRectFPropertyManager *rectFManager = qobject_cast<QtRectFPropertyManager *>(manager)) {
- rectFManager->setValue(internProp, qVariantValue<QRectF>(val));
+ rectFManager->setValue(internProp, qvariant_cast<QRectF>(val));
return;
} else if (QtColorPropertyManager *colorManager = qobject_cast<QtColorPropertyManager *>(manager)) {
- colorManager->setValue(internProp, qVariantValue<QColor>(val));
+ colorManager->setValue(internProp, qvariant_cast<QColor>(val));
return;
} else if (QtEnumPropertyManager *enumManager = qobject_cast<QtEnumPropertyManager *>(manager)) {
- enumManager->setValue(internProp, qVariantValue<int>(val));
+ enumManager->setValue(internProp, qvariant_cast<int>(val));
return;
} else if (QtSizePolicyPropertyManager *sizePolicyManager =
qobject_cast<QtSizePolicyPropertyManager *>(manager)) {
- sizePolicyManager->setValue(internProp, qVariantValue<QSizePolicy>(val));
+ sizePolicyManager->setValue(internProp, qvariant_cast<QSizePolicy>(val));
return;
} else if (QtFontPropertyManager *fontManager = qobject_cast<QtFontPropertyManager *>(manager)) {
- fontManager->setValue(internProp, qVariantValue<QFont>(val));
+ fontManager->setValue(internProp, qvariant_cast<QFont>(val));
return;
#ifndef QT_NO_CURSOR
} else if (QtCursorPropertyManager *cursorManager = qobject_cast<QtCursorPropertyManager *>(manager)) {
- cursorManager->setValue(internProp, qVariantValue<QCursor>(val));
+ cursorManager->setValue(internProp, qvariant_cast<QCursor>(val));
return;
#endif
} else if (QtFlagPropertyManager *flagManager = qobject_cast<QtFlagPropertyManager *>(manager)) {
- flagManager->setValue(internProp, qVariantValue<int>(val));
+ flagManager->setValue(internProp, qvariant_cast<int>(val));
return;
}
}
@@ -1672,69 +1672,69 @@ void QtVariantPropertyManager::setAttribute(QtProperty *property,
QtAbstractPropertyManager *manager = internProp->propertyManager();
if (QtIntPropertyManager *intManager = qobject_cast<QtIntPropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)
- intManager->setMaximum(internProp, qVariantValue<int>(value));
+ intManager->setMaximum(internProp, qvariant_cast<int>(value));
else if (attribute == d_ptr->m_minimumAttribute)
- intManager->setMinimum(internProp, qVariantValue<int>(value));
+ intManager->setMinimum(internProp, qvariant_cast<int>(value));
else if (attribute == d_ptr->m_singleStepAttribute)
- intManager->setSingleStep(internProp, qVariantValue<int>(value));
+ intManager->setSingleStep(internProp, qvariant_cast<int>(value));
return;
} else if (QtDoublePropertyManager *doubleManager = qobject_cast<QtDoublePropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)
- doubleManager->setMaximum(internProp, qVariantValue<double>(value));
+ doubleManager->setMaximum(internProp, qvariant_cast<double>(value));
if (attribute == d_ptr->m_minimumAttribute)
- doubleManager->setMinimum(internProp, qVariantValue<double>(value));
+ doubleManager->setMinimum(internProp, qvariant_cast<double>(value));
if (attribute == d_ptr->m_singleStepAttribute)
- doubleManager->setSingleStep(internProp, qVariantValue<double>(value));
+ doubleManager->setSingleStep(internProp, qvariant_cast<double>(value));
if (attribute == d_ptr->m_decimalsAttribute)
- doubleManager->setDecimals(internProp, qVariantValue<int>(value));
+ doubleManager->setDecimals(internProp, qvariant_cast<int>(value));
return;
} else if (QtStringPropertyManager *stringManager = qobject_cast<QtStringPropertyManager *>(manager)) {
if (attribute == d_ptr->m_regExpAttribute)
- stringManager->setRegExp(internProp, qVariantValue<QRegExp>(value));
+ stringManager->setRegExp(internProp, qvariant_cast<QRegExp>(value));
return;
} else if (QtDatePropertyManager *dateManager = qobject_cast<QtDatePropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)
- dateManager->setMaximum(internProp, qVariantValue<QDate>(value));
+ dateManager->setMaximum(internProp, qvariant_cast<QDate>(value));
if (attribute == d_ptr->m_minimumAttribute)
- dateManager->setMinimum(internProp, qVariantValue<QDate>(value));
+ dateManager->setMinimum(internProp, qvariant_cast<QDate>(value));
return;
} else if (QtPointFPropertyManager *pointFManager = qobject_cast<QtPointFPropertyManager *>(manager)) {
if (attribute == d_ptr->m_decimalsAttribute)
- pointFManager->setDecimals(internProp, qVariantValue<int>(value));
+ pointFManager->setDecimals(internProp, qvariant_cast<int>(value));
return;
} else if (QtSizePropertyManager *sizeManager = qobject_cast<QtSizePropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)
- sizeManager->setMaximum(internProp, qVariantValue<QSize>(value));
+ sizeManager->setMaximum(internProp, qvariant_cast<QSize>(value));
if (attribute == d_ptr->m_minimumAttribute)
- sizeManager->setMinimum(internProp, qVariantValue<QSize>(value));
+ sizeManager->setMinimum(internProp, qvariant_cast<QSize>(value));
return;
} else if (QtSizeFPropertyManager *sizeFManager = qobject_cast<QtSizeFPropertyManager *>(manager)) {
if (attribute == d_ptr->m_maximumAttribute)
- sizeFManager->setMaximum(internProp, qVariantValue<QSizeF>(value));
+ sizeFManager->setMaximum(internProp, qvariant_cast<QSizeF>(value));
if (attribute == d_ptr->m_minimumAttribute)
- sizeFManager->setMinimum(internProp, qVariantValue<QSizeF>(value));
+ sizeFManager->setMinimum(internProp, qvariant_cast<QSizeF>(value));
if (attribute == d_ptr->m_decimalsAttribute)
- sizeFManager->setDecimals(internProp, qVariantValue<int>(value));
+ sizeFManager->setDecimals(internProp, qvariant_cast<int>(value));
return;
} else if (QtRectPropertyManager *rectManager = qobject_cast<QtRectPropertyManager *>(manager)) {
if (attribute == d_ptr->m_constraintAttribute)
- rectManager->setConstraint(internProp, qVariantValue<QRect>(value));
+ rectManager->setConstraint(internProp, qvariant_cast<QRect>(value));
return;
} else if (QtRectFPropertyManager *rectFManager = qobject_cast<QtRectFPropertyManager *>(manager)) {
if (attribute == d_ptr->m_constraintAttribute)
- rectFManager->setConstraint(internProp, qVariantValue<QRectF>(value));
+ rectFManager->setConstraint(internProp, qvariant_cast<QRectF>(value));
if (attribute == d_ptr->m_decimalsAttribute)
- rectFManager->setDecimals(internProp, qVariantValue<int>(value));
+ rectFManager->setDecimals(internProp, qvariant_cast<int>(value));
return;
} else if (QtEnumPropertyManager *enumManager = qobject_cast<QtEnumPropertyManager *>(manager)) {
if (attribute == d_ptr->m_enumNamesAttribute)
- enumManager->setEnumNames(internProp, qVariantValue<QStringList>(value));
+ enumManager->setEnumNames(internProp, qvariant_cast<QStringList>(value));
if (attribute == d_ptr->m_enumIconsAttribute)
- enumManager->setEnumIcons(internProp, qVariantValue<QtIconMap>(value));
+ enumManager->setEnumIcons(internProp, qvariant_cast<QtIconMap>(value));
return;
} else if (QtFlagPropertyManager *flagManager = qobject_cast<QtFlagPropertyManager *>(manager)) {
if (attribute == d_ptr->m_flagNamesAttribute)
- flagManager->setFlagNames(internProp, qVariantValue<QStringList>(value));
+ flagManager->setFlagNames(internProp, qvariant_cast<QStringList>(value));
return;
}
}
diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp
index b0e9e67..8479de7 100644
--- a/tools/xmlpatterns/main.cpp
+++ b/tools/xmlpatterns/main.cpp
@@ -145,14 +145,14 @@ protected:
}
/* The value.isNull() check ensures we can bind variables whose value is an empty string. */
- return qVariantFromValue(Parameter(name, value.isNull() ? QString(QLatin1String("")) : value ));
+ return QVariant::fromValue(Parameter(name, value.isNull() ? QString(QLatin1String("")) : value ));
}
else if(arg.name() == QLatin1String("output"))
{
QFile *const f = new QFile(input);
if(f->open(QIODevice::WriteOnly))
- return qVariantFromValue(static_cast<QIODevice *>(f));
+ return QVariant::fromValue(static_cast<QIODevice *>(f));
else
{
message(QXmlPatternistCLI::tr("Failed to open file %1 for writing: %2").arg(f->fileName(), f->errorString()));
@@ -168,7 +168,7 @@ protected:
return QVariant();
}
else
- return qVariantFromValue(name);
+ return QVariant::fromValue(name);
}
else
return QApplicationArgumentParser::convertToValue(arg, input);
@@ -200,7 +200,7 @@ protected:
out->open(stdout, QIODevice::WriteOnly);
#endif
- return qVariantFromValue(static_cast<QIODevice *>(out));
+ return QVariant::fromValue(static_cast<QIODevice *>(out));
}
else
return QApplicationArgumentParser::defaultValue(argument);
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
QXmlQuery query(lang, namePool);
- query.setInitialTemplateName(qVariantValue<QXmlName>(parser.value(initialTemplateName)));
+ query.setInitialTemplateName(qvariant_cast<QXmlName>(parser.value(initialTemplateName)));
/* Bind external variables. */
{
@@ -329,7 +329,7 @@ int main(int argc, char **argv)
for(int i = 0; i < len; ++i)
{
- const Parameter p(qVariantValue<Parameter>(parameters.at(i)));
+ const Parameter p(qvariant_cast<Parameter>(parameters.at(i)));
if(usedParameters.contains(p.first))
{
@@ -359,7 +359,7 @@ int main(int argc, char **argv)
query.setQuery(effectiveURI);
- const QPatternist::AutoPtr<QIODevice> outDevice(qVariantValue<QIODevice *>(parser.value(output)));
+ const QPatternist::AutoPtr<QIODevice> outDevice(qvariant_cast<QIODevice *>(parser.value(output)));
Q_ASSERT(outDevice);
Q_ASSERT(outDevice->isWritable());