summaryrefslogtreecommitdiffstats
path: root/tools/designer/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'tools/designer/src/components')
-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
17 files changed, 170 insertions, 170 deletions
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);
}