summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-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
21 files changed, 47 insertions, 47 deletions
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)));
}