diff options
77 files changed, 573 insertions, 454 deletions
diff --git a/.qmake.conf b/.qmake.conf index 9450b8383..33a2710f6 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.6.1 +MODULE_VERSION = 5.7.0 diff --git a/examples/uitools/multipleinheritance/main.cpp b/examples/uitools/multipleinheritance/main.cpp index c5febe60e..43b865fcd 100644 --- a/examples/uitools/multipleinheritance/main.cpp +++ b/examples/uitools/multipleinheritance/main.cpp @@ -46,11 +46,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); CalculatorForm calculator; -#if defined(Q_OS_SYMBIAN) - calculator.showMaximized(); -#else calculator.show(); -#endif return app.exec(); } //! [0] diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp index 3414102dc..74e4f8f1f 100644 --- a/src/androiddeployqt/main.cpp +++ b/src/androiddeployqt/main.cpp @@ -100,8 +100,6 @@ struct Options , generateAssetsFileList(true) , build(true) , gradle(false) - , minimumAndroidVersion(9) - , targetAndroidVersion(10) , deploymentMechanism(Bundled) , releasePackage(false) , digestAlg(QLatin1String("SHA1")) @@ -167,8 +165,6 @@ struct Options QString ndkHost; // Package information - int minimumAndroidVersion; - int targetAndroidVersion; DeploymentMechanism deploymentMechanism; QString packageName; QStringList extraLibs; @@ -921,7 +917,6 @@ void cleanAndroidFiles(const Options &options) cleanTopFolders(options, options.androidSourceDirectory, options.outputDirectory); cleanTopFolders(options, options.qtInstallDirectory + QLatin1String("/src/android/templates"), options.outputDirectory); - cleanTopFolders(options, options.qtInstallDirectory + QLatin1String("/src/android/java"), options.outputDirectory + QLatin1String("__qt5__android__files__")); } bool copyAndroidTemplate(const Options &options, const QString &androidTemplate, const QString &outDirPrefix = QString()) @@ -970,8 +965,10 @@ bool copyAndroidTemplate(const Options &options) if (!copyAndroidTemplate(options, QLatin1String("/src/android/templates"))) return false; - return copyAndroidTemplate(options, QLatin1String("/src/android/java"), - options.gradle ? QLatin1String("/__qt5__android__files__/") : QString()); + if (options.gradle) + return true; + + return copyAndroidTemplate(options, QLatin1String("/src/android/java")); } bool copyAndroidSources(const Options &options) @@ -1345,10 +1342,10 @@ bool updateAndroidManifest(Options &options) options.packageName = reader.attributes().value(QLatin1String("package")).toString(); } else if (reader.name() == QLatin1String("uses-sdk")) { if (reader.attributes().hasAttribute(QLatin1String("android:minSdkVersion"))) - options.minimumAndroidVersion = reader.attributes().value(QLatin1String("android:minSdkVersion")).toInt(); - - if (reader.attributes().hasAttribute(QLatin1String("android:targetSdkVersion"))) - options.targetAndroidVersion = reader.attributes().value(QLatin1String("android:targetSdkVersion")).toInt(); + if (reader.attributes().value(QLatin1String("android:minSdkVersion")).toInt() < 16) { + fprintf(stderr, "Invalid minSdkVersion version, minSdkVersion must be >= 16\n"); + return false; + } } else if ((reader.name() == QLatin1String("application") || reader.name() == QLatin1String("activity")) && reader.attributes().hasAttribute(QLatin1String("android:label")) && @@ -1373,70 +1370,6 @@ bool updateAndroidManifest(Options &options) return true; } -bool updateJavaFiles(const Options &options) -{ - if (options.verbose) - fprintf(stdout, " -- /src/org/qtproject/qt5/android/bindings/QtActivity.java\n"); - - - QString fileName(options.outputDirectory + - (options.gradle ? QLatin1String("/__qt5__android__files__") - : QString()) + - QLatin1String("/src/org/qtproject/qt5/android/bindings/QtActivity.java")); - - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) { - fprintf(stderr, "Cannot open %s.\n", qPrintable(fileName)); - return false; - } - - QByteArray contents; - - while (!file.atEnd()) { - QByteArray line = file.readLine(); - if (line.startsWith("//@ANDROID-")) { - bool ok; - int requiredSdkVersion = line.mid(sizeof("//@ANDROID-") - 1).trimmed().toInt(&ok); - if (requiredSdkVersion <= options.minimumAndroidVersion) - contents += line; - - if (ok) { - while (!file.atEnd()) { - line = file.readLine(); - if (requiredSdkVersion <= options.minimumAndroidVersion) - contents += line; - - if (line.startsWith(QByteArray("//@ANDROID-") + QByteArray::number(requiredSdkVersion))) - break; - } - - if (!line.startsWith(QByteArray("//@ANDROID-") + QByteArray::number(requiredSdkVersion))) { - fprintf(stderr, "Mismatched tag ANDROID-%d in %s\n", requiredSdkVersion, qPrintable(fileName)); - return false; - } - } else { - fprintf(stderr, "Warning: Misformatted tag in %s: %s\n", qPrintable(fileName), line.constData()); - } - } else { - contents += line; - } - } - - file.close(); - - if (!file.open(QIODevice::WriteOnly)) { - fprintf(stderr, "Can't open %s for writing.\n", qPrintable(fileName)); - return false; - } - - if (file.write(contents) < contents.size()) { - fprintf(stderr, "Failed to write contents to %s.\n", qPrintable(fileName)); - return false; - } - - return true; -} - bool updateAndroidFiles(Options &options) { if (options.verbose) @@ -1448,9 +1381,6 @@ bool updateAndroidFiles(Options &options) if (!updateAndroidManifest(options)) return false; - if (!updateJavaFiles(options)) - return false; - return true; } @@ -2440,7 +2370,7 @@ bool buildGradleProject(const Options &options) QString gradlePropertiesPath = options.outputDirectory + QLatin1String("gradle.properties"); GradleProperties gradleProperties = readGradleProperties(gradlePropertiesPath); gradleProperties["buildDir"] = "build"; - gradleProperties["qt5AndroidDir"] = "__qt5__android__files__"; + gradleProperties["qt5AndroidDir"] = (options.qtInstallDirectory + QLatin1String("/src/android/java")).toUtf8(); gradleProperties["androidCompileSdkVersion"] = options.androidPlatform.split(QLatin1Char('-')).last().toLocal8Bit(); if (gradleProperties["androidBuildToolsVersion"].isEmpty()) gradleProperties["androidBuildToolsVersion"] = options.sdkBuildToolsVersion.toLocal8Bit(); diff --git a/src/assistant/assistant/assistant.ico b/src/assistant/assistant/assistant.ico Binary files differindex f34505532..b821faaf2 100644 --- a/src/assistant/assistant/assistant.ico +++ b/src/assistant/assistant/assistant.ico diff --git a/src/assistant/assistant/helpenginewrapper.cpp b/src/assistant/assistant/helpenginewrapper.cpp index 619aa8881..390499390 100644 --- a/src/assistant/assistant/helpenginewrapper.cpp +++ b/src/assistant/assistant/helpenginewrapper.cpp @@ -221,6 +221,12 @@ const QStringList HelpEngineWrapper::registeredDocumentations() const return d->m_helpEngine->registeredDocumentations(); } +QString HelpEngineWrapper::documentationFileName(const QString &namespaceName) const +{ + TRACE_OBJ + return d->m_helpEngine->documentationFileName(namespaceName); +} + const QString HelpEngineWrapper::collectionFile() const { TRACE_OBJ diff --git a/src/assistant/assistant/helpenginewrapper.h b/src/assistant/assistant/helpenginewrapper.h index 735e49693..9a83d181d 100644 --- a/src/assistant/assistant/helpenginewrapper.h +++ b/src/assistant/assistant/helpenginewrapper.h @@ -77,6 +77,7 @@ public: QHelpIndexWidget *indexWidget(); bool setupData(); const QStringList registeredDocumentations() const; + QString documentationFileName(const QString &namespaceName) const; const QString collectionFile() const; bool registerDocumentation(const QString &docFile); bool unregisterDocumentation(const QString &namespaceName); diff --git a/src/assistant/assistant/helpviewer.cpp b/src/assistant/assistant/helpviewer.cpp index 7002e4af4..fdf1be4c0 100644 --- a/src/assistant/assistant/helpviewer.cpp +++ b/src/assistant/assistant/helpviewer.cpp @@ -116,10 +116,10 @@ bool HelpViewer::isLocalUrl(const QUrl &url) || scheme == QLatin1String("about"); } -bool HelpViewer::canOpenPage(const QString &url) +bool HelpViewer::canOpenPage(const QString &path) { TRACE_OBJ - return !mimeFromUrl(url).isEmpty(); + return !mimeFromUrl(QUrl::fromLocalFile(path)).isEmpty(); } QString HelpViewer::mimeFromUrl(const QUrl &url) @@ -147,7 +147,7 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url) if (!resolvedUrl.isValid()) return false; - const QString& path = resolvedUrl.path(); + const QString& path = resolvedUrl.toLocalFile(); if (!canOpenPage(path)) { QTemporaryFile tmpTmpFile; if (!tmpTmpFile.open()) diff --git a/src/assistant/assistant/images/assistant-128.png b/src/assistant/assistant/images/assistant-128.png Binary files differindex 7b9f47477..a5d8fea1a 100644 --- a/src/assistant/assistant/images/assistant-128.png +++ b/src/assistant/assistant/images/assistant-128.png diff --git a/src/assistant/assistant/images/assistant.png b/src/assistant/assistant/images/assistant.png Binary files differindex 2d7c47744..e6d7312a8 100644 --- a/src/assistant/assistant/images/assistant.png +++ b/src/assistant/assistant/images/assistant.png diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index 48f9d948f..999179fa1 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -197,10 +197,13 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) appIcon.addPixmap(pix); } while (reader.jumpToNextImage()); qApp->setWindowIcon(appIcon); - } else { + } +#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN) + else { QIcon appIcon(QLatin1String(":/qt-project.org/assistant/images/assistant-128.png")); qApp->setWindowIcon(appIcon); } +#endif QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar")); toolBar->setObjectName(QLatin1String("Bookmark Toolbar")); diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp index 2e68d41ec..47a1f3beb 100644 --- a/src/assistant/assistant/preferencesdialog.cpp +++ b/src/assistant/assistant/preferencesdialog.cpp @@ -39,8 +39,11 @@ #include "openpagesmanager.h" #include "tracer.h" +#include <QtCore/QAbstractListModel> #include <QtCore/QtAlgorithms> #include <QtCore/QFileSystemWatcher> +#include <QtCore/QSortFilterProxyModel> +#include <QtCore/QVector> #include <QtWidgets/QDesktopWidget> #include <QtWidgets/QFileDialog> @@ -51,25 +54,114 @@ #include <QtHelp/QHelpEngineCore> +#include <algorithm> + QT_BEGIN_NAMESPACE +struct RegisteredDocEntry +{ + QString nameSpace; + QString fileName; +}; + +typedef QVector<RegisteredDocEntry> RegisteredDocEntries; + +class RegisteredDocsModel : public QAbstractListModel { +public: + + explicit RegisteredDocsModel(const RegisteredDocEntries &e = RegisteredDocEntries(), QObject *parent = nullptr) + : QAbstractListModel(parent), m_docEntries(e) {} + + int rowCount(const QModelIndex & = QModelIndex()) const override { return m_docEntries.size(); } + QVariant data(const QModelIndex &index, int role) const override; + + bool contains(const QString &nameSpace) const + { + return m_docEntries.cend() != + std::find_if(m_docEntries.cbegin(), m_docEntries.cend(), + [nameSpace] (const RegisteredDocEntry &e) { return e.nameSpace == nameSpace; }); + } + + void append(const RegisteredDocEntry &e); + + const RegisteredDocEntries &docEntries() const { return m_docEntries; } + void setDocEntries(const RegisteredDocEntries &); + +private: + RegisteredDocEntries m_docEntries; +}; + +QVariant RegisteredDocsModel::data(const QModelIndex &index, int role) const +{ + QVariant result; + const int row = index.row(); + if (index.isValid() && row < m_docEntries.size()) { + switch (role) { + case Qt::DisplayRole: + result = QVariant(m_docEntries.at(row).nameSpace); + break; + case Qt::ToolTipRole: + result = QVariant(QDir::toNativeSeparators(m_docEntries.at(row).fileName)); + break; + default: + break; + } + } + return result; +} + +void RegisteredDocsModel::append(const RegisteredDocEntry &e) +{ + beginInsertRows(QModelIndex(), m_docEntries.size(), m_docEntries.size()); + m_docEntries.append(e); + endInsertRows(); +} + +void RegisteredDocsModel::setDocEntries(const RegisteredDocEntries &e) +{ + beginResetModel(); + m_docEntries = e; + endResetModel(); +} + +static RegisteredDocEntries registeredDocEntries(const HelpEngineWrapper &wrapper) +{ + RegisteredDocEntries result; + const QStringList nameSpaces = wrapper.registeredDocumentations(); + result.reserve(nameSpaces.size()); + foreach (const QString &nameSpace, nameSpaces) { + RegisteredDocEntry entry; + entry.nameSpace = nameSpace; + entry.fileName = wrapper.documentationFileName(nameSpace); + result.append(entry); + } + return result; +} + PreferencesDialog::PreferencesDialog(QWidget *parent) : QDialog(parent) , m_appFontChanged(false) , m_browserFontChanged(false) , helpEngine(HelpEngineWrapper::instance()) + , m_hideFiltersTab(!helpEngine.filterFunctionalityEnabled()) + , m_hideDocsTab(!helpEngine.documentationManagerEnabled()) { TRACE_OBJ m_ui.setupUi(this); + m_registeredDocsModel = + new RegisteredDocsModel(m_hideDocsTab ? RegisteredDocEntries() : registeredDocEntries(helpEngine)); + m_registereredDocsFilterModel = new QSortFilterProxyModel(m_ui.registeredDocsListView); + m_registereredDocsFilterModel->setSourceModel(m_registeredDocsModel); + m_ui.registeredDocsListView->setModel(m_registereredDocsFilterModel); + connect(m_ui.registeredDocsFilterLineEdit, &QLineEdit::textChanged, + m_registereredDocsFilterModel, &QSortFilterProxyModel::setFilterFixedString); + connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(applyChanges())); connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); - m_hideFiltersTab = !helpEngine.filterFunctionalityEnabled(); - m_hideDocsTab = !helpEngine.documentationManagerEnabled(); - if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); m_ui.attributeWidget->setRootIsDecorated(false); @@ -97,8 +189,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) connect(m_ui.docRemoveButton, SIGNAL(clicked()), this, SLOT(removeDocumentation())); - m_docsBackup = helpEngine.registeredDocumentations(); - m_ui.registeredDocsListWidget->addItems(m_docsBackup); + m_docsBackup.reserve(m_registeredDocsModel->rowCount()); + foreach (const RegisteredDocEntry &e, m_registeredDocsModel->docEntries()) + m_docsBackup.append(e.nameSpace); } else { m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.docsTab)); } @@ -254,14 +347,16 @@ void PreferencesDialog::addDocumentationLocal() continue; } - if (m_ui.registeredDocsListWidget->findItems(nameSpace, - Qt::MatchFixedString).count()) { + if (m_registeredDocsModel->contains(nameSpace)) { alreadyRegistered.append(nameSpace); continue; } if (helpEngine.registerDocumentation(fileName)) { - m_ui.registeredDocsListWidget->addItem(nameSpace); + RegisteredDocEntry entry; + entry.nameSpace = nameSpace; + entry.fileName = fileName; + m_registeredDocsModel->append(entry); m_regDocs.append(nameSpace); m_unregDocs.removeAll(nameSpace); } @@ -291,14 +386,28 @@ void PreferencesDialog::addDocumentationLocal() updateFilterPage(); } +QList<int> PreferencesDialog::currentRegisteredDocsSelection() const +{ + QList<int> result; + foreach (const QModelIndex &index, m_ui.registeredDocsListView->selectionModel()->selectedRows()) + result.append(m_registereredDocsFilterModel->mapToSource(index).row()); + return result; +} + void PreferencesDialog::removeDocumentation() { TRACE_OBJ + const QList<int> currentSelection = currentRegisteredDocsSelection(); + if (currentSelection.isEmpty()) + return; + + RegisteredDocEntries entries = m_registeredDocsModel->docEntries(); + bool foundBefore = false; - QList<QListWidgetItem*> l = m_ui.registeredDocsListWidget->selectedItems(); - foreach (QListWidgetItem* item, l) { - const QString& ns = item->text(); + for (int i = currentSelection.size() - 1; i >= 0; --i) { + const int row = currentSelection.at(i); + const QString& ns = entries.at(row).nameSpace; if (!foundBefore && OpenPagesManager::instance()->pagesOpenForNamespace(ns)) { if (0 == QMessageBox::information(this, tr("Remove Documentation"), tr("Some documents currently opened in Assistant reference the " @@ -309,13 +418,15 @@ void PreferencesDialog::removeDocumentation() } m_unregDocs.append(ns); - delete m_ui.registeredDocsListWidget->takeItem( - m_ui.registeredDocsListWidget->row(item)); + entries.removeAt(row); } - if (m_ui.registeredDocsListWidget->count()) { - m_ui.registeredDocsListWidget->setCurrentRow(0, - QItemSelectionModel::ClearAndSelect); + m_registeredDocsModel->setDocEntries(entries); + + if (m_registereredDocsFilterModel->rowCount()) { + const QModelIndex first = m_registereredDocsFilterModel->index(0, 0); + m_ui.registeredDocsListView->selectionModel()->setCurrentIndex(first, + QItemSelectionModel::ClearAndSelect); } } diff --git a/src/assistant/assistant/preferencesdialog.h b/src/assistant/assistant/preferencesdialog.h index 79fe9a18c..cf7c0258f 100644 --- a/src/assistant/assistant/preferencesdialog.h +++ b/src/assistant/assistant/preferencesdialog.h @@ -41,7 +41,9 @@ QT_BEGIN_NAMESPACE class FontPanel; class HelpEngineWrapper; +class RegisteredDocsModel; class QFileSystemWatcher; +class QSortFilterProxyModel; class PreferencesDialog : public QDialog { @@ -79,14 +81,15 @@ private: void updateFilterPage(); void updateFontSettingsPage(); void updateOptionsPage(); + QList<int> currentRegisteredDocsSelection() const; Ui::PreferencesDialogClass m_ui; - bool m_hideFiltersTab; - bool m_hideDocsTab; QMap<QString, QStringList> m_filterMapBackup; QMap<QString, QStringList> m_filterMap; QStringList m_removedFilters; QStringList m_docsBackup; + RegisteredDocsModel *m_registeredDocsModel; + QSortFilterProxyModel *m_registereredDocsFilterModel; QStringList m_regDocs; QStringList m_unregDocs; FontPanel *m_appFontPanel; @@ -94,6 +97,8 @@ private: bool m_appFontChanged; bool m_browserFontChanged; HelpEngineWrapper &helpEngine; + const bool m_hideFiltersTab; + const bool m_hideDocsTab; bool m_showTabs; }; diff --git a/src/assistant/assistant/preferencesdialog.ui b/src/assistant/assistant/preferencesdialog.ui index 1c6833ad9..ebefa2458 100644 --- a/src/assistant/assistant/preferencesdialog.ui +++ b/src/assistant/assistant/preferencesdialog.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>375</width> - <height>275</height> + <height>342</height> </rect> </property> <property name="windowTitle"> @@ -119,7 +119,7 @@ <attribute name="title"> <string>Documentation</string> </attribute> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <widget class="QLabel" name="label_3"> <property name="text"> @@ -128,28 +128,33 @@ </widget> </item> <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> - </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> - <widget class="QListWidget" name="registeredDocsListWidget"> - <property name="selectionMode"> - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QLineEdit" name="registeredDocsFilterLineEdit"> + <property name="placeholderText"> + <string><Filter></string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QListView" name="registeredDocsListView"> + <property name="selectionMode"> + <enum>QAbstractItemView::ExtendedSelection</enum> + </property> + </widget> + </item> + </layout> </item> <item> <layout class="QVBoxLayout"> <property name="spacing"> <number>6</number> </property> - <property name="margin"> - <number>0</number> - </property> <item> <widget class="QPushButton" name="docAddButton"> <property name="text"> @@ -347,9 +352,6 @@ <property name="spacing"> <number>6</number> </property> - <property name="margin"> - <number>0</number> - </property> <item> <spacer> <property name="orientation"> diff --git a/src/designer/data/generate_impl.xsl b/src/designer/data/generate_impl.xsl index 4f1c3955f..ba4311d8b 100644 --- a/src/designer/data/generate_impl.xsl +++ b/src/designer/data/generate_impl.xsl @@ -270,7 +270,8 @@ <xsl:if test="$node/xs:attribute"> <xsl:text>&endl;</xsl:text> - <xsl:text> foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {&endl;</xsl:text> + <xsl:text> const QXmlStreamAttributes attributes = reader.attributes();&endl;</xsl:text> + <xsl:text> for (const QXmlStreamAttribute &attribute : attributes) {&endl;</xsl:text> <xsl:text> QStringRef name = attribute.name();&endl;</xsl:text> <xsl:for-each select="$node/xs:attribute"> diff --git a/src/designer/src/components/formeditor/formwindow.cpp b/src/designer/src/components/formeditor/formwindow.cpp index 208dd007a..630a5263a 100644 --- a/src/designer/src/components/formeditor/formwindow.cpp +++ b/src/designer/src/components/formeditor/formwindow.cpp @@ -184,10 +184,8 @@ FormWindow::Selection::~Selection() void FormWindow::Selection::clear() { if (!m_usedSelections.empty()) { - const SelectionHash::iterator mend = m_usedSelections.end(); - for (SelectionHash::iterator it = m_usedSelections.begin(); it != mend; ++it) { + for (auto it = m_usedSelections.begin(), mend = m_usedSelections.end(); it != mend; ++it) it.value()->setWidget(0); - } m_usedSelections.clear(); } } @@ -208,8 +206,7 @@ WidgetSelection *FormWindow::Selection::addWidget(FormWindow* fw, QWidget *w) return rc; } // find a free one in the pool - const SelectionPool::iterator pend = m_selectionPool.end(); - for (SelectionPool::iterator it = m_selectionPool.begin(); it != pend; ++it) { + for (auto it = m_selectionPool.constBegin(), pend = m_selectionPool.constEnd(); it != pend; ++it) { if (! (*it)->isUsed()) { rc = *it; break; @@ -249,10 +246,8 @@ void FormWindow::Selection::repaintSelection(QWidget *w) void FormWindow::Selection::repaintSelection() { - const SelectionHash::iterator mend = m_usedSelections.end(); - for (SelectionHash::iterator it = m_usedSelections.begin(); it != mend; ++it) { + for (auto it = m_usedSelections.begin(), mend = m_usedSelections.end(); it != mend; ++it) it.value()->update(); - } } bool FormWindow::Selection::isWidgetSelected(QWidget *w) const{ @@ -266,8 +261,7 @@ QWidgetList FormWindow::Selection::selectedWidgets() const void FormWindow::Selection::raiseList(const QWidgetList& l) { - const SelectionHash::iterator mend = m_usedSelections.end(); - for (SelectionHash::iterator it = m_usedSelections.begin(); it != mend; ++it) { + for (auto it = m_usedSelections.constBegin(), mend = m_usedSelections.constEnd(); it != mend; ++it) { WidgetSelection *w = it.value(); if (l.contains(w->widget())) w->show(); diff --git a/src/designer/src/components/formeditor/formwindowsettings.cpp b/src/designer/src/components/formeditor/formwindowsettings.cpp index d73fb2881..45589e313 100644 --- a/src/designer/src/components/formeditor/formwindowsettings.cpp +++ b/src/designer/src/components/formeditor/formwindowsettings.cpp @@ -116,7 +116,7 @@ void FormWindowData::fromFormWindow(FormWindowBase* fw) fw->layoutDefault(&defaultMargin, &defaultSpacing); QStyle *style = fw->formContainer()->style(); - layoutDefaultEnabled = defaultMargin != INT_MIN || defaultMargin != INT_MIN; + layoutDefaultEnabled = defaultMargin != INT_MIN || defaultSpacing != INT_MIN; if (defaultMargin == INT_MIN) defaultMargin = style->pixelMetric(QStyle::PM_DefaultChildMargin, 0); if (defaultSpacing == INT_MIN) diff --git a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp index 85f462f1d..9df5e702a 100644 --- a/src/designer/src/components/propertyeditor/designerpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/designerpropertymanager.cpp @@ -216,9 +216,7 @@ int TranslatablePropertyManager<PropertySheetValue>::setValue(QtVariantPropertyM int expectedTypeId, const QVariant &variantValue) { - typedef typename QMap<QtProperty *, PropertySheetValue>::iterator Iterator; - - const Iterator it = m_values.find(property); + const auto it = m_values.find(property); if (it == m_values.end()) return DesignerPropertyManager::NoMatch; if (variantValue.userType() != expectedTypeId) @@ -239,9 +237,7 @@ int TranslatablePropertyManager<PropertySheetValue>::setValue(QtVariantPropertyM template <class PropertySheetValue> bool TranslatablePropertyManager<PropertySheetValue>::value(const QtProperty *property, QVariant *rc) const { - typedef typename QMap<QtProperty *, PropertySheetValue>::const_iterator ConstIterator; - - ConstIterator it = m_values.constFind(const_cast<QtProperty *>(property)); + const auto it = m_values.constFind(const_cast<QtProperty *>(property)); if (it == m_values.constEnd()) return false; *rc = QVariant::fromValue(it.value()); @@ -2251,12 +2247,10 @@ void DesignerEditorFactory::disconnectPropertyManager(QtVariantPropertyManager * template <class EditorContainer, class Editor, class SetterParameter, class Value> static inline void applyToEditors(const EditorContainer &list, void (Editor::*setter)(SetterParameter), const Value &value) { - typedef typename EditorContainer::const_iterator ListIterator; if (list.empty()) { return; } - const ListIterator end = list.constEnd(); - for (ListIterator it = list.constBegin(); it != end; ++it) { + for (auto it = list.constBegin(), end = list.constEnd(); it != end; ++it) { Editor &editor = *(*it); (editor.*setter)(value); } @@ -2627,9 +2621,7 @@ template <class Editor> QtProperty *findPropertyForEditor(const QMap<Editor *, QtProperty *> &editorMap, const QObject *sender) { - typedef typename QMap<Editor *, QtProperty *>::const_iterator Iterator; - const Iterator cend = editorMap.constEnd(); - for (Iterator it = editorMap.constBegin(); it != cend; ++it) + for (auto it = editorMap.constBegin(), cend = editorMap.constEnd(); it != cend; ++it) if (it.key() == sender) return it.value(); return 0; diff --git a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp index f3f4f92cd..b7e995418 100644 --- a/src/designer/src/components/propertyeditor/fontpropertymanager.cpp +++ b/src/designer/src/components/propertyeditor/fontpropertymanager.cpp @@ -95,10 +95,9 @@ namespace qdesigner_internal { if (nm.empty()) return families; - const FontPropertyManager::NameMap::const_iterator ncend = nm.constEnd(); - const QStringList::iterator end = families.end(); - for (QStringList::iterator it = families.begin(); it != end; ++it) { - const FontPropertyManager::NameMap::const_iterator nit = nm.constFind(*it); + const auto ncend = nm.constEnd(); + for (auto it = families.begin(), end = families.end(); it != end; ++it) { + const auto nit = nm.constFind(*it); if (nit != ncend) *it = nit.value(); } diff --git a/src/designer/src/designer/designer.ico b/src/designer/src/designer/designer.ico Binary files differindex 495e8d162..d9cd33f60 100644 --- a/src/designer/src/designer/designer.ico +++ b/src/designer/src/designer/designer.ico diff --git a/src/designer/src/designer/images/designer.png b/src/designer/src/designer/images/designer.png Binary files differindex 15086cb70..9f8578b49 100644 --- a/src/designer/src/designer/images/designer.png +++ b/src/designer/src/designer/images/designer.png diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp index 5e6a3db9c..59c986e72 100644 --- a/src/designer/src/designer/qdesigner.cpp +++ b/src/designer/src/designer/qdesigner.cpp @@ -88,7 +88,7 @@ QDesigner::QDesigner(int &argc, char **argv) setApplicationName(QLatin1String(designerApplicationName)); QDesignerComponents::initializeResources(); -#ifndef Q_OS_MAC +#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN) setWindowIcon(QIcon(QStringLiteral(":/qt-project.org/designer/images/designer.png"))); #endif } @@ -150,7 +150,7 @@ QDesignerServer *QDesigner::server() const return m_server; } -static void showHelp(QCommandLineParser &parser, const QString errorMessage = QString()) +static void showHelp(QCommandLineParser &parser, const QString &errorMessage = QString()) { QString text; QTextStream str(&text); diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index a12bec729..fdbc0cd9a 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -71,7 +71,6 @@ #include <QtCore/QRegExp> #include <QtCore/QDebug> -#include <QtCore/QSignalMapper> #include <QtCore/QBuffer> Q_DECLARE_METATYPE(QAction*) @@ -125,8 +124,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, m_viewModeGroup(new QActionGroup(this)), m_iconViewAction(0), m_listViewAction(0), - m_filterWidget(0), - m_selectAssociatedWidgetsMapper(0) + m_filterWidget(0) { m_actionView->initialize(m_core); m_actionView->setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -780,16 +778,6 @@ void ActionEditor::slotPaste() void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) { - typedef void (QSignalMapper::*MapperQWidgetSignal)(QWidget *); - typedef void (QSignalMapper::*MapperVoidSlot)(); - - // set up signal mapper - if (!m_selectAssociatedWidgetsMapper) { - m_selectAssociatedWidgetsMapper = new QSignalMapper(this); - connect(m_selectAssociatedWidgetsMapper, static_cast<MapperQWidgetSignal>(&QSignalMapper::mapped), - this, &ActionEditor::slotSelectAssociatedWidget); - } - QMenu menu(this); menu.addAction(m_actionNew); menu.addSeparator(); @@ -803,10 +791,8 @@ void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) if (!associatedWidgets.empty()) { QMenu *associatedWidgetsSubMenu = menu.addMenu(tr("Used In")); foreach (QWidget *w, associatedWidgets) { - QAction *action = associatedWidgetsSubMenu->addAction(w->objectName()); - m_selectAssociatedWidgetsMapper->setMapping(action, w); - connect(action, &QAction::triggered, - m_selectAssociatedWidgetsMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + associatedWidgetsSubMenu->addAction(w->objectName(), + this, [this, w] { this->slotSelectAssociatedWidget(w); }); } } } diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h index e96a185ff..b9b563ebb 100644 --- a/src/designer/src/lib/shared/actioneditor_p.h +++ b/src/designer/src/lib/shared/actioneditor_p.h @@ -56,7 +56,6 @@ class QDesignerPropertyEditorInterface; class QDesignerSettingsInterface; class QMenu; class QActionGroup; -class QSignalMapper; class QItemSelection; class QListWidget; class QPushButton; @@ -156,7 +155,6 @@ private: QString m_filter; QWidget *m_filterWidget; - QSignalMapper *m_selectAssociatedWidgetsMapper; }; } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/iconselector.cpp b/src/designer/src/lib/shared/iconselector.cpp index 1e90ee284..357ddbf8b 100644 --- a/src/designer/src/lib/shared/iconselector.cpp +++ b/src/designer/src/lib/shared/iconselector.cpp @@ -46,7 +46,6 @@ #include <QtDesigner/QExtensionManager> #include <QtWidgets/QToolButton> -#include <QtCore/QSignalMapper> #include <QtWidgets/QComboBox> #include <QtWidgets/QAction> #include <QtWidgets/QDialogButtonBox> diff --git a/src/designer/src/lib/shared/morphmenu.cpp b/src/designer/src/lib/shared/morphmenu.cpp index 57ce92fa0..072791aa7 100644 --- a/src/designer/src/lib/shared/morphmenu.cpp +++ b/src/designer/src/lib/shared/morphmenu.cpp @@ -71,7 +71,6 @@ #include <QtCore/QStringList> #include <QtCore/QMap> #include <QtCore/QVariant> -#include <QtCore/QSignalMapper> #include <QtCore/QDebug> Q_DECLARE_METATYPE(QWidgetList) @@ -562,7 +561,6 @@ MorphMenu::MorphMenu(QObject *parent) : QObject(parent), m_subMenuAction(0), m_menu(0), - m_mapper(0), m_widget(0), m_formWindow(0) { @@ -587,9 +585,6 @@ void MorphMenu::slotMorph(const QString &newClassName) bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) { - typedef void (QSignalMapper::*MapperVoidSlot)(); - typedef void (QSignalMapper::*MapperStringSignal)(const QString &); - m_widget = 0; m_formWindow = 0; @@ -616,19 +611,15 @@ bool MorphMenu::populateMenu(QWidget *w, QDesignerFormWindowInterface *fw) m_subMenuAction = new QAction(tr("Morph into"), this); m_menu = new QMenu; m_subMenuAction->setMenu(m_menu); - m_mapper = new QSignalMapper(this); - connect(m_mapper, static_cast<MapperStringSignal>(&QSignalMapper::mapped), - this, &MorphMenu::slotMorph); } // Add actions const QStringList::const_iterator cend = c.constEnd(); for (QStringList::const_iterator it = c.constBegin(); it != cend; ++it) { if (*it != oldClassName) { - QAction *a = m_menu->addAction(*it); - m_mapper->setMapping (a, *it); - connect(a, &QAction::triggered, - m_mapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + const QString className = *it; + m_menu->addAction(className, + this, [this, className] { this->slotMorph(className); }); } } m_subMenuAction->setVisible(true); diff --git a/src/designer/src/lib/shared/morphmenu_p.h b/src/designer/src/lib/shared/morphmenu_p.h index cf8b5f55c..ce7bf1a61 100644 --- a/src/designer/src/lib/shared/morphmenu_p.h +++ b/src/designer/src/lib/shared/morphmenu_p.h @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE class QAction; -class QSignalMapper; class QMenu; namespace qdesigner_internal { @@ -76,8 +75,6 @@ private: QAction *m_subMenuAction; QMenu *m_menu; - QSignalMapper *m_mapper; - QWidget *m_widget; QDesignerFormWindowInterface *m_formWindow; }; diff --git a/src/designer/src/lib/shared/previewmanager.cpp b/src/designer/src/lib/shared/previewmanager.cpp index 12bab9ff7..0bbd3b9c6 100644 --- a/src/designer/src/lib/shared/previewmanager.cpp +++ b/src/designer/src/lib/shared/previewmanager.cpp @@ -823,12 +823,10 @@ QWidget *PreviewManager::raise(const QDesignerFormWindowInterface *fw, const Pre void PreviewManager::closeAllPreviews() { - typedef PreviewManagerPrivate::PreviewDataList PreviewDataList; if (!d->m_previews.empty()) { d->m_updateBlocked = true; d->m_activePreview = 0; - const PreviewDataList::iterator cend = d->m_previews.end(); - for (PreviewDataList::iterator it = d->m_previews.begin(); it != cend ;++it) { + for (auto it = d->m_previews.constBegin(), cend = d->m_previews.constEnd(); it != cend ;++it) { if (it->m_widget) it->m_widget->close(); } diff --git a/src/designer/src/lib/shared/promotiontaskmenu.cpp b/src/designer/src/lib/shared/promotiontaskmenu.cpp index 4697447f7..9b0944247 100644 --- a/src/designer/src/lib/shared/promotiontaskmenu.cpp +++ b/src/designer/src/lib/shared/promotiontaskmenu.cpp @@ -50,7 +50,6 @@ #include <QtWidgets/QAction> #include <QtWidgets/QWidget> #include <QtWidgets/QMenu> -#include <QtCore/QSignalMapper> #include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE @@ -73,7 +72,6 @@ PromotionTaskMenu::PromotionTaskMenu(QWidget *widget,Mode mode, QObject *parent) QObject(parent), m_mode(mode), m_widget(widget), - m_promotionMapper(0), m_globalEditAction(new QAction(tr("Promoted widgets..."), this)), m_EditPromoteToAction(new QAction(tr("Promote to ..."), this)), m_EditSignalsSlotsAction(new QAction(tr("Change signals/slots..."), this)), @@ -117,9 +115,6 @@ void PromotionTaskMenu::setDemoteLabel(const QString &demoteLabel) PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDesignerFormWindowInterface *formWindow) { - typedef void (QSignalMapper::*MapperVoidSlot)(); - typedef void (QSignalMapper::*MapperStringSignal)(const QString &); - // clear out old if (!m_promotionActions.empty()) { qDeleteAll(m_promotionActions); @@ -151,12 +146,6 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe // Is this thing promotable at all? return QDesignerPromotionDialog::baseClassNames(core->promotion()).contains(baseClassName) ? CanPromote : NotApplicable; } - // Set up a signal mapper to associate class names - if (!m_promotionMapper) { - m_promotionMapper = new QSignalMapper(this); - connect(m_promotionMapper, static_cast<MapperStringSignal>(&QSignalMapper::mapped), - this, &PromotionTaskMenu::slotPromoteToCustomWidget); - } QMenu *candidatesMenu = new QMenu(); // Create a sub menu @@ -164,11 +153,8 @@ PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDe // Set up actions and map class names for (WidgetDataBaseItemList::const_iterator it = candidates.constBegin(); it != cend; ++it) { const QString customClassName = (*it)->name(); - QAction *action = new QAction((*it)->name(), this); - connect(action, &QAction::triggered, - m_promotionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); - m_promotionMapper->setMapping(action, customClassName); - candidatesMenu->addAction(action); + candidatesMenu->addAction(customClassName, + this, [this, customClassName] { this->slotPromoteToCustomWidget(customClassName); }); } // Sub menu action QAction *subMenuAction = new QAction(m_promoteLabel, this); diff --git a/src/designer/src/lib/shared/promotiontaskmenu_p.h b/src/designer/src/lib/shared/promotiontaskmenu_p.h index 1d0d2e157..0f8a3f2db 100644 --- a/src/designer/src/lib/shared/promotiontaskmenu_p.h +++ b/src/designer/src/lib/shared/promotiontaskmenu_p.h @@ -59,7 +59,6 @@ class QDesignerFormEditorInterface; class QAction; class QMenu; class QWidget; -class QSignalMapper; namespace qdesigner_internal { @@ -124,7 +123,6 @@ private: QPointer<QWidget> m_widget; - QSignalMapper *m_promotionMapper; // Per-Widget actions QList<QAction *> m_promotionActions; diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp index fad08b1e1..f25a2e875 100644 --- a/src/designer/src/lib/shared/qdesigner_taskmenu.cpp +++ b/src/designer/src/lib/shared/qdesigner_taskmenu.cpp @@ -76,7 +76,6 @@ #include <QtWidgets/QPushButton> #include <QtWidgets/QUndoStack> #include <QtCore/QDebug> -#include <QtCore/QSignalMapper> #include <QtCore/QCoreApplication> QT_BEGIN_NAMESPACE diff --git a/src/designer/src/lib/shared/qdesigner_taskmenu_p.h b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h index c74c2aaa3..7502afd90 100644 --- a/src/designer/src/lib/shared/qdesigner_taskmenu_p.h +++ b/src/designer/src/lib/shared/qdesigner_taskmenu_p.h @@ -59,7 +59,6 @@ class QDesignerFormWindowInterface; class QDesignerFormEditorInterface; class QWidget; -class QSignalMapper; namespace qdesigner_internal { class QDesignerTaskMenuPrivate; diff --git a/src/designer/src/lib/shared/qdesigner_utils.cpp b/src/designer/src/lib/shared/qdesigner_utils.cpp index 1f3173638..a6bd9e37f 100644 --- a/src/designer/src/lib/shared/qdesigner_utils.cpp +++ b/src/designer/src/lib/shared/qdesigner_utils.cpp @@ -177,11 +177,9 @@ namespace qdesigner_internal QStringList DesignerMetaFlags::flags(int ivalue) const { - typedef MetaEnum<uint>::KeyToValueMap::const_iterator KeyToValueMapIterator; QStringList rc; const uint v = static_cast<uint>(ivalue); - const KeyToValueMapIterator cend = keyToValueMap().constEnd(); - for (KeyToValueMapIterator it = keyToValueMap().constBegin();it != cend; ++it ) { + for (auto it = keyToValueMap().constBegin(), cend = keyToValueMap().constEnd(); it != cend; ++it ) { const uint itemValue = it.value(); // Check for equality first as flag values can be 0 or -1, too. Takes preference over a bitwise flag if (v == itemValue) { @@ -229,8 +227,7 @@ namespace qdesigner_internal uint flags = 0; bool valueOk = true; QStringList keys = s.split(QString(QLatin1Char('|'))); - const QStringList::iterator cend = keys.end(); - for (QStringList::iterator it = keys.begin(); it != cend; ++it) { + for (auto it = keys.constBegin(), cend = keys.constEnd(); it != cend; ++it) { const uint flagValue = keyToValue(*it, &valueOk); if (!valueOk) { flags = 0; @@ -422,9 +419,7 @@ namespace qdesigner_internal QIcon DesignerIconCache::icon(const PropertySheetIconValue &value) const { - typedef PropertySheetIconValue::ModeStateToPixmapMap::const_iterator ModeStateToPixmapMapConstIt; - - QMap<PropertySheetIconValue, QIcon>::const_iterator it = m_cache.constFind(value); + const auto it = m_cache.constFind(value); if (it != m_cache.constEnd()) return it.value(); @@ -440,9 +435,8 @@ namespace qdesigner_internal QIcon icon; const PropertySheetIconValue::ModeStateToPixmapMap &paths = value.paths(); - const ModeStateToPixmapMapConstIt cend = paths.constEnd(); - for (ModeStateToPixmapMapConstIt it = paths.constBegin(); it != cend; ++it) { - const QPair<QIcon::Mode, QIcon::State> pair = it.key(); + for (auto it = paths.constBegin(), cend = paths.constEnd(); it != cend; ++it) { + const auto pair = it.key(); icon.addFile(it.value().path(), QSize(), pair.first, pair.second); } m_cache.insert(value, icon); @@ -619,11 +613,8 @@ namespace qdesigner_internal uint PropertySheetIconValue::mask() const { - typedef ModeStateToPixmapMap::const_iterator ModeStateToPixmapMapConstIt; - uint flags = 0; - const ModeStateToPixmapMapConstIt cend = m_data->m_paths.constEnd(); - for (ModeStateToPixmapMapConstIt it = m_data->m_paths.constBegin(); it != cend; ++it) + for (auto it = m_data->m_paths.constBegin(), cend = m_data->m_paths.constEnd(); it != cend; ++it) flags |= iconStateToSubPropertyFlag(it.key().first, it.key().second); if (!m_data->m_theme.isEmpty()) flags |= ThemeIconMask; @@ -680,14 +671,11 @@ namespace qdesigner_internal QDESIGNER_SHARED_EXPORT QDebug operator<<(QDebug d, const PropertySheetIconValue &p) { - typedef PropertySheetIconValue::ModeStateToPixmapMap::const_iterator ModeStateToPixmapMapConstIt; - QDebug nospace = d.nospace(); nospace << "PropertySheetIconValue theme='" << p.theme() << "' "; const PropertySheetIconValue::ModeStateToPixmapMap &paths = p.paths(); - const ModeStateToPixmapMapConstIt cend = paths.constEnd(); - for (ModeStateToPixmapMapConstIt it = paths.constBegin(); it != cend; ++it) + for (auto it = paths.constBegin(), cend = paths.constEnd(); it != cend; ++it) nospace << " mode=" << it.key().first << ",state=" << it.key().second << ",'" << it.value().path() << '\''; nospace << " mask=0x" << QString::number(p.mask(), 16); diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp index 22a6b7599..2758cc2c7 100644 --- a/src/designer/src/lib/shared/qlayout_widget.cpp +++ b/src/designer/src/lib/shared/qlayout_widget.cpp @@ -762,8 +762,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const void GridLayoutState::insertRow(int row) { rowCount++; - const WidgetItemMap::iterator iend = widgetItemMap.end(); - for (WidgetItemMap::iterator it = widgetItemMap.begin(); it != iend; ++it) { + for (auto it = widgetItemMap.begin(), iend = widgetItemMap.end(); it != iend; ++it) { const int topRow = it.value().y(); if (topRow >= row) { it.value().translate(0, 1); @@ -778,8 +777,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const void GridLayoutState::insertColumn(int column) { colCount++; - const WidgetItemMap::iterator iend = widgetItemMap.end(); - for (WidgetItemMap::iterator it = widgetItemMap.begin(); it != iend; ++it) { + for (auto it = widgetItemMap.begin(), iend = widgetItemMap.end(); it != iend; ++it) { const int leftColumn = it.value().x(); if (leftColumn >= column) { it.value().translate(1, 0); @@ -843,8 +841,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const void GridLayoutState::removeFreeRow(int removeRow) { - const WidgetItemMap::iterator iend = widgetItemMap.end(); - for (WidgetItemMap::iterator it = widgetItemMap.begin(); it != iend; ++it) { + for (auto it = widgetItemMap.begin(), iend = widgetItemMap.end(); it != iend; ++it) { const int r = it.value().y(); Q_ASSERT(r != removeRow); // Free rows only if (r < removeRow) { // Does the item span it? - shrink it @@ -863,8 +860,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const void GridLayoutState::removeFreeColumn(int removeColumn) { - const WidgetItemMap::iterator iend = widgetItemMap.end(); - for (WidgetItemMap::iterator it = widgetItemMap.begin(); it != iend; ++it) { + for (auto it = widgetItemMap.begin(), iend = widgetItemMap.end(); it != iend; ++it) { const int c = it.value().x(); Q_ASSERT(c != removeColumn); // Free columns only if (c < removeColumn) { // Does the item span it? - shrink it diff --git a/src/designer/src/lib/shared/rcc.cpp b/src/designer/src/lib/shared/rcc.cpp index 8f3c78f26..582cf731d 100644 --- a/src/designer/src/lib/shared/rcc.cpp +++ b/src/designer/src/lib/shared/rcc.cpp @@ -685,10 +685,8 @@ QStringList RCCResourceLibrary::dataFiles() const // Determine map of resource identifier (':/newPrefix/images/p1.png') to file via recursion static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QString &path, RCCResourceLibrary::ResourceDataFileMap &m) { - typedef QHash<QString, RCCFileInfo*>::const_iterator ChildConstIterator; const QChar slash = QLatin1Char('/'); - const ChildConstIterator cend = m_root->m_children.constEnd(); - for (ChildConstIterator it = m_root->m_children.constBegin(); it != cend; ++it) { + for (auto it = m_root->m_children.constBegin(), cend = m_root->m_children.constEnd(); it != cend; ++it) { const RCCFileInfo *child = it.value(); QString childName = path; childName += slash; diff --git a/src/designer/src/lib/shared/richtexteditor.cpp b/src/designer/src/lib/shared/richtexteditor.cpp index e8eed095e..24682529e 100644 --- a/src/designer/src/lib/shared/richtexteditor.cpp +++ b/src/designer/src/lib/shared/richtexteditor.cpp @@ -88,8 +88,6 @@ static inline void filterAttributes(const QStringRef &name, QXmlStreamAttributes *atts, bool *paragraphAlignmentFound) { - typedef QXmlStreamAttributes::iterator AttributeIt; - if (atts->isEmpty()) return; @@ -101,7 +99,7 @@ static inline void filterAttributes(const QStringRef &name, // Clean out everything except 'align' for 'p' if (name == QStringLiteral("p")) { - for (AttributeIt it = atts->begin(); it != atts->end(); ) { + for (auto it = atts->begin(); it != atts->end(); ) { if (it->name() == QStringLiteral("align")) { ++it; *paragraphAlignmentFound = true; diff --git a/src/designer/src/lib/shared/stylesheeteditor.cpp b/src/designer/src/lib/shared/stylesheeteditor.cpp index 25df6bce4..91dcfd8b2 100644 --- a/src/designer/src/lib/shared/stylesheeteditor.cpp +++ b/src/designer/src/lib/shared/stylesheeteditor.cpp @@ -47,7 +47,6 @@ #include <QtDesigner/QDesignerSettingsInterface> #include <QtDesigner/QExtensionManager> -#include <QtCore/QSignalMapper> #include <QtWidgets/QAction> #include <QtWidgets/QColorDialog> #include <QtWidgets/QDialogButtonBox> @@ -87,9 +86,6 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor m_addColorAction(new QAction(tr("Add Color..."), this)), m_addFontAction(new QAction(tr("Add Font..."), this)) { - typedef void (QSignalMapper::*MapperVoidSlot)(); - typedef void (QSignalMapper::*MapperQStringSignal)(const QString &); - setWindowTitle(tr("Edit Style Sheet")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -114,20 +110,12 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor connect(m_editor, &QWidget::customContextMenuRequested, this, &StyleSheetEditorDialog::slotContextMenuRequested); - QSignalMapper *resourceActionMapper = new QSignalMapper(this); - QSignalMapper *gradientActionMapper = new QSignalMapper(this); - QSignalMapper *colorActionMapper = new QSignalMapper(this); - - resourceActionMapper->setMapping(m_addResourceAction, QString()); - gradientActionMapper->setMapping(m_addGradientAction, QString()); - colorActionMapper->setMapping(m_addColorAction, QString()); - connect(m_addResourceAction, &QAction::triggered, - resourceActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + this, [this] { this->slotAddResource(QString()); }); connect(m_addGradientAction, &QAction::triggered, - gradientActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + this, [this] { this->slotAddGradient(QString()); }); connect(m_addColorAction, &QAction::triggered, - colorActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); + this, [this] { this->slotAddColor(QString()); }); connect(m_addFontAction, &QAction::triggered, this, &StyleSheetEditorDialog::slotAddFont); m_addResourceAction->setEnabled(mode == ModePerForm); @@ -159,30 +147,19 @@ StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *cor QMenu *colorActionMenu = new QMenu(this); for (int resourceProperty = 0; resourceProperties[resourceProperty]; ++resourceProperty) { - QAction *action = resourceActionMenu->addAction(QLatin1String(resourceProperties[resourceProperty])); - connect(action, &QAction::triggered, - resourceActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); - resourceActionMapper->setMapping(action, QLatin1String(resourceProperties[resourceProperty])); + const QString resourcePropertyName = QLatin1String(resourceProperties[resourceProperty]); + resourceActionMenu->addAction(resourcePropertyName, + this, [this, resourcePropertyName] { this->slotAddResource(resourcePropertyName); }); } for (int colorProperty = 0; colorProperties[colorProperty]; ++colorProperty) { - QAction *gradientAction = gradientActionMenu->addAction(QLatin1String(colorProperties[colorProperty])); - QAction *colorAction = colorActionMenu->addAction(QLatin1String(colorProperties[colorProperty])); - connect(gradientAction, &QAction::triggered, - gradientActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); - connect(colorAction, &QAction::triggered, - colorActionMapper, static_cast<MapperVoidSlot>(&QSignalMapper::map)); - gradientActionMapper->setMapping(gradientAction, QLatin1String(colorProperties[colorProperty])); - colorActionMapper->setMapping(colorAction, QLatin1String(colorProperties[colorProperty])); + const QString colorPropertyName = QLatin1String(colorProperties[colorProperty]); + colorActionMenu->addAction(colorPropertyName, + this, [this, colorPropertyName] { this->slotAddColor(colorPropertyName); }); + gradientActionMenu->addAction(colorPropertyName, + this, [this, colorPropertyName] { this->slotAddGradient(colorPropertyName); } ); } - connect(resourceActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), - this, &StyleSheetEditorDialog::slotAddResource); - connect(gradientActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), - this, &StyleSheetEditorDialog::slotAddGradient); - connect(colorActionMapper, static_cast<MapperQStringSignal>(&QSignalMapper::mapped), - this, &StyleSheetEditorDialog::slotAddColor); - m_addResourceAction->setMenu(resourceActionMenu); m_addGradientAction->setMenu(gradientActionMenu); m_addColorAction->setMenu(colorActionMenu); diff --git a/src/designer/src/lib/uilib/ui4.cpp b/src/designer/src/lib/uilib/ui4.cpp index dda6e7414..e72f9b5d4 100644 --- a/src/designer/src/lib/uilib/ui4.cpp +++ b/src/designer/src/lib/uilib/ui4.cpp @@ -129,7 +129,8 @@ DomUI::~DomUI() void DomUI::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("version")) { setAttributeVersion(attribute.value().toString()); @@ -777,7 +778,8 @@ DomInclude::~DomInclude() void DomInclude::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); @@ -854,7 +856,8 @@ DomResources::~DomResources() void DomResources::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -936,7 +939,8 @@ DomResource::~DomResource() void DomResource::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); @@ -1018,7 +1022,8 @@ DomActionGroup::~DomActionGroup() void DomActionGroup::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -1158,7 +1163,8 @@ DomAction::~DomAction() void DomAction::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -1263,7 +1269,8 @@ DomActionRef::~DomActionRef() void DomActionRef::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -1337,7 +1344,8 @@ DomButtonGroup::~DomButtonGroup() void DomButtonGroup::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -1583,7 +1591,8 @@ DomImage::~DomImage() void DomImage::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -1686,7 +1695,8 @@ DomImageData::~DomImageData() void DomImageData::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("format")) { setAttributeFormat(attribute.value().toString()); @@ -1832,7 +1842,8 @@ DomHeader::~DomHeader() void DomHeader::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); @@ -2371,7 +2382,8 @@ DomPropertyData::~DomPropertyData() void DomPropertyData::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); @@ -2537,7 +2549,8 @@ DomLayoutDefault::~DomLayoutDefault() void DomLayoutDefault::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toInt()); @@ -2612,7 +2625,8 @@ DomLayoutFunction::~DomLayoutFunction() void DomLayoutFunction::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toString()); @@ -2777,7 +2791,8 @@ DomLayout::~DomLayout() void DomLayout::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); @@ -2963,7 +2978,8 @@ DomLayoutItem::~DomLayoutItem() void DomLayoutItem::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toInt()); @@ -3300,7 +3316,8 @@ DomItem::~DomItem() void DomItem::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toInt()); @@ -3463,7 +3480,8 @@ DomWidget::~DomWidget() void DomWidget::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); @@ -3767,7 +3785,8 @@ DomSpacer::~DomSpacer() void DomSpacer::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -3857,7 +3876,8 @@ DomColor::~DomColor() void DomColor::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("alpha")) { setAttributeAlpha(attribute.value().toInt()); @@ -3986,7 +4006,8 @@ DomGradientStop::~DomGradientStop() void DomGradientStop::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("position")) { setAttributePosition(attribute.value().toDouble()); @@ -4132,7 +4153,8 @@ DomGradient::~DomGradient() void DomGradient::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("startx")) { setAttributeStartX(attribute.value().toDouble()); @@ -4312,7 +4334,8 @@ DomBrush::~DomBrush() void DomBrush::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("brushstyle")) { setAttributeBrushStyle(attribute.value().toString()); @@ -4467,7 +4490,8 @@ DomColorRole::~DomColorRole() void DomColorRole::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("role")) { setAttributeRole(attribute.value().toString()); @@ -5307,7 +5331,8 @@ DomLocale::~DomLocale() void DomLocale::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); @@ -5390,7 +5415,8 @@ DomSizePolicy::~DomSizePolicy() void DomSizePolicy::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("hsizetype")) { setAttributeHSizeType(attribute.value().toString()); @@ -6047,7 +6073,8 @@ DomStringList::~DomStringList() void DomStringList::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); @@ -6144,7 +6171,8 @@ DomResourcePixmap::~DomResourcePixmap() void DomResourcePixmap::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("resource")) { setAttributeResource(attribute.value().toString()); @@ -6252,7 +6280,8 @@ DomResourceIcon::~DomResourceIcon() void DomResourceIcon::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("theme")) { setAttributeTheme(attribute.value().toString()); @@ -6586,7 +6615,8 @@ DomString::~DomString() void DomString::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); @@ -7255,7 +7285,8 @@ DomProperty::~DomProperty() void DomProperty::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -8391,7 +8422,8 @@ DomConnectionHint::~DomConnectionHint() void DomConnectionHint::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); @@ -8497,7 +8529,8 @@ DomScript::~DomScript() void DomScript::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("source")) { setAttributeSource(attribute.value().toString()); @@ -8890,7 +8923,8 @@ DomPropertyToolTip::~DomPropertyToolTip() void DomPropertyToolTip::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); @@ -8960,7 +8994,8 @@ DomStringPropertySpecification::~DomStringPropertySpecification() void DomStringPropertySpecification::read(QXmlStreamReader &reader) { - foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { + const QXmlStreamAttributes attributes = reader.attributes(); + for (const QXmlStreamAttribute &attribute : attributes) { QStringRef name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); diff --git a/src/linguist/linguist/images/appicon.png b/src/linguist/linguist/images/appicon.png Binary files differindex 6aa09fb7a..748b07810 100644 --- a/src/linguist/linguist/images/appicon.png +++ b/src/linguist/linguist/images/appicon.png diff --git a/src/linguist/linguist/images/icons/linguist-128-32.png b/src/linguist/linguist/images/icons/linguist-128-32.png Binary files differindex e9a44cbef..4deebc24f 100644 --- a/src/linguist/linguist/images/icons/linguist-128-32.png +++ b/src/linguist/linguist/images/icons/linguist-128-32.png diff --git a/src/linguist/linguist/images/icons/linguist-16-32.png b/src/linguist/linguist/images/icons/linguist-16-32.png Binary files differindex 111b910b0..eed9bc076 100644 --- a/src/linguist/linguist/images/icons/linguist-16-32.png +++ b/src/linguist/linguist/images/icons/linguist-16-32.png diff --git a/src/linguist/linguist/images/icons/linguist-32-32.png b/src/linguist/linguist/images/icons/linguist-32-32.png Binary files differindex 6aa09fb7a..de976ccd3 100644 --- a/src/linguist/linguist/images/icons/linguist-32-32.png +++ b/src/linguist/linguist/images/icons/linguist-32-32.png diff --git a/src/linguist/linguist/images/icons/linguist-48-32.png b/src/linguist/linguist/images/icons/linguist-48-32.png Binary files differindex b7e344485..9b429c8b2 100644 --- a/src/linguist/linguist/images/icons/linguist-48-32.png +++ b/src/linguist/linguist/images/icons/linguist-48-32.png diff --git a/src/linguist/linguist/images/icons/linguist-64-32.png b/src/linguist/linguist/images/icons/linguist-64-32.png Binary files differindex 6ea58ff42..41981b645 100644 --- a/src/linguist/linguist/images/icons/linguist-64-32.png +++ b/src/linguist/linguist/images/icons/linguist-64-32.png diff --git a/src/linguist/linguist/images/splash.png b/src/linguist/linguist/images/splash.png Binary files differindex baaed6181..5824fb76c 100644 --- a/src/linguist/linguist/images/splash.png +++ b/src/linguist/linguist/images/splash.png diff --git a/src/linguist/linguist/linguist.ico b/src/linguist/linguist/linguist.ico Binary files differindex 48cd31a17..9c79249f2 100644 --- a/src/linguist/linguist/linguist.ico +++ b/src/linguist/linguist/linguist.ico diff --git a/src/linguist/linguist/mainwindow.cpp b/src/linguist/linguist/mainwindow.cpp index 20a6a0fdf..d4f522d0d 100644 --- a/src/linguist/linguist/mainwindow.cpp +++ b/src/linguist/linguist/mainwindow.cpp @@ -270,7 +270,7 @@ MainWindow::MainWindow() setUnifiedTitleAndToolBarOnMac(true); m_ui.setupUi(this); -#ifndef Q_OS_MAC +#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN) setWindowIcon(QPixmap(QLatin1String(":/images/appicon.png") )); #endif diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp index 9a47e0f2c..c5fa33207 100644 --- a/src/macdeployqt/macdeployqt/main.cpp +++ b/src/macdeployqt/macdeployqt/main.cpp @@ -96,6 +96,7 @@ int main(int argc, char **argv) extern bool runCodesign; extern QString codesignIdentiy; extern bool appstoreCompliant; + extern bool deployFramework; for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); @@ -151,13 +152,22 @@ int main(int argc, char **argv) } else if (argument == QByteArray("-appstore-compliant")) { LogDebug() << "Argument found:" << argument; appstoreCompliant = true; + + // Undocumented option, may not work as intented + } else if (argument == QByteArray("-deploy-framework")) { + LogDebug() << "Argument found:" << argument; + deployFramework = true; + } else if (argument.startsWith("-")) { LogError() << "Unknown argument" << argument << "\n"; return 1; } } - DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath, additionalExecutables, useDebugLibs); + DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath, additionalExecutables, useDebugLibs); + + if (deployFramework && deploymentInfo.isFramework) + fixupFramework(appBundlePath); // Convenience: Look for .qml files in the current directoty if no -qmldir specified. if (qmlDirs.isEmpty()) { diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index b2af604e9..3cfa79b39 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -59,6 +59,7 @@ bool runCodesign = false; QString codesignIdentiy; bool appstoreCompliant = false; int logLevel = 1; +bool deployFramework = false; using std::cout; using std::endl; @@ -810,6 +811,11 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework } } +void addRPath(const QString &rpath, const QString &binaryPath) +{ + runInstallNameTool(QStringList() << "-add_rpath" << rpath << binaryPath); +} + void deployRPaths(const QString &bundlePath, const QSet<QString> &rpaths, const QString &binaryPath, bool useLoaderPath) { const QString absFrameworksPath = QFileInfo(bundlePath).absoluteFilePath() @@ -897,6 +903,7 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks, QStringList copiedFrameworks; DeploymentInfo deploymentInfo; deploymentInfo.useLoaderPath = useLoaderPath; + deploymentInfo.isFramework = bundlePath.contains(".framework"); QSet<QString> rpathsUsed; while (frameworks.isEmpty() == false) { @@ -1466,3 +1473,25 @@ void createDiskImage(const QString &appBundlePath) hdutil.start("hdiutil", options); hdutil.waitForFinished(-1); } + +void fixupFramework(const QString &frameworkName) +{ + // Expected framework name looks like "Foo.framework" + QStringList parts = frameworkName.split("."); + if (parts.count() < 2) { + LogError() << "fixupFramework: Unexpected framework name" << frameworkName; + return; + } + + // Assume framework binary path is Foo.framework/Foo + QString frameworkBinary = frameworkName + QStringLiteral("/") + parts[0]; + + // Xcode expects to find Foo.framework/Versions/A when code + // signing, while qmake typically generates numeric versions. + // Create symlink to the actual version in the framework. + linkFilePrintStatus("Current", frameworkName + "/Versions/A"); + + // Set up @rpath structure. + changeIdentification("@rpath/" + frameworkBinary, frameworkBinary); + addRPath("@loader_path/../../Contents/Frameworks/", frameworkBinary); +} diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h index 47b93f42b..9aee2d424 100644 --- a/src/macdeployqt/shared/shared.h +++ b/src/macdeployqt/shared/shared.h @@ -103,6 +103,7 @@ public: QStringList deployedFrameworks; QSet<QString> rpathsUsed; bool useLoaderPath; + bool isFramework; }; inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info); @@ -134,6 +135,7 @@ QSet<QString> codesignBundle(const QString &identity, QList<QString> additionalBinariesContainingRpaths); void codesign(const QString &identity, const QString &appBundlePath); void createDiskImage(const QString &appBundlePath); +void fixupFramework(const QString &appBundlePath); #endif diff --git a/src/qdbus/qdbusviewer/images/qdbusviewer-128.png b/src/qdbus/qdbusviewer/images/qdbusviewer-128.png Binary files differindex af940dcb5..8946d13c6 100644 --- a/src/qdbus/qdbusviewer/images/qdbusviewer-128.png +++ b/src/qdbus/qdbusviewer/images/qdbusviewer-128.png diff --git a/src/qdbus/qdbusviewer/images/qdbusviewer.ico b/src/qdbus/qdbusviewer/images/qdbusviewer.ico Binary files differindex c5742ccf0..32b68ca74 100644 --- a/src/qdbus/qdbusviewer/images/qdbusviewer.ico +++ b/src/qdbus/qdbusviewer/images/qdbusviewer.ico diff --git a/src/qdbus/qdbusviewer/images/qdbusviewer.png b/src/qdbus/qdbusviewer/images/qdbusviewer.png Binary files differindex b410aaf50..e8c8d7f71 100644 --- a/src/qdbus/qdbusviewer/images/qdbusviewer.png +++ b/src/qdbus/qdbusviewer/images/qdbusviewer.png diff --git a/src/qdbus/qdbusviewer/main.cpp b/src/qdbus/qdbusviewer/main.cpp index 7dcebcc06..8a720404c 100644 --- a/src/qdbus/qdbusviewer/main.cpp +++ b/src/qdbus/qdbusviewer/main.cpp @@ -45,9 +45,10 @@ int main(int argc, char *argv[]) QCoreApplication::setApplicationName(QStringLiteral("QDBusViewer")); MainWindow mw; -#ifndef Q_OS_MAC +#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN) app.setWindowIcon(QIcon(QLatin1String(":/qt-project.org/qdbusviewer/images/qdbusviewer.png"))); -#else +#endif +#ifdef Q_OS_OSX mw.setWindowTitle(qApp->translate("QtDBusViewer", "Qt D-Bus Viewer")); #endif diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index 03afcdb7b..ec29f129c 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -643,8 +643,8 @@ QStringList Config::getAllFiles(const QString &filesVar, const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles) { - QStringList result = getCanonicalPathList(filesVar); - QStringList dirs = getCanonicalPathList(dirsVar); + QStringList result = getCanonicalPathList(filesVar, true); + QStringList dirs = getCanonicalPathList(dirsVar, true); QString nameFilter = getString(filesVar + dot + CONFIG_FILEEXTENSIONS); diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index c1295c3a7..61fb9b7d7 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -54,6 +54,8 @@ static bool inMacroCommand_ = false; static bool parsingHeaderFile_ = false; QStringList CppCodeParser::exampleFiles; QStringList CppCodeParser::exampleDirs; +QSet<QString> CppCodeParser::excludeDirs; +QSet<QString> CppCodeParser::excludeFiles; CppCodeParser* CppCodeParser::cppParser_ = 0; /*! @@ -78,7 +80,7 @@ CppCodeParser::~CppCodeParser() /*! The constructor initializes a map of special node types for identifying important nodes. And it initializes - some filters for identifying certain kinds of files. + some filters for identifying and excluding certain kinds of files. */ void CppCodeParser::initializeParser(const Config &config) { @@ -100,6 +102,10 @@ void CppCodeParser::initializeParser(const Config &config) QStringList exampleFilePatterns = config.getStringList( CONFIG_EXAMPLES + Config::dot + CONFIG_FILEEXTENSIONS); + // Used for excluding dirs and files from the list of example files + excludeDirs = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEDIRS)); + excludeFiles = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEFILES)); + if (!exampleFilePatterns.isEmpty()) exampleNameFilter = exampleFilePatterns.join(' '); else @@ -121,6 +127,8 @@ void CppCodeParser::initializeParser(const Config &config) void CppCodeParser::terminateParser() { nodeTypeMap.clear(); + excludeDirs.clear(); + excludeFiles.clear(); CodeParser::terminateParser(); } @@ -2643,9 +2651,9 @@ void CppCodeParser::createExampleFileNodes(DocumentNode *dn) sizeOfBoringPartOfName = sizeOfBoringPartOfName - 2; fullPath.truncate(fullPath.lastIndexOf('/')); - QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter); + QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(), excludeDirs, excludeFiles); QString imagesPath = fullPath + "/images"; - QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter); + QStringList imageFiles = Config::getFilesHere(imagesPath, exampleImageFilter, Location(), excludeDirs, excludeFiles); if (!exampleFiles.isEmpty()) { // move main.cpp and to the end, if it exists QString mainCpp; diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h index d3a5829e3..3910807ab 100644 --- a/src/qdoc/cppcodeparser.h +++ b/src/qdoc/cppcodeparser.h @@ -179,6 +179,8 @@ protected: static QStringList exampleFiles; static QStringList exampleDirs; + static QSet<QString> excludeDirs; + static QSet<QString> excludeFiles; static CppCodeParser* cppParser_; QString exampleNameFilter; QString exampleImageFilter; diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp index b8fd5f931..412c1950e 100644 --- a/src/qdoc/doc.cpp +++ b/src/qdoc/doc.cpp @@ -1487,6 +1487,18 @@ void DocParser::parse(const QString& source, } } break; + // Do not parse content after '//!' comments + case '/': + { + if (pos + 2 < len) + if (in.at(pos + 1) == '/') + if (in.at(pos + 2) == '!') { + pos += 2; + getRestOfLine(); + break; + } + // fall through + } default: { bool newWord; diff --git a/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc b/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc index af1fa1ba1..5ca9174b0 100644 --- a/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc +++ b/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc @@ -267,10 +267,14 @@ \section1 QDoc Comments - Documentation is contained within qdoc \e comments, delimited by + Documentation is contained within QDoc \e comments, delimited by \beginqdoc and \endqdoc comments. Note that these are valid comments in C++, QML, and JavaScript. + Within a QDoc comment, \c {//!} is used as a single-line documentation + comment; the comment itself and anything after it, until a newline, + is omitted from the generated output. + QDoc will parse C++ and QML files to look for qdoc comments. To explicitly omit a certain file type, omit it from the \l{Input and Output Directories}{configuration} file. diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 3f0033bf0..3992dc58e 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -3775,17 +3775,20 @@ The \\include command sends all or part of the file specified by its first argument to the QDoc input stream to be processed as a - QDoc comment snippet. This command is often assigned the alias, - \e {input}, in the QDoc configuration file, for example \e {alias.include - = input}. - - The command is useful when some snippet of commands and text is to - be used in multiple places in the documentation. In that case, - move the snippet into a separate file and use the \\include - command wherever you want to insert the snippet into the - documentation. To prevent QDoc from reading the file as a - stand-alone page of documentation, we recommend that you use the - \c .qdocinc extension for these \e {include} files. + QDoc comment snippet. + + The command is useful when some snippet of commands or text is to + be used in multiple places in the documentation. Use the \\include + command wherever you want to insert a snippet into the documentation. + The file containing the snippet to include must be located under the + path(s) listed in the \l{sourcedirs-variable}{sourcedirs} QDoc + configuration variable. It can be either any source file parsed + by QDoc (or even the same one where \\include command is used), or + any other text file. To store snippets in a separate file that is + not meant to be parsed by QDoc, use a file extension that is not + listed in \l {sources.fileextensions-variable}{sources.fileextensions}; + for example, \c .qdocinc. + The command can have either one or two arguments. The first argument is always a file name. The contents of the file must be @@ -3809,7 +3812,7 @@ QDoc renders this page \l{corefeatures.html} {as shown here}. - \target 2-argument-form} + \target 2-argument-form \section2 \\include filename snippet-identifier It is a waste of time to make a separate \c .qdocinc file for every @@ -3841,8 +3844,12 @@ It works as expected. The sequence of QDoc commands and text found between the two tags with the same name as the second argument is - sent to the QDoc input stream. You can even nest these snippets, - although it's not clear why you would want to do that. + sent to the QDoc input stream. You can even have nested snippets. + + \note Snippet identifiers work also within documentation comment + (\beginqdoc .. \endqdoc) blocks, so it's not necessary to use a + separate \c .qdocinc file. When processing a comment block, QDoc + removes any \c {//!} comment lines from the generated output. \target meta-command \section1 \\meta @@ -3865,7 +3872,6 @@ \meta {technology} {User Interface} \meta {platform} {OS X 10.6} - \meta {platform} {Symbian} \meta {platform} {MeeGo} \meta {audience} {user} \meta {audience} {programmer} @@ -3905,7 +3911,6 @@ <component>QtGui</component> </prodinfo> <othermeta name="platform" content="MeeGo"/> - <othermeta name="platform" content="Symbian"/> <othermeta name="platform" content="OS X 10.6"/> <othermeta name="technology" content="User Interface"/> </metadata> diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index 500a085cc..990207204 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -365,31 +365,26 @@ static void processQdocconfFile(const QString &fileName) + Config::dot + CONFIG_LANDINGPAGE)); - QSet<QString> excludedDirs; - QSet<QString> excludedFiles; - QStringList excludedDirsList; - QStringList excludedFilesList; + QSet<QString> excludedDirs = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEDIRS)); + QSet<QString> excludedFiles = QSet<QString>::fromList(config.getCanonicalPathList(CONFIG_EXCLUDEFILES)); + + Generator::debug("Adding doc/image dirs found in exampledirs to imagedirs"); + QSet<QString> exampleImageDirs; + QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles); + for (int i = 0; i < exampleImageList.size(); ++i) { + if (exampleImageList[i].contains("doc/images")) { + QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images") + 10); + if (!exampleImageDirs.contains(t)) { + exampleImageDirs.insert(t); + } + } + } + Generator::augmentImageDirs(exampleImageDirs); if (!Generator::singleExec() || !Generator::generating()) { QStringList headerList; QStringList sourceList; - Generator::debug("Reading excludedirs"); - excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS); - foreach (const QString &excludeDir, excludedDirsList) { - QString p = QDir::fromNativeSeparators(excludeDir); - QDir tmp(p); - if (tmp.exists()) - excludedDirs.insert(p); - } - - Generator::debug("Reading excludefiles"); - excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES); - foreach (const QString& excludeFile, excludedFilesList) { - QString p = QDir::fromNativeSeparators(excludeFile); - excludedFiles.insert(p); - } - Generator::debug("Reading headerdirs"); headerList = config.getAllFiles(CONFIG_HEADERS,CONFIG_HEADERDIRS,excludedDirs,excludedFiles); QMap<QString,QString> headers; @@ -430,20 +425,6 @@ static void processQdocconfFile(const QString &fileName) sourceFileNames.insert(t,t); } } - - Generator::debug("Adding doc/image dirs found in exampledirs to imagedirs"); - QSet<QString> exampleImageDirs; - QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles); - for (int i=0; i<exampleImageList.size(); ++i) { - if (exampleImageList[i].contains("doc/images")) { - QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images")+10); - if (!exampleImageDirs.contains(t)) { - exampleImageDirs.insert(t); - } - } - } - Generator::augmentImageDirs(exampleImageDirs); - /* Parse each header file in the set using the appropriate parser and add it to the big tree. @@ -504,34 +485,6 @@ static void processQdocconfFile(const QString &fileName) qdb->resolveIssues(); } else { - Generator::debug("Reading excludedirs"); - excludedDirsList = config.getCanonicalPathList(CONFIG_EXCLUDEDIRS); - foreach (const QString &excludeDir, excludedDirsList) { - QString p = QDir::fromNativeSeparators(excludeDir); - QDir tmp(p); - if (tmp.exists()) - excludedDirs.insert(p); - } - - Generator::debug("Reading excludefiles"); - excludedFilesList = config.getCanonicalPathList(CONFIG_EXCLUDEFILES); - foreach (const QString& excludeFile, excludedFilesList) { - QString p = QDir::fromNativeSeparators(excludeFile); - excludedFiles.insert(p); - } - - Generator::debug("Adding doc/image dirs found in exampledirs to imagedirs"); - QSet<QString> exampleImageDirs; - QStringList exampleImageList = config.getExampleImageFiles(excludedDirs, excludedFiles); - for (int i=0; i<exampleImageList.size(); ++i) { - if (exampleImageList[i].contains("doc/images")) { - QString t = exampleImageList[i].left(exampleImageList[i].lastIndexOf("doc/images")+10); - if (!exampleImageDirs.contains(t)) { - exampleImageDirs.insert(t); - } - } - } - Generator::augmentImageDirs(exampleImageDirs); qdb->resolveStuff(); } diff --git a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp index 9f1f177bd..a6b84048d 100644 --- a/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp +++ b/src/shared/qtpropertybrowser/qtbuttonpropertybrowser.cpp @@ -410,8 +410,7 @@ void QtButtonPropertyBrowserPrivate::insertRow(QGridLayout *layout, int row) con } } - const QMap<QLayoutItem *, QRect>::ConstIterator icend = itemToPos.constEnd(); - for(QMap<QLayoutItem *, QRect>::ConstIterator it = itemToPos.constBegin(); it != icend; ++it) { + for (auto it = itemToPos.constBegin(), icend = itemToPos.constEnd(); it != icend; ++it) { const QRect r = it.value(); layout->addItem(it.key(), r.x(), r.y(), r.width(), r.height()); } @@ -431,8 +430,7 @@ void QtButtonPropertyBrowserPrivate::removeRow(QGridLayout *layout, int row) con } } - const QMap<QLayoutItem *, QRect>::ConstIterator icend = itemToPos.constEnd(); - for(QMap<QLayoutItem *, QRect>::ConstIterator it = itemToPos.constBegin(); it != icend; ++it) { + for (auto it = itemToPos.constBegin(), icend = itemToPos.constEnd(); it != icend; ++it) { const QRect r = it.value(); layout->addItem(it.key(), r.x(), r.y(), r.width(), r.height()); } diff --git a/src/shared/qtpropertybrowser/qtpropertymanager.cpp b/src/shared/qtpropertybrowser/qtpropertymanager.cpp index eea0900ce..4f435f4df 100644 --- a/src/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/src/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -181,9 +181,7 @@ static Value getData(const QMap<const QtProperty *, PrivateData> &propertyMap, Value PrivateData::*data, const QtProperty *property, const Value &defaultValue = Value()) { - typedef QMap<const QtProperty *, PrivateData> PropertyToData; - typedef typename PropertyToData::const_iterator PropertyToDataConstIterator; - const PropertyToDataConstIterator it = propertyMap.constFind(property); + const auto it = propertyMap.constFind(property); if (it == propertyMap.constEnd()) return defaultValue; return it.value().*data; @@ -217,9 +215,7 @@ static void setSimpleValue(QMap<const QtProperty *, Value> &propertyMap, void (PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), QtProperty *property, const Value &val) { - typedef QMap<const QtProperty *, Value> PropertyToData; - typedef typename PropertyToData::iterator PropertyToDataIterator; - const PropertyToDataIterator it = propertyMap.find(property); + const auto it = propertyMap.find(property); if (it == propertyMap.end()) return; @@ -239,14 +235,11 @@ static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *ma QtProperty *property, const Value &val, void (PropertyManagerPrivate::*setSubPropertyValue)(QtProperty *, ValueChangeParameter)) { - typedef typename PropertyManagerPrivate::Data PrivateData; - typedef QMap<const QtProperty *, PrivateData> PropertyToData; - typedef typename PropertyToData::iterator PropertyToDataIterator; - const PropertyToDataIterator it = managerPrivate->m_values.find(property); + const auto it = managerPrivate->m_values.find(property); if (it == managerPrivate->m_values.end()) return; - PrivateData &data = it.value(); + auto &data = it.value(); if (data.val == val) return; @@ -274,10 +267,7 @@ static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *ma void (PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, ValueChangeParameter, ValueChangeParameter, ValueChangeParameter)) { - typedef typename PropertyManagerPrivate::Data PrivateData; - typedef QMap<const QtProperty *, PrivateData> PropertyToData; - typedef typename PropertyToData::iterator PropertyToDataIterator; - const PropertyToDataIterator it = managerPrivate->m_values.find(property); + const auto it = managerPrivate->m_values.find(property); if (it == managerPrivate->m_values.end()) return; @@ -285,7 +275,7 @@ static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *ma Value toVal = maxVal; orderBorders(fromVal, toVal); - PrivateData &data = it.value(); + auto &data = it.value(); if (data.minVal == fromVal && data.maxVal == toVal) return; @@ -318,9 +308,7 @@ static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *man void (PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, ValueChangeParameter, ValueChangeParameter, ValueChangeParameter)) { - typedef QMap<const QtProperty *, PrivateData> PropertyToData; - typedef typename PropertyToData::iterator PropertyToDataIterator; - const PropertyToDataIterator it = managerPrivate->m_values.find(property); + const auto it = managerPrivate->m_values.find(property); if (it == managerPrivate->m_values.end()) return; diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 6c7835318..5cd60e600 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -978,10 +978,12 @@ static bool deployTranslations(const QString &sourcePath, quint64 usedQtModules, struct DeployResult { - DeployResult() : success(false), directlyUsedQtLibraries(0), usedQtLibraries(0), deployedQtLibraries(0) {} + DeployResult() : success(false), isDebug(false), directlyUsedQtLibraries(0), usedQtLibraries(0), + deployedQtLibraries(0) {} operator bool() const { return success; } bool success; + bool isDebug; quint64 directlyUsedQtLibraries; quint64 usedQtLibraries; quint64 deployedQtLibraries; @@ -1117,17 +1119,17 @@ static bool updateLibrary(const QString &sourceFileName, const QString &targetDi // 'QtQuick/Controls' ==> 1, or 'QtQuick/Controls.2' ==> 2. static inline int quickControlsImportPath(const QString &ip) { - if (ip.endsWith(QLatin1String("QtQuick/Dialogs")) || ip.contains(QLatin1String("QtQuick/Dialogs/")) - || ip.contains(QLatin1String("QtQuick/Controls"))) { - return 1; // Dialogs only in v1, so far; no version number on directory: v1. - } if (ip.contains(QLatin1String("Qt/labs/calendar")) - || ip.contains(QLatin1String("Qt/labs/controls")) || ip.contains(QLatin1String("Qt/labs/folderlistmodel")) || ip.contains(QLatin1String("Qt/labs/settings")) - || ip.contains(QLatin1String("Qt/labs/templates"))) { + || ip.contains(QLatin1String("QtQuick/Templates.2")) + || ip.contains(QLatin1String("QtQuick/Controls.2"))) { return 2; } + if (ip.endsWith(QLatin1String("QtQuick/Dialogs")) || ip.contains(QLatin1String("QtQuick/Dialogs/")) + || ip.contains(QLatin1String("QtQuick/Controls"))) { + return 1; // Dialogs only in v1, so far; no version number on directory: v1. + } return 0; // Non-controls import } @@ -1164,6 +1166,7 @@ static DeployResult deploy(const Options &options, } const bool isDebug = options.debugDetection == Options::DebugDetectionAuto ? detectedDebug: options.debugDetection == Options::DebugDetectionForceDebug; + result.isDebug = isDebug; const DebugMatchMode debugMatchMode = isDebug ? MatchDebug : MatchRelease; // Determine application type, check Quick2 is used by looking at the @@ -1467,16 +1470,18 @@ static bool deployWebProcess(const QMap<QString, QString> &qmakeVariables, } static bool deployWebEngineCore(const QMap<QString, QString> &qmakeVariables, - const Options &options, QString *errorMessage) + const Options &options, bool isDebug, QString *errorMessage) { static const char *installDataFiles[] = {"icudtl.dat", "qtwebengine_resources.pak", "qtwebengine_resources_100p.pak", "qtwebengine_resources_200p.pak"}; - + QByteArray webEngineProcessName(webEngineProcessC); + if (isDebug) + webEngineProcessName.append('d'); if (optVerboseLevel) - std::wcout << "Deploying: " << webEngineProcessC << "...\n"; - if (!deployWebProcess(qmakeVariables, webEngineProcessC, options, errorMessage)) + std::wcout << "Deploying: " << webEngineProcessName.constData() << "...\n"; + if (!deployWebProcess(qmakeVariables, webEngineProcessName, options, errorMessage)) return false; const QString resourcesSubDir = QStringLiteral("/resources"); const QString resourcesSourceDir @@ -1583,7 +1588,7 @@ int main(int argc, char **argv) } if (result.deployedQtLibraries & QtWebEngineCoreModule) { - if (!deployWebEngineCore(qmakeVariables, options, &errorMessage)) { + if (!deployWebEngineCore(qmakeVariables, options, result.isDebug, &errorMessage)) { std::wcerr << errorMessage << '\n'; return 1; } diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 5b54a45f0..bf69829fb 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -30,7 +30,8 @@ find_package(Qt5Core REQUIRED) include("${_Qt5CTestMacros}") if(NOT CMAKE_CROSSCOMPILING) - expect_pass(test_translation_macros) + expect_pass(test_create_translation_macro) + expect_pass(test_add_translation_macro) endif() if (NOT NO_WIDGETS) diff --git a/tests/auto/cmake/test_add_translation_macro/CMakeLists.txt b/tests/auto/cmake/test_add_translation_macro/CMakeLists.txt new file mode 100644 index 000000000..90e7f67f5 --- /dev/null +++ b/tests/auto/cmake/test_add_translation_macro/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8) + +project(test_add_translation_macro) + +find_package(Qt5Core 5.0.0 REQUIRED) +find_package(Qt5LinguistTools 5.0.0 REQUIRED) + +include_directories( + ${Qt5Core_INCLUDE_DIRS} +) + +add_definitions(${Qt5Core_DEFINITIONS}) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + +set(my_srcs myi18nobject.cpp) + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/some_dir") + +qt5_add_translation(qm_files myobject_de.ts) + +add_executable(test_add_translation ${my_srcs} ${qm_files}) +target_link_libraries(test_add_translation ${Qt5Core_LIBRARIES}) diff --git a/tests/auto/cmake/test_translation_macros/myi18nobject.cpp b/tests/auto/cmake/test_add_translation_macro/myi18nobject.cpp index d6b0611f7..d6b0611f7 100644 --- a/tests/auto/cmake/test_translation_macros/myi18nobject.cpp +++ b/tests/auto/cmake/test_add_translation_macro/myi18nobject.cpp diff --git a/tests/auto/cmake/test_translation_macros/myobject_de.ts b/tests/auto/cmake/test_add_translation_macro/myobject_de.ts index 3b8f8bb55..240ffb389 100644 --- a/tests/auto/cmake/test_translation_macros/myobject_de.ts +++ b/tests/auto/cmake/test_add_translation_macro/myobject_de.ts @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.0" language="de_DE"> +<TS version="2.1" language="de_DE"> <context> <name>QObject</name> <message> - <location filename="myi18nobject.cpp" line="15"/> + <location filename="myi18nobject.cpp" line="49"/> <source>Hello, world!</source> - <translation>Hallo, Welt</translation> + <translation type="unfinished"></translation> </message> </context> </TS> diff --git a/tests/auto/cmake/test_translation_macros/some_dir/some_include.h b/tests/auto/cmake/test_add_translation_macro/some_dir/some_include.h index 24657b9f1..24657b9f1 100644 --- a/tests/auto/cmake/test_translation_macros/some_dir/some_include.h +++ b/tests/auto/cmake/test_add_translation_macro/some_dir/some_include.h diff --git a/tests/auto/cmake/test_translation_macros/CMakeLists.txt b/tests/auto/cmake/test_create_translation_macro/CMakeLists.txt index 14ecb40e3..100d689c7 100644 --- a/tests/auto/cmake/test_translation_macros/CMakeLists.txt +++ b/tests/auto/cmake/test_create_translation_macro/CMakeLists.txt @@ -1,7 +1,6 @@ - cmake_minimum_required(VERSION 2.8) -project(test_translation_macros) +project(test_create_translation_macros) find_package(Qt5Core 5.0.0 REQUIRED) find_package(Qt5LinguistTools 5.0.0 REQUIRED) @@ -18,7 +17,7 @@ set(my_srcs myi18nobject.cpp) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/some_dir") -qt5_create_translation(qm_files ${my_srcs} myobject_de.ts) +qt5_create_translation(qm_files ${my_srcs} myobject_de.ts OPTIONS -pro-debug) # play around with OPTIONS add_executable(myobject ${my_srcs} ${qm_files}) target_link_libraries(myobject ${Qt5Core_LIBRARIES}) diff --git a/tests/auto/cmake/test_create_translation_macro/myi18nobject.cpp b/tests/auto/cmake/test_create_translation_macro/myi18nobject.cpp new file mode 100644 index 000000000..d6b0611f7 --- /dev/null +++ b/tests/auto/cmake/test_create_translation_macro/myi18nobject.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QCoreApplication> +#include <QTranslator> + +#include "some_include.h" + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QTranslator *myappTranslator = new QTranslator; + QString localeName = QLocale::system().name(); + myappTranslator->load("myobject_" + localeName + ".qm", qApp->applicationDirPath()); + myappTranslator->setObjectName("myobject_" + localeName); + app.installTranslator(myappTranslator); + + qDebug() << QObject::tr("Hello, world!"); + return 0; +} diff --git a/tests/auto/cmake/test_create_translation_macro/myobject_de.ts b/tests/auto/cmake/test_create_translation_macro/myobject_de.ts new file mode 100644 index 000000000..240ffb389 --- /dev/null +++ b/tests/auto/cmake/test_create_translation_macro/myobject_de.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>QObject</name> + <message> + <location filename="myi18nobject.cpp" line="49"/> + <source>Hello, world!</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/cmake/test_create_translation_macro/some_dir/some_include.h b/tests/auto/cmake/test_create_translation_macro/some_dir/some_include.h new file mode 100644 index 000000000..24657b9f1 --- /dev/null +++ b/tests/auto/cmake/test_create_translation_macro/some_dir/some_include.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SOME_INCLUDE_H +#define SOME_INCLUDE_H + +enum { + Non_Empty_File +}; + +#endif diff --git a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro index 94cdd9a0f..13a7d47bb 100644 --- a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro +++ b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro @@ -19,4 +19,3 @@ wince*: { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qhelpenginecore/qhelpenginecore.pro b/tests/auto/qhelpenginecore/qhelpenginecore.pro index 85b68d7ac..4fa425838 100644 --- a/tests/auto/qhelpenginecore/qhelpenginecore.pro +++ b/tests/auto/qhelpenginecore/qhelpenginecore.pro @@ -20,4 +20,3 @@ wince*: { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qhelpindexmodel/qhelpindexmodel.pro b/tests/auto/qhelpindexmodel/qhelpindexmodel.pro index 261afc81d..18c118f2d 100644 --- a/tests/auto/qhelpindexmodel/qhelpindexmodel.pro +++ b/tests/auto/qhelpindexmodel/qhelpindexmodel.pro @@ -6,4 +6,3 @@ QT += help sql testlib DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qhelpprojectdata/qhelpprojectdata.pro b/tests/auto/qhelpprojectdata/qhelpprojectdata.pro index 0272ac2bb..ec2e313d5 100644 --- a/tests/auto/qhelpprojectdata/qhelpprojectdata.pro +++ b/tests/auto/qhelpprojectdata/qhelpprojectdata.pro @@ -7,4 +7,3 @@ QT += help-private testlib DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/manual/uiloader/uiloader/tst_uiloader.cpp b/tests/manual/uiloader/uiloader/tst_uiloader.cpp index cf6e3851b..a0fda4cef 100644 --- a/tests/manual/uiloader/uiloader/tst_uiloader.cpp +++ b/tests/manual/uiloader/uiloader/tst_uiloader.cpp @@ -38,10 +38,6 @@ #include <QApplication> #include <QDir> -#ifdef Q_OS_SYMBIAN -#define SRCDIR "" -#endif - class uiLoaderAutotest: public QObject { |