diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-08-19 10:04:39 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2010-08-19 10:04:39 (GMT) |
commit | a226143eeda6771efc4f0df6955351336735cb60 (patch) | |
tree | a279f87d74f5929e36fe6a3aa5e4f4d843b32458 /tools | |
parent | c02ad51733d0a2885ddb39cb7e3b09355ab97213 (diff) | |
parent | ffbce9839f8be5c2f21cc66b617dbeb0a47af269 (diff) | |
download | Qt-a226143eeda6771efc4f0df6955351336735cb60.zip Qt-a226143eeda6771efc4f0df6955351336735cb60.tar.gz Qt-a226143eeda6771efc4f0df6955351336735cb60.tar.bz2 |
Merge remote branch 'qt/master' into lighthouse-master
Diffstat (limited to 'tools')
107 files changed, 1604 insertions, 871 deletions
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/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index 3535e5a..40a449e 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -421,13 +421,13 @@ void PreferencesDialog::updateFontSettingsPage() connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, SLOT(browserFontSettingToggled(bool))); - QList<QComboBox*> allCombos = qFindChildren<QComboBox*>(m_appFontPanel); + QList<QComboBox*> allCombos = m_appFontPanel->findChildren<QComboBox*>(); foreach (QComboBox* box, allCombos) { connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(appFontSettingChanged(int))); } - allCombos = qFindChildren<QComboBox*>(m_browserFontPanel); + allCombos = m_browserFontPanel->findChildren<QComboBox*>(); foreach (QComboBox* box, allCombos) { connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(browserFontSettingChanged(int))); diff --git a/tools/assistant/tools/assistant/searchwidget.cpp b/tools/assistant/tools/assistant/searchwidget.cpp index d83790d..9eb2106 100644 --- a/tools/assistant/tools/assistant/searchwidget.cpp +++ b/tools/assistant/tools/assistant/searchwidget.cpp @@ -86,7 +86,7 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent) connect(searchEngine, SIGNAL(searchingFinished(int)), this, SLOT(searchingFinished(int))); - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser) // Will be null if lib was configured not to use CLucene. browser->viewport()->installEventFilter(this); } @@ -100,7 +100,7 @@ SearchWidget::~SearchWidget() void SearchWidget::zoomIn() { TRACE_OBJ - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser && zoomCount != 10) { zoomCount++; browser->zoomIn(); @@ -110,7 +110,7 @@ void SearchWidget::zoomIn() void SearchWidget::zoomOut() { TRACE_OBJ - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser && zoomCount != -5) { zoomCount--; browser->zoomOut(); @@ -123,7 +123,7 @@ void SearchWidget::resetZoom() if (zoomCount == 0) return; - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser) { browser->zoomOut(zoomCount); zoomCount = 0; @@ -165,7 +165,7 @@ void SearchWidget::searchingFinished(int hits) bool SearchWidget::eventFilter(QObject* o, QEvent *e) { TRACE_OBJ - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser && o == browser->viewport() && e->type() == QEvent::MouseButtonRelease){ QMouseEvent *me = static_cast<QMouseEvent*>(e); @@ -196,7 +196,7 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent) QMenu menu; QPoint point = contextMenuEvent->globalPos(); - QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget); + QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (!browser) return; diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 69e4727..0ed16ed 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -988,7 +988,6 @@ void Configure::parseCmdLine() ++i; if (i == argCount) break; - qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i); dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i); } else if (configCmdLine.at(i) == "-qtlibinfix") { ++i; @@ -1029,6 +1028,10 @@ void Configure::parseCmdLine() opensslLibs = configCmdLine.at(i); } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) { psqlLibs = configCmdLine.at(i); + } else if (configCmdLine.at(i).startsWith("SYBASE=")) { + sybase = configCmdLine.at(i); + } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) { + sybaseLibs = configCmdLine.at(i); } else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){ @@ -1159,6 +1162,13 @@ void Configure::parseCmdLine() dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-runtimegraphicssystem") { + ++i; + if (i == argCount) + break; + dictionary["RUNTIME_SYSTEM"] = configCmdLine.at(i); + } + else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) { // Scan to see if any specific modules and drivers are enabled or disabled for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) { @@ -1624,7 +1634,7 @@ bool Configure::displayHelp() "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n" "[-no-script] [-script] [-no-scripttools] [-scripttools]\n" - "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg|runtime]\n\n", 0, 7); + "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7); desc("Installation options:\n\n"); @@ -1729,9 +1739,7 @@ bool Configure::displayHelp() "Available values for <sys>:"); desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' '); desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' '); - desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!", ' '); - desc("GRAPHICS_SYSTEM", "runtime", "", " runtime - Runtime switching of graphics sytems", ' '); - + desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!\n", ' '); desc( "-help, -h, -?", "Display this information.\n"); @@ -2098,12 +2106,7 @@ bool Configure::checkAvailability(const QString &part) else if (part == "INCREDIBUILD_XGE") available = findFile("BuildConsole.exe") && findFile("xgConsole.exe"); else if (part == "XMLPATTERNS") - { - /* MSVC 6.0 and MSVC 2002/7.0 has too poor C++ support for QtXmlPatterns. */ - return dictionary.value("QMAKESPEC") != "win32-msvc" - && dictionary.value("QMAKESPEC") != "win32-msvc.net" // Leave for now, since we can't be sure if they are using 2002 or 2003 with this spec - && dictionary.value("QMAKESPEC") != "win32-msvc2002" - && dictionary.value("EXCEPTIONS") == "yes"; + available = dictionary.value("EXCEPTIONS") == "yes"; } else if (part == "PHONON") { if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) { available = true; @@ -2767,6 +2770,17 @@ void Configure::generateOutputVars() } if (!psqlLibs.isEmpty()) qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1); + + { + QStringList lflagsTDS; + if (!sybase.isEmpty()) + lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib"); + if (!sybaseLibs.isEmpty()) + lflagsTDS += sybaseLibs.section("=", 1); + if (!lflagsTDS.isEmpty()) + qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" "); + } + if (!qmakeSql.isEmpty()) qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" "); if (!qmakeSqlPlugins.isEmpty()) @@ -2945,8 +2959,6 @@ void Configure::generateCachefile() configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl; } - configStream << "#modules" << endl << "for(mod,$$list($$files($$[QMAKE_MKSPECS]/modules/qt_*.pri))):include($$mod)" << endl; - configStream.flush(); configFile.close(); } @@ -3045,6 +3057,9 @@ void Configure::generateConfigfiles() tmpStream << endl << "// Compile time features" << endl; tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl; + if (dictionary["GRAPHICS_SYSTEM"] == "runtime" && dictionary["RUNTIME_SYSTEM"] != "runtime") + tmpStream << "#define QT_DEFAULT_RUNTIME_SYSTEM \"" << dictionary["RUNTIME_SYSTEM"] << "\"" << endl; + QStringList qconfigList; if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL"; if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS"; diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index ff2ee8b..b3c07f7 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -134,6 +134,8 @@ private: QStringList qmakeLibs; QString opensslLibs; QString psqlLibs; + QString sybase; + QString sybaseLibs; QMap<QString,QString> licenseInfo; QString outputLine; diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 943a8a2..5d9851f 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -75,8 +75,6 @@ struct CompilerInfo{ {CC_BORLAND, "Borland C++", 0, "bcc32.exe"}, {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"}, {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe - {CC_MSVC6, "Microsoft (R) 32-bit C/C++ Optimizing Compiler (6.x)", "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++\\ProductDir", "cl.exe"}, // link.exe, lib.exe - {CC_NET2002, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2002 (7.0)", "Software\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe {CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe {CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe {CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe @@ -118,14 +116,6 @@ QString Environment::detectQMakeSpec() case CC_NET2003: spec = "win32-msvc2003"; break; - case CC_NET2002: - spec = "win32-msvc2002"; - break; - case CC_MSVC4: - case CC_MSVC5: - case CC_MSVC6: - spec = "win32-msvc"; - break; case CC_INTEL: spec = "win32-icc"; break; @@ -152,7 +142,7 @@ QString Environment::detectQMakeSpec() Compiler Environment::detectCompiler() { #ifndef Q_OS_WIN32 - return MSVC6; // Always generate MSVC 6.0 versions on other platforms + return CC_UNKNOWN; // Always generate CC_UNKNOWN on other platforms #else if(detectedCompiler != CC_UNKNOWN) return detectedCompiler; diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 16af8df..9efaea1 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -50,10 +50,6 @@ enum Compiler { CC_BORLAND = 0x01, CC_MINGW = 0x02, CC_INTEL = 0x03, - CC_MSVC4 = 0x40, - CC_MSVC5 = 0x50, - CC_MSVC6 = 0x60, - CC_NET2002 = 0x70, CC_NET2003 = 0x71, CC_NET2005 = 0x80, CC_NET2008 = 0x90, diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp index e367f9a..4127d7c 100644 --- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp @@ -153,13 +153,13 @@ void BuddyEditor::updateBackground() m_updating = true; QList<Connection *> newList; - const LabelList label_list = qFindChildren<QLabel*>(background()); + const LabelList label_list = background()->findChildren<QLabel*>(); foreach (QLabel *label, label_list) { const QString buddy_name = buddy(label, m_formWindow->core()); if (buddy_name.isEmpty()) continue; - const QList<QWidget *> targets = qFindChildren<QWidget*>(background(), buddy_name); + const QList<QWidget *> targets = background()->findChildren<QWidget*>(buddy_name); if (targets.isEmpty()) continue; @@ -238,12 +238,12 @@ void BuddyEditor::setBackground(QWidget *background) clear(); ConnectionEdit::setBackground(background); - const LabelList label_list = qFindChildren<QLabel*>(background); + const LabelList label_list = background->findChildren<QLabel*>(); foreach (QLabel *label, label_list) { const QString buddy_name = buddy(label, m_formWindow->core()); if (buddy_name.isEmpty()) continue; - QWidget *target = qFindChild<QWidget*>(background, buddy_name); + QWidget *target = background->findChild<QWidget*>(buddy_name); if (target == 0) continue; @@ -297,7 +297,7 @@ void BuddyEditor::endConnection(QWidget *target, const QPoint &pos) void BuddyEditor::widgetRemoved(QWidget *widget) { - QList<QWidget*> child_list = qFindChildren<QWidget*>(widget); + QList<QWidget*> child_list = widget->findChildren<QWidget*>(); child_list.prepend(widget); ConnectionSet remove_set; @@ -354,7 +354,7 @@ void BuddyEditor::deleteSelected() void BuddyEditor::autoBuddy() { // Any labels? - LabelList labelList = qFindChildren<QLabel*>(background()); + LabelList labelList = background()->findChildren<QLabel*>(); if (labelList.empty()) return; // Find already used buddies 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/formeditor.qrc b/tools/designer/src/components/formeditor/formeditor.qrc index 6510814..ed7e40e 100644 --- a/tools/designer/src/components/formeditor/formeditor.qrc +++ b/tools/designer/src/components/formeditor/formeditor.qrc @@ -153,6 +153,7 @@ <file>images/win/textjustify.png</file> <file>images/win/textsuperscript.png</file> <file>images/win/textsubscript.png</file> + <file>images/win/simplifyrichtext.png</file> <file>images/win/back.png</file> <file>images/win/forward.png</file> <file>images/win/down.png</file> @@ -167,6 +168,7 @@ <file>images/mac/textjustify.png</file> <file>images/mac/textsuperscript.png</file> <file>images/mac/textsubscript.png</file> + <file>images/mac/simplifyrichtext.png</file> </qresource> <qresource prefix="/trolltech/brushes"> <file>defaultbrushes.xml</file> diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp index 15775f6..ebf00f9 100644 --- a/tools/designer/src/components/formeditor/formwindow.cpp +++ b/tools/designer/src/components/formeditor/formwindow.cpp @@ -387,7 +387,7 @@ void FormWindow::setCursorToAll(const QCursor &c, QWidget *start) { #ifndef QT_NO_CURSOR start->setCursor(c); - const QWidgetList widgets = qFindChildren<QWidget*>(start); + const QWidgetList widgets = start->findChildren<QWidget*>(); foreach (QWidget *widget, widgets) { if (!qobject_cast<WidgetHandle*>(widget)) { widget->setCursor(c); @@ -945,7 +945,7 @@ bool FormWindow::isMainContainer(const QWidget *w) const void FormWindow::updateChildSelections(QWidget *w) { - const QWidgetList l = qFindChildren<QWidget*>(w); + const QWidgetList l = w->findChildren<QWidget*>(); if (!l.empty()) { const QWidgetList::const_iterator lcend = l.constEnd(); for (QWidgetList::const_iterator it = l.constBegin(); it != lcend; ++it) { @@ -1155,19 +1155,19 @@ bool FormWindow::unify(QObject *w, QString &s, bool changeIt) existingNames.insert(main->objectName()); const QDesignerMetaDataBaseInterface *metaDataBase = core()->metaDataBase(); - const QWidgetList widgetChildren = qFindChildren<QWidget*>(main); + const QWidgetList widgetChildren = main->findChildren<QWidget*>(); if (!widgetChildren.empty()) insertNames(metaDataBase, widgetChildren.constBegin(), widgetChildren.constEnd(), w, existingNames); - const QList<QLayout *> layoutChildren = qFindChildren<QLayout*>(main); + const QList<QLayout *> layoutChildren = main->findChildren<QLayout*>(); if (!layoutChildren.empty()) insertNames(metaDataBase, layoutChildren.constBegin(), layoutChildren.constEnd(), w, existingNames); - const QList<QAction *> actionChildren = qFindChildren<QAction*>(main); + const QList<QAction *> actionChildren = main->findChildren<QAction*>(); if (!actionChildren.empty()) insertNames(metaDataBase, actionChildren.constBegin(), actionChildren.constEnd(), w, existingNames); - const QList<QButtonGroup *> buttonGroupChildren = qFindChildren<QButtonGroup*>(main); + const QList<QButtonGroup *> buttonGroupChildren = main->findChildren<QButtonGroup*>(); if (!buttonGroupChildren.empty()) insertNames(metaDataBase, buttonGroupChildren.constBegin(), buttonGroupChildren.constEnd(), w, existingNames); @@ -1283,7 +1283,7 @@ void FormWindow::resizeWidget(QWidget *widget, const QRect &geometry) void FormWindow::raiseChildSelections(QWidget *w) { - const QWidgetList l = qFindChildren<QWidget*>(w); + const QWidgetList l = w->findChildren<QWidget*>(); if (l.isEmpty()) return; m_selection->raiseList(l); @@ -1344,7 +1344,7 @@ QWidgetList FormWindow::selectedWidgets() const void FormWindow::selectWidgets() { bool selectionChanged = false; - const QWidgetList l = qFindChildren<QWidget*>(mainContainer()); + const QWidgetList l = mainContainer()->findChildren<QWidget*>(); QListIterator <QWidget*> it(l); const QRect selRect(mapToGlobal(m_currRect.topLeft()), m_currRect.size()); while (it.hasNext()) { @@ -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/images/mac/simplifyrichtext.png b/tools/designer/src/components/formeditor/images/mac/simplifyrichtext.png Binary files differnew file mode 100644 index 0000000..a48e974 --- /dev/null +++ b/tools/designer/src/components/formeditor/images/mac/simplifyrichtext.png diff --git a/tools/designer/src/components/formeditor/images/win/simplifyrichtext.png b/tools/designer/src/components/formeditor/images/win/simplifyrichtext.png Binary files differnew file mode 100644 index 0000000..e251cf7 --- /dev/null +++ b/tools/designer/src/components/formeditor/images/win/simplifyrichtext.png diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index 1d78695..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) { @@ -946,7 +946,7 @@ QWidget *QDesignerResource::create(DomWidget *ui_widget, QWidget *parentWidget) w->addAction(a); } else if (QActionGroup *g = m_actionGroups.value(name)) { w->addActions(g->actions()); - } else if (QMenu *menu = qFindChild<QMenu*>(w, name)) { + } else if (QMenu *menu = w->findChild<QMenu*>(name)) { w->addAction(menu->menuAction()); addMenuAction(menu->menuAction()); } @@ -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); @@ -1320,7 +1320,7 @@ DomLayout *QDesignerResource::createDom(QLayout *layout, DomLayout *ui_parentLay QDesignerMetaDataBaseItemInterface *item = core()->metaDataBase()->item(layout); if (item == 0) { - layout = qFindChild<QLayout*>(layout); + layout = layout->findChild<QLayout*>(); // refresh the meta database item item = core()->metaDataBase()->item(layout); } @@ -1440,7 +1440,7 @@ void QDesignerResource::applyTabStops(QWidget *widget, DomTabStops *tabStops) QList<QWidget*> tabOrder; foreach (const QString &widgetName, tabStops->elementTabStop()) { - if (QWidget *w = qFindChild<QWidget*>(widget, widgetName)) { + if (QWidget *w = widget->findChild<QWidget*>(widgetName)) { tabOrder.append(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/formeditor/qmainwindow_container.cpp b/tools/designer/src/components/formeditor/qmainwindow_container.cpp index 9b5326a..ef4ce85 100644 --- a/tools/designer/src/components/formeditor/qmainwindow_container.cpp +++ b/tools/designer/src/components/formeditor/qmainwindow_container.cpp @@ -104,7 +104,7 @@ Qt::DockWidgetArea dockWidgetArea(QDockWidget *me) QList<QLayout*> candidates; if (mw->layout()) { candidates.append(mw->layout()); - candidates += qFindChildren<QLayout*>(mw->layout()); + candidates += mw->layout()->findChildren<QLayout*>(); } foreach (QLayout *l, candidates) { if (l->indexOf(me) != -1) { 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/signalslot_utils.cpp b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp index 8674ac1..09c2233 100644 --- a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -245,7 +245,7 @@ namespace qdesigner_internal { ClassesMemberFunctions reverseClassesMemberFunctions(const QString &obj_name, MemberType member_type, const QString &peer, QDesignerFormWindowInterface *form) { - QObject *object = qFindChild<QObject*>(form, obj_name); + QObject *object = form->findChild<QObject*>(obj_name); if (!object) return ClassesMemberFunctions(); diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp index b801c5e..1d45ef5 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditor.cpp @@ -372,7 +372,7 @@ QObject *SignalSlotEditor::objectByName(QWidget *topLevel, const QString &name) if (topLevel->objectName() == name) object = topLevel; else - object = qFindChild<QObject*>(topLevel, name); + object = topLevel->findChild<QObject*>(name); const QDesignerMetaDataBaseInterface *mdb = formWindow()->core()->metaDataBase(); if (mdb->item(object)) return object; diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 5547761..6cfc286 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -117,7 +117,7 @@ static QStringList objectNameList(QDesignerFormWindowInterface *form) const QDesignerMetaDataBaseInterface *mdb = form->core()->metaDataBase(); // Add managed actions and actions with managed menus - const ActionList actions = qFindChildren<QAction*>(mainContainer); + const ActionList actions = mainContainer->findChildren<QAction*>(); if (!actions.empty()) { const ActionList::const_iterator cend = actions.constEnd(); for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it) { @@ -135,7 +135,7 @@ static QStringList objectNameList(QDesignerFormWindowInterface *form) } // Add managed buttons groups - const ButtonGroupList buttonGroups = qFindChildren<QButtonGroup *>(mainContainer); + const ButtonGroupList buttonGroups = mainContainer->findChildren<QButtonGroup *>(); if (!buttonGroups.empty()) { const ButtonGroupList::const_iterator cend = buttonGroups.constEnd(); for (ButtonGroupList::const_iterator it = buttonGroups.constBegin(); it != cend; ++it) @@ -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) { @@ -658,7 +658,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const qdesigner_internal::ClassesMemberFunctions class_list = qdesigner_internal::reverseClassesMemberFunctions(obj_name, type, peer, m_form); - QObject *object = qFindChild<QObject*>(m_form, obj_name); + QObject *object = m_form->findChild<QObject*>(obj_name); inline_editor->addText(type == qdesigner_internal::SignalMember ? tr("<signal>") : tr("<slot>")); foreach (const qdesigner_internal::ClassMemberFunctions &class_info, class_list) { @@ -767,7 +767,7 @@ void SignalSlotEditorWindow::setActiveFormWindow(QDesignerFormWindowInterface *f } } - m_editor = qFindChild<SignalSlotEditor*>(form); + m_editor = form->findChild<SignalSlotEditor*>(); m_model->setEditor(m_editor); if (!m_editor.isNull()) { ConnectionDelegate *delegate 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/components/widgetbox/widgetbox_dnditem.cpp b/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp index 25798d3..ac32795 100644 --- a/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp +++ b/tools/designer/src/components/widgetbox/widgetbox_dnditem.cpp @@ -185,7 +185,7 @@ static QWidget *decorationFromDomWidget(DomUI *dom_ui, QDesignerFormEditorInterf fakeTopLevel->setParent(0, Qt::ToolTip); // Container // Actual widget const DomWidget *domW = dom_ui->elementWidget()->elementWidget().front(); - QWidget *w = qFindChildren<QWidget*>(fakeTopLevel).front(); + QWidget *w = fakeTopLevel->findChildren<QWidget*>().front(); Q_ASSERT(w); // hack begin; // We set _q_dockDrag dynamic property which will be detected in drag enter event of form window. diff --git a/tools/designer/src/designer/assistantclient.cpp b/tools/designer/src/designer/assistantclient.cpp index e47817f..bddaf63 100644 --- a/tools/designer/src/designer/assistantclient.cpp +++ b/tools/designer/src/designer/assistantclient.cpp @@ -101,7 +101,7 @@ bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage) return false; } QTextStream str(m_process); - str << cmd << QLatin1Char('\0') << endl; + str << cmd << QLatin1Char('\n') << endl; return true; } 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 26ac8a8..d3716ca 100644 --- a/tools/designer/src/lib/shared/actioneditor.cpp +++ b/tools/designer/src/lib/shared/actioneditor.cpp @@ -288,7 +288,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) return; if (m_formWindow != 0) { - const ActionList actionList = qFindChildren<QAction*>(m_formWindow->mainContainer()); + const ActionList actionList = m_formWindow->mainContainer()->findChildren<QAction*>(); foreach (QAction *action, actionList) disconnect(action, SIGNAL(changed()), this, SLOT(slotActionChanged())); } @@ -311,7 +311,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) m_actionNew->setEnabled(true); m_filterWidget->setEnabled(true); - const ActionList actionList = qFindChildren<QAction*>(formWindow->mainContainer()); + const ActionList actionList = formWindow->mainContainer()->findChildren<QAction*>(); foreach (QAction *action, actionList) if (!action->isSeparator() && core()->metaDataBase()->item(action) != 0) { // Show unless it has a menu. However, listen for change on menu actions also as it might be removed @@ -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/connectionedit.cpp b/tools/designer/src/lib/shared/connectionedit.cpp index 0bebe47..fb6cf60 100644 --- a/tools/designer/src/lib/shared/connectionedit.cpp +++ b/tools/designer/src/lib/shared/connectionedit.cpp @@ -1395,7 +1395,7 @@ void ConnectionEdit::widgetRemoved(QWidget *widget) if (m_con_list.empty()) return; - QWidgetList child_list = qFindChildren<QWidget*>(widget); + QWidgetList child_list = widget->findChildren<QWidget*>(); child_list.prepend(widget); const ConnectionSet remove_set = findConnectionsOf(m_con_list, child_list.constBegin(), child_list.constEnd()); @@ -1545,7 +1545,7 @@ void ConnectionEdit::setSource(Connection *con, const QString &obj_name) { QObject *object = 0; if (!obj_name.isEmpty()) { - object = qFindChild<QObject*>(m_bg_widget, obj_name); + object = m_bg_widget->findChild<QObject*>(obj_name); if (object == 0 && m_bg_widget->objectName() == obj_name) object = m_bg_widget; @@ -1559,7 +1559,7 @@ void ConnectionEdit::setTarget(Connection *con, const QString &obj_name) { QObject *object = 0; if (!obj_name.isEmpty()) { - object = qFindChild<QObject*>(m_bg_widget, obj_name); + object = m_bg_widget->findChild<QObject*>(obj_name); if (object == 0 && m_bg_widget->objectName() == obj_name) object = m_bg_widget; 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/layoutinfo.cpp b/tools/designer/src/lib/shared/layoutinfo.cpp index ad2dda4..309aa37 100644 --- a/tools/designer/src/lib/shared/layoutinfo.cpp +++ b/tools/designer/src/lib/shared/layoutinfo.cpp @@ -190,7 +190,7 @@ LayoutInfo::Type LayoutInfo::laidoutWidgetType(const QDesignerFormEditorInterfac } // 3) Some child layout (see below comment about Q3GroupBox) - const QList<QLayout*> childLayouts = qFindChildren<QLayout*>(parentLayout); + const QList<QLayout*> childLayouts = parentLayout->findChildren<QLayout*>(); if (childLayouts.empty()) return NoLayout; const QList<QLayout*>::const_iterator lcend = childLayouts.constEnd(); @@ -244,7 +244,7 @@ QLayout *LayoutInfo::managedLayout(const QDesignerFormEditorInterface *core, QLa * widget->layout() returns an internal VBoxLayout. */ const QDesignerMetaDataBaseItemInterface *item = metaDataBase->item(layout); if (item == 0) { - layout = qFindChild<QLayout*>(layout); + layout = layout->findChild<QLayout*>(); item = metaDataBase->item(layout); } if (!item) diff --git a/tools/designer/src/lib/shared/morphmenu.cpp b/tools/designer/src/lib/shared/morphmenu.cpp index de85d37..80eac0c 100644 --- a/tools/designer/src/lib/shared/morphmenu.cpp +++ b/tools/designer/src/lib/shared/morphmenu.cpp @@ -240,7 +240,7 @@ static QString suggestObjectName(const QString &oldClassName, const QString &new QLabel *buddyLabelOf(QDesignerFormWindowInterface *fw, QWidget *w) { typedef QList<QLabel*> LabelList; - const LabelList labelList = qFindChildren<QLabel*>(fw); + const LabelList labelList = fw->findChildren<QLabel*>(); if (labelList.empty()) return 0; const LabelList::const_iterator cend = labelList.constEnd(); @@ -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 69206df..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; } @@ -247,7 +247,7 @@ void InsertWidgetCommand::refreshBuddyLabels() { typedef QList<QLabel*> LabelList; - const LabelList label_list = qFindChildren<QLabel*>(formWindow()); + const LabelList label_list = formWindow()->findChildren<QLabel*>(); if (label_list.empty()) return; @@ -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); @@ -365,7 +365,7 @@ void ManageWidgetCommandHelper::init(const QDesignerFormWindowInterface *fw, QWi m_widget = widget; m_managedChildren.clear(); - const QWidgetList children = qFindChildren<QWidget *>(m_widget); + const QWidgetList children = m_widget->findChildren<QWidget *>(); if (children.empty()) return; @@ -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_formwindowcommand.cpp b/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp index 490373e..675752e 100644 --- a/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp +++ b/tools/designer/src/lib/shared/qdesigner_formwindowcommand.cpp @@ -115,7 +115,7 @@ void QDesignerFormWindowCommand::updateBuddies(QDesignerFormWindowInterface *for typedef QList<QLabel*> LabelList; - const LabelList label_list = qFindChildren<QLabel*>(form); + const LabelList label_list = form->findChildren<QLabel*>(); if (label_list.empty()) return; diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp index 31a226a..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); @@ -630,7 +630,7 @@ QDesignerMenu *QDesignerMenu::findActivatedMenu() const { QList<QDesignerMenu*> candidates; candidates.append(const_cast<QDesignerMenu*>(this)); - candidates += qFindChildren<QDesignerMenu*>(this); + candidates += findChildren<QDesignerMenu*>(); foreach (QDesignerMenu *m, candidates) { if (m == qApp->activeWindow()) @@ -867,7 +867,7 @@ void QDesignerMenu::closeMenuChain() w = w->parentWidget(); if (w) { - foreach (QMenu *subMenu, qFindChildren<QMenu*>(w)) { + foreach (QMenu *subMenu, w->findChildren<QMenu*>()) { subMenu->hide(); } } @@ -1323,7 +1323,7 @@ QAction *QDesignerMenu::safeActionAt(int index) const void QDesignerMenu::hideSubMenu() { m_lastSubMenuIndex = -1; - foreach (QMenu *subMenu, qFindChildren<QMenu*>(this)) { + foreach (QMenu *subMenu, findChildren<QMenu*>()) { subMenu->hide(); } } 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 ecd97fa..461212c 100644 --- a/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp +++ b/tools/designer/src/lib/shared/qdesigner_tabwidget.cpp @@ -134,7 +134,7 @@ QTabBar *QTabWidgetEventFilter::tabBar() const { // QTabWidget::tabBar() accessor is protected, grmbl... if (!m_cachedTabBar) { - const QList<QTabBar *> tabBars = qFindChildren<QTabBar *>(m_tabWidget); + const QList<QTabBar *> tabBars = m_tabWidget->findChildren<QTabBar *>(); Q_ASSERT(tabBars.size() == 1); m_cachedTabBar = tabBars.front(); } @@ -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/richtexteditor.cpp b/tools/designer/src/lib/shared/richtexteditor.cpp index ec7c2e5..b5a2618 100644 --- a/tools/designer/src/lib/shared/richtexteditor.cpp +++ b/tools/designer/src/lib/shared/richtexteditor.cpp @@ -52,6 +52,9 @@ #include <QtCore/QList> #include <QtCore/QMap> #include <QtCore/QPointer> +#include <QtCore/QXmlStreamReader> +#include <QtCore/QXmlStreamWriter> +#include <QtCore/QXmlStreamAttributes> #include <QtGui/QAction> #include <QtGui/QColorDialog> @@ -74,28 +77,129 @@ QT_BEGIN_NAMESPACE -static const char *RichTextDialogC = "RichTextDialog"; -static const char *Geometry = "Geometry"; +static const char RichTextDialogGroupC[] = "RichTextDialog"; +static const char GeometryKeyC[] = "Geometry"; +static const char TabKeyC[] = "Tab"; + +const bool simplifyRichTextDefault = true; namespace qdesigner_internal { +// Richtext simplification filter helpers: Elements to be discarded +static inline bool filterElement(const QStringRef &name) +{ + return name != QLatin1String("meta") && name != QLatin1String("style"); +} + +// Richtext simplification filter helpers: Filter attributes of elements +static inline void filterAttributes(const QStringRef &name, + QXmlStreamAttributes *atts, + bool *paragraphAlignmentFound) +{ + typedef QXmlStreamAttributes::iterator AttributeIt; + + if (atts->isEmpty()) + return; + + // No style attributes for <body> + if (name == QLatin1String("body")) { + atts->clear(); + return; + } + + // Clean out everything except 'align' for 'p' + if (name == QLatin1String("p")) { + for (AttributeIt it = atts->begin(); it != atts->end(); ) { + if (it->name() == QLatin1String("align")) { + ++it; + *paragraphAlignmentFound = true; + } else { + it = atts->erase(it); + } + } + return; + } +} + +// Richtext simplification filter helpers: Check for blank QStringRef. +static inline bool isWhiteSpace(const QStringRef &in) +{ + const int count = in.size(); + for (int i = 0; i < count; i++) + if (!in.at(i).isSpace()) + return false; + return true; +} + +// Richtext simplification filter: Remove hard-coded font settings, +// <style> elements, <p> attributes other than 'align' and +// and unnecessary meta-information. +QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = 0) +{ + unsigned elementCount = 0; + bool paragraphAlignmentFound = false; + QString out; + QXmlStreamReader reader(in); + QXmlStreamWriter writer(&out); + writer.setAutoFormatting(false); + writer.setAutoFormattingIndent(0); + + while (!reader.atEnd()) { + switch (reader.readNext()) { + case QXmlStreamReader::StartElement: + elementCount++; + if (filterElement(reader.name())) { + const QStringRef name = reader.name(); + QXmlStreamAttributes attributes = reader.attributes(); + filterAttributes(name, &attributes, ¶graphAlignmentFound); + writer.writeStartElement(name.toString()); + if (!attributes.isEmpty()) + writer.writeAttributes(attributes); + } else { + reader.readElementText(); // Skip away all nested elements and characters. + } + break; + case QXmlStreamReader::Characters: + if (!isWhiteSpace(reader.text())) + writer.writeCharacters(reader.text().toString()); + break; + case QXmlStreamReader::EndElement: + writer.writeEndElement(); + break; + default: + break; + } + } + // Check for plain text (no spans, just <html><head><body><p>) + if (isPlainTextPtr) + *isPlainTextPtr = !paragraphAlignmentFound && elementCount == 4u; // + return out; +} + class RichTextEditor : public QTextEdit { Q_OBJECT public: - RichTextEditor(QWidget *parent = 0); - void setDefaultFont(const QFont &font); + explicit RichTextEditor(QWidget *parent = 0); + void setDefaultFont(QFont font); QToolBar *createToolBar(QDesignerFormEditorInterface *core, QWidget *parent = 0); + bool simplifyRichText() const { return m_simplifyRichText; } + public slots: void setFontBold(bool b); void setFontPointSize(double); void setText(const QString &text); + void setSimplifyRichText(bool v); QString text(Qt::TextFormat format) const; signals: void stateChanged(); + void simplifyRichTextChanged(bool); + +private: + bool m_simplifyRichText; }; class AddLinkDialog : public QDialog @@ -303,6 +407,7 @@ private: QAction *m_align_justify_action; QAction *m_link_action; QAction *m_image_action; + QAction *m_simplify_richtext_action; ColorAction *m_color_action; QComboBox *m_font_size_input; @@ -432,6 +537,17 @@ RichTextEditorToolBar::RichTextEditorToolBar(QDesignerFormEditorInterface *core, this, SLOT(colorChanged(QColor))); addAction(m_color_action); + addSeparator(); + + // Simplify rich text + m_simplify_richtext_action + = createCheckableAction(createIconSet(QLatin1String("simplifyrichtext.png")), + tr("Simplify Rich Text"), m_editor, SLOT(setSimplifyRichText(bool))); + m_simplify_richtext_action->setChecked(m_editor->simplifyRichText()); + connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), + m_simplify_richtext_action, SLOT(setChecked(bool))); + addAction(m_simplify_richtext_action); + connect(editor, SIGNAL(textChanged()), this, SLOT(updateActions())); connect(editor, SIGNAL(stateChanged()), this, SLOT(updateActions())); @@ -551,7 +667,7 @@ void RichTextEditorToolBar::updateActions() } RichTextEditor::RichTextEditor(QWidget *parent) - : QTextEdit(parent) + : QTextEdit(parent), m_simplifyRichText(simplifyRichTextDefault) { connect(this, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SIGNAL(stateChanged())); @@ -579,14 +695,31 @@ void RichTextEditor::setFontPointSize(double d) void RichTextEditor::setText(const QString &text) { + if (Qt::mightBeRichText(text)) setHtml(text); else setPlainText(text); } -void RichTextEditor::setDefaultFont(const QFont &font) +void RichTextEditor::setSimplifyRichText(bool v) { + if (v != m_simplifyRichText) { + m_simplifyRichText = v; + emit simplifyRichTextChanged(v); + } +} + +void RichTextEditor::setDefaultFont(QFont font) +{ + // Some default fonts on Windows have a default size of 7.8, + // which results in complicated rich text generated by toHtml(). + // Use an integer value. + const int pointSize = qRound(font.pointSizeF()); + if (pointSize > 0 && !qFuzzyCompare(qreal(pointSize), font.pointSizeF())) { + font.setPointSize(pointSize); + } + document()->setDefaultFont(font); if (font.pointSize() > 0) setFontPointSize(font.pointSize()); @@ -602,15 +735,16 @@ QString RichTextEditor::text(Qt::TextFormat format) const case Qt::PlainText: return toPlainText(); case Qt::RichText: - return toHtml(); + return m_simplifyRichText ? simplifyRichTextFilter(toHtml()) : toHtml(); case Qt::AutoText: break; } const QString html = toHtml(); - const QString plain = toPlainText(); - QTextEdit tester; - tester.setPlainText(plain); - return tester.toHtml() == html ? plain : html; + bool isPlainText; + const QString simplifiedHtml = simplifyRichTextFilter(html, &isPlainText); + if (isPlainText) + return toPlainText(); + return m_simplifyRichText ? simplifiedHtml : html; } RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent) : @@ -619,15 +753,25 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q m_text_edit(new HtmlTextEdit), m_tab_widget(new QTabWidget), m_state(Clean), - m_core(core) + m_core(core), + m_initialTab(RichTextIndex) { setWindowTitle(tr("Edit text")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + // Read settings + const QDesignerSettingsInterface *settings = core->settingsManager(); + const QString rootKey = QLatin1String(RichTextDialogGroupC) + QLatin1Char('/'); + const QByteArray lastGeometry = settings->value(rootKey + QLatin1String(GeometryKeyC)).toByteArray(); + const int initialTab = settings->value(rootKey + QLatin1String(TabKeyC), QVariant(m_initialTab)).toInt(); + if (initialTab == RichTextIndex || initialTab == SourceIndex) + m_initialTab = initialTab; + m_text_edit->setAcceptRichText(false); new HtmlHighlighter(m_text_edit); connect(m_editor, SIGNAL(textChanged()), this, SLOT(richTextChanged())); + connect(m_editor, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged())); connect(m_text_edit, SIGNAL(textChanged()), this, SLOT(sourceChanged())); // The toolbar needs to be created after the RichTextEditor @@ -661,32 +805,33 @@ RichTextEditorDialog::RichTextEditorDialog(QDesignerFormEditorInterface *core, Q layout->addWidget(m_tab_widget); layout->addWidget(buttonBox); - m_editor->setFocus(); - - QDesignerSettingsInterface *settings = core->settingsManager(); - settings->beginGroup(QLatin1String(RichTextDialogC)); - - if (settings->contains(QLatin1String(Geometry))) - restoreGeometry(settings->value(QLatin1String(Geometry)).toByteArray()); - - settings->endGroup(); + if (!lastGeometry.isEmpty()) + restoreGeometry(lastGeometry); } RichTextEditorDialog::~RichTextEditorDialog() { QDesignerSettingsInterface *settings = m_core->settingsManager(); - settings->beginGroup(QLatin1String(RichTextDialogC)); + settings->beginGroup(QLatin1String(RichTextDialogGroupC)); - settings->setValue(QLatin1String(Geometry), saveGeometry()); + settings->setValue(QLatin1String(GeometryKeyC), saveGeometry()); + settings->setValue(QLatin1String(TabKeyC), m_tab_widget->currentIndex()); settings->endGroup(); } int RichTextEditorDialog::showDialog() { - m_tab_widget->setCurrentIndex(0); - m_editor->selectAll(); - m_editor->setFocus(); - + m_tab_widget->setCurrentIndex(m_initialTab); + switch (m_initialTab) { + case RichTextIndex: + m_editor->selectAll(); + m_editor->setFocus(); + break; + case SourceIndex: + m_text_edit->selectAll(); + m_text_edit->setFocus(); + break; + } return exec(); } @@ -697,6 +842,9 @@ void RichTextEditorDialog::setDefaultFont(const QFont &font) void RichTextEditorDialog::setText(const QString &text) { + // Generally simplify rich text unless verbose text is found. + const bool isSimplifiedRichText = !text.startsWith("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"); + m_editor->setSimplifyRichText(isSimplifiedRichText); m_editor->setText(text); m_text_edit->setPlainText(text); m_state = Clean; diff --git a/tools/designer/src/lib/shared/richtexteditor_p.h b/tools/designer/src/lib/shared/richtexteditor_p.h index 44023ef..116ecb4 100644 --- a/tools/designer/src/lib/shared/richtexteditor_p.h +++ b/tools/designer/src/lib/shared/richtexteditor_p.h @@ -93,6 +93,7 @@ private: QTabWidget *m_tab_widget; State m_state; QDesignerFormEditorInterface *m_core; + int m_initialTab; }; } // namespace qdesigner_internal diff --git a/tools/designer/src/lib/shared/stylesheeteditor.cpp b/tools/designer/src/lib/shared/stylesheeteditor.cpp index b76d700..bee5210 100644 --- a/tools/designer/src/lib/shared/stylesheeteditor.cpp +++ b/tools/designer/src/lib/shared/stylesheeteditor.cpp @@ -79,6 +79,7 @@ StyleSheetEditor::StyleSheetEditor(QWidget *parent) : QTextEdit(parent) { setTabStopWidth(fontMetrics().width(QLatin1Char(' '))*4); + setAcceptRichText(false); new CssHighlighter(document()); } @@ -393,14 +394,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/shared/widgetfactory.cpp b/tools/designer/src/lib/shared/widgetfactory.cpp index c7b13a1..d686052 100644 --- a/tools/designer/src/lib/shared/widgetfactory.cpp +++ b/tools/designer/src/lib/shared/widgetfactory.cpp @@ -782,7 +782,7 @@ void WidgetFactory::applyStyleToTopLevel(QStyle *style, QWidget *widget) widget->setStyle(style); widget->setPalette(standardPalette); - const QWidgetList lst = qFindChildren<QWidget*>(widget); + const QWidgetList lst = widget->findChildren<QWidget*>(); const QWidgetList::const_iterator cend = lst.constEnd(); for (QWidgetList::const_iterator it = lst.constBegin(); it != cend; ++it) (*it)->setStyle(style); diff --git a/tools/designer/src/lib/shared/zoomwidget.cpp b/tools/designer/src/lib/shared/zoomwidget.cpp index f5d7434..5cf4ea2 100644 --- a/tools/designer/src/lib/shared/zoomwidget.cpp +++ b/tools/designer/src/lib/shared/zoomwidget.cpp @@ -328,7 +328,7 @@ void ZoomWidget::setWidget(QWidget *w, Qt::WindowFlags wFlags) scene().removeItem(m_proxy); if (QWidget *w = m_proxy->widget()) { // remove the event filter - if (QObject *evf = qFindChild<QObject*>(w, QLatin1String(zoomedEventFilterRedirectorNameC))) + if (QObject *evf = w->findChild<QObject*>(QLatin1String(zoomedEventFilterRedirectorNameC))) w->removeEventFilter(evf); } m_proxy->deleteLater(); diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index 6f009e3..ad2aa05 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -341,7 +341,7 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge w->addAction(a); } else if (QActionGroup *g = m_actionGroups.value(name)) { w->addActions(g->actions()); - } else if (QMenu *menu = qFindChild<QMenu*>(w, name)) { + } else if (QMenu *menu = w->findChild<QMenu*>(name)) { w->addAction(menu->menuAction()); addMenuAction(menu->menuAction()); } @@ -363,9 +363,9 @@ 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 = qFindChild<QWidget*>(w, widgetName)) { + if (QWidget *child = w->findChild<QWidget*>(widgetName)) { if (child->parentWidget() == w) { zOrder.removeAll(child); zOrder.append(child); @@ -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); @@ -1603,14 +1603,14 @@ void QAbstractFormBuilder::applyTabStops(QWidget *widget, DomTabStops *tabStops) for (int i=0; i<l.size(); ++i) { const QString name = l.at(i); - QWidget *child = qFindChild<QWidget*>(widget, name); + QWidget *child = widget->findChild<QWidget*>(name); if (!child) { uiLibWarning(QCoreApplication::translate("QAbstractFormBuilder", "While applying tab stops: The widget '%1' could not be found.").arg(name)); continue; } if (i == 0) { - lastWidget = qFindChild<QWidget*>(widget, name); + lastWidget = widget->findChild<QWidget*>(name); continue; } else if (!child || !lastWidget) { continue; @@ -1618,7 +1618,7 @@ void QAbstractFormBuilder::applyTabStops(QWidget *widget, DomTabStops *tabStops) QWidget::setTabOrder(lastWidget, child); - lastWidget = qFindChild<QWidget*>(widget, name); + lastWidget = widget->findChild<QWidget*>(name); } } @@ -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/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index c97daac..c7d4e90 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -319,7 +319,7 @@ QWidget *QFormBuilder::widgetByName(QWidget *topLevel, const QString &name) if (topLevel->objectName() == name) return topLevel; - return qFindChild<QWidget*>(topLevel, name); + return topLevel->findChild<QWidget*>(name); } static QObject *objectByName(QWidget *topLevel, const QString &name) @@ -328,7 +328,7 @@ static QObject *objectByName(QWidget *topLevel, const QString &name) if (topLevel->objectName() == name) return topLevel; - return qFindChild<QObject*>(topLevel, name); + return topLevel->findChild<QObject*>(name); } /*! diff --git a/tools/designer/src/lib/uilib/formbuilderextra.cpp b/tools/designer/src/lib/uilib/formbuilderextra.cpp index 6c3357f..0747974 100644 --- a/tools/designer/src/lib/uilib/formbuilderextra.cpp +++ b/tools/designer/src/lib/uilib/formbuilderextra.cpp @@ -136,7 +136,7 @@ bool QFormBuilderExtra::applyBuddy(const QString &buddyName, BuddyMode applyMode return false; } - const QWidgetList widgets = qFindChildren<QWidget*>(label->topLevelWidget(), buddyName); + const QWidgetList widgets = label->topLevelWidget()->findChildren<QWidget*>(buddyName); if (widgets.empty()) { label->setBuddy(0); return false; 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..e5c8461 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; } @@ -1347,7 +1347,7 @@ void MainWindow::manual() << (QT_VERSION >> 16) << ((QT_VERSION >> 8) & 0xFF) << (QT_VERSION & 0xFF) << QLatin1String("/qdoc/linguist-manual.html") - << QLatin1Char('\0') << endl; + << QLatin1Char('\n') << endl; } void MainWindow::about() 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/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph index 9e1a580..1884ed3 100644 --- a/tools/linguist/phrasebooks/french.qph +++ b/tools/linguist/phrasebooks/french.qph @@ -801,7 +801,7 @@ </phrase> <phrase> <source>Redo</source> - <target>Annuler Annuler</target> + <target>Rétablir</target> </phrase> <phrase> <source>region selection</source> @@ -1111,10 +1111,6 @@ <target>&Édition</target> </phrase> <phrase> - <source>&Redo</source> - <target>Re&faire</target> -</phrase> -<phrase> <source>debugger</source> <target>débogueur</target> </phrase> @@ -1438,4 +1434,60 @@ <source>&Debug</source> <target>&Déboguer</target> </phrase> +<phrase> + <source>Slider</source> + <target>Barre de défilement</target> +</phrase> +<phrase> + <source>&Restore</source> + <target>&Restaurer</target> +</phrase> +<phrase> + <source>&Move</source> + <target>&Déplacer</target> +</phrase> +<phrase> + <source>New</source> + <target>Créer</target> +</phrase> +<phrase> + <source>Play</source> + <target>Lecture</target> +</phrase> +<phrase> + <source>Slider</source> + <target>Barre de défilement</target> +</phrase> +<phrase> + <source>&Restore</source> + <target>&Restaurer</target> +</phrase> +<phrase> + <source>&Move</source> + <target>&Déplacer</target> +</phrase> +<phrase> + <source>New</source> + <target>Créer</target> +</phrase> +<phrase> + <source>Play</source> + <target>Lecture</target> +</phrase> +<phrase> + <source>&Redo</source> + <target>&Refaire</target> +</phrase> +<phrase> + <source>Raised</source> + <target>Bombé</target> +</phrase> +<phrase> + <source>Sunken</source> + <target>Enfoncé</target> +</phrase> +<phrase> + <source>Run:</source> + <target>Exécution :</target> +</phrase> </QPH> diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph index 750fda0..5876ee9 100644 --- a/tools/linguist/phrasebooks/russian.qph +++ b/tools/linguist/phrasebooks/russian.qph @@ -498,7 +498,7 @@ </phrase> <phrase> <source>Next</source> - <target>Следующий</target> + <target>Далее</target> </phrase> <phrase> <source>object</source> @@ -1070,7 +1070,7 @@ </phrase> <phrase> <source>Next</source> - <target>Далее</target> + <target>Следующий</target> </phrase> <phrase> <source>tree view</source> @@ -1204,4 +1204,16 @@ <source>Permission denied</source> <target>Доступ запрещён</target> </phrase> +<phrase> + <source>Previous</source> + <target>Предыдущий</target> +</phrase> +<phrase> + <source>Next</source> + <target>Следующее</target> +</phrase> +<phrase> + <source>Previous</source> + <target>Предыдущее</target> +</phrase> </QPH> 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/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 7130d61..ec86ae3 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -624,7 +624,9 @@ QString CodeMarker::macName(const Node *node, const QString &name) Get the list of documentation sections for the children of the specified QmlClassNode. */ -QList<Section> CodeMarker::qmlSections(const QmlClassNode* , SynopsisStyle ) +QList<Section> CodeMarker::qmlSections(const QmlClassNode* , + SynopsisStyle , + const Tree* ) { return QList<Section>(); } diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 53ad4a8..f17b28e 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -153,7 +153,8 @@ class CodeMarker Status status) = 0; #ifdef QDOC_QML virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style); + SynopsisStyle style, + const Tree* tree); #endif virtual const Node* resolveTarget(const QString& target, const Tree* tree, diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index b087b1c..335a0d6 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -119,6 +119,7 @@ class Config }; #define CONFIG_ALIAS "alias" +#define CONFIG_APPLICATION "application" #define CONFIG_BASE "base" // ### don't document for now #define CONFIG_CODEINDENT "codeindent" #define CONFIG_DEFINES "defines" @@ -142,9 +143,7 @@ class Config #define CONFIG_MACRO "macro" #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" -#define CONFIG_ONLINE "online" -#define CONFIG_OFFLINE "offline" -#define CONFIG_CREATOR "creator" +#define CONFIG_APPLICATION "application" #define CONFIG_OUTPUTDIR "outputdir" #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 562e92b..3615a84 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1127,7 +1127,8 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode, Currently, it only handles QML property groups. */ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style) + SynopsisStyle style, + const Tree* tree) { QList<Section> sections; if (qmlClassNode) { @@ -1244,6 +1245,48 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlmethods); append(sections,qmlattachedmethods); } + else { + FastSection all(qmlClassNode,"","","member","members"); + + QStack<const QmlClassNode*> stack; + stack.push(qmlClassNode); + + while (!stack.isEmpty()) { + const QmlClassNode* ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while (c != ancestorClass->childNodes().end()) { + // if ((*c)->access() != Node::Private) + if ((*c)->subType() == Node::QmlPropertyGroup) { + const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c); + NodeList::ConstIterator p = qpgn->childNodes().begin(); + while (p != qpgn->childNodes().end()) { + if ((*p)->type() == Node::QmlProperty) { + insert(all,*p,style,Okay); + } + ++p; + } + } + else + insert(all,*c,style,Okay); + ++c; + } + + if (!ancestorClass->links().empty()) { + if (ancestorClass->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = ancestorClass->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = tree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + stack.prepend(qcn); + } + } + } + } + append(sections, all); + } } return sections; diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index eca3936..804a302 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -80,7 +80,8 @@ class CppCodeMarker : public CodeMarker SynopsisStyle style, Status status); QList<Section> qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style); + SynopsisStyle style, + const Tree* tree); const Node* resolveTarget(const QString& target, const Tree* tree, const Node* relative, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4789c67..7892025 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -440,7 +440,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) DITAXMLGENERATOR_GENERATEMACREFS); project = config.getString(CONFIG_PROJECT); - offlineDocs = !config.getBool(CONFIG_ONLINE); projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -1765,7 +1764,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateQmlInstantiates(qml_cn, marker); generateBrief(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; @@ -1782,7 +1781,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAlsoList(fake, marker); out() << "<hr />\n"; - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 24219a1..7f39be2 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1068,8 +1068,11 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) Text text; text << Atom::ParaLeft << "This " - << typeString(node) - << " was introduced in "; + << typeString(node); + if (node->type() == Node::Enum) + text << " was introduced or modified in "; + else + text << " was introduced in "; if (project.isEmpty()) text << "version"; else diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 76d8c0d..4603a40 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -219,9 +219,7 @@ HtmlGenerator::HtmlGenerator() inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), - offlineDocs(false), - onlineDocs(false), - creatorDocs(true), + application(Online), funcLeftParen("\\S(\\()"), myTree(0), slow(false), @@ -290,11 +288,13 @@ void HtmlGenerator::initializeGenerator(const Config &config) project = config.getString(CONFIG_PROJECT); - onlineDocs = config.getBool(CONFIG_ONLINE); - - offlineDocs = config.getBool(CONFIG_OFFLINE); - - creatorDocs = config.getBool(CONFIG_CREATOR); + QString app = config.getString(CONFIG_APPLICATION); + if (app == "online") + application = Online; + else if (app == "creator") + application = Creator; + else + application = Creator; projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) @@ -1489,7 +1489,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) const QmlClassNode* qml_cn = 0; if (fake->subType() == Node::QmlClass) { qml_cn = static_cast<const QmlClassNode*>(fake); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); generateTableOfContents(fake,marker,§ions); } else if (fake->name() != QString("index.html")) @@ -1571,6 +1571,13 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); generateQmlInstantiates(qml_cn, marker); + + QString allQmlMembersLink = generateAllQmlMembersFile(qml_cn, marker); + if (!allQmlMembersLink.isEmpty()) { + out() << "<li><a href=\"" << allQmlMembersLink << "\">" + << "List of all members, including inherited members</a></li>\n"; + } + s = sections.begin(); while (s != sections.end()) { out() << "<a name=\"" << registerRef((*s).name.toLower()) @@ -1590,7 +1597,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateExtractionMark(fake, EndMark); //out() << "<hr />\n"; - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; @@ -1713,7 +1720,7 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << "</li>\n"; } if (!cn->name().isEmpty()) - out() << " <li>" << cn->name() << "</li>\n"; + out() << " <li>" << protectEnc(cn->name()) << "</li>\n"; } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast<const FakeNode*>(node); @@ -1721,52 +1728,50 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, out() << " <li><a href=\"modules.html\">Modules</a></li>"; QString name = node->name(); if (!name.isEmpty()) - out() << " <li>" << name << "</li>\n"; + out() << " <li>" << protectEnc(name) << "</li>\n"; } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) out() << " <li>Modules</li>"; else { - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } } else if (node->subType() == Node::Page) { if (fn->name() == QString("qdeclarativeexamples.html")) { out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; - out() << " <li>QML Examples & Demos</li>"; + out() << " <li>QML Examples & Demos</li>"; } else if (fn->name().startsWith("examples-")) { out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } else if (fn->name() == QString("namespaces.html")) { out() << " <li>Namespaces</li>"; } else { - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } } else if (node->subType() == Node::QmlClass) { out() << " <li><a href=\"qdeclarativeelements.html\">QML Elements</a></li>"; - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } else if (node->subType() == Node::Example) { out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) - out() << " <li><a href=\"qdeclarativeexamples.html\">QML Examples & Demos</a></li>"; + out() << " <li><a href=\"qdeclarativeexamples.html\">QML Examples & Demos</a></li>"; else { - QString name = "examples-" + sl.at(0) + ".html"; + QString name = protectEnc("examples-" + sl.at(0) + ".html"); // this generates an empty link QString t = CodeParser::titleFromName(name); - out() << " <li><a href=\"" << name << "\">" - << t << "</a></li>"; } - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } } else if (node->type() == Node::Namespace) { out() << " <li><a href=\"namespaces.html\">Namespaces</a></li>"; - out() << " <li>" << title << "</li>"; + out() << " <li>" << protectEnc(title) << "</li>"; } } @@ -1811,9 +1816,8 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting some additional style sheet related details depending on configuration (e.g. online/offline) - - if(onlineDocs==true) // onlineDocs is for the web - { + switch (application) { + case Online: // Browser spec styles out() << " <!--[if IE]>\n"; out() << "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n"; @@ -1832,22 +1836,15 @@ void HtmlGenerator::generateHeader(const QString& title, out() << "</head>\n"; // CheckEmptyAndLoadList activating search out() << "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n"; - } - else if (offlineDocs == true) // offlineDocs is for ??? - { - out() << "</head>\n"; - out() << "<body class=\"offline \">\n"; // offline - } - else if (creatorDocs == true) // creatorDocs is for Assistant/Creator - { + break; + case Creator: out() << "</head>\n"; out() << "<body class=\"offline narrow creator\">\n"; // offline narrow - } - // default -- not used except if one forgets to set any of the above settings to true - else - { + break; + default: out() << "</head>\n"; - out() << "<body>\n"; + out() << "<body>\n"; + break; } #ifdef GENERATE_MAC_REFS @@ -1855,31 +1852,77 @@ void HtmlGenerator::generateHeader(const QString& title, generateMacRef(node, marker); #endif - - if(onlineDocs==true) // onlineDocs is for the web - { + switch (application) { + case Online: out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); generateBreadCrumbs(title,node,marker); out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - } - else if (offlineDocs == true) // offlineDocs is for ??? - { - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - } - else if (creatorDocs == true) // creatorDocs is for Assistant/Creator - { + break; + case Creator: out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); generateBreadCrumbs(title,node,marker); out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - } - // default -- not used except if one forgets to set any of the above settings to true - else - { + break; + default: // default -- not used except if one forgets to set any of the above settings to true out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + break; + } + + navigationLinks.clear(); + + if (node && !node->links().empty()) { + QPair<QString,QString> linkPair; + QPair<QString,QString> anchorPair; + const Node *linkNode; + + if (node->links().contains(Node::PreviousLink)) { + linkPair = node->links()[Node::PreviousLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + + out() << " <link rel=\"prev\" href=\"" + << anchorPair.first << "\" />\n"; + + navigationLinks += "[Previous: <a href=\"" + anchorPair.first + "\">"; + if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) + navigationLinks += protect(anchorPair.second); + else + navigationLinks += protect(linkPair.second); + navigationLinks += "</a>]\n"; + } + if (node->links().contains(Node::NextLink)) { + linkPair = node->links()[Node::NextLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + + out() << " <link rel=\"next\" href=\"" + << anchorPair.first << "\" />\n"; + + navigationLinks += "[Next: <a href=\"" + anchorPair.first + "\">"; + if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) + navigationLinks += protect(anchorPair.second); + else + navigationLinks += protect(linkPair.second); + navigationLinks += "</a>]\n"; + } + if (node->links().contains(Node::StartLink)) { + linkPair = node->links()[Node::StartLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + if (!linkNode || linkNode == node) + anchorPair = linkPair; + else + anchorPair = anchorForNode(linkNode); + out() << " <link rel=\"start\" href=\"" + << anchorPair.first << "\" />\n"; + } } #if 0 // Removed for new doc format. MWS @@ -1914,34 +1957,30 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - - if (onlineDocs == true) - { - out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; - out() << " <!-- <script type=\"text/javascript\">\n"; - out() << " var _gaq = _gaq || [];\n"; - out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; - out() << " _gaq.push(['_trackPageview']);\n"; - out() << " (function() {\n"; - out() << " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; - out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; - out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; - out() << " })();\n"; - out() << " </script> -->\n"; - out() << "</body>\n"; - } - else if (offlineDocs == true) - { - out() << "</body>\n"; - } - else if (creatorDocs == true) - { - out() << "</body>\n"; - } - else - { - out() << "</body>\n"; - } + + switch (application) { + case Online: + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; + out() << " <!-- <script type=\"text/javascript\">\n"; + out() << " var _gaq = _gaq || [];\n"; + out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n"; + out() << " _gaq.push(['_trackPageview']);\n"; + out() << " (function() {\n"; + out() << " var ga = document.createElement('script'); "; + out() << "ga.type = 'text/javascript'; ga.async = true;\n"; + out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + "; + out() << "'.google-analytics.com/ga.js';\n"; + out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; + out() << " })();\n"; + out() << " </script> -->\n"; + out() << "</body>\n"; + break; + case Creator: + out() << "</body>\n"; + break; + default: + out() << "</body>\n"; + } out() << "</html>\n"; } @@ -1977,7 +2016,7 @@ void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) } /*! - Generates a table of contents begining at \a node. + Generates a table of contents beginning at \a node. */ void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker, @@ -2063,7 +2102,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, /*! Revised for the new doc format. - Generates a table of contents begining at \a node. + Generates a table of contents beginning at \a node. */ void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker, @@ -2241,6 +2280,38 @@ QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, return fileName; } +/*! + This function creates an html page on which are listed all + the members of QML class \a qml_cn, including the inherited + members. The \a marker is used for formatting stuff. + */ +QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, + CodeMarker* marker) +{ + QList<Section> sections; + QList<Section>::ConstIterator s; + + sections = marker->qmlSections(qml_cn,CodeMarker::SeparateList,myTree); + if (sections.isEmpty()) + return QString(); + + QString fileName = fileBase(qml_cn) + "-members." + fileExtension(qml_cn); + beginSubPage(qml_cn->location(), fileName); + QString title = "List of All Members for " + qml_cn->name(); + generateHeader(title, qml_cn, marker); + generateTitle(title, Text(), SmallSubTitle, qml_cn, marker); + out() << "<p>This is the complete list of members for "; + generateFullName(qml_cn, 0, marker); + out() << ", including inherited members.</p>\n"; + + Section section = sections.first(); + generateSectionList(section, 0, marker, CodeMarker::SeparateList); + + generateFooter(); + endSubPage(); + return fileName; +} + QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, CodeMarker *marker, CodeMarker::Status status) diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d92c349..eab10c6 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -95,6 +95,10 @@ class HtmlGenerator : public PageGenerator LastSinceType }; + enum Application { + Online, + Creator}; + public: HtmlGenerator(); ~HtmlGenerator(); @@ -164,7 +168,10 @@ class HtmlGenerator : public PageGenerator void generateTableOfContents(const Node *node, CodeMarker *marker, QList<Section>* sections = 0); - QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); + QString generateListOfAllMemberFile(const InnerNode *inner, + CodeMarker *marker); + QString generateAllQmlMembersFile(const QmlClassNode* qml_cn, + CodeMarker* marker); QString generateLowStatusMemberFile(const InnerNode *inner, CodeMarker *marker, CodeMarker::Status status); @@ -294,9 +301,7 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; - bool onlineDocs; - bool offlineDocs; - bool creatorDocs; + Application application; QString link; QStringList sectionNumber; QRegExp funcLeftParen; diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 616ae2f..fa7efee 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,6 +105,7 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash<QString, Tree *> trees; +static QString appArg; // application /*! Find the Tree for language \a lang and return a pointer to it. @@ -192,6 +193,24 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* + Set the application to which qdoc will create the output. + The two applications are: + + creator: additional formatting for viewing in + the Creator application. + + online: full-featured online version with search and + links to Qt topics + */ + if (appArg.isEmpty()) { + qDebug() << "Warning: Application flag not specified on" + << "command line. Options are -creator (default)" + << "and -online."; + appArg = "creator"; + } + config.setStringList(CONFIG_APPLICATION, QStringList(appArg)); + + /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -462,12 +481,16 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } + else if (opt == "-creator") + appArg = "creator"; + else if (opt == "-online") + appArg = "online"; else { qdocFiles.append(opt); } } - if (qdocFiles.isEmpty()) { + if (qdocFiles.isEmpty()) { printHelp(); return EXIT_FAILURE; } @@ -475,8 +498,10 @@ int main(int argc, char **argv) /* Main loop. */ - foreach (QString qf, qdocFiles) + foreach (QString qf, qdocFiles) { + //qDebug() << "PROCESSING:" << qf; processQdocconfFile(qf); + } qDeleteAll(trees); return EXIT_SUCCESS; diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 6b7044a..ab2b69a 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Assistant description = Qt Assistant Manual url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index @@ -19,39 +16,39 @@ qhp.Assistant.file = assistant.qhp qhp.Assistant.namespace = com.trolltech.assistant.480 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual -qhp.Assistant.extraFiles = images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ +qhp.Assistant.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ images/bullet_dn.png \ - images/bullet_sq.png \ + images/bullet_sq.png \ images/bullet_up.png \ - images/arrow_down.png \ + images/arrow_down.png \ images/feedbackground.png \ images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Assistant.filterAttributes = qt 4.8.0 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index d479151..1bb366d 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Designer description = Qt Designer Manual url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index f3578bc..4cb4cc7 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Linguist description = Qt Linguist Manual url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 0cff98e..80bca29 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -8,9 +8,6 @@ project = Qml description = Qml Reference Documentation url = http://qt.nokia.com/doc/4.7/ qmlonly = true -online = false -offline = false -creator = true edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \ QtXmlPatterns QtTest @@ -31,32 +28,32 @@ qhp.Qml.indexTitle = Qml Reference # Files not referenced in any qdoc file # See also extraimages.HTML qhp.Qml.extraFiles = images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/arrow-down.png \ - images/spinner.png \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - style/OfflineStyle.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Qml.filterAttributes = qt 4.7.0 qtrefdoc qhp.Qml.customFilters.Qt.name = Qt 4.7.0 diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 4efd19a..04fe6f8 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = QMake description = QMake Manual url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 1ec0c6b..cdd7a7c 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -5,9 +5,6 @@ include(qt-build-docs.qdocconf) # qmake.qdocconf). url = ./ -online = false -offline = false -creator = true # Ensures that the documentation for the tools is not included in the generated # .qhp file. @@ -30,10 +27,7 @@ qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ # Remove the QML documentation from the Qt-only documentation. -excludedirs += $QT_SOURCE_TREE/src/declarative \ - $QT_SOURCE_TREE/src/imports \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \ - $QT_SOURCE_TREE/doc/src/declarative +excludedirs += $QT_SOURCE_TREE/src/imports outputdir = $QT_BUILD_TREE/doc-build/html-qt tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 5ed97eb..a674c72 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true sourceencoding = UTF-8 outputencoding = UTF-8 @@ -21,6 +18,7 @@ qhp.Qt.file = qt.qhp qhp.Qt.namespace = com.trolltech.qt.480 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 4963b96..b78b512 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -64,6 +64,7 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ Q_XMLSTREAM_EXPORT \ Q_XMLPATTERNS_EXPORT \ QDBUS_EXPORT \ + Q_DBUS_EXPORT \ QT_BEGIN_NAMESPACE \ QT_BEGIN_INCLUDE_NAMESPACE \ QT_END_NAMESPACE \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e31a5ea..03dd008 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -4,15 +4,12 @@ HTML.stylesheets = style/style.css \ style/style_ie8.css \ style/style_ie6.css -HTML.creatorpostheader = "**\n" -HTML.creatorpostpostheader = "***\n" - HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div class=\"content\"> \n" \ " <div id=\"nav-logo\">\n" \ " <a href=\"index.html\">Home</a></div>\n" \ " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearchTop\">\n" \ " <fieldset>\n" \ " <input type=\"text\" value=\"\" id=\"pageType2\" name=\"searchstring\"/>\n" \ " </fieldset>\n" \ @@ -30,7 +27,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"shortCut\">\n" \ " <ul>\n" \ " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.8</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \ " </a></li>\n" \ " </ul>\n" \ " </div>\n" \ @@ -41,14 +38,14 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li><a href=\"functions.html\">Function index</a></li> \n" \ " <li><a href=\"modules.html\">Modules</a></li> \n" \ " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ - " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \ " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ " </ul> \n" \ " </li> \n" \ " <li><a href=\"#\">Qt Topics</a> \n" \ " <ul id=\"topmenuTopic\"> \n" \ " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ - " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li> \n" \ " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ @@ -100,7 +97,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"list002\" class=\"list\">\n" \ " <ul id=\"ul002\" >\n" \ " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ - " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtquick.html\">Device UI's & Qt Quick</a></li>\n" \ " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ " </ul> \n" \ @@ -149,6 +146,7 @@ HTML.footer = " <!-- /div -->\n" \ " <span></span>\n" \ " </div>\n" \ " </div> \n" \ + " </div> \n" \ " <div class=\"footer\">\n" \ " <p>\n" \ " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ @@ -161,11 +159,12 @@ HTML.footer = " <!-- /div -->\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p id=\"noteHead\">Thank you for giving your feedback. <div class=\"note\">Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</div></p>\n" \ + " <p id=\"noteHead\">Thank you for giving your feedback.</p> <div class=\"note\"><p>Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a>.</p></div>\n" \ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \ " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ - " </div>\n" + " </div>\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index 027548e..e2abd2a 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -160,19 +160,9 @@ HTML.footer = " <!-- /div -->\n" \ " <div id=\"feedbackBox\">\n" \ " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ - " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ - " </div>\n" \ - "<script type=\"text/javascript\">\n" \ - " var _gaq = _gaq || [];\n" \ - " _gaq.push([\'_setAccount\', \'UA-4457116-5\']);\n" \ - " _gaq.push([\'_trackPageview\']);\n" \ - " (function() {\n" \ - " var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;\n" \ - " ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';\n" \ - " var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);\n" \ - " })();\n" \ - "</script>\n" + " </div>\n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 94ac431..2c5c9d9 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -1,25 +1,168 @@ -HTML.stylesheets = classic.css -HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \ - "<tr>\n" \ - "<td align=\"left\" valign=\"top\" width=\"32\">" \ - "<a href=\"http://qt.nokia.com/\"><img src=\"images/qt-logo.png\" align=\"left\" border=\"0\" /></a>" \ - "</td>\n" \ - "<td width=\"1\"> </td>" \ - "<td class=\"postheader\" valign=\"center\">" \ - "<a href=\"http://qt.nokia.com/doc/4.8/index.html\">" \ - "<font color=\"#004faf\">主页</font></a> ·" \ - " <a href=\"http://qt.nokia.com/doc/4.8/classes.html\">" \ - "<font color=\"#004faf\">所有类</font></a> ·" \ - " <a href=\"http://qt.nokia.com/doc/4.8/functions.html\">" \ - "<font color=\"#004faf\">所有函数</font></a> ·" \ - " <a href=\"http://qt.nokia.com/doc/4.8/overviews.html\">" \ - "<font color=\"#004faf\">简介</font></a>" \ - "</td>" \ - "</tr></table>" +HTML.stylesheets = style/style.css \ + style/OfflineStyle.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style_ie6.css -HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \ - "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \ - "<td width=\"40%\" align=\"left\">版权所有 © 2010 诺基亚公司和/或其子公司</td>\n" \ - "<td width=\"20%\" align=\"center\"><a href=\"trademarks.html\">商标</a></td>\n" \ - "<td width=\"40%\" align=\"right\"><div align=\"right\">Qt \\version</div></td>\n" \ - "</tr></table></div></address>" +HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ + " <div class=\"content\"> \n" \ + " <div id=\"nav-logo\">\n" \ + " <a href=\"index.html\">Home</a></div>\n" \ + " <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \ + " <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \ + " </fieldset>\n" \ + " </form></div>\n" \ + " <div id=\"nav-topright\">\n" \ + " <ul>\n" \ + " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ + " <li class=\"nav-topright-dev\"><a href=\"http://qt.nokia.com/developer\">DEV</a></li>\n" \ + " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ + " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ + " DOC</a></li>\n" \ + " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ + " <li class=\"nav-topright-shop\"><a title=\"SHOP\" href=\"http://shop.qt.nokia.com\">SHOP</a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <div id=\"shortCut\">\n" \ + " <ul>\n" \ + " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.8</a></span></li>\n" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " </a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \ + " <li><a href=\"#\">API Lookup</a> \n" \ + " <ul id=\"topmenuLook\"> \n" \ + " <li><a href=\"classes.html\">所有类</a></li> \n" \ + " <li><a href=\"functions.html\">所有函数</a></li> \n" \ + " <li><a href=\"modules.html\">Modules</a></li> \n" \ + " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \ + " <li><a href=\"qtglobal.html\">Global stuff</a></li> \n" \ + " <li><a href=\"qdeclarativeelements.html\">QML elements</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Qt Topics</a> \n" \ + " <ul id=\"topmenuTopic\"> \n" \ + " <li><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li> \n" \ + " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ + " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ + " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " <li><a href=\"#\">Examples</a> \n" \ + " <ul id=\"topmenuexample\"> \n" \ + " <li><a href=\"all-examples.html\">Examples</a></li> \n" \ + " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ + " <li><a href=\"demos.html\">Demos</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ + " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ + " </ul> \n" \ + " </li> \n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrapper\">\n" \ + " <div class=\"hd\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " <div class=\"bd group\">\n" \ + " <div class=\"sidebar\">\n" \ + " <div class=\"searchlabel\">\n" \ + " Search index:</div>\n" \ + " <div class=\"search\">\n" \ + " <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \ + " <fieldset>\n" \ + " <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \ + " </fieldset>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div class=\"box first bottombar\" id=\"lookup\">\n" \ + " <h2 title=\"API Lookup\"><span></span>\n" \ + " API Lookup</h2>\n" \ + " <div id=\"list001\" class=\"list\">\n" \ + " <ul id=\"ul001\" >\n" \ + " <li class=\"defaultLink\"><a href=\"classes.html\">所有类</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"functions.html\">所有函数</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"modules.html\">Modules</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"namespaces.html\">Namespaces</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qtglobal.html\">Global stuff</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box bottombar\" id=\"topics\">\n" \ + " <h2 title=\"Qt Topics\"><span></span>\n" \ + " Qt Topics</h2>\n" \ + " <div id=\"list002\" class=\"list\">\n" \ + " <ul id=\"ul002\" >\n" \ + " <li class=\"defaultLink\"><a href=\"qt-basic-concepts.html\">Basic Qt architecture</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"box\" id=\"examples\">\n" \ + " <h2 title=\"Examples\"><span></span>\n" \ + " Examples</h2>\n" \ + " <div id=\"list003\" class=\"list\">\n" \ + " <ul id=\"ul003\">\n" \ + " <li class=\"defaultLink\"><a href=\"all-examples.html\">Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"tutorials.html\">Tutorials</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"demos.html\">Demos</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html\">QML Examples</a></li>\n" \ + " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ + " </ul> \n" \ + " </div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"wrap\">\n" \ + " <div class=\"toolbar\">\n" \ + " <div class=\"breadcrumb toolblock\">\n" \ + " <ul>\n" \ + " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ + " <!-- Bread crumbs goes here -->\n" + +HTML.postpostheader = " </ul>\n" \ + " </div>\n" \ + " <div class=\"toolbuttons toolblock\">\n" \ + " <ul>\n" \ + " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ + " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ + " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ + " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ + " <span>Print</span></a></li>\n" \ + " </ul>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"content\">\n" + +HTML.footer = " <!-- /div -->\n" \ + " <div class=\"feedback t_button\">\n" \ + " [+] Documentation Feedback</div>\n" \ + " </div>\n" \ + " </div>\n" \ + " <div class=\"ft\">\n" \ + " <span></span>\n" \ + " </div>\n" \ + " </div> \n" \ + " <div class=\"footer\">\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.</p>\n" \ + " <p>\n" \ + " All other trademarks are property of their respective owners. <a title=\"Privacy Policy\"\n" \ + " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ + " </div>\n" \ + " <div id=\"feedbackBox\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ + " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit your feedback...</textarea></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ + " </form>\n" \ + " </div>\n" \ + " <div id=\"blurpage\">\n" \ + " </div>\n" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 0e1f5f8..7095d1a 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -9,9 +9,6 @@ versionsym = version = %VERSION% description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.8 -online = false -offline = false -creator = true sourceencoding = UTF-8 outputencoding = UTF-8 diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index efb82d1..d794005 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -35,7 +35,7 @@ maemo5 { symbian { TARGET.UID3 = 0x20021317 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 TARGET.CAPABILITY = NetworkServices ReadUserData !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { LIBS += -lsensrvclient -lsensrvutil diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 7767e4b..93b087b 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -51,6 +51,7 @@ #include "trksignalhandler.h" #include "serenum.h" +#include "ossignalconverter.h" void printUsage(QTextStream& outstream, QString exeName) { @@ -235,6 +236,8 @@ int main(int argc, char *argv[]) QObject::connect(&handler, SIGNAL(getRegistersAndCallStack(uint,uint)), launcher.data(), SLOT(getRegistersAndCallStack(uint,uint))); QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished())); + QObject::connect(OsSignalConverter::instance(), SIGNAL(terminate()), launcher.data(), SLOT(terminate()), Qt::QueuedConnection); + QTimer timer; timer.setSingleShot(true); QObject::connect(&timer, SIGNAL(timeout()), &handler, SLOT(timeout())); diff --git a/tools/runonphone/ossignalconverter.cpp b/tools/runonphone/ossignalconverter.cpp new file mode 100644 index 0000000..6554e9f --- /dev/null +++ b/tools/runonphone/ossignalconverter.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ossignalconverter_p.h" +#include <signal.h> +#include <QTimer> + +Q_GLOBAL_STATIC(OsSignalConverter, osSignalConverter); + +OsSignalConverter* OsSignalConverter::instance() +{ + return osSignalConverter(); +} + +OsSignalConverter::OsSignalConverter() +: d(new OsSignalConverterPrivate(this)) +{ +}; + +OsSignalConverter::~OsSignalConverter() +{ +} + +OsSignalConverterPrivate::OsSignalConverterPrivate(OsSignalConverter* owner) +: QObject(owner), q(owner), poller(new QTimer(this)) +{ + trap(); + connect(poller, SIGNAL(timeout()), this, SLOT(poll())); + poller->start(1000); +} + +OsSignalConverterPrivate::~OsSignalConverterPrivate() +{ + untrap(); +} + +void OsSignalConverterPrivate::trap() +{ + signal(SIGINT, handler); + signal(SIGTERM, handler); +#ifdef SIGBREAK + signal(SIGBREAK, handler); +#endif +#ifdef SIGHUP + signal(SIGHUP, handler); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, handler); +#endif +} + +void OsSignalConverterPrivate::untrap() +{ + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); +#ifdef SIGBREAK + signal(SIGBREAK, SIG_DFL); +#endif +#ifdef SIGHUP + signal(SIGHUP, SIG_DFL); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, SIG_DFL); +#endif +} + +void OsSignalConverterPrivate::handler(int sig) +{ + untrap(); //allow 2nd ctrl-c to really kill us + terminateRequest = sig; +} + +void OsSignalConverterPrivate::poll() +{ + if (terminateRequest) { + fprintf(stderr, "\n*** caught signal %d, terminating ***\n", terminateRequest); + poller->stop(); + emit q->terminate(); + } +} + +sig_atomic_t OsSignalConverterPrivate::terminateRequest; diff --git a/tools/runonphone/ossignalconverter.h b/tools/runonphone/ossignalconverter.h new file mode 100644 index 0000000..f53f3c1 --- /dev/null +++ b/tools/runonphone/ossignalconverter.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OSSIGNALCONVERTER_H +#define OSSIGNALCONVERTER_H +#include <QObject> + +class OsSignalConverter : public QObject +{ + friend class OsSignalConverterPrivate; + Q_OBJECT +public: + static OsSignalConverter* instance(); + OsSignalConverter(); + ~OsSignalConverter(); +signals: + //emitted when this process is asked to quit, e.g. by SIGINT + void terminate(); +private: + OsSignalConverterPrivate *d; +}; + +#endif // OSSIGNALCONVERTER_H diff --git a/tools/runonphone/ossignalconverter_p.h b/tools/runonphone/ossignalconverter_p.h new file mode 100644 index 0000000..dddc9ca --- /dev/null +++ b/tools/runonphone/ossignalconverter_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OSSIGNALCONVERTER_P_H +#define OSSIGNALCONVERTER_P_H +#include "ossignalconverter.h" +#include <signal.h> + +class QTimer; +class OsSignalConverterPrivate : public QObject +{ + Q_OBJECT +public: + OsSignalConverterPrivate(OsSignalConverter* owner); + ~OsSignalConverterPrivate(); +private: + + static void trap(); + static void untrap(); + static void handler(int signal); + +private slots: + + void poll(); + +private: + + OsSignalConverter* q; + static sig_atomic_t terminateRequest; + QTimer *poller; +}; + +#endif // OSSIGNALCONVERTER_P_H diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro index 0c63723..15dff51 100644 --- a/tools/runonphone/runonphone.pro +++ b/tools/runonphone/runonphone.pro @@ -7,10 +7,13 @@ CONFIG -= app_bundle include(symbianutils/symbianutils.pri) SOURCES += main.cpp \ - trksignalhandler.cpp + trksignalhandler.cpp \ + ossignalconverter.cpp HEADERS += trksignalhandler.h \ - serenum.h + serenum.h \ + ossignalconverter.h \ + ossignalconverter_p.h DEFINES += SYMBIANUTILS_INCLUDE_PRI diff --git a/tools/shared/qtpropertybrowser/qtvariantproperty.cpp b/tools/shared/qtpropertybrowser/qtvariantproperty.cpp index b16fac3..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; } } @@ -1997,87 +1997,87 @@ QtVariantEditorFactory::~QtVariantEditorFactory() */ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *manager) { - QList<QtIntPropertyManager *> intPropertyManagers = qFindChildren<QtIntPropertyManager *>(manager); + QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); QListIterator<QtIntPropertyManager *> itInt(intPropertyManagers); while (itInt.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itInt.next()); - QList<QtDoublePropertyManager *> doublePropertyManagers = qFindChildren<QtDoublePropertyManager *>(manager); + QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); QListIterator<QtDoublePropertyManager *> itDouble(doublePropertyManagers); while (itDouble.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itDouble.next()); - QList<QtBoolPropertyManager *> boolPropertyManagers = qFindChildren<QtBoolPropertyManager *>(manager); + QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); QListIterator<QtBoolPropertyManager *> itBool(boolPropertyManagers); while (itBool.hasNext()) d_ptr->m_checkBoxFactory->addPropertyManager(itBool.next()); - QList<QtStringPropertyManager *> stringPropertyManagers = qFindChildren<QtStringPropertyManager *>(manager); + QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); QListIterator<QtStringPropertyManager *> itString(stringPropertyManagers); while (itString.hasNext()) d_ptr->m_lineEditFactory->addPropertyManager(itString.next()); - QList<QtDatePropertyManager *> datePropertyManagers = qFindChildren<QtDatePropertyManager *>(manager); + QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); QListIterator<QtDatePropertyManager *> itDate(datePropertyManagers); while (itDate.hasNext()) d_ptr->m_dateEditFactory->addPropertyManager(itDate.next()); - QList<QtTimePropertyManager *> timePropertyManagers = qFindChildren<QtTimePropertyManager *>(manager); + QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); QListIterator<QtTimePropertyManager *> itTime(timePropertyManagers); while (itTime.hasNext()) d_ptr->m_timeEditFactory->addPropertyManager(itTime.next()); - QList<QtDateTimePropertyManager *> dateTimePropertyManagers = qFindChildren<QtDateTimePropertyManager *>(manager); + QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); QListIterator<QtDateTimePropertyManager *> itDateTime(dateTimePropertyManagers); while (itDateTime.hasNext()) d_ptr->m_dateTimeEditFactory->addPropertyManager(itDateTime.next()); - QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = qFindChildren<QtKeySequencePropertyManager *>(manager); + QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); QListIterator<QtKeySequencePropertyManager *> itKeySequence(keySequencePropertyManagers); while (itKeySequence.hasNext()) d_ptr->m_keySequenceEditorFactory->addPropertyManager(itKeySequence.next()); - QList<QtCharPropertyManager *> charPropertyManagers = qFindChildren<QtCharPropertyManager *>(manager); + QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); QListIterator<QtCharPropertyManager *> itChar(charPropertyManagers); while (itChar.hasNext()) d_ptr->m_charEditorFactory->addPropertyManager(itChar.next()); - QList<QtLocalePropertyManager *> localePropertyManagers = qFindChildren<QtLocalePropertyManager *>(manager); + QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); QListIterator<QtLocalePropertyManager *> itLocale(localePropertyManagers); while (itLocale.hasNext()) d_ptr->m_comboBoxFactory->addPropertyManager(itLocale.next()->subEnumPropertyManager()); - QList<QtPointPropertyManager *> pointPropertyManagers = qFindChildren<QtPointPropertyManager *>(manager); + QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); QListIterator<QtPointPropertyManager *> itPoint(pointPropertyManagers); while (itPoint.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itPoint.next()->subIntPropertyManager()); - QList<QtPointFPropertyManager *> pointFPropertyManagers = qFindChildren<QtPointFPropertyManager *>(manager); + QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); QListIterator<QtPointFPropertyManager *> itPointF(pointFPropertyManagers); while (itPointF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itPointF.next()->subDoublePropertyManager()); - QList<QtSizePropertyManager *> sizePropertyManagers = qFindChildren<QtSizePropertyManager *>(manager); + QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); QListIterator<QtSizePropertyManager *> itSize(sizePropertyManagers); while (itSize.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itSize.next()->subIntPropertyManager()); - QList<QtSizeFPropertyManager *> sizeFPropertyManagers = qFindChildren<QtSizeFPropertyManager *>(manager); + QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); QListIterator<QtSizeFPropertyManager *> itSizeF(sizeFPropertyManagers); while (itSizeF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itSizeF.next()->subDoublePropertyManager()); - QList<QtRectPropertyManager *> rectPropertyManagers = qFindChildren<QtRectPropertyManager *>(manager); + QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); QListIterator<QtRectPropertyManager *> itRect(rectPropertyManagers); while (itRect.hasNext()) d_ptr->m_spinBoxFactory->addPropertyManager(itRect.next()->subIntPropertyManager()); - QList<QtRectFPropertyManager *> rectFPropertyManagers = qFindChildren<QtRectFPropertyManager *>(manager); + QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); QListIterator<QtRectFPropertyManager *> itRectF(rectFPropertyManagers); while (itRectF.hasNext()) d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itRectF.next()->subDoublePropertyManager()); - QList<QtColorPropertyManager *> colorPropertyManagers = qFindChildren<QtColorPropertyManager *>(manager); + QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); QListIterator<QtColorPropertyManager *> itColor(colorPropertyManagers); while (itColor.hasNext()) { QtColorPropertyManager *manager = itColor.next(); @@ -2085,12 +2085,12 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager()); } - QList<QtEnumPropertyManager *> enumPropertyManagers = qFindChildren<QtEnumPropertyManager *>(manager); + QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); QListIterator<QtEnumPropertyManager *> itEnum(enumPropertyManagers); while (itEnum.hasNext()) d_ptr->m_comboBoxFactory->addPropertyManager(itEnum.next()); - QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = qFindChildren<QtSizePolicyPropertyManager *>(manager); + QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); QListIterator<QtSizePolicyPropertyManager *> itSizePolicy(sizePolicyPropertyManagers); while (itSizePolicy.hasNext()) { QtSizePolicyPropertyManager *manager = itSizePolicy.next(); @@ -2098,7 +2098,7 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager()); } - QList<QtFontPropertyManager *> fontPropertyManagers = qFindChildren<QtFontPropertyManager *>(manager); + QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); QListIterator<QtFontPropertyManager *> itFont(fontPropertyManagers); while (itFont.hasNext()) { QtFontPropertyManager *manager = itFont.next(); @@ -2108,12 +2108,12 @@ void QtVariantEditorFactory::connectPropertyManager(QtVariantPropertyManager *ma d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager()); } - QList<QtCursorPropertyManager *> cursorPropertyManagers = qFindChildren<QtCursorPropertyManager *>(manager); + QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); QListIterator<QtCursorPropertyManager *> itCursor(cursorPropertyManagers); while (itCursor.hasNext()) d_ptr->m_cursorEditorFactory->addPropertyManager(itCursor.next()); - QList<QtFlagPropertyManager *> flagPropertyManagers = qFindChildren<QtFlagPropertyManager *>(manager); + QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); QListIterator<QtFlagPropertyManager *> itFlag(flagPropertyManagers); while (itFlag.hasNext()) d_ptr->m_checkBoxFactory->addPropertyManager(itFlag.next()->subBoolPropertyManager()); @@ -2141,87 +2141,87 @@ QWidget *QtVariantEditorFactory::createEditor(QtVariantPropertyManager *manager, */ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager *manager) { - QList<QtIntPropertyManager *> intPropertyManagers = qFindChildren<QtIntPropertyManager *>(manager); + QList<QtIntPropertyManager *> intPropertyManagers = manager->findChildren<QtIntPropertyManager *>(); QListIterator<QtIntPropertyManager *> itInt(intPropertyManagers); while (itInt.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itInt.next()); - QList<QtDoublePropertyManager *> doublePropertyManagers = qFindChildren<QtDoublePropertyManager *>(manager); + QList<QtDoublePropertyManager *> doublePropertyManagers = manager->findChildren<QtDoublePropertyManager *>(); QListIterator<QtDoublePropertyManager *> itDouble(doublePropertyManagers); while (itDouble.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itDouble.next()); - QList<QtBoolPropertyManager *> boolPropertyManagers = qFindChildren<QtBoolPropertyManager *>(manager); + QList<QtBoolPropertyManager *> boolPropertyManagers = manager->findChildren<QtBoolPropertyManager *>(); QListIterator<QtBoolPropertyManager *> itBool(boolPropertyManagers); while (itBool.hasNext()) d_ptr->m_checkBoxFactory->removePropertyManager(itBool.next()); - QList<QtStringPropertyManager *> stringPropertyManagers = qFindChildren<QtStringPropertyManager *>(manager); + QList<QtStringPropertyManager *> stringPropertyManagers = manager->findChildren<QtStringPropertyManager *>(); QListIterator<QtStringPropertyManager *> itString(stringPropertyManagers); while (itString.hasNext()) d_ptr->m_lineEditFactory->removePropertyManager(itString.next()); - QList<QtDatePropertyManager *> datePropertyManagers = qFindChildren<QtDatePropertyManager *>(manager); + QList<QtDatePropertyManager *> datePropertyManagers = manager->findChildren<QtDatePropertyManager *>(); QListIterator<QtDatePropertyManager *> itDate(datePropertyManagers); while (itDate.hasNext()) d_ptr->m_dateEditFactory->removePropertyManager(itDate.next()); - QList<QtTimePropertyManager *> timePropertyManagers = qFindChildren<QtTimePropertyManager *>(manager); + QList<QtTimePropertyManager *> timePropertyManagers = manager->findChildren<QtTimePropertyManager *>(); QListIterator<QtTimePropertyManager *> itTime(timePropertyManagers); while (itTime.hasNext()) d_ptr->m_timeEditFactory->removePropertyManager(itTime.next()); - QList<QtDateTimePropertyManager *> dateTimePropertyManagers = qFindChildren<QtDateTimePropertyManager *>(manager); + QList<QtDateTimePropertyManager *> dateTimePropertyManagers = manager->findChildren<QtDateTimePropertyManager *>(); QListIterator<QtDateTimePropertyManager *> itDateTime(dateTimePropertyManagers); while (itDateTime.hasNext()) d_ptr->m_dateTimeEditFactory->removePropertyManager(itDateTime.next()); - QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = qFindChildren<QtKeySequencePropertyManager *>(manager); + QList<QtKeySequencePropertyManager *> keySequencePropertyManagers = manager->findChildren<QtKeySequencePropertyManager *>(); QListIterator<QtKeySequencePropertyManager *> itKeySequence(keySequencePropertyManagers); while (itKeySequence.hasNext()) d_ptr->m_keySequenceEditorFactory->removePropertyManager(itKeySequence.next()); - QList<QtCharPropertyManager *> charPropertyManagers = qFindChildren<QtCharPropertyManager *>(manager); + QList<QtCharPropertyManager *> charPropertyManagers = manager->findChildren<QtCharPropertyManager *>(); QListIterator<QtCharPropertyManager *> itChar(charPropertyManagers); while (itChar.hasNext()) d_ptr->m_charEditorFactory->removePropertyManager(itChar.next()); - QList<QtLocalePropertyManager *> localePropertyManagers = qFindChildren<QtLocalePropertyManager *>(manager); + QList<QtLocalePropertyManager *> localePropertyManagers = manager->findChildren<QtLocalePropertyManager *>(); QListIterator<QtLocalePropertyManager *> itLocale(localePropertyManagers); while (itLocale.hasNext()) d_ptr->m_comboBoxFactory->removePropertyManager(itLocale.next()->subEnumPropertyManager()); - QList<QtPointPropertyManager *> pointPropertyManagers = qFindChildren<QtPointPropertyManager *>(manager); + QList<QtPointPropertyManager *> pointPropertyManagers = manager->findChildren<QtPointPropertyManager *>(); QListIterator<QtPointPropertyManager *> itPoint(pointPropertyManagers); while (itPoint.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itPoint.next()->subIntPropertyManager()); - QList<QtPointFPropertyManager *> pointFPropertyManagers = qFindChildren<QtPointFPropertyManager *>(manager); + QList<QtPointFPropertyManager *> pointFPropertyManagers = manager->findChildren<QtPointFPropertyManager *>(); QListIterator<QtPointFPropertyManager *> itPointF(pointFPropertyManagers); while (itPointF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itPointF.next()->subDoublePropertyManager()); - QList<QtSizePropertyManager *> sizePropertyManagers = qFindChildren<QtSizePropertyManager *>(manager); + QList<QtSizePropertyManager *> sizePropertyManagers = manager->findChildren<QtSizePropertyManager *>(); QListIterator<QtSizePropertyManager *> itSize(sizePropertyManagers); while (itSize.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itSize.next()->subIntPropertyManager()); - QList<QtSizeFPropertyManager *> sizeFPropertyManagers = qFindChildren<QtSizeFPropertyManager *>(manager); + QList<QtSizeFPropertyManager *> sizeFPropertyManagers = manager->findChildren<QtSizeFPropertyManager *>(); QListIterator<QtSizeFPropertyManager *> itSizeF(sizeFPropertyManagers); while (itSizeF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itSizeF.next()->subDoublePropertyManager()); - QList<QtRectPropertyManager *> rectPropertyManagers = qFindChildren<QtRectPropertyManager *>(manager); + QList<QtRectPropertyManager *> rectPropertyManagers = manager->findChildren<QtRectPropertyManager *>(); QListIterator<QtRectPropertyManager *> itRect(rectPropertyManagers); while (itRect.hasNext()) d_ptr->m_spinBoxFactory->removePropertyManager(itRect.next()->subIntPropertyManager()); - QList<QtRectFPropertyManager *> rectFPropertyManagers = qFindChildren<QtRectFPropertyManager *>(manager); + QList<QtRectFPropertyManager *> rectFPropertyManagers = manager->findChildren<QtRectFPropertyManager *>(); QListIterator<QtRectFPropertyManager *> itRectF(rectFPropertyManagers); while (itRectF.hasNext()) d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itRectF.next()->subDoublePropertyManager()); - QList<QtColorPropertyManager *> colorPropertyManagers = qFindChildren<QtColorPropertyManager *>(manager); + QList<QtColorPropertyManager *> colorPropertyManagers = manager->findChildren<QtColorPropertyManager *>(); QListIterator<QtColorPropertyManager *> itColor(colorPropertyManagers); while (itColor.hasNext()) { QtColorPropertyManager *manager = itColor.next(); @@ -2229,12 +2229,12 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager()); } - QList<QtEnumPropertyManager *> enumPropertyManagers = qFindChildren<QtEnumPropertyManager *>(manager); + QList<QtEnumPropertyManager *> enumPropertyManagers = manager->findChildren<QtEnumPropertyManager *>(); QListIterator<QtEnumPropertyManager *> itEnum(enumPropertyManagers); while (itEnum.hasNext()) d_ptr->m_comboBoxFactory->removePropertyManager(itEnum.next()); - QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = qFindChildren<QtSizePolicyPropertyManager *>(manager); + QList<QtSizePolicyPropertyManager *> sizePolicyPropertyManagers = manager->findChildren<QtSizePolicyPropertyManager *>(); QListIterator<QtSizePolicyPropertyManager *> itSizePolicy(sizePolicyPropertyManagers); while (itSizePolicy.hasNext()) { QtSizePolicyPropertyManager *manager = itSizePolicy.next(); @@ -2242,7 +2242,7 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager()); } - QList<QtFontPropertyManager *> fontPropertyManagers = qFindChildren<QtFontPropertyManager *>(manager); + QList<QtFontPropertyManager *> fontPropertyManagers = manager->findChildren<QtFontPropertyManager *>(); QListIterator<QtFontPropertyManager *> itFont(fontPropertyManagers); while (itFont.hasNext()) { QtFontPropertyManager *manager = itFont.next(); @@ -2252,12 +2252,12 @@ void QtVariantEditorFactory::disconnectPropertyManager(QtVariantPropertyManager d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager()); } - QList<QtCursorPropertyManager *> cursorPropertyManagers = qFindChildren<QtCursorPropertyManager *>(manager); + QList<QtCursorPropertyManager *> cursorPropertyManagers = manager->findChildren<QtCursorPropertyManager *>(); QListIterator<QtCursorPropertyManager *> itCursor(cursorPropertyManagers); while (itCursor.hasNext()) d_ptr->m_cursorEditorFactory->removePropertyManager(itCursor.next()); - QList<QtFlagPropertyManager *> flagPropertyManagers = qFindChildren<QtFlagPropertyManager *>(manager); + QList<QtFlagPropertyManager *> flagPropertyManagers = manager->findChildren<QtFlagPropertyManager *>(); QListIterator<QtFlagPropertyManager *> itFlag(flagPropertyManagers); while (itFlag.hasNext()) d_ptr->m_checkBoxFactory->removePropertyManager(itFlag.next()->subBoolPropertyManager()); 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()); |