diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-29 13:01:29 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-29 13:01:29 +0100 |
commit | 36aa99b22465e10d44c1461021b93d60bc6aeead (patch) | |
tree | 7bd9365b82bb50845428d864d9863ebebcf62666 | |
parent | 0e25b01afe4c68f34019753d120aebfbe7b5665e (diff) | |
parent | a6a665bdb147d0a0fbfcd65053718a54e1d9815b (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I348539d1e75ec97acf3601931d2d8ab6281e96eb
-rw-r--r-- | LICENSE.GPLv3 | 2 | ||||
-rw-r--r-- | LICENSE.LGPLv21 | 2 | ||||
-rw-r--r-- | LICENSE.LGPLv3 | 2 | ||||
-rw-r--r-- | src/assistant/assistant/main.cpp | 1 | ||||
-rw-r--r-- | src/assistant/assistant/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/assistant/help/doc/src/qthelp-index.qdoc | 2 | ||||
-rw-r--r-- | src/designer/src/designer/versiondialog.cpp | 2 | ||||
-rw-r--r-- | src/linguist/linguist/formpreviewview.cpp | 72 | ||||
-rw-r--r-- | src/linguist/linguist/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/profileevaluator.cpp | 18 | ||||
-rw-r--r-- | src/macdeployqt/macdeployqt/main.cpp | 2 | ||||
-rw-r--r-- | src/pixeltool/main.cpp | 47 | ||||
-rw-r--r-- | src/pixeltool/pixeltool.pro | 2 | ||||
-rw-r--r-- | src/pixeltool/qpixeltool.cpp | 218 | ||||
-rw-r--r-- | src/pixeltool/qpixeltool.h | 27 | ||||
-rw-r--r-- | src/qconfig/main.cpp | 2 | ||||
-rw-r--r-- | src/qdbus/qdbusviewer/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/qdoc/config.cpp | 23 | ||||
-rw-r--r-- | src/qdoc/config.h | 1 | ||||
-rw-r--r-- | src/qdoc/doc/qdoc-manual-markupcmds.qdoc | 2 | ||||
-rw-r--r-- | src/qdoc/doc/qdoc-manual-qdocconf.qdoc | 13 |
21 files changed, 267 insertions, 177 deletions
diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3 index 4e49b122a..0c0f8e15f 100644 --- a/LICENSE.GPLv3 +++ b/LICENSE.GPLv3 @@ -1,6 +1,6 @@ GNU GENERAL PUBLIC LICENSE - The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + The Qt Toolkit is Copyright (C) 2016 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ You may use, distribute and copy the Qt GUI Toolkit under the terms of diff --git a/LICENSE.LGPLv21 b/LICENSE.LGPLv21 index 6e1846112..ca5adae7e 100644 --- a/LICENSE.LGPLv21 +++ b/LICENSE.LGPLv21 @@ -1,6 +1,6 @@ GNU LESSER GENERAL PUBLIC LICENSE - The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + The Qt Toolkit is Copyright (C) 2016 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ You may use, distribute and copy the Qt GUI Toolkit under the terms of diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3 index 4d67bac0b..d3268e665 100644 --- a/LICENSE.LGPLv3 +++ b/LICENSE.LGPLv3 @@ -1,6 +1,6 @@ GNU LESSER GENERAL PUBLIC LICENSE - The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + The Qt Toolkit is Copyright (C) 2016 The Qt Company Ltd. Contact: http://www.qt.io/licensing/ You may use, distribute and copy the Qt GUI Toolkit under the terms of diff --git a/src/assistant/assistant/main.cpp b/src/assistant/assistant/main.cpp index 8ae25fc9a..4d097aaf1 100644 --- a/src/assistant/assistant/main.cpp +++ b/src/assistant/assistant/main.cpp @@ -293,6 +293,7 @@ void setupTranslations() int main(int argc, char *argv[]) { + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); TRACE_OBJ QScopedPointer<QCoreApplication> a(createApplication(argc, argv)); a->addLibraryPath(a->applicationDirPath() + QLatin1String("/plugins")); diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index 0a3c1e27f..48f9d948f 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -901,7 +901,7 @@ void MainWindow::showAboutDialog() "<p>Version %2</p>" "<p>Browser: %3</p></center>" "<p>Copyright (C) %4 The Qt Company Ltd.</p>") - .arg(tr("Qt Assistant"), QLatin1String(QT_VERSION_STR), browser, QStringLiteral("2015")), + .arg(tr("Qt Assistant"), QLatin1String(QT_VERSION_STR), browser, QStringLiteral("2016")), resources); QLatin1String path(":/qt-project.org/assistant/images/assistant-128.png"); aboutDia.setPixmap(QString(path)); diff --git a/src/assistant/help/doc/src/qthelp-index.qdoc b/src/assistant/help/doc/src/qthelp-index.qdoc index ff84c568b..c992fdac8 100644 --- a/src/assistant/help/doc/src/qthelp-index.qdoc +++ b/src/assistant/help/doc/src/qthelp-index.qdoc @@ -73,7 +73,7 @@ \legalese Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team \BR - Changes are Copyright (C) 2015 The Qt Company Ltd. + Changes are Copyright (C) 2016 The Qt Company Ltd. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/src/designer/src/designer/versiondialog.cpp b/src/designer/src/designer/versiondialog.cpp index b7564bf58..d91c16cb0 100644 --- a/src/designer/src/designer/versiondialog.cpp +++ b/src/designer/src/designer/versiondialog.cpp @@ -165,7 +165,7 @@ VersionDialog::VersionDialog(QWidget *parent) lbl->setText(tr("%1" "<br/>Copyright (C) %2 The Qt Company Ltd." - ).arg(version, QStringLiteral("2015"))); + ).arg(version, QStringLiteral("2016"))); lbl->setWordWrap(true); lbl->setOpenExternalLinks(true); diff --git a/src/linguist/linguist/formpreviewview.cpp b/src/linguist/linguist/formpreviewview.cpp index c73a2366f..e21dd0120 100644 --- a/src/linguist/linguist/formpreviewview.cpp +++ b/src/linguist/linguist/formpreviewview.cpp @@ -54,6 +54,7 @@ #include <QtWidgets/QTabWidget> #include <QtWidgets/QToolBox> #include <QtWidgets/QTreeWidget> +#include <QtWidgets/QScrollArea> QT_BEGIN_NAMESPACE @@ -187,9 +188,9 @@ static void buildTargets(QObject *o, TargetsHash *targets) const int row_cnt = tablew->rowCount(); const int col_cnt = tablew->columnCount(); for (int j = 0; j < col_cnt; ++j) - registerTableItem(tablew->verticalHeaderItem(j), targets); + registerTableItem(tablew->horizontalHeaderItem(j), targets); for (int i = 0; i < row_cnt; ++i) { - registerTableItem(tablew->horizontalHeaderItem(i), targets); + registerTableItem(tablew->verticalHeaderItem(i), targets); for (int j = 0; j < col_cnt; ++j) registerTableItem(tablew->item(i, j), targets); } @@ -286,6 +287,31 @@ static void retranslateTargets( retranslateTarget(target, text); } +static void bringToFront(QWidget *w) +{ + for (; QWidget *pw = w->parentWidget(); w = pw) { +#ifndef QT_NO_STACKEDWIDGET + if (QStackedWidget *stack = qobject_cast<QStackedWidget *>(pw)) { +#ifndef QT_NO_TABWIDGET + // Updating QTabWidget's embedded QStackedWidget does not update its + // QTabBar, so handle tab widgets explicitly. + if (QTabWidget *tab = qobject_cast<QTabWidget *>(stack->parent())) + tab->setCurrentWidget(w); + else +#endif + stack->setCurrentWidget(w); + continue; + } +#endif +#ifndef QT_NO_TOOLBOX + if (QScrollArea *sv = qobject_cast<QScrollArea *>(pw)) { + if (QToolBox *tb = qobject_cast<QToolBox *>(sv->parent())) + tb->setCurrentWidget(w); + } +#endif + } +} + static void highlightTreeWidgetItem(QTreeWidgetItem *item, int col, bool on) { QVariant br = item->data(col, Qt::BackgroundRole + 500); @@ -394,35 +420,26 @@ static void highlightWidget(QWidget *w, bool on) highlightAction(m->menuAction(), on); } -static void bringToFront(const TranslatableEntry &target) -{ - for (QObject *obj = target.target.object; obj != 0; obj = obj->parent()) { - if (QWidget *w = qobject_cast<QWidget *>(obj)) { - if (QStackedLayout *lay = qobject_cast<QStackedLayout *>(w->layout())) - lay->setCurrentWidget(w); -#ifndef QT_NO_STACKEDWIDGET - if (QStackedWidget *stack = qobject_cast<QStackedWidget *>(obj->parent())) - stack->setCurrentWidget(w); -#endif -#ifndef QT_NO_TABWIDGET - if (QTabWidget *tab = qobject_cast<QTabWidget *>(obj->parent())) - tab->setCurrentWidget(w); -#endif - } - } -} static void highlightTarget(const TranslatableEntry &target, bool on) { - bringToFront(target); switch (target.type) { case TranslatableProperty: if (QAction *a = qobject_cast<QAction *>(target.target.object)) { highlightAction(a, on); - break; + } else if (QWidget *w = qobject_cast<QWidget *>(target.target.object)) { + bringToFront(w); + highlightWidget(w, on); } - // fallthrough + break; +#ifndef QT_NO_COMBOBOX + case TranslatableComboBoxItem: + static_cast<QComboBox *>(target.target.object)->setCurrentIndex(target.prop.index); + goto frontAndHighlight; +#endif #ifndef QT_NO_TABWIDGET case TranslatableTabPageText: + static_cast<QTabWidget *>(target.target.object)->setCurrentIndex(target.prop.index); + goto frontAndHighlight; # ifndef QT_NO_TOOLTIP case TranslatableTabPageToolTip: # endif @@ -436,24 +453,27 @@ static void highlightTarget(const TranslatableEntry &target, bool on) case TranslatableToolItemToolTip: # endif #endif // QT_NO_TOOLBOX -#ifndef QT_NO_COMBOBOX - case TranslatableComboBoxItem: +#if !defined(QT_NO_COMBOBOX) || !defined(QT_NO_TABWIDGET) + frontAndHighlight: #endif - if (QWidget *w = qobject_cast<QWidget *>(target.target.object)) - highlightWidget(w, on); + bringToFront(static_cast<QWidget *>(target.target.object)); + highlightWidget(static_cast<QWidget *>(target.target.object), on); break; #ifndef QT_NO_LISTWIDGET case TranslatableListWidgetItem: + bringToFront(target.target.listWidgetItem->listWidget()); highlightWidgetItem(target.target.listWidgetItem, on); break; #endif #ifndef QT_NO_TABLEWIDGET case TranslatableTableWidgetItem: + bringToFront(target.target.tableWidgetItem->tableWidget()); highlightWidgetItem(target.target.tableWidgetItem, on); break; #endif #ifndef QT_NO_TREEWIDGET case TranslatableTreeWidgetItem: + bringToFront(target.target.treeWidgetItem->treeWidget()); highlightTreeWidgetItem(target.target.treeWidgetItem, target.prop.treeIndex.column, on); break; #endif diff --git a/src/linguist/linguist/mainwindow.cpp b/src/linguist/linguist/mainwindow.cpp index 2971041e7..20a6a0fdf 100644 --- a/src/linguist/linguist/mainwindow.cpp +++ b/src/linguist/linguist/mainwindow.cpp @@ -1338,7 +1338,7 @@ void MainWindow::about() "<p>Qt Linguist is a tool for adding translations to Qt " "applications.</p>" "<p>Copyright (C) %2 The Qt Company Ltd." - ).arg(version, QStringLiteral("2015"))); + ).arg(version, QStringLiteral("2016"))); box.setWindowTitle(QApplication::translate("AboutDialog", "Qt Linguist")); box.setIcon(QMessageBox::NoIcon); diff --git a/src/linguist/shared/profileevaluator.cpp b/src/linguist/shared/profileevaluator.cpp index 21fc698ed..f850f3c1c 100644 --- a/src/linguist/shared/profileevaluator.cpp +++ b/src/linguist/shared/profileevaluator.cpp @@ -35,6 +35,7 @@ #include "qmakeglobals.h" #include "ioutils.h" +#include "qmakevfs.h" #include <QDir> @@ -130,29 +131,28 @@ QStringList ProFileEvaluator::absoluteFileValues( foreach (const QString &el, pro ? values(variable, pro) : values(variable)) { QString absEl; if (IoUtils::isAbsolutePath(el)) { - const QString elWithSysroot = sysrootify(el, baseDirectory); - if (IoUtils::exists(elWithSysroot)) { - result << QDir::cleanPath(elWithSysroot); + const QString elWithSysroot = QDir::cleanPath(sysrootify(el, baseDirectory)); + if (d->m_vfs->exists(elWithSysroot)) { + result << elWithSysroot; goto next; } absEl = elWithSysroot; } else { foreach (const QString &dir, searchDirs) { - QString fn = dir + QLatin1Char('/') + el; - if (IoUtils::exists(fn)) { - result << QDir::cleanPath(fn); + QString fn = QDir::cleanPath(dir + QLatin1Char('/') + el); + if (d->m_vfs->exists(fn)) { + result << fn; goto next; } } if (baseDirectory.isEmpty()) goto next; - absEl = baseDirectory + QLatin1Char('/') + el; + absEl = QDir::cleanPath(baseDirectory + QLatin1Char('/') + el); } { - absEl = QDir::cleanPath(absEl); int nameOff = absEl.lastIndexOf(QLatin1Char('/')); QString absDir = d->m_tmp1.setRawData(absEl.constData(), nameOff); - if (IoUtils::exists(absDir)) { + if (d->m_vfs->exists(absDir)) { QString wildcard = d->m_tmp2.setRawData(absEl.constData() + nameOff + 1, absEl.length() - nameOff - 1); if (wildcard.contains(QLatin1Char('*')) || wildcard.contains(QLatin1Char('?'))) { diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp index 97abac2de..c5fa33207 100644 --- a/src/macdeployqt/macdeployqt/main.cpp +++ b/src/macdeployqt/macdeployqt/main.cpp @@ -53,7 +53,7 @@ int main(int argc, char **argv) qDebug() << " -no-strip : Don't run 'strip' on the binaries"; qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)"; qDebug() << " -executable=<path> : Let the given executable use the deployed frameworks too"; - qDebug() << " -qmldir=<path> : Deploy imports used by .qml files in the given path"; + qDebug() << " -qmldir=<path> : Scan for QML imports in the given path"; qDebug() << " -always-overwrite : Copy files even if the target file exists"; qDebug() << " -codesign=<ident> : Run codesign with the given identity on all executables"; qDebug() << " -appstore-compliant: Skip deployment of components that use private API"; diff --git a/src/pixeltool/main.cpp b/src/pixeltool/main.cpp index a9377ad91..810d3a474 100644 --- a/src/pixeltool/main.cpp +++ b/src/pixeltool/main.cpp @@ -34,24 +34,57 @@ #include "qpixeltool.h" #include <qapplication.h> +#include <qcommandlineparser.h> +#include <qcommandlineoption.h> #include <qfileinfo.h> QT_USE_NAMESPACE +static bool isOptionSet(int argc, char *argv[], const char *option) +{ + for (int i = 1; i < argc; ++i) { + if (!qstrcmp(argv[i], option)) + return true; + } + return false; +} + int main(int argc, char **argv) { + if (isOptionSet(argc, argv, "--no-scaling")) + QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + QApplication app(argc, argv); + QCoreApplication::setApplicationName(QLatin1String("PixelTool")); + QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR)); + QCoreApplication::setOrganizationName(QLatin1String("QtProject")); + + QCommandLineParser parser; + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption noScalingDummy(QStringLiteral("no-scaling"), + QStringLiteral("Set Qt::AA_DisableHighDpiScaling.")); + parser.addOption(noScalingDummy); + parser.addPositionalArgument(QLatin1String("preview"), + QLatin1String("The preview image to show.")); + + parser.process(app); - QPixelTool pt; + QPixelTool pixelTool; - if (app.arguments().size() > 1 && QFileInfo(app.arguments().at(1)).exists()) { - pt.setPreviewImage(QImage(app.arguments().at(1))); + if (!parser.positionalArguments().isEmpty()) { + const QString previewImageFileName = parser.positionalArguments().first(); + if (QFileInfo(previewImageFileName).exists()) { + QImage previewImage(previewImageFileName); + if (!previewImage.size().isEmpty()) + pixelTool.setPreviewImage(previewImage); + } } - pt.show(); + pixelTool.show(); - QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); + QObject::connect(&app, &QApplication::lastWindowClosed, + &app, &QCoreApplication::quit); - int ret = app.exec(); - return ret; + return app.exec(); } diff --git a/src/pixeltool/pixeltool.pro b/src/pixeltool/pixeltool.pro index 82db6e48f..f3d1bf436 100644 --- a/src/pixeltool/pixeltool.pro +++ b/src/pixeltool/pixeltool.pro @@ -1,4 +1,4 @@ -QT += widgets +QT += core-private gui-private widgets mac { QMAKE_INFO_PLIST=Info_mac.plist diff --git a/src/pixeltool/qpixeltool.cpp b/src/pixeltool/qpixeltool.cpp index eac447c0a..b381c2e9c 100644 --- a/src/pixeltool/qpixeltool.cpp +++ b/src/pixeltool/qpixeltool.cpp @@ -35,6 +35,7 @@ #include <qapplication.h> #include <qdesktopwidget.h> +#include <qdir.h> #include <qapplication.h> #include <qscreen.h> #ifndef QT_NO_CLIPBOARD @@ -43,9 +44,13 @@ #include <qpainter.h> #include <qevent.h> #include <qfiledialog.h> +#include <qmessagebox.h> #include <qsettings.h> #include <qmenu.h> #include <qactiongroup.h> +#include <qimagewriter.h> +#include <qstandardpaths.h> +#include <private/qhighdpiscaling_p.h> #include <qdebug.h> @@ -53,30 +58,21 @@ QT_BEGIN_NAMESPACE QPixelTool::QPixelTool(QWidget *parent) : QWidget(parent) + , m_freeze(false) + , m_displayZoom(false) + , m_displayGridSize(false) + , m_mouseDown(false) + , m_preview_mode(false) + , m_displayZoomId(0) + , m_displayGridSizeId(0) + , m_currentColor(0) { - setWindowTitle(QLatin1String("PixelTool")); + setWindowTitle(QCoreApplication::applicationName()); QSettings settings(QLatin1String("QtProject"), QLatin1String("QPixelTool")); - - m_freeze = false; - m_autoUpdate = settings.value(QLatin1String("autoUpdate"), 0).toBool(); - m_gridSize = settings.value(QLatin1String("gridSize"), 1).toInt(); m_gridActive = settings.value(QLatin1String("gridActive"), 1).toInt(); - m_displayGridSize = false; - m_displayGridSizeId = 0; - m_zoom = settings.value(QLatin1String("zoom"), 4).toInt(); - - m_displayZoom = false; - m_displayZoomId = 0; - - m_preview_mode = false; - - m_currentColor = 0; - - m_mouseDown = false; - m_initialSize = settings.value(QLatin1String("initialSize"), QSize(250, 200)).toSize(); move(settings.value(QLatin1String("position")).toPoint()); @@ -174,13 +170,13 @@ void QPixelTool::paintEvent(QPaintEvent *) if (m_displayZoom) { render_string(&p, w, h, - QString::fromLatin1("Zoom: x%1").arg(m_zoom), + QLatin1String("Zoom: x") + QString::number(m_zoom), Qt::AlignTop | Qt::AlignRight); } if (m_displayGridSize) { render_string(&p, w, h, - QString::fromLatin1("Grid size: %1").arg(m_gridSize), + QLatin1String("Grid size: ") + QString::number(m_gridSize), Qt::AlignBottom | Qt::AlignLeft); } @@ -307,99 +303,88 @@ void QPixelTool::mouseReleaseEvent(QMouseEvent *) m_mouseDown = false; } +static QAction *addCheckableAction(QMenu &menu, const QString &title, + bool value, const QKeySequence &key) +{ + QAction *result = menu.addAction(title); + result->setCheckable(true); + result->setChecked(value); + result->setShortcut(key); + return result; +} + +static QAction *addCheckableAction(QMenu &menu, const QString &title, + bool value, const QKeySequence &key, + QActionGroup *group) +{ + QAction *result = addCheckableAction(menu, title, value, key); + result->setActionGroup(group); + return result; +} + void QPixelTool::contextMenuEvent(QContextMenuEvent *e) { - bool tmpFreeze = m_freeze; + const bool tmpFreeze = m_freeze; m_freeze = true; QMenu menu; - - QAction title(QLatin1String("Qt Pixel Zooming Tool"), &menu); - title.setEnabled(false); + menu.addAction(QLatin1String("Qt Pixel Zooming Tool"))->setEnabled(false); + menu.addSeparator(); // Grid color options... - QActionGroup gridGroup(this); - QAction whiteGrid(QLatin1String("White grid"), &gridGroup); - whiteGrid.setCheckable(true); - whiteGrid.setChecked(m_gridActive == 2); - whiteGrid.setShortcut(QKeySequence(Qt::Key_G)); - QAction blackGrid(QLatin1String("Black grid"), &gridGroup); - blackGrid.setCheckable(true); - blackGrid.setChecked(m_gridActive == 1); - blackGrid.setShortcut(QKeySequence(Qt::Key_G)); - QAction noGrid(QLatin1String("No grid"), &gridGroup); - noGrid.setCheckable(true); - noGrid.setChecked(m_gridActive == 0); - noGrid.setShortcut(QKeySequence(Qt::Key_G)); + QActionGroup *gridGroup = new QActionGroup(&menu); + addCheckableAction(menu, QLatin1String("White grid"), m_gridActive == 2, + Qt::Key_W, gridGroup); + QAction *blackGrid = addCheckableAction(menu, QLatin1String("Black grid"), + m_gridActive == 1, Qt::Key_B, gridGroup); + QAction *noGrid = addCheckableAction(menu, QLatin1String("No grid"), m_gridActive == 0, + Qt::Key_N, gridGroup); + menu.addSeparator(); // Grid size options - QAction incrGrid(QLatin1String("Increase grid size"), &menu); - incrGrid.setShortcut(QKeySequence(Qt::Key_PageUp)); - connect(&incrGrid, SIGNAL(triggered()), this, SLOT(increaseGridSize())); - QAction decrGrid(QLatin1String("Decrease grid size"), &menu); - decrGrid.setShortcut(QKeySequence(Qt::Key_PageDown)); - connect(&decrGrid, SIGNAL(triggered()), this, SLOT(decreaseGridSize())); + menu.addAction(QLatin1String("Increase grid size"), + this, &QPixelTool::increaseGridSize, Qt::Key_PageUp); + menu.addAction(QLatin1String("Decrease grid size"), + this, &QPixelTool::decreaseGridSize, Qt::Key_PageDown); + menu.addSeparator(); // Zoom options - QAction incrZoom(QLatin1String("Zoom in"), &menu); - incrZoom.setShortcut(QKeySequence(Qt::Key_Plus)); - connect(&incrZoom, SIGNAL(triggered()), this, SLOT(increaseZoom())); - QAction decrZoom(QLatin1String("Zoom out"), &menu); - decrZoom.setShortcut(QKeySequence(Qt::Key_Minus)); - connect(&decrZoom, SIGNAL(triggered()), this, SLOT(decreaseZoom())); + menu.addAction(QLatin1String("Zoom in"), + this, &QPixelTool::increaseZoom, Qt::Key_Plus); + menu.addAction(QLatin1String("Zoom out"), + this, &QPixelTool::decreaseZoom, Qt::Key_Minus); + menu.addSeparator(); // Freeze / Autoupdate - QAction freeze(QLatin1String("Frozen"), &menu); - freeze.setCheckable(true); - freeze.setChecked(tmpFreeze); - freeze.setShortcut(QKeySequence(Qt::Key_Space)); - QAction autoUpdate(QLatin1String("Continuous update"), &menu); - autoUpdate.setCheckable(true); - autoUpdate.setChecked(m_autoUpdate); - autoUpdate.setShortcut(QKeySequence(Qt::Key_A)); + QAction *freeze = addCheckableAction(menu, QLatin1String("Frozen"), + tmpFreeze, Qt::Key_Space); + QAction *autoUpdate = addCheckableAction(menu, QLatin1String("Continuous update"), + m_autoUpdate, Qt::Key_A); + menu.addSeparator(); // Copy to clipboard / save - QAction save(QLatin1String("Save as image"), &menu); - save.setShortcut(QKeySequence(QLatin1String("Ctrl+S"))); - connect(&save, SIGNAL(triggered()), this, SLOT(saveToFile())); + menu.addAction(QLatin1String("Save as image..."), + this, &QPixelTool::saveToFile, QKeySequence::SaveAs); #ifndef QT_NO_CLIPBOARD - QAction copy(QLatin1String("Copy to clipboard"), &menu); - copy.setShortcut(QKeySequence(QLatin1String("Ctrl+C"))); - connect(©, SIGNAL(triggered()), this, SLOT(copyToClipboard())); + menu.addAction(QLatin1String("Copy to clipboard"), + this, &QPixelTool::copyToClipboard, QKeySequence::Copy); #endif - menu.addAction(&title); - menu.addSeparator(); - menu.addAction(&whiteGrid); - menu.addAction(&blackGrid); - menu.addAction(&noGrid); - menu.addSeparator(); - menu.addAction(&incrGrid); - menu.addAction(&decrGrid); - menu.addSeparator(); - menu.addAction(&incrZoom); - menu.addAction(&decrZoom); menu.addSeparator(); - menu.addAction(&freeze); - menu.addAction(&autoUpdate); - menu.addSeparator(); - menu.addAction(&save); -#ifndef QT_NO_CLIPBOARD - menu.addAction(©); -#endif + menu.addAction(QLatin1String("About Qt"), qApp, &QApplication::aboutQt); menu.exec(mapToGlobal(e->pos())); // Read out grid settings - if (noGrid.isChecked()) m_gridActive = 0; - else if (blackGrid.isChecked()) m_gridActive = 1; - else m_gridActive = 2; - - m_autoUpdate = autoUpdate.isChecked(); - tmpFreeze = freeze.isChecked(); - + if (noGrid->isChecked()) + m_gridActive = 0; + else if (blackGrid->isChecked()) + m_gridActive = 1; + else + m_gridActive = 2; - m_freeze = tmpFreeze; + m_autoUpdate = autoUpdate->isChecked(); + m_freeze = freeze->isChecked(); } QSize QPixelTool::sizeHint() const @@ -407,6 +392,17 @@ QSize QPixelTool::sizeHint() const return m_initialSize; } +static inline QString pixelToolTitle(QPoint pos) +{ + if (QHighDpiScaling::isActive()) { + const int screenNumber = QApplication::desktop()->screenNumber(pos); + pos = QHighDpi::toNativePixels(pos, QGuiApplication::screens().at(screenNumber)); + } + return QCoreApplication::applicationName() + QLatin1String(" [") + + QString::number(pos.x()) + + QLatin1String(", ") + QString::number(pos.y()) + QLatin1Char(']'); +} + void QPixelTool::grabScreen() { if (m_preview_mode) { @@ -421,10 +417,8 @@ void QPixelTool::grabScreen() if (mousePos == m_lastMousePos && !m_autoUpdate) return; - if (m_lastMousePos != mousePos) { - setWindowTitle(QString::fromLatin1("PixelTool [%1, %2] ") - .arg(mousePos.x()).arg(mousePos.y())); - } + if (m_lastMousePos != mousePos) + setWindowTitle(pixelToolTitle(mousePos)); int w = int(width() / float(m_zoom)); int h = int(height() / float(m_zoom)); @@ -437,13 +431,15 @@ void QPixelTool::grabScreen() int x = mousePos.x() - w/2; int y = mousePos.y() - h/2; - QScreen *screen = qApp->screens().at(qApp->desktop()->screenNumber()); - m_buffer = screen->grabWindow(qApp->desktop()->winId(), x, y, w, h); + const QDesktopWidget *desktopWidget = QApplication::desktop(); + + QScreen *screen = QGuiApplication::screens().at(desktopWidget->screenNumber(this)); + m_buffer = screen->grabWindow(desktopWidget->winId(), x, y, w, h); QRegion geom(x, y, w, h); QRect screenRect; - for (int i=0; i<qApp->desktop()->numScreens(); ++i) - screenRect |= qApp->desktop()->screenGeometry(i); + for (int i = 0; i < desktopWidget->numScreens(); ++i) + screenRect |= desktopWidget->screenGeometry(i); geom -= screenRect; QVector<QRect> rects = geom.rects(); if (rects.size() > 0) { @@ -524,8 +520,7 @@ void QPixelTool::setGridSize(int gridSize) #ifndef QT_NO_CLIPBOARD void QPixelTool::copyToClipboard() { - QClipboard *cb = QApplication::clipboard(); - cb->setPixmap(m_buffer); + QGuiApplication::clipboard()->setPixmap(m_buffer); } #endif @@ -533,11 +528,26 @@ void QPixelTool::saveToFile() { bool oldFreeze = m_freeze; m_freeze = true; - QString name = QFileDialog::getSaveFileName(this, QLatin1String("Save as image"), QString(), QLatin1String("*.png")); - if (!name.isEmpty()) { - if (!name.endsWith(QLatin1String(".png"))) - name.append(QLatin1String(".png")); - m_buffer.save(name, "PNG"); + + QFileDialog fileDialog(this); + fileDialog.setWindowTitle(QLatin1String("Save as image")); + fileDialog.setAcceptMode(QFileDialog::AcceptSave); + fileDialog.setDirectory(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); + QStringList mimeTypes; + foreach (const QByteArray &mimeTypeB, QImageWriter::supportedMimeTypes()) + mimeTypes.append(QString::fromLatin1(mimeTypeB)); + fileDialog.setMimeTypeFilters(mimeTypes); + const QString pngType = QLatin1String("image/png"); + if (mimeTypes.contains(pngType)) { + fileDialog.selectMimeTypeFilter(pngType); + fileDialog.setDefaultSuffix(QLatin1String("png")); + } + + while (fileDialog.exec() == QDialog::Accepted + && !m_buffer.save(fileDialog.selectedFiles().first())) { + QMessageBox::warning(this, QLatin1String("Unable to write image"), + QLatin1String("Unable to write ") + + QDir::toNativeSeparators(fileDialog.selectedFiles().first())); } m_freeze = oldFreeze; } diff --git a/src/pixeltool/qpixeltool.h b/src/pixeltool/qpixeltool.h index 71be2ee6d..2b62daa78 100644 --- a/src/pixeltool/qpixeltool.h +++ b/src/pixeltool/qpixeltool.h @@ -43,23 +43,13 @@ class QPixelTool : public QWidget { Q_OBJECT public: - QPixelTool(QWidget *parent = 0); + explicit QPixelTool(QWidget *parent = Q_NULLPTR); ~QPixelTool(); - void timerEvent(QTimerEvent *event); - void paintEvent(QPaintEvent *event); - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); - void resizeEvent(QResizeEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void contextMenuEvent(QContextMenuEvent *event); - - QSize sizeHint() const; - void setPreviewImage(const QImage &image); + QSize sizeHint() const Q_DECL_OVERRIDE; + public slots: void setZoom(int zoom); void setGridSize(int gridSize); @@ -75,6 +65,17 @@ public slots: void increaseZoom() { setZoom(m_zoom + 1); } void decreaseZoom() { setZoom(m_zoom - 1); } +protected: + void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; + void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; + private: void grabScreen(); void startZoomVisibleTimer(); diff --git a/src/qconfig/main.cpp b/src/qconfig/main.cpp index 2d2668b3a..453cb6060 100644 --- a/src/qconfig/main.cpp +++ b/src/qconfig/main.cpp @@ -511,7 +511,7 @@ void Main::about() "<p><b><font size=\"+2\">Qtopia Core build configuration</font></b></p>" "<p></p>" "<p>Version 2.0</p>" - "<p>Copyright (C) 2015 The Qt Company Ltd.</p>" + "<p>Copyright (C) 2016 The Qt Company Ltd.</p>" "<p></p>" ); } diff --git a/src/qdbus/qdbusviewer/mainwindow.cpp b/src/qdbus/qdbusviewer/mainwindow.cpp index 9c02f6384..d57c61e57 100644 --- a/src/qdbus/qdbusviewer/mainwindow.cpp +++ b/src/qdbus/qdbusviewer/mainwindow.cpp @@ -95,7 +95,7 @@ void MainWindow::about() "<h3>%1</h3>" "<p>Version %2</p></center>" "<p>Copyright (C) %3 The Qt Company Ltd.</p>") - .arg(tr("D-Bus Viewer"), QLatin1String(QT_VERSION_STR), QStringLiteral("2015"))); + .arg(tr("D-Bus Viewer"), QLatin1String(QT_VERSION_STR), QStringLiteral("2016"))); box.setWindowTitle(tr("D-Bus Viewer")); box.exec(); } diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index 6c47b86d2..03afcdb7b 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -496,8 +496,13 @@ QStringList Config::getCanonicalPathList(const QString& var, bool validate) cons dir.setPath(d + QLatin1Char('/') + path); if (validate && !QFileInfo::exists(dir.path())) lastLocation_.warning(tr("Cannot find file or directory: %1").arg(path)); - else - t.append(dir.canonicalPath()); + else { + QString canonicalPath = dir.canonicalPath(); + if (!canonicalPath.isEmpty()) + t.append(canonicalPath); + else if (path.contains(QLatin1Char('*')) || path.contains(QLatin1Char('?'))) + t.append(path); + } } } --i; @@ -1156,6 +1161,18 @@ void Config::load(Location location, const QString& fileName) QDir::setCurrent(workingDirs_.top()); } +bool Config::isFileExcluded(const QString &fileName, const QSet<QString> &excludedFiles) +{ + foreach (const QString &entry, excludedFiles) { + if (entry.contains(QLatin1Char('*')) || entry.contains(QLatin1Char('?'))) { + QRegExp re(entry, Qt::CaseSensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return true; + } + } + return excludedFiles.contains(fileName); +} + QStringList Config::getFilesHere(const QString& uncleanDir, const QString& nameFilter, const Location &location, @@ -1180,7 +1197,7 @@ QStringList Config::getFilesHere(const QString& uncleanDir, if (!fn->startsWith(QLatin1Char('~'))) { QString s = dirInfo.filePath(*fn); QString c = QDir::cleanPath(s); - if (!excludedFiles.contains(c)) + if (!isFileExcluded(c, excludedFiles)) result.append(c); } ++fn; diff --git a/src/qdoc/config.h b/src/qdoc/config.h index 740568ca0..8356f9396 100644 --- a/src/qdoc/config.h +++ b/src/qdoc/config.h @@ -109,6 +109,7 @@ public: QStringList getExampleImageFiles(const QSet<QString> &excludedDirs, const QSet<QString> &excludedFiles); static QStringList loadMaster(const QString& fileName); + static bool isFileExcluded(const QString &fileName, const QSet<QString> &excludedFiles); static QStringList getFilesHere(const QString& dir, const QString& nameFilter, const Location &location = Location(), diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 2e82ad123..8a682affe 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -3888,7 +3888,7 @@ <author>Qt Development Frameworks</author> <publisher>Qt Project</publisher> <copyright> - <copyryear year="2015"/> + <copyryear year="2016"/> <copyrholder>Qt Project</copyrholder> </copyright> <permissions view="all"/> diff --git a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc index 7579a5598..57e6a1cb8 100644 --- a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -410,8 +410,15 @@ \endcode If you include the above in your qdocconf file for qtbase, there - will be no qwidget.html generated for html and no qwidget.xml - generated for DITA XML. + will be no class documentation generated for QWidget. + + Since Qt 5.6, also simple wildcards ('*' and '?') are recognized by + \c excludefiles. For example, to exclude all private Qt header files + from being parsed, define the following: + + \badcode + excludefiles += "*_p.h" + \endcode See also \l {excludedirs-variable} {excludedirs}. @@ -1693,7 +1700,7 @@ dita.metadata.default.author = Qt Development Frameworks dita.metadata.default.permissions = all dita.metadata.default.publisher = Qt Project - dita.metadata.default.copyryear = 2015 + dita.metadata.default.copyryear = 2016 dita.metadata.default.copyrholder = Qt Project dita.metadata.default.audience = programmer \endcode |