diff options
Diffstat (limited to 'src')
250 files changed, 2409 insertions, 2145 deletions
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 6ba2cbdf7aa..4e523582053 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -15,7 +15,8 @@ isEmpty(ANGLE_DIR) { win32 { GNUTOOLS_DIR=$$PWD/../../../../gnuwin32/bin exists($$GNUTOOLS_DIR/gperf.exe) { - GNUTOOLS = "(set $$escape_expand(\\\")PATH=$$replace(GNUTOOLS_DIR, [/\\\\], $${QMAKE_DIR_SEP});%PATH%$$escape_expand(\\\"))" + # Escape closing parens when expanding the variable, otherwise cmd confuses itself. + GNUTOOLS = "(set PATH=$$replace(GNUTOOLS_DIR, [/\\\\], $${QMAKE_DIR_SEP});%PATH:)=^)%)" } } diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index 2b2886703cc..3d5e9de5e0c 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtConcurrent description = Qt Concurrent Reference Documentation -url = http://qt-project.org/doc/qtconcurrent -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtconcurrent +version = $QT_VERSION examplesinstallpath = qtconcurrent qhp.projects = QtConcurrent qhp.QtConcurrent.file = qtconcurrent.qhp -qhp.QtConcurrent.namespace = org.qt-project.qtconcurrent.510 +qhp.QtConcurrent.namespace = org.qt-project.qtconcurrent.$QT_VERSION_TAG qhp.QtConcurrent.virtualFolder = qtconcurrent qhp.QtConcurrent.indexTitle = Qt Concurrent qhp.QtConcurrent.indexRoot = -qhp.QtConcurrent.filterAttributes = qtconcurrent 5.1.0 qtrefdoc -qhp.QtConcurrent.customFilters.Qt.name = QtConcurrent 5.1.0 -qhp.QtConcurrent.customFilters.Qt.filterAttributes = qtconcurrent 5.1.0 +qhp.QtConcurrent.filterAttributes = qtconcurrent $QT_VERSION qtrefdoc +qhp.QtConcurrent.customFilters.Qt.name = QtConcurrent $QT_VERSION +qhp.QtConcurrent.customFilters.Qt.filterAttributes = qtconcurrent $QT_VERSION qhp.QtConcurrent.subprojects = classes qhp.QtConcurrent.subprojects.classes.title = C++ Classes diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake index c5d10c9b5bf..60b98a71384 100644 --- a/src/corelib/Qt5CTestMacros.cmake +++ b/src/corelib/Qt5CTestMacros.cmake @@ -94,6 +94,18 @@ function(test_module_includes) include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS}) add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n" ) + + # Because the CI system tests built packages before installation, + # the include dir allowing module-includes for the new module is not + # the same as the dir for QtCore (because that is at the installation + # location). The CI system is untypical here in that it attempts to use + # packages while they are in an intermediate state, so we work around + # that in the test system. + set(packages_string + "${packages_string} + include_directories(\"\${Qt5${qtmodule}_DIR}/../../../include\")\n" + ) + set(libraries_string "${libraries_string} Qt5::${qtmodule}") endwhile() diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 06ff6dc831b..4e0fcda20e1 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -1,12 +1,10 @@ -get_filename_component(_qt5_corelib_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) - if (NOT TARGET Qt5::qmake) add_executable(Qt5::qmake IMPORTED) set_target_properties(Qt5::qmake PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\" !!ENDIF @@ -18,7 +16,7 @@ if (NOT TARGET Qt5::moc) set_target_properties(Qt5::moc PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\" !!ENDIF @@ -32,7 +30,7 @@ if (NOT TARGET Qt5::rcc) set_target_properties(Qt5::rcc PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_corelib_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\" !!ENDIF @@ -44,9 +42,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc) set(Qt5Core_RCC_EXECUTABLE Qt5::rcc) !!IF isEmpty(CMAKE_ARCHDATA_DIR_IS_ABSOLUTE) -list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/$${CMAKE_ARCHDATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") +list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5Core_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5Core_install_prefix}/$${CMAKE_ARCHDATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\") !!ELSE -list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_ARCHDATA_DIR}mkspecs/$${CMAKE_MKSPEC}\") +list(APPEND Qt5Core_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_ARCHDATA_DIR}mkspecs/$${CMAKE_MKSPEC}\") !!ENDIF !!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS) @@ -80,7 +78,7 @@ if (NOT TARGET Qt5::WinMain) set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(Qt5::WinMain PROPERTIES !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION_DEBUG \"${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" + IMPORTED_LOCATION_DEBUG \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" !!ELSE IMPORTED_LOCATION_DEBUG \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\" !!ENDIF @@ -91,7 +89,7 @@ if (NOT TARGET Qt5::WinMain) set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(Qt5::WinMain PROPERTIES !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION_RELEASE \"${_qt5_corelib_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" + IMPORTED_LOCATION_RELEASE \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" !!ELSE IMPORTED_LOCATION_RELEASE \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\" !!ENDIF diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 614b79ab880..e3115db8ee2 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -234,7 +234,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) foreach(_module ${_qt5_modules}) if (NOT Qt5${_module}_FOUND) - find_package(Qt5${_module} PATHS ${_qt5_corelib_install_prefix} NO_DEFAULT_PATH) + find_package(Qt5${_module} PATHS ${_qt5Core_install_prefix} NO_DEFAULT_PATH) if (NOT Qt5${_module}_FOUND) message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") endif() diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 2bac1bcbef6..cbfb4572121 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -54,7 +54,10 @@ HOST_BINS = $$[QT_HOST_BINS/raw] host_bins.name = host_bins host_bins.variable = HOST_BINS -QMAKE_PKGCONFIG_VARIABLES += host_bins +qt_conf.name = qt_config +qt_conf.variable = QT_CONFIG + +QMAKE_PKGCONFIG_VARIABLES += host_bins qt_conf ctest_macros_file.input = $$PWD/Qt5CTestMacros.cmake ctest_macros_file.output = $$DESTDIR/cmake/Qt5Core/Qt5CTestMacros.cmake diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index bf402cae97a..0e275ee8d47 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtCore description = Qt Core Reference Documentation -url = http://qt-project.org/doc/qtcore -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtcore +version = $QT_VERSION examplesinstallpath = core qhp.projects = QtCore qhp.QtCore.file = qtcore.qhp -qhp.QtCore.namespace = org.qt-project.qtcore.510 +qhp.QtCore.namespace = org.qt-project.qtcore.$QT_VERSION_TAG qhp.QtCore.virtualFolder = qtcore qhp.QtCore.indexTitle = Qt Core qhp.QtCore.indexRoot = -qhp.QtCore.filterAttributes = qtcore 5.1.0 qtrefdoc -qhp.QtCore.customFilters.Qt.name = QtCore 5.1.0 -qhp.QtCore.customFilters.Qt.filterAttributes = qtcore 5.1.0 +qhp.QtCore.filterAttributes = qtcore $QT_VERSION qtrefdoc +qhp.QtCore.customFilters.Qt.name = QtCore $QT_VERSION +qhp.QtCore.customFilters.Qt.filterAttributes = qtcore $QT_VERSION qhp.QtCore.subprojects = classes qhp.QtCore.subprojects.classes.title = C++ Classes qhp.QtCore.subprojects.classes.indexTitle = Qt Core C++ Classes @@ -36,7 +36,6 @@ exampledirs += \ ../ \ snippets \ ../../../examples/threads/ \ - ../../../examples/tools/ \ - ../../../examples/widgets/ + ../../../examples/tools/ imagedirs += images diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index 2b58802426d..ddb84bcc746 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -535,7 +535,7 @@ CApaApplication *myApplicationFactory(); //! [49] -void myMessageHandler(QtMsgType, const QMessageLogContext &, const char *); +void myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &); //! [49] //! [50] diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp index ad2e502be88..532a0e1f59e 100644 --- a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp @@ -45,7 +45,7 @@ QUrl url("http://www.example.com/List of holidays.xml"); //! [1] -QUrl url = QUrl::fromEncoded("http://qt.nokia.com/List%20of%20holidays.xml"); +QUrl url = QUrl::fromEncoded("http://qt-project.org/List%20of%20holidays.xml"); //! [1] @@ -73,10 +73,10 @@ http://www.example.com/cgi-bin/drawgraph.cgi?type(pie)color(green) //! [5] -QUrl baseUrl("http://qt.nokia.com/support"); -QUrl relativeUrl("../products/solutions"); +QUrl baseUrl("http://qt.digia.com/Support/"); +QUrl relativeUrl("../Product/Library/"); qDebug(baseUrl.resolved(relativeUrl).toString()); -// prints "http://qt.nokia.com/products/solutions" +// prints "http://qt.digia.com/Product/Library/" //! [5] diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp index 932a006436b..bafd3f8eb87 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp @@ -480,7 +480,8 @@ QObject::disconnect(lineEdit, &QLineEdit::textChanged, //! [48] //! [49] -if (isSignalConnected(QMetaMethod::fromSignal(&MyObject::valueChanged))) { +static const QMetaMethod valueChangedSignal = QMetaMethod::fromSignal(&MyObject::valueChanged); +if (isSignalConnected(valueChangedSignal)) { QByteArray data; data = get_the_value(); // expensive operation emit valueChanged(data); diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp index f0bc7593208..c33c8bb48a8 100644 --- a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart <[email protected]> ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. @@ -38,41 +38,68 @@ ** ****************************************************************************/ -//! [0] -class Worker : public QObject +#include <QtCore/QThread> +class MyObject; + +//! [reimpl-run] +class WorkerThread : public QThread { Q_OBJECT - -public slots: - void doWork() { - ... + void run() Q_DECL_OVERRIDE { + QString result; + /* expensive or blocking operation */ + emit resultReady(result); } +signals: + void resultReady(const QString &s); }; -void MyObject::putWorkerInAThread() +void MyObject::startWorkInAThread() { - Worker *worker = new Worker; - QThread *workerThread = new QThread(this); - - connect(workerThread, &QThread::started, worker, &Worker::doWork); - connect(workerThread, &QThread::finished, worker, &Worker::deleteLater); - worker->moveToThread(workerThread); - - // Starts an event loop, and emits workerThread->started() + WorkerThread *workerThread = new WorkerThread(this); + connect(workerThread, &WorkerThread::resultReady, this, &MyObject::handleResults); + connect(workerThread, &WorkerThread::finished, workerThread, &QObject::deleteLater); workerThread->start(); } -//! [0] +//! [reimpl-run] + -//! [1] -class AdvancedThreadManager : public QThread +//! [worker] +class Worker : public QObject { -protected: - void run() - { - /* ... other code to initialize thread... */ + Q_OBJECT + QThread workerThread; - // Begin event handling - exec(); +public slots: + void doWork(const QString ¶meter) { + // ... + emit resultReady(result); } + +signals: + void resultReady(const QString &result); +}; + +class Controller : public QObject +{ + Q_OBJECT + QThread workerThread; +public: + Controller() { + Worker *worker = new Worker; + worker->moveToThread(&workerThread); + connect(workerThread, &QThread::finished, worker, &QObject::deleteLater); + connect(this, &Controller::operate, worker, &Worker::doWork); + connect(worker, &Worker::resultReady, this, &Controller::handleResults); + workerThread.start(); + } + ~Controller() { + workerThread.quit(); + workerThread.wait(); + } +public slots: + void handleResults(const QString &); +signals: + void operate(const QString &); }; -//! [1] +//! [worker] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index 9f52fcff984..7e221cfaab1 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp @@ -258,7 +258,7 @@ if (url.startsWith("ftp:")) //! [26] -QByteArray url("http://qt.nokia.com/index.html"); +QByteArray url("http://qt-project.org/doc/qt-5.0/qtdoc/index.html"); if (url.endsWith(".html")) ... //! [26] @@ -286,16 +286,16 @@ QByteArray z = x.mid(5); // z == "pineapples" //! [30] -QByteArray x("Qt by NOKIA"); +QByteArray x("Qt by DIGIA"); QByteArray y = x.toLower(); -// y == "qt by nokia" +// y == "qt by digia" //! [30] //! [31] -QByteArray x("Qt by NOKIA"); +QByteArray x("Qt by DIGIA"); QByteArray y = x.toUpper(); -// y == "QT BY NOKIA" +// y == "QT BY DIGIA" //! [31] diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 0fdb88cd8bc..6ee30881385 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -856,8 +856,8 @@ void Widget::toLongLongFunction() void Widget::toLowerFunction() { //! [75] - QString str = "Qt by NOKIA"; - str = str.toLower(); // str == "qt by nokia" + QString str = "The Qt PROJECT"; + str = str.toLower(); // str == "the qt project" //! [75] } diff --git a/src/corelib/doc/snippets/qxmlstreamwriter/main.cpp b/src/corelib/doc/snippets/qxmlstreamwriter/main.cpp index 134c3b55fff..046790e8ae8 100644 --- a/src/corelib/doc/snippets/qxmlstreamwriter/main.cpp +++ b/src/corelib/doc/snippets/qxmlstreamwriter/main.cpp @@ -61,8 +61,8 @@ int main(int argc, char *argv[]) stream.writeAttribute("folded", "no"); //! [write element] stream.writeStartElement("bookmark"); - stream.writeAttribute("href", "http://qt.nokia.com/"); - stream.writeTextElement("title", "Qt Home"); + stream.writeAttribute("href", "http://qt-project.org/"); + stream.writeTextElement("title", "Qt Project"); stream.writeEndElement(); // bookmark //! [write element] stream.writeEndElement(); // folder diff --git a/src/corelib/doc/snippets/resource-system/application.pro b/src/corelib/doc/snippets/resource-system/application.pro new file mode 100644 index 00000000000..652cc734851 --- /dev/null +++ b/src/corelib/doc/snippets/resource-system/application.pro @@ -0,0 +1,14 @@ +QT += widgets + +HEADERS = mainwindow.h +SOURCES = main.cpp \ + mainwindow.cpp +#! [0] +RESOURCES = application.qrc +#! [0] + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/application +INSTALLS += target + +simulator: warning(This example might not fully work on Simulator platform) diff --git a/src/corelib/doc/snippets/resource-system/application.qrc b/src/corelib/doc/snippets/resource-system/application.qrc new file mode 100644 index 00000000000..0a776fab4d3 --- /dev/null +++ b/src/corelib/doc/snippets/resource-system/application.qrc @@ -0,0 +1,10 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>images/copy.png</file> + <file>images/cut.png</file> + <file>images/new.png</file> + <file>images/open.png</file> + <file>images/paste.png</file> + <file>images/save.png</file> +</qresource> +</RCC> diff --git a/src/corelib/doc/snippets/resource-system/mainwindow.cpp b/src/corelib/doc/snippets/resource-system/mainwindow.cpp new file mode 100644 index 00000000000..8bdd0303def --- /dev/null +++ b/src/corelib/doc/snippets/resource-system/mainwindow.cpp @@ -0,0 +1,392 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include <QtWidgets> + +#include "mainwindow.h" +//! [0] + +//! [1] +MainWindow::MainWindow() +//! [1] //! [2] +{ + textEdit = new QPlainTextEdit; + setCentralWidget(textEdit); + + createActions(); + createMenus(); + createToolBars(); + createStatusBar(); + + readSettings(); + + connect(textEdit->document(), SIGNAL(contentsChanged()), + this, SLOT(documentWasModified())); + + setCurrentFile(""); + setUnifiedTitleAndToolBarOnMac(true); +} +//! [2] + +//! [3] +void MainWindow::closeEvent(QCloseEvent *event) +//! [3] //! [4] +{ + if (maybeSave()) { + writeSettings(); + event->accept(); + } else { + event->ignore(); + } +} +//! [4] + +//! [5] +void MainWindow::newFile() +//! [5] //! [6] +{ + if (maybeSave()) { + textEdit->clear(); + setCurrentFile(""); + } +} +//! [6] + +//! [7] +void MainWindow::open() +//! [7] //! [8] +{ + if (maybeSave()) { + QString fileName = QFileDialog::getOpenFileName(this); + if (!fileName.isEmpty()) + loadFile(fileName); + } +} +//! [8] + +//! [9] +bool MainWindow::save() +//! [9] //! [10] +{ + if (curFile.isEmpty()) { + return saveAs(); + } else { + return saveFile(curFile); + } +} +//! [10] + +//! [11] +bool MainWindow::saveAs() +//! [11] //! [12] +{ + QString fileName = QFileDialog::getSaveFileName(this); + if (fileName.isEmpty()) + return false; + + return saveFile(fileName); +} +//! [12] + +//! [13] +void MainWindow::about() +//! [13] //! [14] +{ + QMessageBox::about(this, tr("About Application"), + tr("The <b>Application</b> example demonstrates how to " + "write modern GUI applications using Qt, with a menu bar, " + "toolbars, and a status bar.")); +} +//! [14] + +//! [15] +void MainWindow::documentWasModified() +//! [15] //! [16] +{ + setWindowModified(textEdit->document()->isModified()); +} +//! [16] + +//! [17] +void MainWindow::createActions() +//! [17] //! [18] +{ + newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); + newAct->setShortcuts(QKeySequence::New); + newAct->setStatusTip(tr("Create a new file")); + connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); + +//! [19] + openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); + openAct->setShortcuts(QKeySequence::Open); + openAct->setStatusTip(tr("Open an existing file")); + connect(openAct, SIGNAL(triggered()), this, SLOT(open())); +//! [18] //! [19] + + saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); + saveAct->setShortcuts(QKeySequence::Save); + saveAct->setStatusTip(tr("Save the document to disk")); + connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); + + saveAsAct = new QAction(tr("Save &As..."), this); + saveAsAct->setShortcuts(QKeySequence::SaveAs); + saveAsAct->setStatusTip(tr("Save the document under a new name")); + connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); + +//! [20] + exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcuts(QKeySequence::Quit); +//! [20] + exitAct->setStatusTip(tr("Exit the application")); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + +//! [21] + cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); +//! [21] + cutAct->setShortcuts(QKeySequence::Cut); + cutAct->setStatusTip(tr("Cut the current selection's contents to the " + "clipboard")); + connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut())); + + copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this); + copyAct->setShortcuts(QKeySequence::Copy); + copyAct->setStatusTip(tr("Copy the current selection's contents to the " + "clipboard")); + connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy())); + + pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this); + pasteAct->setShortcuts(QKeySequence::Paste); + pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " + "selection")); + connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste())); + + aboutAct = new QAction(tr("&About"), this); + aboutAct->setStatusTip(tr("Show the application's About box")); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); + +//! [22] + aboutQtAct = new QAction(tr("About &Qt"), this); + aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); + connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +//! [22] + +//! [23] + cutAct->setEnabled(false); +//! [23] //! [24] + copyAct->setEnabled(false); + connect(textEdit, SIGNAL(copyAvailable(bool)), + cutAct, SLOT(setEnabled(bool))); + connect(textEdit, SIGNAL(copyAvailable(bool)), + copyAct, SLOT(setEnabled(bool))); +} +//! [24] + +//! [25] //! [26] +void MainWindow::createMenus() +//! [25] //! [27] +{ + fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->addAction(newAct); +//! [28] + fileMenu->addAction(openAct); +//! [28] + fileMenu->addAction(saveAct); +//! [26] + fileMenu->addAction(saveAsAct); + fileMenu->addSeparator(); + fileMenu->addAction(exitAct); + + editMenu = menuBar()->addMenu(tr("&Edit")); + editMenu->addAction(cutAct); + editMenu->addAction(copyAct); + editMenu->addAction(pasteAct); + + menuBar()->addSeparator(); + + helpMenu = menuBar()->addMenu(tr("&Help")); + helpMenu->addAction(aboutAct); + helpMenu->addAction(aboutQtAct); +} +//! [27] + +//! [29] //! [30] +void MainWindow::createToolBars() +{ + fileToolBar = addToolBar(tr("File")); + fileToolBar->addAction(newAct); +//! [29] //! [31] + fileToolBar->addAction(openAct); +//! [31] + fileToolBar->addAction(saveAct); + + editToolBar = addToolBar(tr("Edit")); + editToolBar->addAction(cutAct); + editToolBar->addAction(copyAct); + editToolBar->addAction(pasteAct); +} +//! [30] + +//! [32] +void MainWindow::createStatusBar() +//! [32] //! [33] +{ + statusBar()->showMessage(tr("Ready")); +} +//! [33] + +//! [34] //! [35] +void MainWindow::readSettings() +//! [34] //! [36] +{ + QSettings settings("QtProject", "Application Example"); + QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); + QSize size = settings.value("size", QSize(400, 400)).toSize(); + resize(size); + move(pos); +} +//! [35] //! [36] + +//! [37] //! [38] +void MainWindow::writeSettings() +//! [37] //! [39] +{ + QSettings settings("QtProject", "Application Example"); + settings.setValue("pos", pos()); + settings.setValue("size", size()); +} +//! [38] //! [39] + +//! [40] +bool MainWindow::maybeSave() +//! [40] //! [41] +{ + if (textEdit->document()->isModified()) { + QMessageBox::StandardButton ret; + ret = QMessageBox::warning(this, tr("Application"), + tr("The document has been modified.\n" + "Do you want to save your changes?"), + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + if (ret == QMessageBox::Save) + return save(); + else if (ret == QMessageBox::Cancel) + return false; + } + return true; +} +//! [41] + +//! [42] +void MainWindow::loadFile(const QString &fileName) +//! [42] //! [43] +{ + QFile file(fileName); + if (!file.open(QFile::ReadOnly | QFile::Text)) { + QMessageBox::warning(this, tr("Application"), + tr("Cannot read file %1:\n%2.") + .arg(fileName) + .arg(file.errorString())); + return; + } + + QTextStream in(&file); +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); +#endif + textEdit->setPlainText(in.readAll()); +#ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); +#endif + + setCurrentFile(fileName); + statusBar()->showMessage(tr("File loaded"), 2000); +} +//! [43] + +//! [44] +bool MainWindow::saveFile(const QString &fileName) +//! [44] //! [45] +{ + QFile file(fileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + QMessageBox::warning(this, tr("Application"), + tr("Cannot write file %1:\n%2.") + .arg(fileName) + .arg(file.errorString())); + return false; + } + + QTextStream out(&file); +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); +#endif + out << textEdit->toPlainText(); +#ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); +#endif + + setCurrentFile(fileName); + statusBar()->showMessage(tr("File saved"), 2000); + return true; +} +//! [45] + +//! [46] +void MainWindow::setCurrentFile(const QString &fileName) +//! [46] //! [47] +{ + curFile = fileName; + textEdit->document()->setModified(false); + setWindowModified(false); + + QString shownName = curFile; + if (curFile.isEmpty()) + shownName = "untitled.txt"; + setWindowFilePath(shownName); +} +//! [47] + +//! [48] +QString MainWindow::strippedName(const QString &fullFileName) +//! [48] //! [49] +{ + return QFileInfo(fullFileName).fileName(); +} +//! [49] diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc index 9f63eb0a7e6..30d86eac630 100644 --- a/src/corelib/doc/src/containers.qdoc +++ b/src/corelib/doc/src/containers.qdoc @@ -221,7 +221,7 @@ \codeline \snippet streaming/main.cpp 2 - \keyword default-constructed values + \keyword default-constructed value The documentation of certain container class functions refer to \e{default-constructed values}; for example, QVector diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc index 58da01f8354..cd31e36dee5 100644 --- a/src/corelib/doc/src/eventsandfilters.qdoc +++ b/src/corelib/doc/src/eventsandfilters.qdoc @@ -100,7 +100,7 @@ event delivery mechanisms are flexible. The documentation for QCoreApplication::notify() concisely tells the whole story; the \e{Qt Quarterly} article - \l{http://doc.qt.nokia.com/qq/qq11-events.html}{Another Look at Events} + \l{http://doc.qt.digia.com/qq/qq11-events.html}{Another Look at Events} rehashes it less concisely. Here we will explain enough for 95% of applications. diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index c92f7524769..86df385d9e6 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -64,4 +64,9 @@ /*! \externalpage http://www.ietf.org/rfc/rfc2045.txt \title RFC 2045 -*/
\ No newline at end of file +*/ + +/*! + \externalpage http://www.iana.org/assignments/character-sets/character-sets.xml + \title IANA character-sets encoding file +*/ diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 4a676c0fdf8..5ef6bb285c0 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -50,7 +50,7 @@ Here's an example \c .qrc file: - \quotefile mainwindows/application/application.qrc + \quotefile resource-system/application.qrc The resource files listed in the \c .qrc file are files that are part of the application's source tree. The specified paths are @@ -122,7 +122,7 @@ mentioned in the application's \c .pro file so that \c qmake knows about it. For example: - \snippet mainwindows/application/application.pro 0 + \snippet resource-system/application.pro 0 \c qmake will produce make rules to generate a file called \c qrc_application.cpp that is linked into the application. This @@ -167,7 +167,7 @@ pass a resource path instead of a file name to the QIcon, QImage, or QPixmap constructor: - \snippet mainwindows/application/mainwindow.cpp 21 + \snippet resource-system/mainwindow.cpp 21 See the \l{mainwindows/application}{Application} example for an actual application that uses Qt's resource system to store its diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b271620ee0a..1f1ff36442d 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -523,11 +523,11 @@ application to deadlock. \value UniqueConnection - Same as AutoConnection, but the connection is made only if - it does not duplicate an existing connection. i.e., if the - same signal is already connected to the same slot for the - same pair of objects, then the connection will fail. This - connection type was introduced in Qt 4.6. + This is a flag that can be combined with any one of the above + connection types, using a bitwise OR. When Qt::UniqueConnection is + set, QObject::connect() will fail if the connection already exists + (i.e. if the same signal is already connected to the same slot + for the same pair of objects). This flag was introduced in Qt 4.6. With queued connections, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the @@ -2493,7 +2493,7 @@ "\l{http://bugreports.qt-project.org/browse/QTWEBSITE-13}{http://bugreports.qt.../QTWEBSITE-13/}"), whereas Qt::ElideRight is appropriate for other strings (e.g., - "\l{http://qt.nokia.com/doc/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}"). + "\l{http://doc.qt.digia.com/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}"). \sa QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag, QTabBar::elideMode */ diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 4f3518aeb89..4df9c6b911e 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1640,8 +1640,8 @@ QString QIODevice::errorString() const all the requested information was read and therefore does not retry reading if there was a problem. - This function will be called with maxSize 0 when the device is - buffered and the buffer was emptied by a call to read(). + This function might be called with a maxSize of 0, which can be used to + perform post-reading operations. \sa read(), readLine(), writeData() */ diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index d249bb17fb1..693778e6298 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -364,7 +364,8 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() if (wchar_t *envStrings = GetEnvironmentStringsW()) { for (const wchar_t *entry = envStrings; *entry; ) { const int entryLen = int(wcslen(entry)); - if (const wchar_t *equal = wcschr(entry, L'=')) { + // + 1 to permit magic cmd variable names starting with = + if (const wchar_t *equal = wcschr(entry + 1, L'=')) { int nameLen = equal - entry; QString name = QString::fromWCharArray(entry, nameLen); QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index ed0ff8d2e21..c71bb3afac8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3887,7 +3887,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \section1 Examples: \list - \li qt.nokia.com becomes http://qt.nokia.com + \li qt-project.org becomes http://qt-project.org \li ftp.qt-project.org becomes ftp://ftp.qt-project.org \li hostname becomes http://hostname \li /home/user/test.html becomes file:///home/user/test.html diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h index 70b9d80f2df..c791f017d48 100644 --- a/src/corelib/kernel/qmetaobject_moc_p.h +++ b/src/corelib/kernel/qmetaobject_moc_p.h @@ -71,7 +71,7 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc break; } /* - We musn't convert 'char * const *' into 'const char **' + We mustn't convert 'char * const *' into 'const char **' and we must beware of 'Bar<const Bla>'. */ if (t[i] == '&' || t[i] == '*' ||t[i] == '<') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 69e2c6e1a25..e8c30d753e0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1917,7 +1917,11 @@ void QObject::removeEventFilter(QObject *obj) loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the - event loop is started. + event loop is started. If deleteLater() is called after the main event loop + has stopped, the object will not be deleted. + Since Qt 4.8, if deleteLater() is called on an object that lives in a + thread with no running event loop, the object will be destroyed when the + thread finishes. Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will \e not perform the deferred deletion; for the object to be diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h index 49fa1897f7a..e6f924814dd 100644 --- a/src/corelib/kernel/qobject_impl.h +++ b/src/corelib/kernel/qobject_impl.h @@ -76,14 +76,14 @@ namespace QtPrivate { { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), 0 }; return t; } }; template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, void> > > >, true> - { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), + { static const int *types() { static const int t[5] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), 0 }; return t; } }; template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, void> > > > >, true> - { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), + { static const int *types() { static const int t[6] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(), 0 }; return t; } }; template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > >, true> - { static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), + { static const int *types() { static const int t[7] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg6>::qt_metatype_id(), 0 }; return t; } }; #else diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index d8bc87d13e5..e4b4ce8b42f 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -69,7 +69,7 @@ class QThreadData; class QObjectConnectionListVector; namespace QtSharedPointer { struct ExternalRefCountData; } -/* for QtTestLib */ +/* for Qt Test */ struct QSignalSpyCallbackSet { typedef void (*BeginCallback)(QObject *caller, int signal_or_method_index, void **argv); diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index d0c2dd63804..667c490d31f 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -385,6 +385,7 @@ void QTimer::setInterval(int msec) /*! \property QTimer::remainingTime + \since 5.0 \brief the remaining time in milliseconds Returns the timer's remaining value in milliseconds left until the timeout. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 8cc26c5ff66..ed1a8a4974f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2960,7 +2960,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p) Returns the stored value converted to the template type \c{T}. Call canConvert() to find out whether a type can be converted. - If the value cannot be converted, \l{default-constructed value} + If the value cannot be converted, a \l{default-constructed value} will be returned. If the type \c{T} is supported by QVariant, this function behaves diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 712681024d9..bd8c6341c15 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -178,21 +178,38 @@ QThreadPrivate::~QThreadPrivate() \ingroup thread A QThread object manages one thread of control within the - program. To make code run in a separate thread, simply create a - QThread, change the thread affinity of the QObject(s) that - contain the code, and start() the new event loop. For example: + program. QThreads begin executing in run(). By default, run() starts the + event loop by calling exec() and runs a Qt event loop inside the thread. - \snippet code/src_corelib_thread_qthread.cpp 0 + You can use worker objects by moving them to the thread using + QObject::moveToThread. + + \snippet code/src_corelib_thread_qthread.cpp worker The code inside the Worker's slot would then execute in a - separate thread. In this example, the QThread triggers the - Worker's doWork() slot upon starting, and frees the Worker's - memory upon terminating. However, you are free to connect the + separate thread. However, you are free to connect the Worker's slots to any signal, from any object, in any thread. It is safe to connect signals and slots across different threads, thanks to a mechanism called \l{Qt::QueuedConnection}{queued connections}. + Another way to make code run in a separate thread, is to subclass QThread + and reimplement run(). For example: + + \snippet code/src_corelib_thread_qthread.cpp reimpl-run + + In that example, the thread will exit after the run function has returned. + There will not be any event loop running in the thread unless you call + exec(). + + It is important to remember that a QThread object usually lives + in the thread where it was created, not in the thread that it + manages. This oft-overlooked detail means that a QThread's slots + will be executed in the context of its home thread, not in the + context of the thread it is managing. For this reason, + implementing new slots in a QThread subclass is error-prone and + discouraged. + \note If you interact with an object, using any technique other than queued signal/slot connections (e.g. direct function calls), then the usual multithreading precautions need to be taken. @@ -200,7 +217,6 @@ QThreadPrivate::~QThreadPrivate() \note It is not possible to change the thread affinity of GUI objects; they must remain in the main thread. - \section1 Managing threads QThread will notifiy you via a signal when the thread is @@ -244,36 +260,6 @@ QThreadPrivate::~QThreadPrivate() \l{Mandelbrot Example}, as that is the name of the QThread subclass). Note that this is currently not available with release builds on Windows. - \section1 Subclassing QThread - - Subclassing QThread is unnecessary for most purposes, since - QThread provides fully-functional thread management capabilities. - Nonetheless, QThread can be subclassed if you wish to implement - advanced thread management. This is done by adding new member - functions to the subclass, and/or by reimplementing run(). - QThread's run() function is analogous to an application's main() - function -- it is executed when the thread is started, and the - thread will end when it returns. - - \note Prior to Qt 4.4, the only way to use QThread for parallel - processing was to subclass it and implement the processing code - inside run(). This approach is now considered \b {bad practice}; - a QThread should only manage a thread, not process data. - - If you require event handling and signal/slot connections to - work in your thread, and if you reimplement run(), you must - explicitly call exec() at the end of your reimplementation: - - \snippet code/src_corelib_thread_qthread.cpp 1 - - It is important to remember that a QThread object usually lives - in the thread where it was created, not in the thread that it - manages. This oft-overlooked detail means that a QThread's slots - will be executed in the context of its home thread, not in the - context of the thread it is managing. For this reason, - implementing new slots in a QThread subclass is error-prone and - discouraged. - \sa {Thread Support in Qt}, QThreadStorage, QMutex, QSemaphore, QWaitCondition, {Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index a79486115da..55353dc258d 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -84,7 +84,7 @@ /*! \fn QPair::QPair() Constructs an empty pair. The \c first and \c second elements are - initialized with \l{default-constructed values}. + initialized with \l{default-constructed value}s. */ /*! diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 1a9c25837ef..b9d546452f6 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -139,7 +139,8 @@ #endif // other x86 intrinsics -#if defined(QT_COMPILER_SUPPORTS_AVX) && defined(Q_CC_GNU) +#if defined(QT_COMPILER_SUPPORTS_AVX) && defined(Q_CC_GNU) && \ + (!defined(Q_CC_INTEL)|| __INTEL_COMPILER >= 1310 || (__GNUC__ * 100 + __GNUC_MINOR__ < 407)) #define QT_COMPILER_SUPPORTS_X86INTRIN #include <x86intrin.h> #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index ed8cb734f54..0be0a844596 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4965,7 +4965,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, lists of strings to the user. On Mac OS X since Qt 4.3, this function compares according the - "Order for sorted lists" setting in the International prefereces panel. + "Order for sorted lists" setting in the International preferences panel. \sa compare(), QTextCodec::locale() */ diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 455df4ec73d..4be4593e95b 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -1958,7 +1958,7 @@ QStringRef QXmlStreamReader::text() const } -/*! If the state() is \l DTD, this function returns the DTD's +/*! If the tokenType() is \l DTD, this function returns the DTD's notation declarations. Otherwise an empty vector is returned. The QXmlStreamNotationDeclarations class is defined to be a QVector @@ -1973,7 +1973,7 @@ QXmlStreamNotationDeclarations QXmlStreamReader::notationDeclarations() const } -/*! If the state() is \l DTD, this function returns the DTD's +/*! If the tokenType() is \l DTD, this function returns the DTD's unparsed (external) entity declarations. Otherwise an empty vector is returned. The QXmlStreamEntityDeclarations class is defined to be a QVector @@ -1990,7 +1990,7 @@ QXmlStreamEntityDeclarations QXmlStreamReader::entityDeclarations() const /*! \since 4.4 - If the state() is \l DTD, this function returns the DTD's + If the tokenType() is \l DTD, this function returns the DTD's name. Otherwise an empty string is returned. */ @@ -2005,7 +2005,7 @@ QStringRef QXmlStreamReader::dtdName() const /*! \since 4.4 - If the state() is \l DTD, this function returns the DTD's + If the tokenType() is \l DTD, this function returns the DTD's public identifier. Otherwise an empty string is returned. */ @@ -2020,7 +2020,7 @@ QStringRef QXmlStreamReader::dtdPublicId() const /*! \since 4.4 - If the state() is \l DTD, this function returns the DTD's + If the tokenType() is \l DTD, this function returns the DTD's system identifier. Otherwise an empty string is returned. */ @@ -2032,7 +2032,7 @@ QStringRef QXmlStreamReader::dtdSystemId() const return QStringRef(); } -/*! If the state() is \l StartElement, this function returns the +/*! If the tokenType() is \l StartElement, this function returns the element's namespace declarations. Otherwise an empty vector is returned. @@ -2845,7 +2845,7 @@ bool QXmlStreamReader::isStandaloneDocument() const /*! \since 4.4 - If the state() is \l StartDocument, this function returns the + If the tokenType() is \l StartDocument, this function returns the version string as specified in the XML declaration. Otherwise an empty string is returned. */ @@ -2860,7 +2860,7 @@ QStringRef QXmlStreamReader::documentVersion() const /*! \since 4.4 - If the state() is \l StartDocument, this function returns the + If the tokenType() is \l StartDocument, this function returns the encoding string as specified in the XML declaration. Otherwise an empty string is returned. */ diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index dc0bb353c92..cd7b4fe14ef 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -207,18 +207,18 @@ public: inline QStringRef addToStringStorage(const QStringRef &s) { int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); + int sz = s.size(); + if (pos != tagStackStringStorage.size()) + tagStackStringStorage.resize(pos); tagStackStringStorage.insert(pos, s.unicode(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); } inline QStringRef addToStringStorage(const QString &s) { int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); + int sz = s.size(); + if (pos != tagStackStringStorage.size()) + tagStackStringStorage.resize(pos); tagStackStringStorage.insert(pos, s.unicode(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); @@ -525,7 +525,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::StartElement: name.clear(); prefix.clear(); - qualifiedName.clear(); + qualifiedName.clear(); namespaceUri.clear(); if (publicNamespaceDeclarations.size()) publicNamespaceDeclarations.clear(); @@ -536,7 +536,7 @@ bool QXmlStreamReaderPrivate::parse() Tag &tag = tagStack_pop(); namespaceUri = tag.namespaceDeclaration.namespaceUri; name = tag.name; - qualifiedName = tag.qualifiedName; + qualifiedName = tag.qualifiedName; isEmptyElement = false; return true; } @@ -545,7 +545,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::EndElement: name.clear(); prefix.clear(); - qualifiedName.clear(); + qualifiedName.clear(); namespaceUri.clear(); clearTextBuffer(); break; @@ -559,7 +559,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::Comment: case QXmlStreamReader::Characters: isCDATA = false; - isWhitespace = true; + isWhitespace = true; text.clear(); clearTextBuffer(); break; @@ -571,21 +571,21 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::ProcessingInstruction: processingInstructionTarget.clear(); processingInstructionData.clear(); - clearTextBuffer(); + clearTextBuffer(); break; case QXmlStreamReader::NoToken: case QXmlStreamReader::Invalid: break; case QXmlStreamReader::StartDocument: - lockEncoding = true; + lockEncoding = true; documentVersion.clear(); documentEncoding.clear(); #ifndef QT_NO_TEXTCODEC - if(decoder->hasFailure()) { - raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); - readBuffer.clear(); - return false; - } + if (decoder->hasFailure()) { + raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); + readBuffer.clear(); + return false; + } #endif // fall through default: @@ -1225,7 +1225,7 @@ cdata ::= langle_bang CDATA_START; case $rule_number: { setType(QXmlStreamReader::Characters); isCDATA = true; - isWhitespace = false; + isWhitespace = false; int pos = sym(2).pos; if (scanUntil("]]>", -1)) { text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); @@ -1294,7 +1294,7 @@ scan_content_char ::= SPACE; resume($rule_number); return false; } - break; + break; ./ content_char_list ::= content_char_list char_ref; @@ -1310,11 +1310,11 @@ content_char_list ::= scan_content_char; character_content ::= content_char_list %prec SHIFT_THERE; /. case $rule_number: - if (!textBuffer.isEmpty()) { + if (!textBuffer.isEmpty()) { setType(QXmlStreamReader::Characters); text = &textBuffer; - } - break; + } + break; ./ literal ::= QUOTE QUOTE; @@ -1361,7 +1361,7 @@ literal_content_start ::= LETTER | DIGIT | RANGLE | HASH | LBRACK | RBRACK | LPA literal_content_start ::= SPACE; /. case $rule_number: - if (normalizeLiterals) + if (normalizeLiterals) textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); break; ./ @@ -1405,7 +1405,7 @@ entity_value ::= QUOTE entity_value_content_with_dblquote QUOTE; entity_value ::= DBLQUOTE entity_value_content_with_quote DBLQUOTE; /. case $rule_number: - sym(1) = sym(2); + sym(1) = sym(2); break; ./ @@ -1609,7 +1609,7 @@ unresolved_entity ::= UNRESOLVED_ENTITY; } setType(QXmlStreamReader::EntityReference); name = &unresolvedEntity; - break; + break; ./ entity_ref ::= AMPERSAND name SEMICOLON; @@ -1646,10 +1646,10 @@ entity_ref ::= AMPERSAND name SEMICOLON; } } - injectToken(UNRESOLVED_ENTITY); - unresolvedEntity = symString(2).toString(); - textBuffer.chop(2 + sym(2).len); - clearSym(); + injectToken(UNRESOLVED_ENTITY); + unresolvedEntity = symString(2).toString(); + textBuffer.chop(2 + sym(2).len); + clearSym(); } break; ./ diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 8276fe27210..68b7ff7af34 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -701,18 +701,18 @@ public: inline QStringRef addToStringStorage(const QStringRef &s) { int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); + int sz = s.size(); + if (pos != tagStackStringStorage.size()) + tagStackStringStorage.resize(pos); tagStackStringStorage.insert(pos, s.unicode(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); } inline QStringRef addToStringStorage(const QString &s) { int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); + int sz = s.size(); + if (pos != tagStackStringStorage.size()) + tagStackStringStorage.resize(pos); tagStackStringStorage.insert(pos, s.unicode(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); @@ -1019,7 +1019,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::StartElement: name.clear(); prefix.clear(); - qualifiedName.clear(); + qualifiedName.clear(); namespaceUri.clear(); if (publicNamespaceDeclarations.size()) publicNamespaceDeclarations.clear(); @@ -1030,7 +1030,7 @@ bool QXmlStreamReaderPrivate::parse() Tag &tag = tagStack_pop(); namespaceUri = tag.namespaceDeclaration.namespaceUri; name = tag.name; - qualifiedName = tag.qualifiedName; + qualifiedName = tag.qualifiedName; isEmptyElement = false; return true; } @@ -1039,7 +1039,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::EndElement: name.clear(); prefix.clear(); - qualifiedName.clear(); + qualifiedName.clear(); namespaceUri.clear(); clearTextBuffer(); break; @@ -1053,7 +1053,7 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::Comment: case QXmlStreamReader::Characters: isCDATA = false; - isWhitespace = true; + isWhitespace = true; text.clear(); clearTextBuffer(); break; @@ -1065,21 +1065,21 @@ bool QXmlStreamReaderPrivate::parse() case QXmlStreamReader::ProcessingInstruction: processingInstructionTarget.clear(); processingInstructionData.clear(); - clearTextBuffer(); + clearTextBuffer(); break; case QXmlStreamReader::NoToken: case QXmlStreamReader::Invalid: break; case QXmlStreamReader::StartDocument: - lockEncoding = true; + lockEncoding = true; documentVersion.clear(); documentEncoding.clear(); #ifndef QT_NO_TEXTCODEC - if(decoder->hasFailure()) { - raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); - readBuffer.clear(); - return false; - } + if (decoder->hasFailure()) { + raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); + readBuffer.clear(); + return false; + } #endif // fall through default: @@ -1550,7 +1550,7 @@ bool QXmlStreamReaderPrivate::parse() case 101: { setType(QXmlStreamReader::Characters); isCDATA = true; - isWhitespace = false; + isWhitespace = false; int pos = sym(2).pos; if (scanUntil("]]>", -1)) { text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); @@ -1597,14 +1597,14 @@ bool QXmlStreamReaderPrivate::parse() resume(130); return false; } - break; + break; case 139: - if (!textBuffer.isEmpty()) { + if (!textBuffer.isEmpty()) { setType(QXmlStreamReader::Characters); text = &textBuffer; - } - break; + } + break; case 140: case 141: @@ -1624,7 +1624,7 @@ bool QXmlStreamReaderPrivate::parse() break; case 173: - if (normalizeLiterals) + if (normalizeLiterals) textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); break; @@ -1651,7 +1651,7 @@ bool QXmlStreamReaderPrivate::parse() case 178: case 179: - sym(1) = sym(2); + sym(1) = sym(2); break; case 180: @@ -1789,7 +1789,7 @@ bool QXmlStreamReaderPrivate::parse() } setType(QXmlStreamReader::EntityReference); name = &unresolvedEntity; - break; + break; case 240: { sym(1).len += sym(2).len + 1; @@ -1823,10 +1823,10 @@ bool QXmlStreamReaderPrivate::parse() } } - injectToken(UNRESOLVED_ENTITY); - unresolvedEntity = symString(2).toString(); - textBuffer.chop(2 + sym(2).len); - clearSym(); + injectToken(UNRESOLVED_ENTITY); + unresolvedEntity = symString(2).toString(); + textBuffer.chop(2 + sym(2).len); + clearSym(); } break; diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in index 03640f8ccd1..8ecf7ceb5ca 100644 --- a/src/dbus/Qt5DBusConfigExtras.cmake.in +++ b/src/dbus/Qt5DBusConfigExtras.cmake.in @@ -1,12 +1,10 @@ -get_filename_component(_qt5_dbus_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) - if (NOT TARGET Qt5::qdbuscpp2xml) add_executable(Qt5::qdbuscpp2xml IMPORTED) set_target_properties(Qt5::qdbuscpp2xml PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_dbus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\" !!ENDIF @@ -18,7 +16,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp) set_target_properties(Qt5::qdbusxml2cpp PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_dbus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\" !!ENDIF diff --git a/src/dbus/doc/qtdbus.qdocconf b/src/dbus/doc/qtdbus.qdocconf index 1ff4c0d6c7e..f3b4c0f1d7b 100644 --- a/src/dbus/doc/qtdbus.qdocconf +++ b/src/dbus/doc/qtdbus.qdocconf @@ -36,7 +36,7 @@ qhp.qtdbus.file = qtdbus.qhp # Namespace for the output file. This namespace is used to distinguish between # different documentation files in Creator/Assistant. -qhp.qtdbus.namespace = org.qt-project.qtdbus.510 +qhp.qtdbus.namespace = org.qt-project.qtdbus.$QT_VERSION_TAG # Title for the package, will be the main title for the package in # Assistant/Creator. diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h index 92553544ebf..8f8954c1ce2 100644 --- a/src/dbus/qdbusmessage.h +++ b/src/dbus/qdbusmessage.h @@ -49,6 +49,10 @@ #ifndef QT_NO_DBUS +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + QT_BEGIN_NAMESPACE diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index c77aa0bcb95..016e9b6d079 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -282,10 +282,10 @@ public: Canvas = 0x00000035, Animation = 0x00000036, Equation = 0x00000037, - ButtonDropDown = 0x00000038, + ButtonDropDown = 0x00000038, // The object represents a button that expands a grid. ButtonMenu = 0x00000039, ButtonDropGrid = 0x0000003A, - Whitespace = 0x0000003B, + Whitespace = 0x0000003B, // The object represents blank space between other objects. PageTabList = 0x0000003C, Clock = 0x0000003D, Splitter = 0x0000003E, diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index 469aa004726..fcf6cdf57c0 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation -url = http://qt-project.org/doc/qtgui -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtgui +version = $QT_VERSION examplesinstallpath = gui qhp.projects = QtGui qhp.QtGui.file = qtgui.qhp -qhp.QtGui.namespace = org.qt-project.qtgui.510 +qhp.QtGui.namespace = org.qt-project.qtgui.$QT_VERSION_TAG qhp.QtGui.virtualFolder = qtgui qhp.QtGui.indexTitle = Qt GUI qhp.QtGui.indexRoot = -qhp.QtGui.filterAttributes = qtgui 5.1.0 qtrefdoc -qhp.QtGui.customFilters.Qt.name = Qtgui 5.1.0 -qhp.QtGui.customFilters.Qt.filterAttributes = qtgui 5.1.0 +qhp.QtGui.filterAttributes = qtgui $QT_VERSION qtrefdoc +qhp.QtGui.customFilters.Qt.name = Qtgui $QT_VERSION +qhp.QtGui.customFilters.Qt.filterAttributes = qtgui $QT_VERSION qhp.QtGui.subprojects = classes qhp.QtGui.subprojects.classes.title = C++ Classes diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp index 79cef3b5ef9..6a012879d41 100644 --- a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp +++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp @@ -213,7 +213,7 @@ painter.drawPixmap(target, image, source); //! [17] QPainter painter(this); -painter.drawText(rect, Qt::AlignCenter, tr("Qt by\nNokia")); +painter.drawText(rect, Qt::AlignCenter, tr("Qt\nProject")); //! [17] diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 062714c7696..6abde5e420c 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -143,7 +143,7 @@ static QDataStream &operator<<(QDataStream &s, const BMP_INFOHDR &bi) return s; } -static int calc_shift(int mask) +static int calc_shift(uint mask) { int result = 0; while (mask && !(mask & 1)) { @@ -207,9 +207,9 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int #endif int w = bi.biWidth, h = bi.biHeight, nbits = bi.biBitCount; int t = bi.biSize, comp = bi.biCompression; - int red_mask = 0; - int green_mask = 0; - int blue_mask = 0; + uint red_mask = 0; + uint green_mask = 0; + uint blue_mask = 0; int red_shift = 0; int green_shift = 0; int blue_shift = 0; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index de1e555771e..975ef54d6b0 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -99,8 +99,6 @@ QImageData::QImageData() format(QImage::Format_ARGB32), bytes_per_line(0), ser_no(qimage_serial_number.fetchAndAddRelaxed(1)), detach_no(0), - ldpmx(qt_defaultDpiX() * 100 / qreal(2.54)), - ldpmy(qt_defaultDpiY() * 100 / qreal(2.54)), dpmx(qt_defaultDpiX() * 100 / qreal(2.54)), dpmy(qt_defaultDpiY() * 100 / qreal(2.54)), offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false), @@ -4984,11 +4982,11 @@ int QImage::metric(PaintDeviceMetric metric) const return d->depth; case PdmDpiX: - return qRound(d->ldpmx * 0.0254); + return qRound(d->dpmx * 0.0254); break; case PdmDpiY: - return qRound(d->ldpmy * 0.0254); + return qRound(d->dpmy * 0.0254); break; case PdmPhysicalDpiX: diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index e79eb9d5621..18c686e917f 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -82,10 +82,8 @@ struct Q_GUI_EXPORT QImageData { // internal image data int ser_no; // serial number int detach_no; - qreal ldpmx; // logical dots per meter X (or 0) - qreal ldpmy; // logical dots per meter Y (or 0) - qreal dpmx; // device dots per meter X (or 0) - qreal dpmy; // device dots per meter Y (or 0) + qreal dpmx; // dots per meter X (or 0) + qreal dpmy; // dots per meter Y (or 0) QPoint offset; // offset in pixels uint own_data : 1; diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 286169426e0..89930f3b203 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -162,11 +162,14 @@ enum _qt_BuiltInFormatType { #endif #ifndef QT_NO_IMAGEFORMAT_JPEG _qt_JpgFormat, + _qt_JpegFormat, #endif #ifdef QT_BUILTIN_GIF_READER _qt_GifFormat, #endif +#ifndef QT_NO_IMAGEFORMAT_BMP _qt_BmpFormat, +#endif #ifndef QT_NO_IMAGEFORMAT_PPM _qt_PpmFormat, _qt_PgmFormat, @@ -195,11 +198,14 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { #endif #ifndef QT_NO_IMAGEFORMAT_JPEG {_qt_JpgFormat, "jpg", "image/jpeg"}, + {_qt_JpegFormat, "jpeg"}, #endif #ifdef QT_BUILTIN_GIF_READER {_qt_GifFormat, "gif", "image/gif"}, #endif +#ifndef QT_NO_IMAGEFORMAT_BMP {_qt_BmpFormat, "bmp", "image/bmp"}, +#endif #ifndef QT_NO_IMAGEFORMAT_PPM {_qt_PpmFormat, "ppm", "image/x-portable-pixmap"}, {_qt_PgmFormat, "pgm", "image/x-portable-graymap"}, @@ -423,6 +429,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, #endif #ifndef QT_NO_IMAGEFORMAT_JPEG case _qt_JpgFormat: + case _qt_JpegFormat: if (QJpegHandler::canRead(device)) handler = new QJpegHandler; break; diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 9ce3a774ed5..8823f9293d2 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -728,7 +728,9 @@ void supportedImageHandlerMimeTypes(QFactoryLoader *loader, QList<QByteArray> QImageWriter::supportedImageFormats() { QSet<QByteArray> formats; +#ifndef QT_NO_IMAGEFORMAT_BMP formats << "bmp"; +#endif #ifndef QT_NO_IMAGEFORMAT_PPM formats << "pbm" << "pgm" << "ppm"; #endif diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index bfc31930dd9..f6de22851de 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1278,6 +1278,7 @@ QList<QByteArray> QPicture::outputFormats() \ingroup painting \ingroup io + \inmodule QtGui QPictureIO contains a QIODevice object that is used for picture data I/O. The programmer can install new picture file formats in addition diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp index bef72595ad5..29d69122011 100644 --- a/src/gui/image/qpictureformatplugin.cpp +++ b/src/gui/image/qpictureformatplugin.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE for custom picture format plugins. \ingroup plugins + \inmodule QtGui The picture format plugin is a simple plugin interface that makes it easy to create custom picture formats that can be used diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index ed477e767ba..85f0dc2d92b 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -763,6 +763,8 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers return false; } + detach(); + QFileInfo info(fileName); QString key = QLatin1String("qt_pixmap") % info.absoluteFilePath() diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 47d6f336342..f4d2afed7af 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -75,22 +75,20 @@ QT_BEGIN_NAMESPACE behavior of the QHash and QCache classes. The cache becomes full when the total size of all pixmaps in the - cache exceeds cacheLimit(). The initial cache limit is - 2048 KB (2 MB) on embedded platforms, 10240 KB (10 MB) on desktop - platforms; you can change this by calling setCacheLimit() with the - required value. + cache exceeds cacheLimit(). The initial cache limit is 10240 KB (10 MB); + you can change this by calling setCacheLimit() with the required value. A pixmap takes roughly (\e{width} * \e{height} * \e{depth})/8 bytes of memory. The \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq12-qpixmapcache.html}{Optimizing + \l{http://doc.qt.digia.com/qq/qq12-qpixmapcache.html}{Optimizing with QPixmapCache} explains how to use QPixmapCache to speed up applications by caching the results of painting. \sa QCache, QPixmap */ -static int cache_limit = 10240; // 10 MB cache limit for desktop +static int cache_limit = 10240; // 10 MB cache limit /*! \class QPixmapCache::Key @@ -596,8 +594,7 @@ bool QPixmapCache::replace(const Key &key, const QPixmap &pixmap) /*! Returns the cache limit (in kilobytes). - The default cache limit is 2048 KB on embedded platforms, 10240 KB on - desktop platforms. + The default cache limit is 10240 KB. \sa setCacheLimit() */ @@ -610,8 +607,7 @@ int QPixmapCache::cacheLimit() /*! Sets the cache limit to \a n kilobytes. - The default setting is 2048 KB on embedded platforms, 10240 KB on - desktop platforms. + The default setting is 10240 KB. \sa cacheLimit() */ diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 3a6c0804ab5..d6161671b15 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -1470,7 +1470,7 @@ void QStandardItem::insertRow(int row, const QList<QStandardItem*> &items) } /*! - Inserts \a items at \a row. The column count wont be changed. + Inserts \a items at \a row. The column count won't be changed. \sa insertRow(), insertColumn() */ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 33e3b7e1b70..e9527bdc48b 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE /*! \class QEnterEvent \ingroup events + \inmodule QtGui \brief The QEnterEvent class contains parameters that describe an enter event. @@ -144,6 +145,7 @@ QInputEvent::~QInputEvent() /*! \class QMouseEvent \ingroup events + \inmodule QtGui \brief The QMouseEvent class contains parameters that describe a mouse event. @@ -412,6 +414,7 @@ QMouseEvent::~QMouseEvent() /*! \class QHoverEvent \ingroup events + \inmodule QtGui \brief The QHoverEvent class contains parameters that describe a mouse event. @@ -797,6 +800,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, \brief The QKeyEvent class describes a key event. \ingroup events + \inmodule QtGui Key events are sent to the widget with keyboard input focus when keys are pressed or released. @@ -1728,6 +1732,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) /*! \class QInputMethodEvent::Attribute + \inmodule QtGui \brief The QInputMethodEvent::Attribute class stores an input method attribute. */ @@ -1752,7 +1757,7 @@ QInputMethodEvent::QInputMethodEvent() } /*! - Construcs an event of type QEvent::InputMethod. The + Constructs an event of type QEvent::InputMethod. The preedit text is set to \a preeditText, the attributes to \a attributes. diff --git a/src/gui/kernel/qgenericplugin.cpp b/src/gui/kernel/qgenericplugin.cpp index c3301a4e34d..98709804de0 100644 --- a/src/gui/kernel/qgenericplugin.cpp +++ b/src/gui/kernel/qgenericplugin.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \class QGenericPlugin \ingroup plugins + \inmodule QtGui \brief The QGenericPlugin class is an abstract base class for plugins. diff --git a/src/gui/kernel/qgenericpluginfactory.cpp b/src/gui/kernel/qgenericpluginfactory.cpp index cecaf060cea..8e3b45d1a83 100644 --- a/src/gui/kernel/qgenericpluginfactory.cpp +++ b/src/gui/kernel/qgenericpluginfactory.cpp @@ -61,6 +61,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, /*! \class QGenericPluginFactory \ingroup plugins + \inmodule QtGui \brief The QGenericPluginFactory class creates plugin drivers. diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c73eeadbfbe..3a8428b3321 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -851,15 +851,6 @@ void QGuiApplicationPrivate::createPlatformIntegration() // Load the platform integration QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); - // On Mac, look inside the application bundle for the platform plugin. - // TODO (msorvig): Create proper cross-platform solution for loading - // deployed platform plugins -#ifdef Q_OS_MAC - const QString bundlePluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/"); - if (platformPluginPath.isEmpty() && QDir(bundlePluginPath).exists()) { - platformPluginPath = bundlePluginPath; - } -#endif QByteArray platformName; #ifdef QT_QPA_DEFAULT_PLATFORM_NAME diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index bf3de0de8df..645c13a2ea8 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -165,7 +165,7 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context QGuiGLThreadContext *threadContext = qwindow_context_storage.localData(); if (!threadContext) { if (!QThread::currentThread()) { - qWarning("No QTLS available. currentContext wont work"); + qWarning("No QTLS available. currentContext won't work"); return 0; } threadContext = new QGuiGLThreadContext; @@ -667,7 +667,7 @@ QScreen *QOpenGLContext::screen() const } /*! - internal: Needs to have a pointer to qGLContext. But since this is in Qt GUI we cant + internal: Needs to have a pointer to qGLContext. But since this is in Qt GUI we can't have any type information. \internal diff --git a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp index 0976bf320d6..13de2c658aa 100644 --- a/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp +++ b/src/gui/kernel/qplatformsystemtrayicon_qpa.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \class QPlatformSystemTrayIcon + \inmodule QtGui \brief The QPlatformSystemTrayIcon class abstracts the system tray icon and interaction. \sa QSystemTray diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 88a82b12a3f..1eec6bfefc2 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -42,6 +42,7 @@ #include "qplatformwindow.h" #include "qplatformwindow_p.h" +#include <private/qguiapplication_p.h> #include <qpa/qwindowsysteminterface.h> #include <QtGui/qwindow.h> #include <QtGui/qscreen.h> @@ -437,6 +438,29 @@ bool QPlatformWindow::frameStrutEventsEnabled() const } /*! + Call this method to put together a window title composed of + \a title + \a separator + the application display name + + If the display name isn't set, and the title is empty, the raw app name is used. +*/ +QString QPlatformWindow::formatWindowTitle(const QString &title, const QString &separator) +{ + QString fullTitle = title; + if (QGuiApplicationPrivate::displayName) { + // Append display name, if set. + if (!fullTitle.isEmpty()) + fullTitle += separator; + fullTitle += *QGuiApplicationPrivate::displayName; + } else if (fullTitle.isEmpty()) { + // Don't let the window title be completely empty, use the app name as fallback. + fullTitle = QCoreApplication::applicationName(); + } + return fullTitle; +} + +/*! \class QPlatformWindow \since 4.8 \internal diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index 2fa5d3ed0b6..e3e460b54ca 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -129,6 +129,8 @@ public: virtual bool frameStrutEventsEnabled() const; protected: + static QString formatWindowTitle(const QString &title, const QString &separator); + QScopedPointer<QPlatformWindowPrivate> d_ptr; private: Q_DISABLE_COPY(QPlatformWindow) diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 6d42613727c..25b603bb9cd 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -130,7 +130,6 @@ public: \value StereoBuffers Used to request stereo buffers in the surface format. \value DebugContext Used to request a debug context with extra debugging information. - This requires OpenGL version 3.0 or higher. \value DeprecatedFunctions Used to request that deprecated functions be included in the OpenGL context profile. If not specified, you should get a forward compatible context without support functionality marked as deprecated. This requires OpenGL version 3.0 or higher. diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index bf3eb677782..69ae30389eb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1316,7 +1316,7 @@ void QWindow::setFramePosition(const QPoint &point) if (d->platformWindow) { d->platformWindow->setGeometry(QRect(point, size())); } else { - d->geometry.setTopLeft(point); + d->geometry.moveTopLeft(point); } } diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index adb8cbd962f..a4a626a0c4d 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -93,6 +93,7 @@ typedef GLfloat GLdouble; # if defined(Q_OS_WIN) # include <QtCore/qt_windows.h> # endif +# define GL_GLEXT_LEGACY // Prevents GL/gl.h form #including system glext.h # include <GL/gl.h> # include <QtGui/qopenglext.h> # endif // Q_OS_MAC diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 5582f777a50..7397dc7fc28 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -31,6 +31,7 @@ can be painted on with QPainter. \ingroup painting + \inmodule QtGui A paint device is an abstraction of a two-dimensional space that can be drawn on using a QPainter. Its default coordinate system has diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index fd867ebde66..801a5689c16 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -296,6 +296,7 @@ QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : \class QRasterPaintEngine \preliminary \ingroup qws + \inmodule QtGui \since 4.2 \brief The QRasterPaintEngine class enables hardware acceleration diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 4699d7cd996..522965c1047 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -663,7 +663,7 @@ void QNetworkReplyHttpImplPrivate::postRequest() // unsuitable proxies QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProxyNotFoundError), - Q_ARG(QString, q->tr("No suitable proxy found"))); + Q_ARG(QString, QNetworkReplyHttpImpl::tr("No suitable proxy found"))); QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); return; } diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index a2ab83d3950..20353726acb 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -59,6 +59,10 @@ #include <QtCore/qmutex.h> #include <QtCore/qmap.h> +#ifdef Q_OS_BLACKBERRY +#include <bps/netstatus.h> +#endif + QT_BEGIN_NAMESPACE typedef QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> QNetworkConfigurationPrivatePointer; @@ -70,6 +74,9 @@ public: type(QNetworkConfiguration::Invalid), purpose(QNetworkConfiguration::UnknownPurpose), bearerType(QNetworkConfiguration::BearerUnknown), +#ifdef Q_OS_BLACKBERRY + oldIpStatus(NETSTATUS_IP_STATUS_ERROR_UNKNOWN), +#endif isValid(false), roamingSupported(false) {} virtual ~QNetworkConfigurationPrivate() @@ -90,6 +97,10 @@ public: QNetworkConfiguration::Purpose purpose; QNetworkConfiguration::BearerType bearerType; +#ifdef Q_OS_BLACKBERRY + netstatus_ip_status_t oldIpStatus; +#endif + bool isValid; bool roamingSupported; diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf index 496dda967b2..048b3325b67 100644 --- a/src/network/doc/qtnetwork.qdocconf +++ b/src/network/doc/qtnetwork.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtNetwork description = Qt Network Reference Documentation -url = http://qt-project.org/doc/qtnetwork -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtnetwork +version = $QT_VERSION examplesinstallpath = network qhp.projects = QtNetwork qhp.QtNetwork.file = qtnetwork.qhp -qhp.QtNetwork.namespace = org.qt-project.qtnetwork.510 +qhp.QtNetwork.namespace = org.qt-project.qtnetwork.$QT_VERSION_TAG qhp.QtNetwork.virtualFolder = qtnetwork qhp.QtNetwork.indexTitle = Qt Network qhp.QtNetwork.indexRoot = -qhp.QtNetwork.filterAttributes = qtnetwork 5.1.0 qtrefdoc -qhp.QtNetwork.customFilters.Qt.name = QtNetwork 5.1.0 -qhp.QtNetwork.customFilters.Qt.filterAttributes = qtnetwork 5.1.0 +qhp.QtNetwork.filterAttributes = qtnetwork $QT_VERSION qtrefdoc +qhp.QtNetwork.customFilters.Qt.name = QtNetwork $QT_VERSION +qhp.QtNetwork.customFilters.Qt.filterAttributes = qtnetwork $QT_VERSION qhp.QtNetwork.subprojects = classes qhp.QtNetwork.subprojects.classes.title = C++ Classes diff --git a/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp b/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp index 327bb8beee1..f0506f1f41c 100644 --- a/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp +++ b/src/network/doc/snippets/code/src_network_access_qnetworkaccessmanager.cpp @@ -43,13 +43,13 @@ QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); -manager->get(QNetworkRequest(QUrl("http://qt.nokia.com"))); +manager->get(QNetworkRequest(QUrl("http://qt-project.org"))); //! [0] //! [1] QNetworkRequest request; -request.setUrl(QUrl("http://qt.nokia.com")); +request.setUrl(QUrl("http://qt-project.org")); request.setRawHeader("User-Agent", "MyOwnBrowser 1.0"); QNetworkReply *reply = manager->get(request); diff --git a/src/network/doc/snippets/code/src_network_access_qnetworkdiskcache.cpp b/src/network/doc/snippets/code/src_network_access_qnetworkdiskcache.cpp index fd95c6947b9..a017d43dce3 100644 --- a/src/network/doc/snippets/code/src_network_access_qnetworkdiskcache.cpp +++ b/src/network/doc/snippets/code/src_network_access_qnetworkdiskcache.cpp @@ -47,11 +47,11 @@ manager->setCache(diskCache); //! [1] // do a normal request (preferred from network, as this is the default) -QNetworkRequest request(QUrl(QString("http://qt.nokia.com"))); +QNetworkRequest request(QUrl(QString("http://qt-project.org"))); manager->get(request); // do a request preferred from cache -QNetworkRequest request2(QUrl(QString("http://qt.nokia.com"))); +QNetworkRequest request2(QUrl(QString("http://qt-project.org"))); request2.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); manager->get(request2); //! [1] diff --git a/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp b/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp index 67645a6628d..dae999676e2 100644 --- a/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp +++ b/src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp @@ -39,8 +39,8 @@ ****************************************************************************/ //! [0] -// To find the IP address of qt.nokia.com -QHostInfo::lookupHost("qt.nokia.com", +// To find the IP address of qt-project.org +QHostInfo::lookupHost("qt-project.org", this, SLOT(printResults(QHostInfo))); // To find the host name for 4.2.2.1 @@ -50,7 +50,7 @@ QHostInfo::lookupHost("4.2.2.1", //! [1] -QHostInfo info = QHostInfo::fromName("qt.nokia.com"); +QHostInfo info = QHostInfo::fromName("qt-project.org"); //! [1] diff --git a/src/network/kernel/qurlinfo.cpp b/src/network/kernel/qurlinfo.cpp index db5105a52bb..89d48639cf2 100644 --- a/src/network/kernel/qurlinfo.cpp +++ b/src/network/kernel/qurlinfo.cpp @@ -217,7 +217,7 @@ QUrlInfo::QUrlInfo(const QUrl &url, int permissions, const QString &owner, /*! Sets the name of the URL to \a name. The name is the full text, - for example, "http://qt.nokia.com/doc/qurlinfo.html". + for example, "http://qt-project.org/doc/qt-5.0/qtcore/qurl.html". If you call this function for an invalid URL info, this function turns it into a valid one. diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 49eb71a20e0..e846e43e730 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -248,7 +248,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) QLatin1String("QLocalSocket::connectToServer")); return; } - // set non blocking so we can try to connect and it wont wait + // set non blocking so we can try to connect and it won't wait int flags = fcntl(d->connectingSocket, F_GETFL, 0); if (-1 == flags || -1 == (fcntl(d->connectingSocket, F_SETFL, flags | O_NONBLOCK))) { diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index db20f5618b7..8b5be7ae00b 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -876,8 +876,11 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path, // Check if the path is a file. if (QFileInfo(sourcePath).isFile()) { QFile file(sourcePath); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - return QSslCertificate::fromData(file.readAll(),format); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + return QSslCertificate::fromData(file.readAll(), format); return QList<QSslCertificate>(); } } @@ -899,8 +902,11 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path, continue; QFile file(filePath); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - certs += QSslCertificate::fromData(file.readAll(),format); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + certs += QSslCertificate::fromData(file.readAll(), format); } return certs; } diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index b1d24514f54..064e1b96a8b 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -41,10 +41,10 @@ /**************************************************************************** ** -** In addition, as a special exception, Nokia gives permission to link -** the code of its release of Qt with the OpenSSL project's "OpenSSL" library -** (or modified versions of the "OpenSSL" library that use the same license -** as the original version), and distribute the linked executables. +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. ** ** You must comply with the GNU General Public License version 2 in all ** respects for all of the code used other than the "OpenSSL" code. If you diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index 3acbdd5bef5..a6c22db7072 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -41,10 +41,10 @@ /**************************************************************************** ** -** In addition, as a special exception, Nokia gives permission to link -** the code of its release of Qt with the OpenSSL project's "OpenSSL" library -** (or modified versions of the "OpenSSL" library that use the same license -** as the original version), and distribute the linked executables. +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. ** ** You must comply with the GNU General Public License version 2 in all ** respects for all of the code used other than the "OpenSSL" code. If you diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 894703acb71..7820e8b9a9d 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -39,6 +39,21 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ + //#define QSSLSOCKET_DEBUG #include "qsslsocket_openssl_p.h" diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index 7d5fa0bd6d9..c8b23e6cadc 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #ifndef QSSLSOCKET_OPENSSL_P_H #define QSSLSOCKET_OPENSSL_P_H diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index e880a2452f3..2be62515e8a 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #include "qsslsocket_openssl_symbols_p.h" diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 8d8fda888ed..62648e3e37a 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H #define QSSLSOCKET_OPENSSL_SYMBOLS_P_H diff --git a/src/opengl/doc/qtopengl.qdocconf b/src/opengl/doc/qtopengl.qdocconf index 0ccc25ab496..d0f49fd6025 100644 --- a/src/opengl/doc/qtopengl.qdocconf +++ b/src/opengl/doc/qtopengl.qdocconf @@ -39,7 +39,7 @@ qhp.qtopengl.file = qtopengl.qhp # Namespace for the output file. This namespace is used to distinguish between # different documentation files in Creator/Assistant. -qhp.qtopengl.namespace = org.qt-project.qtopengl.510 +qhp.qtopengl.namespace = org.qt-project.qtopengl.$QT_VERSION_TAG # Title for the package, will be the main title for the package in # Assistant/Creator. diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f9ed294cca6..4345804da87 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1681,7 +1681,7 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo img = img.mirrored(); } -QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) +QImage qt_gl_read_frame_buffer(const QSize &size, bool alpha_format, bool include_alpha) { QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); @@ -4087,7 +4087,7 @@ QImage QGLWidget::grabFrameBuffer(bool withAlpha) int w = width(); int h = height(); if (format().rgba()) - res = qt_gl_read_framebuffer(QSize(w, h), format().alpha(), withAlpha); + res = qt_gl_read_frame_buffer(QSize(w, h), format().alpha(), withAlpha); return res; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index fa9037abae1..72fe7b8da66 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -44,6 +44,7 @@ #ifndef QT_NO_OPENGL +#include <QtGui/qopengl.h> #include <QtWidgets/qwidget.h> #include <QtGui/qpaintengine.h> #include <QtOpenGL/qglcolormap.h> @@ -52,32 +53,6 @@ #include <QtGui/QSurfaceFormat> -#if defined(Q_OS_WIN) -# include <QtCore/qt_windows.h> -#endif - -#if defined(Q_OS_MAC) -# if !defined(Q_OS_IOS) -# include <OpenGL/gl.h> -# else -# if defined(QT_OPENGL_ES_2) -# include <OpenGLES/ES2/gl.h> -# endif -# endif -#elif defined(QT_OPENGL_ES_2) -# include <GLES2/gl2.h> -# else -# include <GL/gl.h> -# endif - -#if defined(QT_OPENGL_ES_2) -# ifndef GL_DOUBLE -# define GL_DOUBLE GL_FLOAT -# endif -# ifndef GLdouble -typedef GLfloat GLdouble; -# endif -#endif QT_BEGIN_NAMESPACE diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 44df7d109c0..0a246546248 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -100,7 +100,7 @@ QSurfaceFormat QGLFormat::toSurfaceFormat(const QGLFormat &format) retFormat.setRedBufferSize(format.redBufferSize()); if (format.depth()) retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize()); - retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::DefaultSwapBehavior); + retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer); if (format.sampleBuffers()) retFormat.setSamples(format.samples() == -1 ? 4 : format.samples()); if (format.stencil()) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 8400db1f5e4..d1b3f355c92 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); +extern QImage qt_gl_read_frame_buffer(const QSize&, bool, bool); #define QGL_FUNC_CONTEXT const QGLContext *ctx = QGLContext::currentContext(); #define QGL_FUNCP_CONTEXT const QGLContext *ctx = QGLContext::currentContext(); @@ -1083,7 +1083,7 @@ QImage QGLFramebufferObject::toImage() const if (!d->valid) return QImage(); - // qt_gl_read_framebuffer doesn't work on a multisample FBO + // qt_gl_read_frame_buffer doesn't work on a multisample FBO if (format().samples() != 0) { QGLFramebufferObject temp(size(), QGLFramebufferObjectFormat()); @@ -1096,7 +1096,7 @@ QImage QGLFramebufferObject::toImage() const bool wasBound = isBound(); if (!wasBound) const_cast<QGLFramebufferObject *>(this)->bind(); - QImage image = qt_gl_read_framebuffer(d->size, format().internalTextureFormat() != GL_RGB, true); + QImage image = qt_gl_read_frame_buffer(d->size, format().internalTextureFormat() != GL_RGB, true); if (!wasBound) const_cast<QGLFramebufferObject *>(this)->release(); diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 36b9e60937c..e514e34552f 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE -extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); +extern QImage qt_gl_read_frame_buffer(const QSize&, bool, bool); QGLContext* QGLPBufferGLPaintDevice::context() const @@ -391,7 +391,7 @@ QImage QGLPixelBuffer::toImage() const const_cast<QGLPixelBuffer *>(this)->makeCurrent(); if (d->fbo) d->fbo->bind(); - return qt_gl_read_framebuffer(d->req_size, d->format.alpha(), true); + return qt_gl_read_frame_buffer(d->req_size, d->format.alpha(), true); } /*! diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm index dbb453f1b5d..b0ea2d2225a 100644 --- a/src/platformsupport/cglconvenience/cglconvenience.mm +++ b/src/platformsupport/cglconvenience/cglconvenience.mm @@ -87,7 +87,8 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format) QVector<NSOpenGLPixelFormatAttribute> attrs; - attrs.append(NSOpenGLPFADoubleBuffer); + if (format.swapBehavior() != QSurfaceFormat::SingleBuffer) + attrs.append(NSOpenGLPFADoubleBuffer); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 3d91f883f98..4cd81b23892 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1104,22 +1104,10 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } break; } -// case QAccessible::TableModelChanged: { -// // This is rather evil. We don't send data and hope that at-spi fetches the right child. -// // This hack fails when a row gets removed and a different one added in its place. -// QDBusVariant data; -// emit ChildrenChanged("add", 0, 0, data, spiBridge->getRootReference()); -// break; -// } - // case QAccessible::TableModelChanged: - // QAccessible2::TableModelChange change = interface->tableInterface()->modelChange(); - // // assume we should reset if everything is 0 - // if (change.firstColumn == 0 && change.firstRow == 0 && change.lastColumn == 0 && change.lastRow == 0) { - // notifyAboutDestruction(accessible); - // notifyAboutCreation(accessible); - // } - // break; - + case QAccessible::TableModelChanged: + // For now we ignore this event and hope that + // setting manages_descendants works. + break; case QAccessible::ParentChanged: break; case QAccessible::DialogStart: @@ -1181,7 +1169,7 @@ void AtSpiAdaptor::notifyAboutCreation(const QAIPointer &interface) const void AtSpiAdaptor::notifyAboutDestruction(const QAIPointer &interface) const { - if (!interface->isValid()) + if (!interface || !interface->isValid()) return; QAIPointer parent(interface->parent()); diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index d42ce8b0642..181feeba6a7 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -117,70 +117,134 @@ struct RoleMapping { }; static RoleMapping map[] = { - { QAccessible::NoRole, ATSPI_ROLE_INVALID, QT_TR_NOOP("invalid role") }, - { QAccessible::TitleBar, ATSPI_ROLE_TEXT, QT_TR_NOOP("title bar") }, - { QAccessible::MenuBar, ATSPI_ROLE_MENU_BAR, QT_TR_NOOP("menu bar") }, - { QAccessible::ScrollBar, ATSPI_ROLE_SCROLL_BAR, QT_TR_NOOP("scroll bar") }, - { QAccessible::Grip, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("grip") }, - { QAccessible::Sound, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("sound") }, - { QAccessible::Cursor, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("cursor") }, - { QAccessible::Caret, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("cursor") }, - { QAccessible::AlertMessage, ATSPI_ROLE_ALERT, QT_TR_NOOP("alert message") }, - { QAccessible::Window, ATSPI_ROLE_WINDOW, QT_TR_NOOP("window") }, - { QAccessible::Client, ATSPI_ROLE_FILLER, QT_TR_NOOP("filler") }, - { QAccessible::PopupMenu, ATSPI_ROLE_POPUP_MENU, QT_TR_NOOP("popup menu") }, - { QAccessible::MenuItem, ATSPI_ROLE_MENU_ITEM, QT_TR_NOOP("menu item") }, - { QAccessible::ToolTip, ATSPI_ROLE_TOOL_TIP, QT_TR_NOOP("tool tip") }, - { QAccessible::Application, ATSPI_ROLE_APPLICATION, QT_TR_NOOP("application") }, - { QAccessible::Document, ATSPI_ROLE_DOCUMENT_FRAME, QT_TR_NOOP("document") }, - { QAccessible::Pane, ATSPI_ROLE_PANEL, QT_TR_NOOP("panel") }, - { QAccessible::Chart, ATSPI_ROLE_CHART, QT_TR_NOOP("chart") }, - { QAccessible::Dialog, ATSPI_ROLE_DIALOG, QT_TR_NOOP("dialog") }, - { QAccessible::Border, ATSPI_ROLE_FRAME, QT_TR_NOOP("frame") }, - { QAccessible::Grouping, ATSPI_ROLE_PANEL, QT_TR_NOOP("panel") }, - { QAccessible::Separator, ATSPI_ROLE_SEPARATOR, QT_TR_NOOP("separator") }, - { QAccessible::ToolBar, ATSPI_ROLE_TOOL_BAR, QT_TR_NOOP("tool bar") }, - { QAccessible::StatusBar, ATSPI_ROLE_STATUS_BAR, QT_TR_NOOP("status bar") }, - { QAccessible::Table, ATSPI_ROLE_TABLE, QT_TR_NOOP("table") }, - { QAccessible::ColumnHeader, ATSPI_ROLE_TABLE_COLUMN_HEADER, QT_TR_NOOP("column header") }, - { QAccessible::RowHeader, ATSPI_ROLE_TABLE_ROW_HEADER, QT_TR_NOOP("row header") }, - { QAccessible::Column, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("column") }, - { QAccessible::Row, ATSPI_ROLE_TABLE_ROW, QT_TR_NOOP("row") }, - { QAccessible::Cell, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("cell") }, - { QAccessible::Link, ATSPI_ROLE_LINK, QT_TR_NOOP("link") }, - { QAccessible::HelpBalloon, ATSPI_ROLE_DIALOG, QT_TR_NOOP("help balloon") }, - { QAccessible::Assistant, ATSPI_ROLE_DIALOG, QT_TR_NOOP("assistant") }, - { QAccessible::List, ATSPI_ROLE_LIST, QT_TR_NOOP("list") }, - { QAccessible::ListItem, ATSPI_ROLE_LIST_ITEM, QT_TR_NOOP("list item") }, - { QAccessible::Tree, ATSPI_ROLE_TREE, QT_TR_NOOP("tree") }, - { QAccessible::TreeItem, ATSPI_ROLE_TABLE_CELL, QT_TR_NOOP("tree item") }, - { QAccessible::PageTab, ATSPI_ROLE_PAGE_TAB, QT_TR_NOOP("page tab") }, - { QAccessible::PropertyPage, ATSPI_ROLE_PAGE_TAB, QT_TR_NOOP("property page") }, - { QAccessible::Indicator, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("indicator") }, - { QAccessible::Graphic, ATSPI_ROLE_IMAGE, QT_TR_NOOP("graphic") }, - { QAccessible::StaticText, ATSPI_ROLE_LABEL, QT_TR_NOOP("label") }, - { QAccessible::EditableText, ATSPI_ROLE_TEXT, QT_TR_NOOP("text") }, - { QAccessible::PushButton, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("push button") }, - { QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, QT_TR_NOOP("check box") }, - { QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, QT_TR_NOOP("radio button") }, - { QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, QT_TR_NOOP("combo box") }, - { QAccessible::ProgressBar, ATSPI_ROLE_PROGRESS_BAR, QT_TR_NOOP("progress bar") }, - { QAccessible::Dial, ATSPI_ROLE_DIAL, QT_TR_NOOP("dial") }, - { QAccessible::HotkeyField, ATSPI_ROLE_TEXT, QT_TR_NOOP("hotkey field") }, - { QAccessible::Slider, ATSPI_ROLE_SLIDER, QT_TR_NOOP("slider") }, - { QAccessible::SpinBox, ATSPI_ROLE_SPIN_BUTTON, QT_TR_NOOP("spin box") }, - { QAccessible::Canvas, ATSPI_ROLE_CANVAS, QT_TR_NOOP("canvas") }, - { QAccessible::Animation, ATSPI_ROLE_ANIMATION, QT_TR_NOOP("animation") }, - { QAccessible::Equation, ATSPI_ROLE_TEXT, QT_TR_NOOP("equation") }, - { QAccessible::ButtonDropDown, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button drop down") }, - { QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button menu") }, - { QAccessible::ButtonDropGrid, ATSPI_ROLE_PUSH_BUTTON, QT_TR_NOOP("button drop grid") }, - { QAccessible::Whitespace, ATSPI_ROLE_FILLER, QT_TR_NOOP("whitespace") }, - { QAccessible::PageTabList, ATSPI_ROLE_PAGE_TAB_LIST, QT_TR_NOOP("page tab list") }, - { QAccessible::Clock, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("clock") }, - { QAccessible::Splitter, ATSPI_ROLE_SPLIT_PANE, QT_TR_NOOP("splitter") }, - { QAccessible::LayeredPane, ATSPI_ROLE_LAYERED_PANE, QT_TR_NOOP("layered pane") }, - { QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, QT_TR_NOOP("unknown") } + //: Role of an accessible object - the object is in an invalid state or could not be constructed + { QAccessible::NoRole, ATSPI_ROLE_INVALID, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "invalid role") }, + //: Role of an accessible object + { QAccessible::TitleBar, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "title bar") }, + //: Role of an accessible object + { QAccessible::MenuBar, ATSPI_ROLE_MENU_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "menu bar") }, + //: Role of an accessible object + { QAccessible::ScrollBar, ATSPI_ROLE_SCROLL_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "scroll bar") }, + //: Role of an accessible object - the grip is usually used for resizing another object + { QAccessible::Grip, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "grip") }, + //: Role of an accessible object + { QAccessible::Sound, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "sound") }, + //: Role of an accessible object + { QAccessible::Cursor, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "cursor") }, + //: Role of an accessible object + { QAccessible::Caret, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "text caret") }, + //: Role of an accessible object + { QAccessible::AlertMessage, ATSPI_ROLE_ALERT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "alert message") }, + //: Role of an accessible object + { QAccessible::Window, ATSPI_ROLE_WINDOW, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "window") }, + //: Role of an accessible object + { QAccessible::Client, ATSPI_ROLE_FILLER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "filler") }, + //: Role of an accessible object + { QAccessible::PopupMenu, ATSPI_ROLE_POPUP_MENU, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "popup menu") }, + //: Role of an accessible object + { QAccessible::MenuItem, ATSPI_ROLE_MENU_ITEM, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "menu item") }, + //: Role of an accessible object + { QAccessible::ToolTip, ATSPI_ROLE_TOOL_TIP, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tool tip") }, + //: Role of an accessible object + { QAccessible::Application, ATSPI_ROLE_APPLICATION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "application") }, + //: Role of an accessible object + { QAccessible::Document, ATSPI_ROLE_DOCUMENT_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "document") }, + //: Role of an accessible object + { QAccessible::Pane, ATSPI_ROLE_PANEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "panel") }, + //: Role of an accessible object + { QAccessible::Chart, ATSPI_ROLE_CHART, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "chart") }, + //: Role of an accessible object + { QAccessible::Dialog, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "dialog") }, + //: Role of an accessible object + { QAccessible::Border, ATSPI_ROLE_FRAME, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "frame") }, + //: Role of an accessible object + { QAccessible::Grouping, ATSPI_ROLE_PANEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "panel") }, + //: Role of an accessible object + { QAccessible::Separator, ATSPI_ROLE_SEPARATOR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "separator") }, + //: Role of an accessible object + { QAccessible::ToolBar, ATSPI_ROLE_TOOL_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tool bar") }, + //: Role of an accessible object + { QAccessible::StatusBar, ATSPI_ROLE_STATUS_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "status bar") }, + //: Role of an accessible object + { QAccessible::Table, ATSPI_ROLE_TABLE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "table") }, + //: Role of an accessible object - part of a table + { QAccessible::ColumnHeader, ATSPI_ROLE_TABLE_COLUMN_HEADER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "column header") }, + //: Role of an accessible object - part of a table + { QAccessible::RowHeader, ATSPI_ROLE_TABLE_ROW_HEADER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "row header") }, + //: Role of an accessible object - part of a table + { QAccessible::Column, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "column") }, + //: Role of an accessible object - part of a table + { QAccessible::Row, ATSPI_ROLE_TABLE_ROW, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "row") }, + //: Role of an accessible object - part of a table + { QAccessible::Cell, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "cell") }, + //: Role of an accessible object + { QAccessible::Link, ATSPI_ROLE_LINK, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "link") }, + //: Role of an accessible object + { QAccessible::HelpBalloon, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "help balloon") }, + //: Role of an accessible object - a helper dialog + { QAccessible::Assistant, ATSPI_ROLE_DIALOG, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "assistant") }, + //: Role of an accessible object + { QAccessible::List, ATSPI_ROLE_LIST, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "list") }, + //: Role of an accessible object + { QAccessible::ListItem, ATSPI_ROLE_LIST_ITEM, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "list item") }, + //: Role of an accessible object + { QAccessible::Tree, ATSPI_ROLE_TREE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tree") }, + //: Role of an accessible object + { QAccessible::TreeItem, ATSPI_ROLE_TABLE_CELL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "tree item") }, + //: Role of an accessible object + { QAccessible::PageTab, ATSPI_ROLE_PAGE_TAB, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "page tab") }, + //: Role of an accessible object + { QAccessible::PropertyPage, ATSPI_ROLE_PAGE_TAB, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "property page") }, + //: Role of an accessible object + { QAccessible::Indicator, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "indicator") }, + //: Role of an accessible object + { QAccessible::Graphic, ATSPI_ROLE_IMAGE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "graphic") }, + //: Role of an accessible object + { QAccessible::StaticText, ATSPI_ROLE_LABEL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "label") }, + //: Role of an accessible object + { QAccessible::EditableText, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "text") }, + //: Role of an accessible object + { QAccessible::PushButton, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "push button") }, + //: Role of an accessible object + { QAccessible::CheckBox, ATSPI_ROLE_CHECK_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "check box") }, + //: Role of an accessible object + { QAccessible::RadioButton, ATSPI_ROLE_RADIO_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "radio button") }, + //: Role of an accessible object + { QAccessible::ComboBox, ATSPI_ROLE_COMBO_BOX, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "combo box") }, + //: Role of an accessible object + { QAccessible::ProgressBar, ATSPI_ROLE_PROGRESS_BAR, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "progress bar") }, + //: Role of an accessible object + { QAccessible::Dial, ATSPI_ROLE_DIAL, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "dial") }, + //: Role of an accessible object + { QAccessible::HotkeyField, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "hotkey field") }, + //: Role of an accessible object + { QAccessible::Slider, ATSPI_ROLE_SLIDER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "slider") }, + //: Role of an accessible object + { QAccessible::SpinBox, ATSPI_ROLE_SPIN_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "spin box") }, + //: Role of an accessible object + { QAccessible::Canvas, ATSPI_ROLE_CANVAS, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "canvas") }, + //: Role of an accessible object + { QAccessible::Animation, ATSPI_ROLE_ANIMATION, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "animation") }, + //: Role of an accessible object + { QAccessible::Equation, ATSPI_ROLE_TEXT, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "equation") }, + //: Role of an accessible object + { QAccessible::ButtonDropDown, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button with drop down") }, + //: Role of an accessible object + { QAccessible::ButtonMenu, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button menu") }, + //: Role of an accessible object - a button that expands a grid. + { QAccessible::ButtonDropGrid, ATSPI_ROLE_PUSH_BUTTON, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "button with drop down grid") }, + //: Role of an accessible object - blank space between other objects. + { QAccessible::Whitespace, ATSPI_ROLE_FILLER, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "space") }, + //: Role of an accessible object + { QAccessible::PageTabList, ATSPI_ROLE_PAGE_TAB_LIST, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "page tab list") }, + //: Role of an accessible object + { QAccessible::Clock, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "clock") }, + //: Role of an accessible object + { QAccessible::Splitter, ATSPI_ROLE_SPLIT_PANE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "splitter") }, + //: Role of an accessible object + { QAccessible::LayeredPane, ATSPI_ROLE_LAYERED_PANE, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "layered pane") }, + //: Role of an accessible object + { QAccessible::UserRole, ATSPI_ROLE_UNKNOWN, QT_TRANSLATE_NOOP("QSpiAccessibleBridge", "unknown") } }; void QSpiAccessibleBridge::initializeConstantMappings() diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 48f973c30d6..a9a43a78759 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -424,7 +424,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const /*! \reimp */ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > -QAccessibleDisplay::relations(QAccessible::Relation match /*= QAccessible::AllRelations*/) const +QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels = QAccessibleWidget::relations(match); if (match & QAccessible::Labelled) { @@ -530,7 +530,7 @@ QAccessible::Role QAccessibleGroupBox::role() const } QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > -QAccessibleGroupBox::relations(QAccessible::Relation match /*= QAccessible::AllRelations*/) const +QAccessibleGroupBox::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels = QAccessibleWidget::relations(match); diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp index d64a8fe20f8..ab1ba9aa198 100644 --- a/src/plugins/bearer/blackberry/qbbengine.cpp +++ b/src/plugins/bearer/blackberry/qbbengine.cpp @@ -45,6 +45,7 @@ #include <QDebug> #include <QThreadStorage> #include <QStringList> +#include <QTimer> #include <bps/netstatus.h> @@ -355,6 +356,9 @@ void QBBEngine::updateConfiguration(const char *interface) changed = true; } + const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus; + ptr->oldIpStatus = ipStatus; + ptrLocker.unlock(); locker.unlock(); @@ -364,7 +368,17 @@ void QBBEngine::updateConfiguration(const char *interface) Q_EMIT configurationChanged(ptr); } else { + // maybe Wifi has changed but gateway not yet ready etc. qBearerDebug() << Q_FUNC_INFO << "configuration has not changed."; + if (oldIpStatus != ipStatus) { // if IP status changed + if (ipStatus != NETSTATUS_IP_STATUS_OK + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_UP + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_CONFIGURED) { + // work around race condition in netstatus API by just checking + // again in 300 ms + QTimer::singleShot(300, this, SLOT(doRequestUpdate())); + } + } } return; diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 085b57d660d..f6fb55522ec 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -56,6 +56,22 @@ #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS +QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item) +{ + argument.beginStructure(); + argument << item.path << item.properties; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathProperties &item) +{ + argument.beginStructure(); + argument >> item.path >> item.properties; + argument.endStructure(); + return argument; +} + QT_BEGIN_NAMESPACE QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent) @@ -64,6 +80,8 @@ QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent) OFONO_MANAGER_INTERFACE, QDBusConnection::systemBus(), parent) { + qDBusRegisterMetaType<ObjectPathProperties>(); + qDBusRegisterMetaType<PathPropertiesList>(); } QOfonoManagerInterface::~QOfonoManagerInterface() @@ -72,8 +90,16 @@ QOfonoManagerInterface::~QOfonoManagerInterface() QList <QDBusObjectPath> QOfonoManagerInterface::getModems() { - QVariant var = getProperty("Modems"); - return qdbus_cast<QList<QDBusObjectPath> >(var); + QList <QDBusObjectPath> modemList; + QList<QVariant> argumentList; + QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetModems"), argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties modem, reply.value()) { + modemList << modem.path; + } + } + + return modemList; } QDBusObjectPath QOfonoManagerInterface::currentModem() @@ -81,7 +107,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem() QList<QDBusObjectPath> modems = getModems(); foreach (const QDBusObjectPath &modem, modems) { QOfonoModemInterface device(modem.path()); - if(device.isPowered() && device.isOnline()) + if (device.isPowered() && device.isOnline()) return modem;; } return QDBusObjectPath(); @@ -92,7 +118,7 @@ void QOfonoManagerInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoManagerInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), QLatin1String(OFONO_MANAGER_PATH), QLatin1String(OFONO_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -140,7 +166,7 @@ QVariant QOfonoManagerInterface::getProperty(const QString &property) QVariantMap QOfonoManagerInterface::getProperties() { QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); - if(reply.isValid()) + if (reply.isValid()) return reply.value(); else return QVariantMap(); @@ -234,7 +260,7 @@ QStringList QOfonoModemInterface::getInterfaces() QString QOfonoModemInterface::defaultInterface() { - foreach(const QString &modem,getInterfaces()) { + foreach (const QString &modem,getInterfaces()) { return modem; } return QString(); @@ -245,7 +271,7 @@ void QOfonoModemInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoModemInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_MODEM_INTERFACE), QLatin1String("PropertyChanged"), @@ -363,15 +389,23 @@ QString QOfonoNetworkRegistrationInterface::getBaseStation() QList <QDBusObjectPath> QOfonoNetworkRegistrationInterface::getOperators() { - QVariant var = getProperty("Operators"); - return qdbus_cast<QList <QDBusObjectPath> >(var); + QList <QDBusObjectPath> operatorList; + QList<QVariant> argumentList; + QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetOperators"), + argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties netop, reply.value()) { + operatorList << netop.path; + } + } + return operatorList; } void QOfonoNetworkRegistrationInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkRegistrationInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE), QLatin1String("PropertyChanged"), @@ -473,7 +507,7 @@ void QOfonoNetworkOperatorInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoNetworkOperatorInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE), // QLatin1String("PropertyChanged"), @@ -581,7 +615,7 @@ void QOfonoSimInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSimInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_SIM_MANAGER_INTERFACE), // QLatin1String("PropertyChanged"), @@ -648,8 +682,16 @@ QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface() QList<QDBusObjectPath> QOfonoDataConnectionManagerInterface::getPrimaryContexts() { - QVariant var = getProperty("PrimaryContexts"); - return qdbus_cast<QList<QDBusObjectPath> >(var); + QList <QDBusObjectPath> contextList; + QList<QVariant> argumentList; + QDBusReply<PathPropertiesList > reply = this->asyncCallWithArgumentList(QLatin1String("GetContexts"), + argumentList); + if (reply.isValid()) { + foreach (ObjectPathProperties context, reply.value()) { + contextList << context.path; + } + } + return contextList; } bool QOfonoDataConnectionManagerInterface::isAttached() @@ -675,7 +717,7 @@ void QOfonoDataConnectionManagerInterface::connectNotify(const QMetaMethod &sign Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoDataConnectionManagerInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE), // QLatin1String("PropertyChanged"), @@ -799,7 +841,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal) Q_UNUSED(signal); // static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged); // if (signal == propertyChangedSignal) { -// if(!connection().connect(QLatin1String(OFONO_SERVICE), +// if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), // QLatin1String(OFONO_DATA_CONTEXT_INTERFACE), // QLatin1String("PropertyChanged"), @@ -861,7 +903,7 @@ bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const Q QLatin1String("SetProperty"), args); bool ok = true; - if(reply.type() != QDBusMessage::ReplyMessage) { + if (reply.type() != QDBusMessage::ReplyMessage) { qWarning() << reply.errorMessage(); ok = false; } @@ -885,7 +927,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::propertyChanged); if (signal == propertyChangedSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -912,7 +954,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) static const QMetaMethod immediateMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::immediateMessage); if (signal == immediateMessageSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("ImmediateMessage"), @@ -923,7 +965,7 @@ void QOfonoSmsInterface::connectNotify(const QMetaMethod &signal) static const QMetaMethod incomingMessageSignal = QMetaMethod::fromSignal(&QOfonoSmsInterface::incomingMessage); if (signal == incomingMessageSignal) { - if(!connection().connect(QLatin1String(OFONO_SERVICE), + if (!connection().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("IncomingMessage"), diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 85f66020234..00be9aa6750 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -88,6 +88,14 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE +struct ObjectPathProperties +{ + QDBusObjectPath path; + QVariantMap properties; +}; +typedef QList<ObjectPathProperties> PathPropertiesList; +Q_DECLARE_METATYPE(ObjectPathProperties) +Q_DECLARE_METATYPE (PathPropertiesList) QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index fd0f4529cce..7f022da4c3a 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -67,7 +67,7 @@ QPaintDevice *QCocoaBackingStore::paintDevice() #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle()); - if (cocoaWindow && cocoaWindow->m_contentView) { + if (cocoaWindow && cocoaWindow->m_contentView && [cocoaWindow->m_contentView window]) { scaleFactor = int([[cocoaWindow->m_contentView window] backingScaleFactor]); } } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index d8bb72dd45a..faea417f0fc 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -251,6 +251,7 @@ static QString strippedText(QString s) [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : nil]; // Call processEvents in case the event dispatcher has been interrupted, and needs to do // cleanup of modal sessions. Do this before showing the native dialog, otherwise it will @@ -277,6 +278,7 @@ static QString strippedText(QString s) [self updateProperties]; [mSavePanel setDirectoryURL:selectable ? [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.filePath())] : [NSURL fileURLWithPath:QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.path())]]; + [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : nil]; NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent)); [mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){ diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index 51beaa97f51..c801d9d9268 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -156,8 +156,9 @@ public: } }; -CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); +CGContextRef qt_mac_cg_context(QPaintDevice *pdev); CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy); +QImage qt_mac_toQImage(CGImageRef image); QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 08024b7bc6a..dc43666bb62 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -714,35 +714,38 @@ QString qt_mac_removeAmpersandEscapes(QString s) \warning This function is only available on Mac OS X. \warning This function is duplicated in qmacstyle_mac.mm */ -CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) +CGContextRef qt_mac_cg_context(QPaintDevice *pdev) { - if (pdev->devType() == QInternal::Pixmap) { - const QPixmap *pm = static_cast<const QPixmap*>(pdev); - CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); - uint flags = kCGImageAlphaPremultipliedFirst; - flags |= kCGBitmapByteOrder32Host; - CGContextRef ret = 0; + // In Qt 5, QWidget and QPixmap (and QImage) paint devices are all QImages under the hood. + QImage *image = 0; + if (pdev->devType() == QInternal::Image) { + image = static_cast<QImage *>(pdev); + } else if (pdev->devType() == QInternal::Pixmap) { + const QPixmap *pm = static_cast<const QPixmap*>(pdev); QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data(); if (data && data->classId() == QPlatformPixmap::RasterClass) { - QImage *image = data->buffer(); - ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorspace, flags); + image = data->buffer(); } else { qDebug() << "qt_mac_cg_context: Unsupported pixmap class"; } - - CGContextTranslateCTM(ret, 0, pm->height()); - CGContextScaleCTM(ret, 1, -1); - return ret; } else if (pdev->devType() == QInternal::Widget) { - //CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle()); - ///CGContextRetain(ret); - //return ret; + // TODO test: image = static_cast<QImage *>(static_cast<const QWidget *>(pdev)->backingStore()->paintDevice()); qDebug() << "qt_mac_cg_context: not implemented: Widget class"; - return 0; } - return 0; + + if (!image) + return 0; // Context type not supported. + + CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); + uint flags = kCGImageAlphaPremultipliedFirst; + flags |= kCGBitmapByteOrder32Host; + CGContextRef ret = 0; + ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), + 8, image->bytesPerLine(), colorspace, flags); + CGContextTranslateCTM(ret, 0, image->height()); + CGContextScaleCTM(ret, 1, -1); + return ret; } CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) @@ -836,4 +839,18 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy) return cgImage; } +QImage qt_mac_toQImage(CGImageRef image) +{ + const size_t w = CGImageGetWidth(image), + h = CGImageGetHeight(image); + QImage ret(w, h, QImage::Format_ARGB32_Premultiplied); + ret.fill(Qt::transparent); + CGRect rect = CGRectMake(0, 0, w, h); + CGContextRef ctx = qt_mac_cg_context(&ret); + qt_mac_drawCGImage(ctx, &rect, image); + CGContextRelease(ctx); + return ret; +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 34e8fb61e23..9506f862381 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -42,6 +42,8 @@ #ifndef QCOCOANATIVEINTERFACE_H #define QCOCOANATIVEINTERFACE_H +#include <ApplicationServices/ApplicationServices.h> + #include <qpa/qplatformnativeinterface.h> QT_BEGIN_NAMESPACE @@ -49,6 +51,7 @@ QT_BEGIN_NAMESPACE class QWidget; class QPlatformPrinterSupport; class QPrintEngine; +class QPlatformMenu; class QCocoaNativeInterface : public QPlatformNativeInterface { @@ -92,6 +95,13 @@ private: static void addToMimeList(void *macPasteboardMime); static void removeFromMimeList(void *macPasteboardMime); static void registerDraggedTypes(const QStringList &types); + + // Dock menu support + static void setDockMenu(QPlatformMenu *platformMenu); + + // QImage <-> CGImage conversion functions + static CGImageRef qImageToCGImage(const QImage &image); + static QImage cgImageToQImage(CGImageRef image); }; #endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 08084b52005..bd3a9091371 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -42,8 +42,10 @@ #include "qcocoanativeinterface.h" #include "qcocoaglcontext.h" #include "qcocoawindow.h" +#include "qcocoamenu.h" #include "qcocoamenubar.h" #include "qmacmime.h" +#include "qcocoahelpers.h" #include <qbytearray.h> #include <qwindow.h> @@ -60,6 +62,8 @@ #include <qpa/qplatformprintersupport.h> #endif +#include <Cocoa/Cocoa.h> + QT_BEGIN_NAMESPACE QCocoaNativeInterface::QCocoaNativeInterface() @@ -103,6 +107,12 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::removeFromMimeList); if (resource.toLower() == "registerdraggedtypes") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerDraggedTypes); + if (resource.toLower() == "setdockmenu") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setDockMenu); + if (resource.toLower() == "qimagetocgimage") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage); + if (resource.toLower() == "cgimagetoqimage") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage); return 0; } @@ -170,4 +180,23 @@ void QCocoaNativeInterface::registerDraggedTypes(const QStringList &types) qt_mac_registerDraggedTypes(types); } +void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu) +{ + QCocoaMenu *cocoaPlatformMenu = static_cast<QCocoaMenu *>(platformMenu); + NSMenu *menu = cocoaPlatformMenu->nsMenu(); + // setDockMenu seems to be undocumented, but this is what Qt 4 did. + [NSApp setDockMenu: menu]; +} + +CGImageRef QCocoaNativeInterface::qImageToCGImage(const QImage &image) +{ + return qt_mac_toCGImage(image, false, 0); +} + +QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image) +{ + return qt_mac_toQImage(image); +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 0845ab8e946..beaa50da6d9 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -53,6 +53,7 @@ #include "qcocoamenuitem.h" #include "qcocoamenu.h" #include "qcocoamenubar.h" +#include "qcocoahelpers.h" #include <QtCore/qfileinfo.h> #include <QtGui/private/qguiapplication_p.h> @@ -137,9 +138,6 @@ const QFont *QCocoaTheme::font(Font type) const return m_fonts.value(type, 0); } -// Defined in qpaintengine_mac.mm -extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); - //! \internal QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height) { diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 66c4deb3666..291c688915f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -49,7 +49,8 @@ #include "qcocoaglcontext.h" #include "qnsview.h" -class QT_PREPEND_NAMESPACE(QCocoaWindow); + +QT_FORWARD_DECLARE_CLASS(QCocoaWindow) @interface QNSWindow : NSWindow { @public QCocoaWindow *m_cocoaPlatformWindow; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a3d0bc6e540..56ca2e0b146 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -301,9 +301,11 @@ void QCocoaWindow::setVisible(bool visible) [m_nsWindow orderFront: nil]; } - // We want the events to properly reach the popup and dialog - if (window()->type() == Qt::Popup || window()->type() == Qt::Dialog) + // We want the events to properly reach the popup, dialog, and tool + if ((window()->type() == Qt::Popup || window()->type() == Qt::Dialog || window()->type() == Qt::Tool) + && [m_nsWindow isKindOfClass:[NSPanel class]]) { [(NSPanel *)m_nsWindow setWorksWhenModal:YES]; + } } } else { [m_contentView setHidden:NO]; @@ -717,6 +719,11 @@ NSWindow * QCocoaWindow::createNSWindow() createdWindow = window; } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if ([createdWindow respondsToSelector:@selector(setRestorable:)]) + [createdWindow setRestorable: NO]; +#endif + NSInteger level = windowLevel(flags); [createdWindow setLevel:level]; m_windowModality = window()->modality(); @@ -837,11 +844,9 @@ QCocoaMenuBar *QCocoaWindow::menubar() const qreal QCocoaWindow::devicePixelRatio() const { - if (!m_nsWindow) - return 1.0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { - return qreal([m_nsWindow backingScaleFactor]); + return qreal([[m_contentView window] backingScaleFactor]); } else #endif { diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 6fcf4d57469..95143fd8ea3 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -135,7 +135,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id, } if (!promise.itemId && flavorAsQString == QLatin1String("com.trolltech.qt.MimeTypeName")) { - // we have promised this data, but wont be able to convert, so return null data. + // we have promised this data, but won't be able to convert, so return null data. // This helps in making the application/x-qt-mime-type-name hidden from normal use. QByteArray ba; QCFType<CFDataRef> data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size()); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 82fde6221d2..c23d9249933 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1047,7 +1047,7 @@ static QTouchDevice *touchDevice = 0; - (NSUInteger)characterIndexForPoint:(NSPoint)aPoint { - // We dont support cursor movements using mouse while composing. + // We don't support cursor movements using mouse while composing. Q_UNUSED(aPoint); return NSNotFound; } diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index a5382c5ef67..54019372bce 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -109,7 +109,7 @@ bool QMacPrintEngine::end() if (d->state == QPrinter::Aborted) return true; // I was just here a function call ago :) if (d->paintEngine->type() == QPaintEngine::CoreGraphics) { - // We dont need the paint engine to call restoreGraphicsState() + // We don't need the paint engine to call restoreGraphicsState() static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->stackCount = 0; static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = 0; } diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp index 72137b91bc3..14b499f7cf7 100644 --- a/src/plugins/platforms/openwfd/qopenwfdport.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp @@ -125,7 +125,7 @@ void QOpenWFDPort::attach() } if (mPipeline == WFD_INVALID_HANDLE) { - qWarning("Failed to create pipeline and cant bind it to port"); + qWarning("Failed to create pipeline and can't bind it to port"); } WFDint geomerty[] = { 0, 0, mPixelSize.width(), mPixelSize.height() }; diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index aa748fc8524..1c2ec23fa9c 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -150,13 +150,13 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) // Select EGL config based on requested window format m_eglConfig = q_configFromGLFormat(ms_eglDisplay, format); if (m_eglConfig == 0) { - qFatal("QQNXQBBWindow: failed to find EGL config"); + qFatal("QQnxGLContext: failed to find EGL config"); } m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs()); if (m_eglContext == EGL_NO_CONTEXT) { checkEGLError("eglCreateContext"); - qFatal("QQNXQBBWindow: failed to create EGL context, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to create EGL context, err=%d", eglGetError()); } // Query/cache window format of selected EGL config @@ -184,13 +184,13 @@ void QQnxGLContext::initialize() ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (ms_eglDisplay == EGL_NO_DISPLAY) { checkEGLError("eglGetDisplay"); - qFatal("QQNXQBBWindow: failed to obtain EGL display"); + qFatal("QQnxGLContext: failed to obtain EGL display"); } EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0); if (eglResult != EGL_TRUE) { checkEGLError("eglInitialize"); - qFatal("QQNXQBBWindow: failed to initialize EGL display, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to initialize EGL display, err=%d", eglGetError()); } } @@ -217,7 +217,7 @@ bool QQnxGLContext::makeCurrent(QPlatformSurface *surface) // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); if (eglResult != EGL_TRUE) { - qFatal("QQNXQBBWindow: failed to set EGL API, err=%d", eglGetError()); + qFatal("QQnxGLContext: failed to set EGL API, err=%d", eglGetError()); } if (m_newSurfaceRequested.testAndSetOrdered(true, false)) { diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 30ca8a5c485..0d8f430c734 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -42,6 +42,8 @@ #include "qqnxinputcontext_imf.h" #include "qqnxeventthread.h" #include "qqnxabstractvirtualkeyboard.h" +#include "qqnxintegration.h" +#include "qqnxscreen.h" #include <QtGui/QGuiApplication> #include <QtGui/QInputMethodEvent> @@ -645,12 +647,13 @@ static bool imfAvailable() QT_BEGIN_NAMESPACE -QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard): +QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) : QPlatformInputContext(), m_lastCaretPos(0), m_isComposing(false), m_inputPanelVisible(false), m_inputPanelLocale(QLocale::c()), + m_integration(integration), m_virtualKeyboad(keyboard) { qInputContextDebug() << Q_FUNC_INFO; @@ -857,6 +860,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) } } +QRectF QQnxInputContext::keyboardRect() const +{ + QRect screenGeometry = m_integration->primaryDisplay()->geometry(); + return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(), + screenGeometry.width(), m_virtualKeyboard.height()); +} + void QQnxInputContext::reset() { qInputContextDebug() << Q_FUNC_INFO; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h index 72c52300bb9..1980a99ed95 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h @@ -54,21 +54,24 @@ QT_BEGIN_NAMESPACE class QQnxAbstractVirtualKeyboard; +class QQnxIntegration; class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard); + explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard); ~QQnxInputContext(); bool isValid() const; bool filterEvent(const QEvent *event); + QRectF keyboardRect() const; void reset(); void update(Qt::InputMethodQueries); bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); + void showInputPanel(); void hideInputPanel(); bool isInputPanelVisible() const; @@ -125,6 +128,7 @@ private: QString m_composingText; bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxIntegration *m_integration; QQnxAbstractVirtualKeyboard &m_virtualKeyboad; }; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp index 23d1f75539b..71b925357a7 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp @@ -41,6 +41,8 @@ #include "qqnxinputcontext_noimf.h" #include "qqnxabstractvirtualkeyboard.h" +#include "qqnxintegration.h" +#include "qqnxscreen.h" #include <QtCore/QDebug> #include <QtGui/QGuiApplication> @@ -53,12 +55,14 @@ QT_BEGIN_NAMESPACE -QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard) : +QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) : QPlatformInputContext(), m_inputPanelVisible(false), m_inputPanelLocale(QLocale::c()), + m_integration(integration), m_virtualKeyboard(keyboard) { + connect(&keyboard, SIGNAL(heightChanged(int)), this, SLOT(keyboardHeightChanged())); connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool))); connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale))); keyboardVisibilityChanged(keyboard.isVisible()); @@ -105,6 +109,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event ) } +QRectF QQnxInputContext::keyboardRect() const +{ + QRect screenGeometry = m_integration->primaryDisplay()->geometry(); + return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(), + screenGeometry.width(), m_virtualKeyboard.height()); +} + bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap) { Q_UNUSED(flags); @@ -137,6 +148,11 @@ QLocale QQnxInputContext::locale() const return m_inputPanelLocale; } +void QQnxInputContext::keyboardHeightChanged() +{ + emitKeyboardRectChanged(); +} + void QQnxInputContext::keyboardVisibilityChanged(bool visible) { qInputContextDebug() << Q_FUNC_INFO << "visible=" << visible; diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h index c037b6afd05..1ecf7cc94e2 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h +++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h @@ -49,18 +49,20 @@ QT_BEGIN_NAMESPACE class QQnxAbstractVirtualKeyboard; +class QQnxIntegration; class QQnxInputContext : public QPlatformInputContext { Q_OBJECT public: - explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard); + explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard); ~QQnxInputContext(); bool isValid() const; void reset(); bool filterEvent( const QEvent *event ); + QRectF keyboardRect() const; bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap); void showInputPanel(); @@ -71,6 +73,7 @@ public: void setFocusObject(QObject *object); private Q_SLOTS: + void keyboardHeightChanged(); void keyboardVisibilityChanged(bool visible); void keyboardLocaleChanged(const QLocale &locale); @@ -79,6 +82,7 @@ private: bool m_inputPanelVisible; QLocale m_inputPanelLocale; + QQnxIntegration *m_integration; QQnxAbstractVirtualKeyboard &m_virtualKeyboard; }; diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index bff4dbdc2a2..f3cfdab9c6b 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -214,7 +214,7 @@ QQnxIntegration::QQnxIntegration() #if defined(QQNX_PPS) // Set up the input context - m_inputContext = new QQnxInputContext(*m_virtualKeyboard); + m_inputContext = new QQnxInputContext(this, *m_virtualKeyboard); #endif } @@ -446,6 +446,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query display count, errno=%d", errno); } + if (displayCount < 1) { + // Never happens, even if there's no display, libscreen returns 1 + qFatal("QQnxIntegration: displayCount=%d", displayCount); + } + // Get all displays errno = 0; screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount); @@ -454,7 +459,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query displays, errno=%d", errno); } - for (int i=0; i<displayCount; i++) { + // If it's primary, we create a QScreen for it even if it's not attached + // since Qt will dereference QGuiApplication::primaryScreen() + createDisplay(displays[0], /*isPrimary=*/true); + + for (int i=1; i<displayCount; i++) { int isAttached = 0; result = screen_get_display_property_iv(displays[i], SCREEN_PROPERTY_ATTACHED, &isAttached); if (result != 0) { @@ -468,7 +477,7 @@ void QQnxIntegration::createDisplays() } qIntegrationDebug() << Q_FUNC_INFO << "Creating screen for display" << i; - createDisplay(displays[i], i==0); + createDisplay(displays[i], /*isPrimary=*/false); } // of displays iteration } diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index ee05e003941..b01d4686472 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -57,7 +57,7 @@ static const int MAGIC_ZORDER_FOR_NO_NAV = 10; -QQnxRootWindow::QQnxRootWindow(QQnxScreen *screen) +QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) : m_screen(screen), m_window(0), m_windowGroupName() diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.h b/src/plugins/platforms/qnx/qqnxrootwindow.h index f9f1dc08106..aae1563c953 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.h +++ b/src/plugins/platforms/qnx/qqnxrootwindow.h @@ -54,7 +54,7 @@ class QQnxScreen; class QQnxRootWindow { public: - QQnxRootWindow(QQnxScreen *screen); + QQnxRootWindow(const QQnxScreen *screen); ~QQnxRootWindow(); screen_window_t nativeHandle() const { return m_window; } @@ -71,7 +71,7 @@ public: private: void createWindowGroup(); - QQnxScreen *m_screen; + const QQnxScreen *m_screen; screen_window_t m_window; QByteArray m_windowGroupName; }; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 5450f086e94..fc8b3bb167a 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -107,7 +107,6 @@ static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, bool primaryScreen) : m_screenContext(screenContext), m_display(display), - m_rootWindow(), m_primaryScreen(primaryScreen), m_posted(false), m_keyboardHeight(0), @@ -147,10 +146,6 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_currentPhysicalSize = m_initialPhysicalSize = screenSize; else m_currentPhysicalSize = m_initialPhysicalSize = screenSize.transposed(); - - // We only create the root window if we are the primary display. - if (primaryScreen) - m_rootWindow = QSharedPointer<QQnxRootWindow>(new QQnxRootWindow(this)); } QQnxScreen::~QQnxScreen() @@ -252,8 +247,8 @@ void QQnxScreen::setRotation(int rotation) // Check if rotation changed if (m_currentRotation != rotation) { // Update rotation of root window - if (m_rootWindow) - m_rootWindow->setRotation(rotation); + if (rootWindow()) + rootWindow()->setRotation(rotation); const QRect previousScreenGeometry = geometry(); @@ -269,16 +264,16 @@ void QQnxScreen::setRotation(int rotation) // Resize root window if we've rotated 90 or 270 from previous orientation if (isOrthogonal(m_currentRotation, rotation)) { qScreenDebug() << Q_FUNC_INFO << "resize, size =" << m_currentGeometry.size(); - if (m_rootWindow) - m_rootWindow->resize(m_currentGeometry.size()); + if (rootWindow()) + rootWindow()->resize(m_currentGeometry.size()); if (m_primaryScreen) resizeWindows(previousScreenGeometry); } else { // TODO: Find one global place to flush display updates // Force immediate display update if no geometry changes required - if (m_rootWindow) - m_rootWindow->flush(); + if (rootWindow()) + rootWindow()->flush(); } // Save new rotation @@ -495,8 +490,8 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) // post app window (so navigator will show it) after first child window // has posted; this only needs to happen once as the app window's content // never changes - if (!m_posted && m_rootWindow) { - m_rootWindow->post(); + if (!m_posted && rootWindow()) { + rootWindow()->post(); m_posted = true; } } @@ -582,4 +577,13 @@ void QQnxScreen::deactivateWindowGroup(const QByteArray &id) QWindowSystemInterface::handleWindowActivated(0); } +QSharedPointer<QQnxRootWindow> QQnxScreen::rootWindow() const +{ + // We only create the root window if we are the primary display. + if (m_primaryScreen && !m_rootWindow) + m_rootWindow = QSharedPointer<QQnxRootWindow>(new QQnxRootWindow(this)); + + return m_rootWindow; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 682f681cd34..39cd4159d15 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -80,7 +80,7 @@ public: int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; } screen_display_t nativeDisplay() const { return m_display; } screen_context_t nativeContext() const { return m_screenContext; } - const char *windowGroupName() const { return m_rootWindow->groupName().constData(); } + const char *windowGroupName() const { return rootWindow()->groupName().constData(); } QQnxWindow *findWindow(screen_window_t windowHandle); @@ -93,7 +93,7 @@ public: void onWindowPost(QQnxWindow *window); - QSharedPointer<QQnxRootWindow> rootWindow() const { return m_rootWindow; } + QSharedPointer<QQnxRootWindow> rootWindow() const; QPlatformCursor *cursor() const; @@ -116,8 +116,8 @@ private: screen_context_t m_screenContext; screen_display_t m_display; - QSharedPointer<QQnxRootWindow> m_rootWindow; - bool m_primaryScreen; + mutable QSharedPointer<QQnxRootWindow> m_rootWindow; + const bool m_primaryScreen; bool m_posted; int m_initialRotation; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 4b1cc4fdace..2d3c7608bf8 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -42,6 +42,7 @@ #include "qqnxscreeneventhandler.h" #include "qqnxintegration.h" #include "qqnxkeytranslator.h" +#include "qqnxscreen.h" #include <QDebug> #include <QGuiApplication> @@ -489,9 +490,18 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) m_qnxIntegration->createDisplay(nativeDisplay, false /* not primary, we assume */); } } else if (!isAttached) { - // libscreen display is deactivated, let's remove the QQnxScreen / QScreen - qScreenEventDebug() << "removing display"; - m_qnxIntegration->removeDisplay(screen); + // We never remove the primary display, the qpa plugin doesn't support that and it crashes. + // To support it, this would be needed: + // - Adjust all qnx qpa code which uses screens + // - Make QWidgetBackingStore not dereference a null paint device + // - Create platform resources ( QQnxWindow ) for all QWindow because they would be deleted + // when you delete the screen + + if (!screen->isPrimaryScreen()) { + // libscreen display is deactivated, let's remove the QQnxScreen / QScreen + qScreenEventDebug() << "removing display"; + m_qnxIntegration->removeDisplay(screen); + } } } diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 7cc2b2aeb00..c23902014c0 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -577,9 +577,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long QRect rect; if (varID.lVal) { - QAIPointer child = QAIPointer(accessible->child(varID.lVal - 1)); - if (child->isValid()) - rect = child->rect(); + QAIPointer child(childPointer(varID)); + if (!child) + return E_FAIL; + rect = child->rect(); } else { rect = accessible->rect(); } diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 792eaf0fdcc..b40aefa2257 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -88,11 +88,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window); #ifndef Q_OS_WINCE - if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) { - const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE); - if ((wl & WS_EX_LAYERED) == 0) - SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED); - + const Qt::WindowFlags flags = window->flags(); + if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, rw->format().hasAlpha(), rw->opacity())) { QRect r = window->frameGeometry(); QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top()); QRect dirtyRect = br.translated(offset + frameOffset); @@ -101,7 +98,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA}; - if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { RECT dirty = {dirtyRect.x(), dirtyRect.y(), dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index c658a1814f6..a6709dffb32 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -869,8 +869,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: - handleContextMenuEvent(platformWindow->window(), msg); - return true; + return handleContextMenuEvent(platformWindow->window(), msg); #endif default: break; @@ -904,7 +903,7 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et, } #ifndef QT_NO_CONTEXTMENU -void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) +bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) { bool mouseTriggered = false; QPoint globalPos; @@ -914,10 +913,23 @@ void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) globalPos.setX(msg.pt.x); globalPos.setY(msg.pt.y); pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos); + + RECT clientRect; + if (GetClientRect(msg.hwnd, &clientRect)) { + if (pos.x() < (int)clientRect.left || pos.x() >= (int)clientRect.right || + pos.y() < (int)clientRect.top || pos.y() >= (int)clientRect.bottom) + { + // This is the case that user has right clicked in the window's caption, + // We should call DefWindowProc() to display a default shortcut menu + // instead of sending a Qt window system event. + return false; + } + } } QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos, QWindowsKeyMapper::queryKeyboardModifiers()); + return true; } #endif diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index bfe56ed2466..1fe71e3affc 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -192,7 +192,7 @@ public: private: void handleFocusEvent(QtWindows::WindowsEventType et, QWindowsWindow *w); #ifndef QT_NO_CONTEXTMENU - void handleContextMenuEvent(QWindow *window, const MSG &msg); + bool handleContextMenuEvent(QWindow *window, const MSG &msg); #endif void unregisterWindowClasses(); diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 4f9698b21bb..5b2a3acbae0 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#ifndef QT_NO_CURSOR #include "qwindowscursor.h" #include "qwindowscontext.h" #include "qwindowswindow.h" @@ -527,3 +528,5 @@ HCURSOR QWindowsWindowCursor::handle() const } QT_END_NAMESPACE + +#endif // !QT_NO_CURSOR diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index a71ee2f9edd..c2ddb912f1a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -247,7 +247,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName, value = fontCache.value(faceName); - //Fallback if we havent cached the font yet or the font got removed/renamed iterate again over all fonts + //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts if (value.isEmpty() || !QFile::exists(value)) { QSettings settings(QSettings::SystemScope, QStringLiteral("Qt-Project"), QStringLiteral("Qtbase")); settings.beginGroup(QStringLiteral("CEFontCache")); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 3c6fcca8131..30e0478e649 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -59,8 +59,10 @@ #include "qwindowsguieventdispatcher.h" #ifndef QT_NO_CLIPBOARD # include "qwindowsclipboard.h" +# ifndef QT_NO_DRAGANDDROP +# include "qwindowsdrag.h" +# endif #endif -#include "qwindowsdrag.h" #include "qwindowsinputcontext.h" #include "qwindowskeymapper.h" # ifndef QT_NO_ACCESSIBILITY @@ -108,6 +110,9 @@ public: Q_INVOKABLE void *createMessageWindow(const QString &classNameTemplate, const QString &windowName, void *eventProc) const; + + Q_INVOKABLE QString registerWindowClass(const QString &classNameIn, void *eventProc) const; + bool asyncExpose() const; void setAsyncExpose(bool value); @@ -223,6 +228,15 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl return hwnd; } +/*! + \brief Registers a unique window class with a callback function based on \a classNameIn. +*/ + +QString QWindowsNativeInterface::registerWindowClass(const QString &classNameIn, void *eventProc) const +{ + return QWindowsContext::instance()->registerWindowClass(classNameIn, (WNDPROC)eventProc); +} + bool QWindowsNativeInterface::asyncExpose() const { return QWindowsContext::instance()->asyncExpose(); @@ -291,8 +305,10 @@ struct QWindowsIntegrationPrivate QWindowsNativeInterface m_nativeInterface; #ifndef QT_NO_CLIPBOARD QWindowsClipboard m_clipboard; -#endif +# ifndef QT_NO_DRAGANDDROP QWindowsDrag m_drag; +# endif +#endif QWindowsGuiEventDispatcher *m_eventDispatcher; #if defined(QT_OPENGL_ES_2) QEGLStaticContextPtr m_staticEGLContext; @@ -559,12 +575,13 @@ QPlatformClipboard * QWindowsIntegration::clipboard() const { return &d->m_clipboard; } -#endif // !QT_NO_CLIPBOARD - +# ifndef QT_NO_DRAGANDDROP QPlatformDrag *QWindowsIntegration::drag() const { return &d->m_drag; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD QPlatformInputContext * QWindowsIntegration::inputContext() const { diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 2593c3b946f..24dc01f0bda 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -75,8 +75,10 @@ public: virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const; #ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; -#endif +# ifndef QT_NO_DRAGANDDROP virtual QPlatformDrag *drag() const; +# endif +#endif !QT_NO_CLIPBOARD virtual QPlatformInputContext *inputContext() const; #ifndef QT_NO_ACCESSIBILITY virtual QPlatformAccessibility *accessibility() const; diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 9bb16793cc2..f616972aa05 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -168,8 +168,10 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d) // Return the cursor to be shared by all screens (virtual desktop). static inline QSharedPointer<QWindowsCursor> sharedCursor() { +#ifndef QT_NO_CURSOR if (const QScreen *primaryScreen = QGuiApplication::primaryScreen()) return static_cast<const QWindowsScreen *>(primaryScreen->handle())->windowsCursor(); +#endif return QSharedPointer<QWindowsCursor>(new QWindowsCursor); } @@ -182,7 +184,10 @@ static inline QSharedPointer<QWindowsCursor> sharedCursor() */ QWindowsScreen::QWindowsScreen(const QWindowsScreenData &data) : - m_data(data), m_cursor(sharedCursor()) + m_data(data) +#ifndef QT_NO_CURSOR + ,m_cursor(sharedCursor()) +#endif { } @@ -250,7 +255,11 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags) QWindow *QWindowsScreen::windowUnderMouse(unsigned flags) { +#ifndef QT_NO_CURSOR return QWindowsScreen::windowAt(QWindowsCursor::mousePosition(), flags); +#else + return 0; +#endif } QWindowsScreen *QWindowsScreen::screenOf(const QWindow *w) diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 7da1a4d207c..216973125b8 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -79,7 +79,9 @@ struct QWindowsScreenData class QWindowsScreen : public QPlatformScreen { public: +#ifndef QT_NO_CURSOR typedef QSharedPointer<QWindowsCursor> WindowsCursorPtr; +#endif explicit QWindowsScreen(const QWindowsScreenData &data); @@ -106,14 +108,20 @@ public: inline void handleChanges(const QWindowsScreenData &newData); +#ifndef QT_NO_CURSOR QPlatformCursor *cursor() const { return m_cursor.data(); } const WindowsCursorPtr &windowsCursor() const { return m_cursor; } +#else + QPlatformCursor *cursor() const { return 0; } +#endif // !QT_NO_CURSOR const QWindowsScreenData &data() const { return m_data; } private: QWindowsScreenData m_data; +#ifndef QT_NO_CURSOR const WindowsCursorPtr m_cursor; +#endif }; class QWindowsScreenManager diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 9391929c415..d565420f4fa 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -44,7 +44,9 @@ #include "qwindowscontext.h" #include "qwindowsdrag.h" #include "qwindowsscreen.h" -#include "qwindowscursor.h" +#ifdef QT_NO_CURSOR +# include "qwindowscursor.h" +#endif #ifdef QT_OPENGL_ES_2 # include "qwindowseglcontext.h" @@ -209,22 +211,42 @@ static bool shouldShowMaximizeButton(Qt::WindowFlags flags) return flags & Qt::WindowMaximizeButtonHint; } -static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level) +// Set the WS_EX_LAYERED flag on a HWND if required. This is required for +// translucent backgrounds, not fully opaque windows and for +// Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT). +bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity) +{ +#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED + const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); + const bool needsLayered = (flags & Qt::WindowTransparentForInput) + || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0; + const bool isLayered = (exStyle & WS_EX_LAYERED); + if (needsLayered != isLayered) { + if (needsLayered) { + SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_LAYERED); + } else { + SetWindowLong(hwnd, GWL_EXSTYLE, exStyle & ~WS_EX_LAYERED); + } + } + return needsLayered; +#else // !Q_OS_WINCE + Q_UNUSED(hwnd); + Q_UNUSED(flags); + Q_UNUSED(hasAlpha); + Q_UNUSED(opacity); + return false; +#endif // Q_OS_WINCE +} + +static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level) { -#ifdef Q_OS_WINCE // maybe needs revisit WS_EX_LAYERED +#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls Q_UNUSED(hwnd); Q_UNUSED(flags); + Q_UNUSED(hasAlpha); Q_UNUSED(level); #else - const long wl = GetWindowLong(hwnd, GWL_EXSTYLE); - const bool isOpaque = level == 1.0 && !(flags & Qt::WindowTransparentForInput); - - if (isOpaque) { - if (wl & WS_EX_LAYERED) - SetWindowLong(hwnd, GWL_EXSTYLE, wl & ~WS_EX_LAYERED); - } else { - if ((wl & WS_EX_LAYERED) == 0) - SetWindowLong(hwnd, GWL_EXSTYLE, wl | WS_EX_LAYERED); + if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { if (flags & Qt::FramelessWindowHint) { BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA}; QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); @@ -271,7 +293,7 @@ struct WindowCreationData WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), topLevel(false), popup(false), dialog(false), desktop(false), - tool(false), embedded(false) {} + tool(false), embedded(false), hasAlpha(false) {} void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0); inline WindowData create(const QWindow *w, const WindowData &data, QString title) const; @@ -290,6 +312,7 @@ struct WindowCreationData bool desktop; bool tool; bool embedded; + bool hasAlpha; }; QDebug operator<<(QDebug debug, const WindowCreationData &d) @@ -308,6 +331,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag unsigned creationFlags) { isGL = w->surfaceType() == QWindow::OpenGLSurface; + hasAlpha = w->format().hasAlpha(); flags = flagsIn; // Sometimes QWindow doesn't have a QWindow parent but does have a native parent window, @@ -321,10 +345,12 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag if (creationFlags & ForceChild) { topLevel = false; - } else if (creationFlags & ForceTopLevel) { - topLevel = true; + } else if (embedded) { + // Embedded native windows (for example Active X server windows) are by + // definition never toplevel, even though they do not have QWindow parents. + topLevel = false; } else { - topLevel = w->isTopLevel(); + topLevel = (creationFlags & ForceTopLevel) ? true : w->isTopLevel(); } if (topLevel && flags == 1) { @@ -530,7 +556,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); } - setWindowOpacity(hwnd, flags, opacityLevel); + setWindowOpacity(hwnd, flags, hasAlpha, opacityLevel); } else { // child. SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags); } @@ -770,8 +796,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : break; } } +#ifndef Q_OS_WINCE if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0); +#endif // !Q_OS_WINCE setWindowState(aWindow->windowState()); const qreal opacity = qt_window_private(aWindow)->opacity; if (!qFuzzyCompare(opacity, qreal(1.0))) @@ -780,8 +808,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : QWindowsWindow::~QWindowsWindow() { +#ifndef Q_OS_WINCE if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); +#endif // !Q_OS_WINCE destroyWindow(); destroyIcon(); } @@ -811,7 +841,7 @@ void QWindowsWindow::destroyWindow() ShowWindow(handle, SW_SHOW); } } -#endif +#endif // !Q_OS_WINCE if (m_data.hwnd != GetDesktopWindow()) DestroyWindow(m_data.hwnd); QWindowsContext::instance()->removeWindow(m_data.hwnd); @@ -821,21 +851,29 @@ void QWindowsWindow::destroyWindow() void QWindowsWindow::registerDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && !m_dropTarget) { m_dropTarget = new QWindowsOleDropTarget(window()); RegisterDragDrop(m_data.hwnd, m_dropTarget); CoLockObjectExternal(m_dropTarget, true, true); } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } void QWindowsWindow::unregisterDropSite() { +#ifndef QT_NO_CLIPBOARD +# ifndef QT_NO_DRAGANDDROP if (m_data.hwnd && m_dropTarget) { m_dropTarget->Release(); CoLockObjectExternal(m_dropTarget, false, true); RevokeDragDrop(m_data.hwnd); m_dropTarget = 0; } +# endif // !QT_NO_DRAGANDDROP +#endif // !QT_NO_CLIPBOARD } // Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain. @@ -1231,18 +1269,7 @@ void QWindowsWindow::setWindowTitle(const QString &title) if (QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << this << window() <<title; if (m_data.hwnd) { - - QString fullTitle = title; - if (QGuiApplicationPrivate::displayName) { - // Append display name, if set. - if (!fullTitle.isEmpty()) - fullTitle += QStringLiteral(" - "); - fullTitle += *QGuiApplicationPrivate::displayName; - } else if (fullTitle.isEmpty()) { - // Don't let the window title be completely empty, use the app name as fallback. - fullTitle = QCoreApplication::applicationName(); - } - + const QString fullTitle = formatWindowTitle(title, QStringLiteral(" - ")); SetWindowText(m_data.hwnd, (const wchar_t*)fullTitle.utf16()); } } @@ -1508,7 +1535,7 @@ void QWindowsWindow::setOpacity(qreal level) if (m_opacity != level) { m_opacity = level; if (m_data.hwnd) - setWindowOpacity(m_data.hwnd, m_data.flags, level); + setWindowOpacity(m_data.hwnd, m_data.flags, window()->format().hasAlpha(), level); } } @@ -1671,12 +1698,14 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const void QWindowsWindow::applyCursor() { +#ifndef QT_NO_CURSOR if (m_cursor.isNull()) { // Recurse up to parent with non-null cursor. if (const QWindow *p = window()->parent()) QWindowsWindow::baseWindowOf(p)->applyCursor(); } else { SetCursor(m_cursor.handle()); } +#endif } // Check whether to apply a new cursor. Either the window in question is @@ -1698,6 +1727,7 @@ static inline bool applyNewCursor(const QWindow *w) void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) { +#ifndef QT_NO_CURSOR if (c.handle() != m_cursor.handle()) { const bool apply = applyNewCursor(window()); if (QWindowsContext::verboseWindows) @@ -1707,6 +1737,7 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) if (apply) applyCursor(); } +#endif } /*! diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 9dc8c170e7e..8fe5cbe17bd 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -223,13 +223,17 @@ public: static inline void *userDataOf(HWND hwnd); static inline void setUserDataOf(HWND hwnd, void *ud); + static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity); + HDC getDC(); void releaseDC(); #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void getSizeHints(MINMAXINFO *mmi) const; #endif +#ifndef QT_NO_CURSOR QWindowsWindowCursor cursor() const { return m_cursor; } +#endif void setCursor(const QWindowsWindowCursor &c); void applyCursor(); @@ -275,7 +279,9 @@ private: HDC m_hdc; Qt::WindowState m_windowState; qreal m_opacity; +#ifndef QT_NO_CURSOR QWindowsWindowCursor m_cursor; +#endif QWindowsOleDropTarget *m_dropTarget; unsigned m_savedStyle; QRect m_savedFrameGeometry; diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 7f73465135d..ff162e2d41c 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -45,7 +45,6 @@ SOURCES += \ qwindowsguieventdispatcher.cpp \ qwindowsole.cpp \ qwindowsmime.cpp \ - qwindowsdrag.cpp \ qwindowsinternalmimedata.cpp \ qwindowscursor.cpp \ qwindowsinputcontext.cpp \ @@ -69,7 +68,6 @@ HEADERS += \ qtwindows_additional.h \ qwindowsole.h \ qwindowsmime.h \ - qwindowsdrag.h \ qwindowsinternalmimedata.h \ qwindowscursor.h \ array.h \ @@ -94,6 +92,16 @@ contains(QT_CONFIG, opengles2) { HEADERS += qwindowsclipboard.h } +# drag and drop on windows only works if a clipboard is available +!contains( DEFINES, QT_NO_DRAGANDDROP ) { + !win32:SOURCES += qwindowsdrag.cpp + !win32:HEADERS += qwindowsdrag.h + win32:!contains( DEFINES, QT_NO_CLIPBOARD ) { + HEADERS += qwindowsdrag.h + SOURCES += qwindowsdrag.cpp + } +} + # Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h. DEFINES *= QT_COMPILES_IN_HARFBUZZ diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 80fcbbebc6f..23bec15b48b 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -305,14 +305,24 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat // If asking for OpenGL 3.2 or newer we should also specify a profile if (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1)) { - if (m_format.profile() == QSurfaceFormat::CoreProfile) { - contextAttributes << GLX_CONTEXT_FLAGS_ARB << GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB - << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - } else { + if (m_format.profile() == QSurfaceFormat::CoreProfile) + contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + else contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } } + int flags = 0; + + if (m_format.testOption(QSurfaceFormat::DebugContext)) + flags |= GLX_CONTEXT_DEBUG_BIT_ARB; + + // A forward-compatible context may be requested for 3.0 and later + if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions)) + flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + + if (flags != 0) + contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags; + contextAttributes << None; m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data()); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index a8957d58108..c0ddf5c0ae7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1125,18 +1125,8 @@ void QXcbWindow::setParent(const QPlatformWindow *parent) void QXcbWindow::setWindowTitle(const QString &title) { - QString fullTitle = title; - if (QGuiApplicationPrivate::displayName) { - // Append display name, if set. - if (!fullTitle.isEmpty()) - fullTitle += QString::fromUtf8(" \xe2\x80\x94 "); // unicode character U+2014, EM DASH - fullTitle += *QGuiApplicationPrivate::displayName; - } else if (fullTitle.isEmpty()) { - // Don't let the window title be completely empty, use the app name as fallback. - fullTitle = QCoreApplication::applicationName(); - } + const QString fullTitle = formatWindowTitle(title, QString::fromUtf8(" \xe2\x80\x94 ")); // unicode character U+2014, EM DASH const QByteArray ba = fullTitle.toUtf8(); - Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf index 25317d4773b..76206a8c1fc 100644 --- a/src/printsupport/doc/qtprintsupport.qdocconf +++ b/src/printsupport/doc/qtprintsupport.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtPrintSupport description = Qt Print Support Reference Documentation -url = http://qt-project.org/doc/qtprintsupport -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtprintsupport +version = $QT_VERSION examplesinstallpath = printsupport qhp.projects = QtPrintSupport qhp.QtPrintSupport.file = qtprintsupport.qhp -qhp.QtPrintSupport.namespace = org.qt-project.qtprintsupport.510 +qhp.QtPrintSupport.namespace = org.qt-project.qtprintsupport.$QT_VERSION_TAG qhp.QtPrintSupport.virtualFolder = qtprintsupport qhp.QtPrintSupport.indexTitle = Qt Print Support qhp.QtPrintSupport.indexRoot = -qhp.QtPrintSupport.filterAttributes = qtprintsupport 5.1.0 qtrefdoc -qhp.QtPrintSupport.customFilters.Qt.name = QtPrintSupport 5.1.0 -qhp.QtPrintSupport.customFilters.Qt.filterAttributes = qtprintsupport 5.1.0 +qhp.QtPrintSupport.filterAttributes = qtprintsupport $QT_VERSION qtrefdoc +qhp.QtPrintSupport.customFilters.Qt.name = QtPrintSupport $QT_VERSION +qhp.QtPrintSupport.customFilters.Qt.filterAttributes = qtprintsupport $QT_VERSION qhp.QtPrintSupport.subprojects = classes qhp.QtPrintSupport.subprojects.classes.title = C++ Classes diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 5f14c286160..8bdccd0f5b2 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -24,7 +24,7 @@ win32 { $$PWD/qprintengine_win_p.h SOURCES += \ $$PWD/qprintengine_win.cpp - LIBS += -lwinspool -lcomdlg32 + LIBS += -lwinspool -lcomdlg32 -lgdi32 -luser32 } unix:!mac:contains(QT_CONFIG, cups): { diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf index 19dd9eae1e6..e53bd50b556 100644 --- a/src/sql/doc/qtsql.qdocconf +++ b/src/sql/doc/qtsql.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtSql description = Qt SQL Reference Documentation -url = http://qt-project.org/doc/qtsql -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtsql +version = $QT_VERSION examplesinstallpath = sql qhp.projects = QtSql qhp.QtSql.file = qtsql.qhp -qhp.QtSql.namespace = org.qt-project.qtsql.510 +qhp.QtSql.namespace = org.qt-project.qtsql.$QT_VERSION_TAG qhp.QtSql.virtualFolder = qtsql qhp.QtSql.indexTitle = Qt SQL qhp.QtSql.indexRoot = -qhp.QtSql.filterAttributes = qtsql 5.1.0 qtrefdoc -qhp.QtSql.customFilters.Qt.name = QtSql 5.1.0 -qhp.QtSql.customFilters.Qt.filterAttributes = qtsql 5.1.0 +qhp.QtSql.filterAttributes = qtsql $QT_VERSION qtrefdoc +qhp.QtSql.customFilters.Qt.name = QtSql $QT_VERSION +qhp.QtSql.customFilters.Qt.filterAttributes = qtsql $QT_VERSION qhp.QtSql.subprojects = classes qhp.QtSql.subprojects.classes.title = C++ Classes diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri index c9ec2575faf..0423eb4ed91 100644 --- a/src/sql/drivers/mysql/qsql_mysql.pri +++ b/src/sql/drivers/mysql/qsql_mysql.pri @@ -13,7 +13,7 @@ unix { else:LIBS += -lmysqlclient } } else { - LIBS *= $$QT_LFLAGS_MYSQL + LIBS += $$QT_LFLAGS_MYSQL QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL } } else { diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 678e83690a9..1d96e9f93b6 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1208,8 +1208,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const if (field.value().toDateTime().isValid()) { QDate dt = field.value().toDateTime().date(); QTime tm = field.value().toDateTime().time(); - // msecs need to be right aligned otherwise psql - // interpretes them wrong + // msecs need to be right aligned otherwise psql interprets them wrong r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-') + QString::number(dt.month()) + QLatin1Char('-') + QString::number(dt.day()) + QLatin1Char(' ') diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri index 6da3540104b..9b647d8200b 100644 --- a/src/sql/drivers/psql/qsql_psql.pri +++ b/src/sql/drivers/psql/qsql_psql.pri @@ -2,7 +2,7 @@ HEADERS += $$PWD/qsql_psql.h SOURCES += $$PWD/qsql_psql.cpp unix|win32-g++* { - LIBS *= $$QT_LFLAGS_PSQL + LIBS += $$QT_LFLAGS_PSQL !contains(LIBS, .*pq.*):LIBS += -lpq QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL } else { diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri index 7ad5936e25a..a2e80d4c746 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.pri +++ b/src/sql/drivers/sqlite/qsql_sqlite.pri @@ -4,6 +4,6 @@ SOURCES += $$PWD/qsql_sqlite.cpp !system-sqlite:!contains(LIBS, .*sqlite3.*) { include($$PWD/../../../3rdparty/sqlite.pri) } else { - LIBS *= $$QT_LFLAGS_SQLITE + LIBS += $$QT_LFLAGS_SQLITE QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE } diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index 3b5a6895c9c..38aab2f3e49 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -2,7 +2,7 @@ HEADERS += $$PWD/qsql_tds.h SOURCES += $$PWD/qsql_tds.cpp unix|win32-g++*: { - LIBS *= $$QT_LFLAGS_TDS + LIBS += $$QT_LFLAGS_TDS !contains(LIBS, .*sybdb.*):LIBS += -lsybdb QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS } else { diff --git a/src/sql/kernel/kernel.pri b/src/sql/kernel/kernel.pri index c6fe404737c..fe7f1270f9f 100644 --- a/src/sql/kernel/kernel.pri +++ b/src/sql/kernel/kernel.pri @@ -8,6 +8,7 @@ HEADERS += kernel/qsql.h \ kernel/qsqldriverplugin.h \ kernel/qsqlerror.h \ kernel/qsqlresult.h \ + kernel/qsqlresult_p.h \ kernel/qsqlcachedresult_p.h \ kernel/qsqlindex.h diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 4f59855ac29..36422f5f621 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -794,9 +794,6 @@ void QSqlDatabasePrivate::init(const QString &type) /*! Destroys the object and frees any allocated resources. - If this is the last QSqlDatabase object that uses a certain - database connection, the database connection is automatically closed. - \sa close() */ diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 3a45ccbcce7..b3e7ad5b385 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -50,78 +50,11 @@ #include "qvector.h" #include "qsqldriver.h" #include "qpointer.h" +#include "qsqlresult_p.h" #include <QDebug> QT_BEGIN_NAMESPACE -struct QHolder { - QHolder(const QString& hldr = QString(), int index = -1): holderName(hldr), holderPos(index) {} - bool operator==(const QHolder& h) const { return h.holderPos == holderPos && h.holderName == holderName; } - bool operator!=(const QHolder& h) const { return h.holderPos != holderPos || h.holderName != holderName; } - QString holderName; - int holderPos; -}; - -class QSqlResultPrivate -{ -public: - QSqlResultPrivate(QSqlResult* d) - : q(d), idx(QSql::BeforeFirstRow), active(false), - isSel(false), forwardOnly(false), precisionPolicy(QSql::LowPrecisionDouble), bindCount(0), binds(QSqlResult::PositionalBinding) - {} - - void clearValues() - { - values.clear(); - bindCount = 0; - } - - void resetBindCount() - { - bindCount = 0; - } - - void clearIndex() - { - indexes.clear(); - holders.clear(); - types.clear(); - } - - void clear() - { - clearValues(); - clearIndex();; - } - - QString positionalToNamedBinding(); - QString namedToPositionalBinding(); - QString holderAt(int index) const; - -public: - QSqlResult* q; - QPointer<QSqlDriver> sqldriver; - int idx; - QString sql; - bool active; - bool isSel; - QSqlError error; - bool forwardOnly; - QSql::NumericalPrecisionPolicy precisionPolicy; - - int bindCount; - QSqlResult::BindingSyntax binds; - - QString executedQuery; - QHash<int, QSql::ParamType> types; - QVector<QVariant> values; - typedef QHash<QString, QList<int> > IndexMap; - IndexMap indexes; - - typedef QVector<QHolder> QHolderVector; - QHolderVector holders; -}; - static QString qFieldSerial(int); QString QSqlResultPrivate::holderAt(int index) const @@ -584,6 +517,8 @@ void QSqlResult::setForwardOnly(bool forward) functionality where possible. Returns true if the query is prepared successfully; otherwise returns false. + Note: This method should have been called "safePrepare()". + \sa prepare() */ bool QSqlResult::savePrepare(const QString& query) @@ -595,13 +530,12 @@ bool QSqlResult::savePrepare(const QString& query) if (!driver()->hasFeature(QSqlDriver::PreparedQueries)) return prepare(query); - if (driver()->hasFeature(QSqlDriver::NamedPlaceholders)) { - // parse the query to memorize parameter location - d->namedToPositionalBinding(); + // parse the query to memorize parameter location + d->executedQuery = d->namedToPositionalBinding(); + + if (driver()->hasFeature(QSqlDriver::NamedPlaceholders)) d->executedQuery = d->positionalToNamedBinding(); - } else { - d->executedQuery = d->namedToPositionalBinding(); - } + return prepare(d->executedQuery); } @@ -614,34 +548,11 @@ bool QSqlResult::savePrepare(const QString& query) */ bool QSqlResult::prepare(const QString& query) { + d->sql = query; if (d->holders.isEmpty()) { - int n = query.size(); - - bool inQuote = false; - int i = 0; - - while (i < n) { - QChar ch = query.at(i); - if (ch == QLatin1Char(':') && !inQuote - && (i == 0 || query.at(i - 1) != QLatin1Char(':')) - && (i + 1 < n && qIsAlnum(query.at(i + 1)))) { - int pos = i + 2; - while (pos < n && qIsAlnum(query.at(pos))) - ++pos; - - QString holder(query.mid(i, pos - i)); - d->indexes[holder].append(d->holders.size()); - d->holders.append(QHolder(holder, i)); - i = pos; - } else { - if (ch == QLatin1Char('\'')) - inQuote = !inQuote; - ++i; - } - } - d->values.resize(d->holders.size()); + // parse the query to memorize parameter location + d->namedToPositionalBinding(); } - d->sql = query; return true; // fake prepares should always succeed } diff --git a/src/sql/kernel/qsqlresult_p.h b/src/sql/kernel/qsqlresult_p.h new file mode 100644 index 00000000000..65f9be7a05b --- /dev/null +++ b/src/sql/kernel/qsqlresult_p.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQLRESULT_P_H +#define QSQLRESULT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qsql*model.h . This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qpointer.h> +#include <QtSql/qsqldriver.h> +#include "qsqlerror.h" +#include "qsqlresult.h" + +QT_BEGIN_NAMESPACE + +struct QHolder { + QHolder(const QString &hldr = QString(), int index = -1): holderName(hldr), holderPos(index) { } + bool operator==(const QHolder &h) const { return h.holderPos == holderPos && h.holderName == holderName; } + bool operator!=(const QHolder &h) const { return h.holderPos != holderPos || h.holderName != holderName; } + QString holderName; + int holderPos; +}; + +class Q_SQL_EXPORT QSqlResultPrivate +{ +public: + QSqlResultPrivate(QSqlResult *d) + : q(d), + idx(QSql::BeforeFirstRow), + active(false), + isSel(false), + forwardOnly(false), + precisionPolicy(QSql::LowPrecisionDouble), + bindCount(0), + binds(QSqlResult::PositionalBinding) + { } + + void clearValues() + { + values.clear(); + bindCount = 0; + } + + void resetBindCount() + { + bindCount = 0; + } + + void clearIndex() + { + indexes.clear(); + holders.clear(); + types.clear(); + } + + void clear() + { + clearValues(); + clearIndex();; + } + + QString positionalToNamedBinding(); + QString namedToPositionalBinding(); + QString holderAt(int index) const; + + QSqlResult *q; + QPointer<QSqlDriver> sqldriver; + int idx; + QString sql; + bool active; + bool isSel; + QSqlError error; + bool forwardOnly; + QSql::NumericalPrecisionPolicy precisionPolicy; + + int bindCount; + QSqlResult::BindingSyntax binds; + + QString executedQuery; + QHash<int, QSql::ParamType> types; + QVector<QVariant> values; + typedef QHash<QString, QList<int> > IndexMap; + IndexMap indexes; + + typedef QVector<QHolder> QHolderVector; + QHolderVector holders; +}; + +QT_END_NAMESPACE + +#endif // QSQLRESULT_P_H diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 59103b72d3f..00fc410ca5a 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -95,6 +95,13 @@ void QSqlQueryModelPrivate::initColOffsets(int size) memset(colOffsets.data(), 0, colOffsets.size() * sizeof(int)); } +int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const +{ + if (modelColumn < 0 || modelColumn >= rec.count() || !rec.isGenerated(modelColumn) || modelColumn >= colOffsets.size()) + return -1; + return modelColumn - colOffsets[modelColumn]; +} + /*! \class QSqlQueryModel \brief The QSqlQueryModel class provides a read-only data model for SQL @@ -370,11 +377,7 @@ QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, in val = d->headers.value(section).value(Qt::EditRole); if (val.isValid()) return val; - - // See if it's an inserted column (iiq.column() != -1) - QModelIndex dItem = indexInQuery(createIndex(0, section)); - - if (role == Qt::DisplayRole && d->rec.count() > section && dItem.column() != -1) + if (role == Qt::DisplayRole && d->rec.count() > section && d->columnInQuery(section) != -1) return d->rec.fieldName(section); } return QAbstractItemModel::headerData(section, orientation, role); @@ -668,12 +671,10 @@ bool QSqlQueryModel::removeColumns(int column, int count, const QModelIndex &par QModelIndex QSqlQueryModel::indexInQuery(const QModelIndex &item) const { Q_D(const QSqlQueryModel); - if (item.column() < 0 || item.column() >= d->rec.count() - || !d->rec.isGenerated(item.column()) - || item.column() >= d->colOffsets.size()) + int modelColumn = d->columnInQuery(item.column()); + if (modelColumn < 0) return QModelIndex(); - return createIndex(item.row(), item.column() - d->colOffsets[item.column()], - item.internalPointer()); + return createIndex(item.row(), modelColumn, item.internalPointer()); } QT_END_NAMESPACE diff --git a/src/sql/models/qsqlquerymodel_p.h b/src/sql/models/qsqlquerymodel_p.h index ecf69003f4a..a79b62cda14 100644 --- a/src/sql/models/qsqlquerymodel_p.h +++ b/src/sql/models/qsqlquerymodel_p.h @@ -72,6 +72,7 @@ public: void prefetch(int); void initColOffsets(int size); + int columnInQuery(int modelColumn) const; mutable QSqlQuery query; mutable QSqlError error; diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 32dd517a7aa..2e395b0a595 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -355,6 +355,16 @@ void QSqlTableModel::setTable(const QString &tableName) if (d->rec.count() == 0) d->error = QSqlError(QLatin1String("Unable to find table ") + d->tableName, QString(), QSqlError::StatementError); + + // Remember the auto index column if there is one now. + // The record that will be obtained from the query after select lacks this feature. + d->autoColumn.clear(); + for (int c = 0; c < d->rec.count(); ++c) { + if (d->rec.field(c).isAutoValue()) { + d->autoColumn = d->rec.fieldName(c); + break; + } + } } /*! @@ -587,7 +597,10 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in if (!(flags(index) & Qt::ItemIsEditable)) return false; - if (QSqlTableModel::data(index, role) == value) + const QVariant oldValue = QSqlTableModel::data(index, role); + if (value == oldValue + && value.isNull() == oldValue.isNull() + && d->cache.value(index.row()).op() != QSqlTableModelPrivate::Insert) return true; QSqlTableModelPrivate::ModifiedRow &row = d->cache[index.row()]; @@ -772,6 +785,11 @@ bool QSqlTableModel::submitAll() } if (success) { + if (d->strategy != OnManualSubmit && mrow.op() == QSqlTableModelPrivate::Insert) { + int c = mrow.rec().indexOf(d->autoColumn); + if (c != -1 && !mrow.rec().isGenerated(c)) + mrow.setValue(c, d->editQuery.lastInsertId()); + } mrow.setSubmitted(); if (d->strategy != OnManualSubmit) success = selectRow(row); @@ -821,7 +839,8 @@ bool QSqlTableModel::submit() user canceled editing the current row. Reverts the changes if the model's strategy is set to - OnRowChange. Does nothing for the other edit strategies. + OnRowChange or OnFieldChange. Does nothing for the OnManualSubmit + strategy. Use revertAll() to revert all pending changes for the OnManualSubmit strategy or revertRow() to revert a specific row. @@ -831,7 +850,7 @@ bool QSqlTableModel::submit() void QSqlTableModel::revert() { Q_D(QSqlTableModel); - if (d->strategy == OnRowChange) + if (d->strategy == OnRowChange || d->strategy == OnFieldChange) revertAll(); } diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h index 56db09b7e01..825490ea39b 100644 --- a/src/sql/models/qsqltablemodel_p.h +++ b/src/sql/models/qsqltablemodel_p.h @@ -96,6 +96,7 @@ public: QSqlIndex primaryIndex; QString tableName; QString filter; + QString autoColumn; enum Op { None, Insert, Update, Delete }; diff --git a/src/src.pro b/src/src.pro index 1ce31eed475..525c9c88554 100644 --- a/src/src.pro +++ b/src/src.pro @@ -36,7 +36,7 @@ src_testlib.target = sub-testlib src_testlib.depends = src_corelib # src_gui & src_widgets are not build-depends src_angle.subdir = $$PWD/angle -src_angle.target = src_angle +src_angle.target = sub-angle src_gui.subdir = $$PWD/gui src_gui.target = sub-gui diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf index 1f0c35c3895..2eea4f246a6 100644 --- a/src/testlib/doc/qttestlib.qdocconf +++ b/src/testlib/doc/qttestlib.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtTestLib description = Qt Test Reference Documentation -url = http://qt-project.org/doc/qttestlib -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qttestlib +version = $QT_VERSION examplesinstallpath = testlib qhp.projects = QtTestLib qhp.QtTestLib.file = qttestlib.qhp -qhp.QtTestLib.namespace = org.qt-project.qttest.510 +qhp.QtTestLib.namespace = org.qt-project.qttest.$QT_VERSION_TAG qhp.QtTestLib.virtualFolder = qttest qhp.QtTestLib.indexTitle = Qt Test qhp.QtTestLib.indexRoot = -qhp.QtTestLib.filterAttributes = qttestlib 5.1.0 qtrefdoc -qhp.QtTestLib.customFilters.Qt.name = QtTestLib 5.1.0 -qhp.QtTestLib.customFilters.Qt.filterAttributes = qttest 5.1.0 +qhp.QtTestLib.filterAttributes = qttest $QT_VERSION qtrefdoc +qhp.QtTestLib.customFilters.Qt.name = QtTest $QT_VERSION +qhp.QtTestLib.customFilters.Qt.filterAttributes = qttest $QT_VERSION qhp.QtTestLib.subprojects = classes qhp.QtTestLib.subprojects.classes.title = C++ Classes diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc index a3203189262..a0af232c036 100644 --- a/src/testlib/doc/src/qt-webpages.qdoc +++ b/src/testlib/doc/src/qt-webpages.qdoc @@ -36,7 +36,3 @@ \externalpage http://qt.gitorious.org/qt-labs/qtestlib-tools \title qtestlib-tools */ -/*! - \externalpage http://qt.nokia.com/services-partners/partners/partner-directory - \title Partner Directory -*/ diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc index fb0b6398475..db42db1687a 100644 --- a/src/testlib/doc/src/qttest-index.qdoc +++ b/src/testlib/doc/src/qttest-index.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ /*! - \page qttestlib-index.html + \page qttest-index.html \title Qt Test \brief Provides classes for unit testing Qt applications and libraries. diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 450dce46ab9..796d817ae2e 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -266,7 +266,7 @@ quint64 QTest::endBenchmarkMeasurement() Sets the benchmark result for this test function to \a result. Use this function if you want to report benchmark results without - using the QBENCHMARK macro. Use \a metric to specify how QTestLib + using the QBENCHMARK macro. Use \a metric to specify how Qt Test should interpret the results. The context for the result will be the test function name and any diff --git a/src/testlib/qbenchmark.h b/src/testlib/qbenchmark.h index f64cb1d2db3..ea5023c0957 100644 --- a/src/testlib/qbenchmark.h +++ b/src/testlib/qbenchmark.h @@ -56,7 +56,7 @@ namespace QTest // ------------- // // The QBenchmarkIterationController class is not a part of the -// QTestlib API. It exists purely as an implementation detail. +// Qt Test API. It exists purely as an implementation detail. // // class Q_TESTLIB_EXPORT QBenchmarkIterationController diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 91da10fd941..f9f21c6a8fb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1837,7 +1837,7 @@ char *toHexRepresentation(const char *ba, int length) * running out of memory and flooding things when the byte array * is large. * - * maxLen can't be for example 200 because QTestLib is sprinkled with fixed + * maxLen can't be for example 200 because Qt Test is sprinkled with fixed * size char arrays. * */ const int maxLen = 50; @@ -2037,7 +2037,7 @@ FatalSignalHandler::~FatalSignalHandler() are executed if they exist. See \l{Creating a Test} for more details. Optionally, the command line arguments \a argc and \a argv can be provided. - For a list of recognized arguments, read \l {QTestLib Command Line Arguments}. + For a list of recognized arguments, read \l {Qt Test Command Line Arguments}. The following example will run all tests in \c MyTestObject: diff --git a/src/tools/qdoc/atom.cpp b/src/tools/qdoc/atom.cpp index 481cfffd751..6f9da3790d7 100644 --- a/src/tools/qdoc/atom.cpp +++ b/src/tools/qdoc/atom.cpp @@ -349,7 +349,7 @@ QString Atom::typeString() const int i = 0; while (atms[i].english != 0) { if (atms[i].no != i) - Location::internalError(tr("atom %1 missing").arg(i)); + Location::internalError(QCoreApplication::translate("QDoc::Atom", "atom %1 missing").arg(i)); i++; } deja = true; diff --git a/src/tools/qdoc/codeparser.h b/src/tools/qdoc/codeparser.h index cbb8544d6fc..8c398aeb057 100644 --- a/src/tools/qdoc/codeparser.h +++ b/src/tools/qdoc/codeparser.h @@ -54,6 +54,8 @@ class QDocDatabase; class CodeParser { + Q_DECLARE_TR_FUNCTIONS(QDoc::CodeParser) + public: CodeParser(); virtual ~CodeParser(); diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 9b58df19ee1..766697dfc23 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -88,6 +88,8 @@ void MetaStackEntry::close() */ class MetaStack : private QStack<MetaStackEntry> { + Q_DECLARE_TR_FUNCTIONS(QDoc::MetaStack) + public: MetaStack(); diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h index 419329797b7..2c655cdf236 100644 --- a/src/tools/qdoc/config.h +++ b/src/tools/qdoc/config.h @@ -72,6 +72,8 @@ typedef QMap<QString, QStringListPair> QStringListPairMap; class Config { + Q_DECLARE_TR_FUNCTIONS(QDoc::Config) + public: Config(const QString& programName); ~Config(); diff --git a/src/tools/qdoc/cppcodemarker.h b/src/tools/qdoc/cppcodemarker.h index f4bdca0133f..91a9c01a283 100644 --- a/src/tools/qdoc/cppcodemarker.h +++ b/src/tools/qdoc/cppcodemarker.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE class CppCodeMarker : public CodeMarker { + Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeMarker) + public: CppCodeMarker(); ~CppCodeMarker(); diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index e83147776f3..0af5a841eb8 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE /* qmake ignore Q_OBJECT */ +static bool inMacroCommand_ = false; QStringList CppCodeParser::exampleFiles; QStringList CppCodeParser::exampleDirs; @@ -311,13 +312,14 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, const QString& command, const ArgLocPair& arg) { + ExtraFuncData extra; if (command == COMMAND_FN) { QStringList parentPath; FunctionNode *func = 0; FunctionNode *clone = 0; - if (!makeFunctionNode(arg.first, &parentPath, &clone) && - !makeFunctionNode("void " + arg.first, &parentPath, &clone)) { + if (!makeFunctionNode(arg.first, &parentPath, &clone, extra) && + !makeFunctionNode("void " + arg.first, &parentPath, &clone, extra)) { doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_FN)); } else { @@ -368,7 +370,9 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, QStringList parentPath; FunctionNode *func = 0; - if (makeFunctionNode(arg.first, &parentPath, &func, qdb_->treeRoot())) { + extra.root = qdb_->treeRoot(); + extra.isMacro = true; + if (makeFunctionNode(arg.first, &parentPath, &func, extra)) { if (!parentPath.isEmpty()) { doc.startLocation().warning(tr("Invalid syntax in '\\%1'").arg(COMMAND_MACRO)); delete func; @@ -1152,7 +1156,6 @@ bool CppCodeParser::matchTemplateAngles(CodeChunk *dataType) if (--parenAndBraceDepth < 0) return false; } - if (dataType != 0) dataType->append(lexeme()); readToken(); @@ -1161,6 +1164,9 @@ bool CppCodeParser::matchTemplateAngles(CodeChunk *dataType) return matches; } +/* + This function is no longer used. + */ bool CppCodeParser::matchTemplateHeader() { readToken(); @@ -1204,13 +1210,27 @@ bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var) } if (virgin) { - if (match(Tok_Ident)) - dataType->append(previousLexeme()); + if (match(Tok_Ident)) { + /* + This is a hack until we replace this "parser" + with the real one used in Qt Creator. + */ + if (!inMacroCommand_ && lexeme() == "(" && + ((previousLexeme() == "QT_PREPEND_NAMESPACE") || (previousLexeme() == "NS"))) { + readToken(); + readToken(); + dataType->append(previousLexeme()); + readToken(); + } + else + dataType->append(previousLexeme()); + } else if (match(Tok_void) || match(Tok_int) || match(Tok_char) || match(Tok_double) || match(Tok_Ellipsis)) dataType->append(previousLexeme()); - else + else { return false; + } } else if (match(Tok_int) || match(Tok_char) || match(Tok_double)) { dataType->append(previousLexeme()); @@ -1242,8 +1262,9 @@ bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var) dataType->appendHotspot(); if (var != 0 && match(Tok_Ident)) *var = previousLexeme(); - if (!match(Tok_RightParen) || tok != Tok_LeftParen) + if (!match(Tok_RightParen) || tok != Tok_LeftParen) { return false; + } dataType->append(previousLexeme()); int parenDepth0 = tokenizer->parenDepth(); @@ -1298,8 +1319,9 @@ bool CppCodeParser::matchParameter(FunctionNode *func) QString name; CodeChunk defaultValue; - if (!matchDataType(&dataType, &name)) + if (!matchDataType(&dataType, &name)) { return false; + } match(Tok_Comment); if (match(Tok_Equal)) { int parenDepth0 = tokenizer->parenDepth(); @@ -1312,10 +1334,7 @@ bool CppCodeParser::matchParameter(FunctionNode *func) readToken(); } } - func->addParameter(Parameter(dataType.toString(), - "", - name, - defaultValue.toString())); // ### + func->addParameter(Parameter(dataType.toString(), "", name, defaultValue.toString())); // ### return true; } @@ -1323,16 +1342,16 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, QStringList *parentPathPtr, FunctionNode **funcPtr, const QString &templateStuff, - Node::Type type, - bool attached) + ExtraFuncData& extra) { CodeChunk returnType; QStringList parentPath; QString name; - bool compat = false; - if (match(Tok_friend)) + + if (match(Tok_friend)) { return false; + } match(Tok_explicit); if (matchCompat()) compat = true; @@ -1473,7 +1492,7 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, } readToken(); - FunctionNode *func = new FunctionNode(type, parent, name, attached); + FunctionNode *func = new FunctionNode(extra.type, parent, name, extra.isAttached); func->setAccess(access); func->setLocation(location()); func->setReturnType(returnType.toString()); @@ -1899,6 +1918,7 @@ bool CppCodeParser::matchProperty(InnerNode *parent) */ bool CppCodeParser::matchDeclList(InnerNode *parent) { + ExtraFuncData extra; QString templateStuff; int braceDepth0 = tokenizer->braceDepth(); if (tok == Tok_RightBrace) // prevents failure on empty body @@ -1921,7 +1941,12 @@ bool CppCodeParser::matchDeclList(InnerNode *parent) matchUsingDecl(); break; case Tok_template: - templateStuff = matchTemplateHeader(); + { + CodeChunk dataType; + readToken(); + matchTemplateAngles(&dataType); + templateStuff = dataType.toString(); + } continue; case Tok_enum: matchEnumDecl(parent); @@ -2017,13 +2042,14 @@ bool CppCodeParser::matchDeclList(InnerNode *parent) match(Tok_RightParen); break; default: - if (!matchFunctionDecl(parent, 0, 0, templateStuff)) { + if (!matchFunctionDecl(parent, 0, 0, templateStuff, extra)) { while (tok != Tok_Eoi && (tokenizer->braceDepth() > braceDepth0 || (!match(Tok_Semicolon) && tok != Tok_public && tok != Tok_protected && - tok != Tok_private))) + tok != Tok_private))) { readToken(); + } } } templateStuff.clear(); @@ -2037,6 +2063,7 @@ bool CppCodeParser::matchDeclList(InnerNode *parent) */ bool CppCodeParser::matchDocsAndStuff() { + ExtraFuncData extra; QSet<QString> topicCommandsAllowed = topicCommands(); QSet<QString> otherMetacommandsAllowed = otherMetaCommands(); QSet<QString> metacommandsAllowed = topicCommandsAllowed + @@ -2082,7 +2109,7 @@ bool CppCodeParser::matchDocsAndStuff() FunctionNode *clone; FunctionNode *func = 0; - if (matchFunctionDecl(0, &parentPath, &clone)) { + if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { foreach (const QString& usedNamespace_, activeNamespaces_) { QStringList newPath = usedNamespace_.split("::") + parentPath; func = qdb_->findFunctionNode(newPath, clone); @@ -2176,7 +2203,7 @@ bool CppCodeParser::matchDocsAndStuff() FunctionNode *clone; FunctionNode *node = 0; - if (matchFunctionDecl(0, &parentPath, &clone)) { + if (matchFunctionDecl(0, &parentPath, &clone, QString(), extra)) { /* The location of the definition is more interesting than that of the declaration. People equipped with @@ -2209,9 +2236,7 @@ bool CppCodeParser::matchDocsAndStuff() bool CppCodeParser::makeFunctionNode(const QString& signature, QStringList* parentPathPtr, FunctionNode** funcPtr, - InnerNode* root, - Node::Type type, - bool attached) + ExtraFuncData& extra) { Tokenizer* outerTokenizer = tokenizer; int outerTok = tok; @@ -2223,7 +2248,9 @@ bool CppCodeParser::makeFunctionNode(const QString& signature, tokenizer = &stringTokenizer; readToken(); - bool ok = matchFunctionDecl(root, parentPathPtr, funcPtr, QString(), type, attached); + inMacroCommand_ = extra.isMacro; + bool ok = matchFunctionDecl(extra.root, parentPathPtr, funcPtr, QString(), extra); + inMacroCommand_ = false; // potential memory leak with funcPtr tokenizer = outerTokenizer; @@ -2252,15 +2279,14 @@ FunctionNode* CppCodeParser::makeFunctionNode(const Doc& doc, { QStringList pp; FunctionNode* fn = 0; - if (!makeFunctionNode(sig,&pp,&fn,parent,type,attached) && - !makeFunctionNode("void "+sig,&pp,&fn,parent,type,attached)) { + ExtraFuncData extra(parent, type, attached); + if (!makeFunctionNode(sig, &pp, &fn, extra) && !makeFunctionNode("void " + sig, &pp, &fn, extra)) { doc.location().warning(tr("Invalid syntax in '\\%1'").arg(qdoctag)); } return fn; } -void CppCodeParser::parseQiteratorDotH(const Location &location, - const QString &filePath) +void CppCodeParser::parseQiteratorDotH(const Location &location, const QString &filePath) { QFile file(filePath); if (!file.open(QFile::ReadOnly)) diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h index 72c59071669..eae5d1e97db 100644 --- a/src/tools/qdoc/cppcodeparser.h +++ b/src/tools/qdoc/cppcodeparser.h @@ -57,6 +57,18 @@ class Tokenizer; class CppCodeParser : public CodeParser { + Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser) + + struct ExtraFuncData { + InnerNode* root; // Used as the parent. + Node::Type type; // The node type: Function, etc. + bool isAttached; // If true, the method is attached. + bool isMacro; // If true, we are parsing a macro signature. + ExtraFuncData() : root(0), type(Node::Function), isAttached(false), isMacro(false) { } + ExtraFuncData(InnerNode* r, Node::Type t, bool a) + : root(r), type(t), isAttached(a), isMacro(false) { } + }; + public: CppCodeParser(); ~CppCodeParser(); @@ -112,11 +124,10 @@ protected: bool matchDataType(CodeChunk *type, QString *var = 0); bool matchParameter(FunctionNode *func); bool matchFunctionDecl(InnerNode *parent, - QStringList *parentPathPtr = 0, - FunctionNode **funcPtr = 0, - const QString &templateStuff = QString(), - Node::Type type = Node::Function, - bool attached = false); + QStringList *parentPathPtr, + FunctionNode **funcPtr, + const QString &templateStuff, + ExtraFuncData& extra); bool matchBaseSpecifier(ClassNode *classe, bool isClass); bool matchBaseList(ClassNode *classe, bool isClass); bool matchClassDecl(InnerNode *parent, @@ -132,9 +143,7 @@ protected: bool makeFunctionNode(const QString &synopsis, QStringList *parentPathPtr, FunctionNode **funcPtr, - InnerNode *root = 0, - Node::Type type = Node::Function, - bool attached = false); + ExtraFuncData& params); FunctionNode* makeFunctionNode(const Doc& doc, const QString& sig, InnerNode* parent, diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h index 95e034bc432..c096829caeb 100644 --- a/src/tools/qdoc/ditaxmlgenerator.h +++ b/src/tools/qdoc/ditaxmlgenerator.h @@ -56,6 +56,8 @@ typedef QMap<QString, GuidMap*> GuidMaps; class DitaXmlGenerator : public Generator { + Q_DECLARE_TR_FUNCTIONS(QDoc::DitaXmlGenerator) + public: enum SinceType { Namespace, diff --git a/src/tools/qdoc/doc.cpp b/src/tools/qdoc/doc.cpp index 3154578766d..a0a2e511989 100644 --- a/src/tools/qdoc/doc.cpp +++ b/src/tools/qdoc/doc.cpp @@ -439,6 +439,8 @@ bool DocPrivate::isEnumDocSimplifiable() const class DocParser { + Q_DECLARE_TR_FUNCTIONS(QDoc::DocParser) + public: void parse(const QString &source, DocPrivate *docPrivate, diff --git a/src/tools/qdoc/doc.h b/src/tools/qdoc/doc.h index abbe231a46f..ca9787595fe 100644 --- a/src/tools/qdoc/doc.h +++ b/src/tools/qdoc/doc.h @@ -121,6 +121,8 @@ public: class Doc { + Q_DECLARE_TR_FUNCTIONS(QDoc::Doc) + public: // the order is important enum Sections { diff --git a/src/tools/qdoc/doc/config/compat.qdocconf b/src/tools/qdoc/doc/config/compat.qdocconf deleted file mode 100644 index 3e7ea6c8917..00000000000 --- a/src/tools/qdoc/doc/config/compat.qdocconf +++ /dev/null @@ -1,12 +0,0 @@ -alias.include = input - -macro.0 = "\\\\0" -macro.b = "\\\\b" -macro.n = "\\\\n" -macro.r = "\\\\r" -macro.img = "\\image" -macro.endquote = "\\endquotation" -macro.relatesto = "\\relates" - -spurious = "Missing comma in .*" \ - "Missing pattern .*" diff --git a/src/tools/qdoc/doc/config/config.pro b/src/tools/qdoc/doc/config/config.pro deleted file mode 100644 index ee7aea8a047..00000000000 --- a/src/tools/qdoc/doc/config/config.pro +++ /dev/null @@ -1,13 +0,0 @@ -SOURCES = config.pro \ - compat.qdocconf \ - qdoc-online.qdocconf \ - qt-defines.qdocconf \ - qt-html-templates.qdocconf \ - qdoc-project.qdocconf \ - qt-html-default-styles.qdocconf \ - qdoc.qdocconf \ - qt-html-online-styles.qdocconf \ - macros.qdocconf \ - qt-cpp-ignore.qdocconf \ - qt-html-templates-online.qdocconf - diff --git a/src/tools/qdoc/doc/config/images/arrow_down.png b/src/tools/qdoc/doc/config/images/arrow_down.png Binary files differdeleted file mode 100644 index 9d01e97f6a9..00000000000 --- a/src/tools/qdoc/doc/config/images/arrow_down.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bg_l.png b/src/tools/qdoc/doc/config/images/bg_l.png Binary files differdeleted file mode 100755 index 90b1da10b9b..00000000000 --- a/src/tools/qdoc/doc/config/images/bg_l.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bg_l_blank.png b/src/tools/qdoc/doc/config/images/bg_l_blank.png Binary files differdeleted file mode 100755 index 5a9673d81bd..00000000000 --- a/src/tools/qdoc/doc/config/images/bg_l_blank.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bg_ll_blank.png b/src/tools/qdoc/doc/config/images/bg_ll_blank.png Binary files differdeleted file mode 100644 index 95a1c45e04b..00000000000 --- a/src/tools/qdoc/doc/config/images/bg_ll_blank.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bg_r.png b/src/tools/qdoc/doc/config/images/bg_r.png Binary files differdeleted file mode 100755 index f0fb121dea5..00000000000 --- a/src/tools/qdoc/doc/config/images/bg_r.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bg_ul_blank.png b/src/tools/qdoc/doc/config/images/bg_ul_blank.png Binary files differdeleted file mode 100644 index 70512614cc7..00000000000 --- a/src/tools/qdoc/doc/config/images/bg_ul_blank.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/box_bg.png b/src/tools/qdoc/doc/config/images/box_bg.png Binary files differdeleted file mode 100755 index 3322f923f81..00000000000 --- a/src/tools/qdoc/doc/config/images/box_bg.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/breadcrumb.png b/src/tools/qdoc/doc/config/images/breadcrumb.png Binary files differdeleted file mode 100755 index 0ded5514d23..00000000000 --- a/src/tools/qdoc/doc/config/images/breadcrumb.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bullet_dn.png b/src/tools/qdoc/doc/config/images/bullet_dn.png Binary files differdeleted file mode 100644 index f7762472e23..00000000000 --- a/src/tools/qdoc/doc/config/images/bullet_dn.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bullet_gt.png b/src/tools/qdoc/doc/config/images/bullet_gt.png Binary files differdeleted file mode 100755 index 7561b4edc4c..00000000000 --- a/src/tools/qdoc/doc/config/images/bullet_gt.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bullet_sq.png b/src/tools/qdoc/doc/config/images/bullet_sq.png Binary files differdeleted file mode 100755 index a84845e3c7e..00000000000 --- a/src/tools/qdoc/doc/config/images/bullet_sq.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/bullet_up.png b/src/tools/qdoc/doc/config/images/bullet_up.png Binary files differdeleted file mode 100644 index 7de2f06954b..00000000000 --- a/src/tools/qdoc/doc/config/images/bullet_up.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/feedbackground.png b/src/tools/qdoc/doc/config/images/feedbackground.png Binary files differdeleted file mode 100755 index 3a38d995d7f..00000000000 --- a/src/tools/qdoc/doc/config/images/feedbackground.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/header_bg.png b/src/tools/qdoc/doc/config/images/header_bg.png Binary files differdeleted file mode 100644 index a436aa61eff..00000000000 --- a/src/tools/qdoc/doc/config/images/header_bg.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/horBar.png b/src/tools/qdoc/doc/config/images/horBar.png Binary files differdeleted file mode 100755 index 100fe91c6c5..00000000000 --- a/src/tools/qdoc/doc/config/images/horBar.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/page.png b/src/tools/qdoc/doc/config/images/page.png Binary files differdeleted file mode 100644 index 1db151bd31e..00000000000 --- a/src/tools/qdoc/doc/config/images/page.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/page_bg.png b/src/tools/qdoc/doc/config/images/page_bg.png Binary files differdeleted file mode 100755 index 9b3bd999dfb..00000000000 --- a/src/tools/qdoc/doc/config/images/page_bg.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/spinner.gif b/src/tools/qdoc/doc/config/images/spinner.gif Binary files differdeleted file mode 100644 index 1ed786f2ece..00000000000 --- a/src/tools/qdoc/doc/config/images/spinner.gif +++ /dev/null diff --git a/src/tools/qdoc/doc/config/images/sprites-combined.png b/src/tools/qdoc/doc/config/images/sprites-combined.png Binary files differdeleted file mode 100755 index 3a48b21f6b8..00000000000 --- a/src/tools/qdoc/doc/config/images/sprites-combined.png +++ /dev/null diff --git a/src/tools/qdoc/doc/config/macros.qdocconf b/src/tools/qdoc/doc/config/macros.qdocconf deleted file mode 100644 index 2dbc9c1f916..00000000000 --- a/src/tools/qdoc/doc/config/macros.qdocconf +++ /dev/null @@ -1,40 +0,0 @@ -macro.aacute.HTML = "á" -macro.Aring.HTML = "Å" -macro.aring.HTML = "å" -macro.Auml.HTML = "Ä" -macro.author = "\\bold{Author:}" -macro.br.HTML = "<br />" -macro.BR.HTML = "<br />" -macro.copyright.HTML = "©" -macro.eacute.HTML = "é" -macro.gui = "\\bold" -macro.hr.HTML = "<hr />" -macro.iacute.HTML = "í" -macro.key = "\\bold" -macro.menu = "\\bold" -macro.note = "\\bold{Note:}" -macro.oslash.HTML = "ø" -macro.ouml.HTML = "ö" -macro.QA = "\\e{Qt Assistant}" -macro.QD = "\\e{Qt Designer}" -macro.QL = "\\e{Qt Linguist}" -macro.QQV = "\\e{Qt QML Viewer}" -macro.param = "\\e" -macro.raisedaster.HTML = "<sup>*</sup>" -macro.rarrow.HTML = "→" -macro.reg.HTML = "<sup>®</sup>" -macro.return = "Returns" -macro.starslash = "\\c{*/}" -macro.begincomment = "\\c{/*}" -macro.endcomment = "\\c{*/}" -macro.uuml.HTML = "ü" -macro.mdash.HTML = "—" -macro.pi.HTML = "Π" -macro.beginqdoc.HTML = "/*!" -macro.endqdoc.HTML = "*/" - -macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">" -macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">" -macro.endfloat.HTML = "</div>" -macro.clearfloat.HTML = "<br style=\"clear: both\" />" -macro.emptyspan.HTML = "<span></span>" diff --git a/src/tools/qdoc/doc/config/qdoc-online.qdocconf b/src/tools/qdoc/doc/config/qdoc-online.qdocconf deleted file mode 100644 index 7fd8ed59f40..00000000000 --- a/src/tools/qdoc/doc/config/qdoc-online.qdocconf +++ /dev/null @@ -1,2 +0,0 @@ -include(qdoc-project.qdocconf) -include(qt-html-templates-online.qdocconf) diff --git a/src/tools/qdoc/doc/config/qdoc-project.qdocconf b/src/tools/qdoc/doc/config/qdoc-project.qdocconf deleted file mode 100644 index 10cdfa417ba..00000000000 --- a/src/tools/qdoc/doc/config/qdoc-project.qdocconf +++ /dev/null @@ -1,45 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-defines.qdocconf) - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -project = QDoc -description = QDoc Manual -url = http://doc-snapshot.qt-project.org/qdoc - -sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" -headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.qdoc *.qdocconf *.qdocinc" -examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" - -sourcedirs = .. - -exampledirs = .. \ - ../examples \ - ../../../../examples \ - config - -imagedirs = ../../../doc/src/templates/images \ - images - -tagfile = ../html/qdoc.tags - -qhp.projects = QDoc - -qhp.QDoc.file = qdoc.qhp -qhp.QDoc.namespace = com.trolltech.qdoc -qhp.QDoc.virtualFolder = qdoc -qhp.QDoc.indexTitle = QDoc Manual - Table of Contents -qhp.QDoc.indexRoot = - -qhp.QDoc.filterAttributes = qdoc qtrefdoc -qhp.QDoc.customFilters.QDoc.name = QDoc -qhp.QDoc.customFilters.QDoc.filterAttributes = qdoc -qhp.QDoc.subprojects = overviews -qhp.QDoc.subprojects.overviews.title = Overviews -qhp.QDoc.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.QDoc.subprojects.overviews.selectors = fake:page,group,module diff --git a/src/tools/qdoc/doc/config/qdoc.qdocconf b/src/tools/qdoc/doc/config/qdoc.qdocconf index c238abef88a..6bbe9347492 100644 --- a/src/tools/qdoc/doc/config/qdoc.qdocconf +++ b/src/tools/qdoc/doc/config/qdoc.qdocconf @@ -1,2 +1,71 @@ -include(qdoc-project.qdocconf) -include(qt-html-templates.qdocconf) +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QDoc +description = QDoc Manual +url = http://qt-project.org/doc/qt-$QT_VER +version = $QT_VERSION + +sourcedirs = .. + +exampledirs = .. \ + ../examples \ + ../../../../examples \ + config + +imagedirs = ../../../doc/src/templates/images \ + images + +tagfile = ../html/qdoc.tags + +qhp.projects = QDoc + +qhp.QDoc.file = qdoc.qhp +qhp.QDoc.namespace = qdoc.$QT_VERSION_TAG +qhp.QDoc.virtualFolder = qdoc +qhp.QDoc.indexTitle = QDoc Manual +qhp.QDoc.indexRoot = + +qhp.QDoc.filterAttributes = qdoc qtrefdoc +qhp.QDoc.customFilters.QDoc.name = QDoc +qhp.QDoc.customFilters.QDoc.filterAttributes = qdoc +qhp.QDoc.subprojects = overviews +qhp.QDoc.subprojects.overviews.title = Overviews +qhp.QDoc.subprojects.overviews.indexTitle = QDoc Manual +qhp.QDoc.subprojects.overviews.selectors = fake:page,group,module + +depends += \ + activeqt \ + qtassistant \ + qtbluetooth \ + qtconcurrent \ + qtcontacts \ + qtcore \ + qtdbus \ + qtdesigner \ + qtdoc \ + qthelp \ + qtimageformats \ + qtgui \ + qtlocation \ + qtlinguist \ + qtmultimedia \ + qtnetwork \ + qtopengl \ + qtorganizer \ + qtprintsupport \ + qtqml \ + qtquick \ + qtscript \ + qtscripttools \ + qtsensors \ + qtsql \ + qtsvg \ + qttestlib \ + qttools \ + qtuitools \ + qtversit \ + qtwidgets \ + qtwebkit \ + qtwebkitexamples \ + qtxml \ + qtxmlpatterns diff --git a/src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf b/src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf deleted file mode 100644 index 38a421f8291..00000000000 --- a/src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf +++ /dev/null @@ -1,96 +0,0 @@ -Cpp.ignoretokens = QAXFACTORY_EXPORT \ - QDESIGNER_COMPONENTS_LIBRARY \ - QDESIGNER_EXTENSION_LIBRARY \ - QDESIGNER_SDK_LIBRARY \ - QDESIGNER_SHARED_LIBRARY \ - QDESIGNER_UILIB_LIBRARY \ - QM_EXPORT_CANVAS \ - QM_EXPORT_DNS \ - QM_EXPORT_DOM \ - QM_EXPORT_FTP \ - QM_EXPORT_HTTP \ - QM_EXPORT_ICONVIEW \ - QM_EXPORT_NETWORK \ - QM_EXPORT_OPENGL \ - QM_EXPORT_OPENVG \ - QM_EXPORT_SQL \ - QM_EXPORT_TABLE \ - QM_EXPORT_WORKSPACE \ - QM_EXPORT_XML \ - QT_ASCII_CAST_WARN \ - QT_ASCII_CAST_WARN_CONSTRUCTOR \ - QT_DESIGNER_STATIC \ - QT_FASTCALL \ - QT_WIDGET_PLUGIN_EXPORT \ - Q_COMPAT_EXPORT \ - Q_CORE_EXPORT \ - Q_CORE_EXPORT_INLINE \ - Q_EXPLICIT \ - Q_EXPORT \ - Q_EXPORT_CODECS_CN \ - Q_EXPORT_CODECS_JP \ - Q_EXPORT_CODECS_KR \ - Q_EXPORT_PLUGIN \ - Q_GFX_INLINE \ - Q_AUTOTEST_EXPORT \ - Q_GUI_EXPORT \ - Q_GUI_EXPORT_INLINE \ - Q_GUI_EXPORT_STYLE_CDE \ - Q_GUI_EXPORT_STYLE_COMPACT \ - Q_GUI_EXPORT_STYLE_MAC \ - Q_GUI_EXPORT_STYLE_MOTIF \ - Q_GUI_EXPORT_STYLE_MOTIFPLUS \ - Q_GUI_EXPORT_STYLE_PLATINUM \ - Q_GUI_EXPORT_STYLE_POCKETPC \ - Q_GUI_EXPORT_STYLE_SGI \ - Q_GUI_EXPORT_STYLE_WINDOWS \ - Q_GUI_EXPORT_STYLE_WINDOWSXP \ - QHELP_EXPORT \ - Q_INLINE_TEMPLATE \ - Q_INTERNAL_WIN_NO_THROW \ - Q_LOCATION_EXPORT \ - Q_NETWORK_EXPORT \ - Q_OPENGL_EXPORT \ - Q_OPENVG_EXPORT \ - Q_OUTOFLINE_TEMPLATE \ - Q_SQL_EXPORT \ - Q_SVG_EXPORT \ - Q_SCRIPT_EXPORT \ - Q_SCRIPTTOOLS_EXPORT \ - Q_TESTLIB_EXPORT \ - Q_XML_EXPORT \ - Q_XMLSTREAM_EXPORT \ - Q_XMLPATTERNS_EXPORT \ - QDBUS_EXPORT \ - Q_DBUS_EXPORT \ - QT_BEGIN_NAMESPACE \ - QT_BEGIN_INCLUDE_NAMESPACE \ - QT_END_NAMESPACE \ - QT_END_INCLUDE_NAMESPACE \ - PHONON_EXPORT \ - Q_DECLARATIVE_EXPORT \ - Q_GADGET \ - QWEBKIT_EXPORT \ - Q_INVOKABLE -Cpp.ignoredirectives = Q_DECLARE_HANDLE \ - Q_DECLARE_INTERFACE \ - Q_DECLARE_METATYPE \ - Q_DECLARE_OPERATORS_FOR_FLAGS \ - Q_DECLARE_PRIVATE \ - Q_DECLARE_PUBLIC \ - Q_DECLARE_SHARED \ - Q_DECLARE_TR_FUNCTIONS \ - Q_DECLARE_TYPEINFO \ - Q_DISABLE_COPY \ - QT_FORWARD_DECLARE_CLASS \ - Q_DUMMY_COMPARISON_OPERATOR \ - Q_ENUMS \ - Q_FLAGS \ - Q_INTERFACES \ - __attribute__ \ - K_DECLARE_PRIVATE \ - PHONON_OBJECT \ - PHONON_HEIR \ - Q_PRIVATE_PROPERTY \ - Q_DECLARE_PRIVATE_D \ - Q_CLASSINFO diff --git a/src/tools/qdoc/doc/config/qt-defines.qdocconf b/src/tools/qdoc/doc/config/qt-defines.qdocconf deleted file mode 100644 index e11b32dc4ca..00000000000 --- a/src/tools/qdoc/doc/config/qt-defines.qdocconf +++ /dev/null @@ -1,16 +0,0 @@ -defines = Q_QDOC \ - QT_.*_SUPPORT \ - QT_.*_LIB \ - QT_COMPAT \ - QT_KEYPAD_NAVIGATION \ - QT3_SUPPORT \ - Q_WS_.* \ - Q_OS_.* \ - Q_BYTE_ORDER \ - QT_DEPRECATED \ - Q_NO_USING_KEYWORD \ - __cplusplus - -versionsym = QT_VERSION_STR - -codeindent = 1 diff --git a/src/tools/qdoc/doc/config/qt-html-default-styles.qdocconf b/src/tools/qdoc/doc/config/qt-html-default-styles.qdocconf deleted file mode 100644 index b2e39d02f52..00000000000 --- a/src/tools/qdoc/doc/config/qt-html-default-styles.qdocconf +++ /dev/null @@ -1,32 +0,0 @@ -# Define the location of the templates to use. Style sheets and scripts are -# specified relative to the template directory and will be copied into -# subdirectories of the output directory. - -HTML.templatedir = . - -HTML.stylesheets = style/offline.css - -HTML.scripts = - -# Files not referenced in any qdoc file (last four needed by qtdemo) -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo.png \ - arrow_down.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - horBar.png \ - sprites-combined.png - -# Include the style sheets and scripts used. - -HTML.headerstyles = \ - " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n" - -HTML.headerscripts = - -HTML.endheader = \ - "</head>\n" \ - "<body>\n" diff --git a/src/tools/qdoc/doc/config/qt-html-online-styles.qdocconf b/src/tools/qdoc/doc/config/qt-html-online-styles.qdocconf deleted file mode 100644 index 4ffd6ca65ff..00000000000 --- a/src/tools/qdoc/doc/config/qt-html-online-styles.qdocconf +++ /dev/null @@ -1,72 +0,0 @@ -# Define the location of the templates to use. Style sheets and scripts are -# specified relative to the template directory and will be copied into -# subdirectories of the output directory. - -HTML.templatedir = . - -HTML.stylesheets = style/narrow.css \ - style/style.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/superfish.css - -# Adding jquery and functions - providing online tools and search features -HTML.scripts = scripts/functions.js \ - scripts/narrow.js \ - scripts/superfish.js \ - scripts/jquery.js - - -# Files not referenced in any qdoc file. -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo.png \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif - -# Include the style sheets and scripts used. - -HTML.headerstyles = \ - " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n" \ - " <script src=\"scripts/jquery.js\" type=\"text/javascript\"></script>\n" \ - " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n" \ - " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/superfish.css\" />\n" \ - " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/narrow.css\" />\n" \ - " <!--[if IE]>\n" \ - "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\">\n" \ - "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n" \ - "<![endif]-->\n" \ - "<!--[if lt IE 7]>\n" \ - "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie6.css\">\n" \ - "<![endif]-->\n" \ - "<!--[if IE 7]>\n" \ - "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie7.css\">\n" \ - "<![endif]-->\n" \ - "<!--[if IE 8]>\n" \ - "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style_ie8.css\">\n" \ - "<![endif]-->\n\n" - -HTML.headerscripts = \ - "<script src=\"scripts/superfish.js\" type=\"text/javascript\"></script>\n" \ - "<script src=\"scripts/narrow.js\" type=\"text/javascript\"></script>\n\n" - -HTML.endheader = \ - "</head>\n" \ - "<body class=\"\" onload=\"CheckEmptyAndLoadList();\">\n" diff --git a/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf b/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf deleted file mode 100644 index 038f3de5a04..00000000000 --- a/src/tools/qdoc/doc/config/qt-html-templates-online.qdocconf +++ /dev/null @@ -1,117 +0,0 @@ -include(qt-html-online-styles.qdocconf) - -HTML.postheader = \ - " <div class=\"header\" id=\"qtdocheader\">\n" \ - " <div class=\"content\"> \n" \ - " <div id=\"nav-logo\">\n" \ - " <a href=\"qdoc-index.html\">Home</a></div>\n" \ - " <a href=\"qdoc-index.html\" class=\"qtref\"><span>QDoc Reference Documentation</span></a>\n" \ - " <div id=\"narrowsearch\"></div>\n" \ - " <div id=\"nav-topright\">\n" \ - " <ul>\n" \ - " <li class=\"nav-topright-home\"><a href=\"http://qt.nokia.com/\">Qt HOME</a></li>\n" \ - " <li class=\"nav-topright-dev\"><a href=\"http://developer.qt.nokia.com/\">DEV</a></li>\n" \ - " <li class=\"nav-topright-labs\"><a href=\"http://labs.qt.nokia.com/blogs/\">LABS</a></li>\n" \ - " <li class=\"nav-topright-doc nav-topright-doc-active\"><a href=\"http://doc.qt.nokia.com/\">\n" \ - " DOC</a></li>\n" \ - " <li class=\"nav-topright-blog\"><a href=\"http://blog.qt.nokia.com/\">BLOG</a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " <div id=\"shortCut\">\n" \ - " <ul>\n" \ - " <li class=\"shortCut-topleft-inactive\"><span><a href=\"qdoc-index.html\">Qt 4.7</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \ - " </a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"wrapper\">\n" \ - " <div class=\"hd\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " <div class=\"bd group\">\n" \ - " <div class=\"wrap\">\n" \ - " <div class=\"toolbar\">\n" \ - " <div class=\"breadcrumb toolblock\">\n" \ - " <ul>\n" \ - " <li class=\"first\"><a href=\"qdoc-index.html\">Home</a></li>\n" \ - " <!-- Breadcrumbs go here -->\n" - -HTML.postpostheader = \ - " </ul>\n" \ - " </div>\n" \ - " <div class=\"toolbuttons toolblock\">\n" \ - " <ul>\n" \ - " <li id=\"smallA\" class=\"t_button\">A</li>\n" \ - " <li id=\"medA\" class=\"t_button active\">A</li>\n" \ - " <li id=\"bigA\" class=\"t_button\">A</li>\n" \ - " <li id=\"print\" class=\"t_button\"><a href=\"javascript:this.print();\">\n" \ - " <span>Print</span></a></li>\n" \ - " </ul>\n" \ - " </div>\n" \ - " </div>\n" \ - " <div class=\"content mainContent\">\n" - -HTML.footer = \ - " </div>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - " </div> \n" \ - " <div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2012 Digia Plc and/or its\n" \ - " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ - " their respective owners.</p>\n" \ - " <br />\n" \ - " <p>\n" \ - " The documentation provided herein is licensed under the terms of the\n" \ - " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \ - " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \ - " <p>\n" \ - " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \ - " www.qt-project.org</a>.</p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Digia, Qt and their respective logos are trademarks of Digia Plc \n" \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \ - " </div>\n" - - -# Files not referenced in any qdoc file. -# See also extraimages.HTML -qhp.QDoc.extraFiles = qdoc-index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css diff --git a/src/tools/qdoc/doc/config/qt-html-templates.qdocconf b/src/tools/qdoc/doc/config/qt-html-templates.qdocconf deleted file mode 100644 index 22bf6e1c23c..00000000000 --- a/src/tools/qdoc/doc/config/qt-html-templates.qdocconf +++ /dev/null @@ -1,56 +0,0 @@ -include(qt-html-default-styles.qdocconf) - -HTML.postheader = \ - "<div class=\"header\" id=\"qtdocheader\">\n" \ - " <div class=\"content\"> \n" \ - " <a href=\"qdoc-index.html\" class=\"qtref\"><span>QDoc Reference Documentation</span></a>\n" \ - " </div>\n" \ - " <div class=\"breadcrumb toolblock\">\n" \ - " <ul>\n" \ - " <li class=\"first\"><a href=\"qdoc-index.html\">Home</a></li>\n" \ - " <!-- Breadcrumbs go here -->\n" - -HTML.postpostheader = \ - " </ul>\n" \ - " </div>\n" \ - "</div>\n" \ - "<div class=\"content mainContent\">\n" - -HTML.footer = \ - " <div class=\"ft\">\n" \ - " <span></span>\n" \ - " </div>\n" \ - "</div> \n" \ - "<div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2012 Digia Plc and/or its\n" \ - " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ - " their respective owners.</p>\n" \ - " <br />\n" \ - " <p>\n" \ - " The documentation provided herein is licensed under the terms of the\n" \ - " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \ - " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \ - " <p>\n" \ - " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \ - " www.qt-project.org</a>.</p>\n" \ - " <br />\n" \ - " <p>\n" \ - " Digia, Qt and their respective logos are trademarks of Digia Plc \n" \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \ - "</div>\n" \ - -# Files not referenced in any qdoc file. -# See also extraimages.HTML -qhp.QDoc.extraFiles = qdoc-index.html \ - images/arrow_down.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/horBar.png \ - images/sprites-combined.png \ - style/offline.css diff --git a/src/tools/qdoc/doc/config/style/offline.css b/src/tools/qdoc/doc/config/style/offline.css deleted file mode 100644 index 3689ee8d40d..00000000000 --- a/src/tools/qdoc/doc/config/style/offline.css +++ /dev/null @@ -1,673 +0,0 @@ -@media screen -{ - -/* basic elements */ - html - { - color: #000000; - background: #FFFFFF; - } - table - { - border-collapse: collapse; - border-spacing: 0; - } - fieldset, img - { - border: 0; - max-width:100%; - } - address, caption, cite, code, dfn, em, strong, th, var, optgroup - { - font-style: inherit; - font-weight: inherit; - } - del, ins - { - text-decoration: none; - } - li - { - list-style: none; - } - ol li - { - list-style: decimal; - } - caption, th - { - text-align: left; - } - h1, h2, h3, h4, h5, h6 - { - font-size: 100%; - } - q:before, q:after - { - content: ''; - } - abbr, acronym - { - border: 0; - font-variant: normal; - } - sup, sub - { - vertical-align: baseline; - } - tt, .qmlreadonly span, .qmldefault span - { - word-spacing:0.5em; - } - legend - { - color: #000000; - } - strong - { - font-weight: bold; - } - em - { - font-style: italic; - } - - body - { - margin-left: 0.5em; - margin-right: 0.5em; - } - a - { - color: #00732F; - text-decoration: none; - } - hr - { - background-color: #E6E6E6; - border: 1px solid #E6E6E6; - height: 1px; - width: 100%; - text-align: left; - margin: 1.5em 0 1.5em 0; - } - - pre - { - border: 1px solid #DDDDDD; - -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; - -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; - border-radius: 0.7em 0.7em 0.7em 0.7em; - margin: 0 1.5em 1em 1em; - padding: 1em 1em 1em 1em; - overflow-x: auto; - } - table, pre - { - -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; - -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; - border-radius: 0.7em 0.7em 0.7em 0.7em; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - margin-bottom: 2.5em; - } - pre { - font-size: 90%; - display: block; - overflow:hidden; - } - thead - { - margin-top: 0.5em; - font-weight: bold - } - th - { - padding: 0.5em 1.5em 0.5em 1.5em; - background-color: #E1E1E1; - border-left: 1px solid #E6E6E6; - } - td - { - padding: 0.25em 1.5em 0.25em 2em; - } - - td.rightAlign - { - padding: 0.25em 0.5em 0.25em 1em; - } - table tr.odd - { - border-left: 1px solid #E6E6E6; - background-color: #F6F6F6; - color: #66666E; - } - table tr.even - { - border-left: 1px solid #E6E6E6; - background-color: #ffffff; - color: #66666E; - } - - div.float-left - { - float: left; margin-right: 2em - } - div.float-right - { - float: right; margin-left: 2em - } - - span.comment - { - color: #008B00; - font-style: italic - } - span.string, span.char - { - color: #000084; - } - span.number - { - color: #a46200; - } - span.operator - { - color: #202020; - } - span.keyword - { - color: #840000; - } - span.name - { - color: black - } - span.type - { - font-weight: bold - } - span.type a:visited - { - color: #0F5300; - } - span.preprocessor - { - color: #404040 - } -/* end basic elements */ - -/* font style elements */ - .heading - { - font-weight: bold; - font-size: 125%; - } - .subtitle - { - font-size: 110% - } - .small-subtitle - { - font-size: 100% - } - .red - { - color:red; - } -/* end font style elements */ - -/* global settings*/ - .header, .footer - { - display: block; - clear: both; - overflow: hidden; - } -/* end global settings*/ - -/* header elements */ - .header .qtref - { - color: #00732F; - font-weight: bold; - font-size: 130%; - } - - .header .content - { - margin-bottom: 0.5em - } - - .naviNextPrevious - { - display: none - } - .header .breadcrumb - { - font-size: 90%; - padding: 0.5em 0 0.5em 1em; - margin: 0; - background-color: #fafafa; - height: 1.35em; - border-bottom: 1px solid #d1d1d1; - } - - .header .breadcrumb ul - { - margin: 0; - padding: 0; - } - - .header .content - { - word-wrap: break-word; - } - - .header .breadcrumb ul li - { - float: left; - background: url(../images/breadcrumb.png) no-repeat 0 3px; - padding-left: 1.5em; - margin-left: 1.5em; - } - - .header .breadcrumb ul li.last - { - font-weight: normal; - } - - .header .breadcrumb ul li a - { - color: #00732F; - } - - .header .breadcrumb ul li.first - { - background-image: none; - padding-left: 0; - margin-left: 0; - } - - .header .content ol li { - background: none; - margin-bottom: 1.0em; - margin-left: 1.2em; - padding-left: 0 - } - - .header .content li - { - background: url(../images/bullet_sq.png) no-repeat 0 5px; - margin-bottom: 1em; - padding-left: 1.2em; - } - -/* end header elements */ - -/* content elements */ - .content h1 - { - font-weight: bold; - font-size: 150% - } - - .content h2 - { - font-weight: bold; - font-size: 135%; - width: 100%; - } - .content h3 - { - font-weight: bold; - font-size: 120%; - width: 100%; - } - .content table p - { - margin: 0 - } - .content ul - { - padding-left: 2.5em; - } - .content li - { - padding-top: 0.25em; - padding-bottom: 0.25em; - } - .content ul img { - vertical-align: middle; - } - - .content a:visited - { - color: #4c0033; - text-decoration: none; - } - - .content a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } - - a:hover - { - color: #4c0033; - text-decoration: underline; - } - descr p a - { - text-decoration: underline; - } - - .descr p a:visited - { - text-decoration: underline; - } - - .alphaChar{ - width:95%; - background-color:#F6F6F6; - border:1px solid #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - font-size:12pt; - padding-left:10px; - margin-top:10px; - margin-bottom:10px; - } - .flowList{ - /*vertical-align:top;*/ - /*margin:20px auto;*/ - - column-count:3; - -webkit-column-count:3; - -moz-column-count:3; -/* - column-width:100%; - -webkit-column-width:200px; - -col-column-width:200px; -*/ - column-gap:41px; - -webkit-column-gap:41px; - -moz-column-gap:41px; - - column-rule: 1px dashed #ccc; - -webkit-column-rule: 1px dashed #ccc; - -moz-column-rule: 1px dashed #ccc; - } - - .flowList dl{ - } - .flowList dd{ - /*display:inline-block;*/ - margin-left:10px; - min-width:250px; - line-height: 1.5; - min-width:100%; - min-height:15px; - } - - .flowList dd a{ - } - - .content .flowList p{ - padding:0px; - } - - .content .alignedsummary - { - margin: 15px; - } - - - .qmltype - { - text-align: center; - font-size: 120%; - } - .qmlreadonly - { - padding-left: 5px; - float: right; - color: #254117; - } - - .qmldefault - { - padding-left: 5px; - float: right; - color: red; - } - - .qmldoc - { - } - - .generic .alphaChar{ - margin-top:5px; - } - - .generic .odd .alphaChar{ - background-color: #F6F6F6; - } - - .generic .even .alphaChar{ - background-color: #FFFFFF; - } - - .memItemRight{ - padding: 0.25em 1.5em 0.25em 0; - } - .highlightedCode - { - margin: 1.0em; - } - .annotated td { - padding: 0.25em 0.5em 0.25em 0.5em; - } - - .header .content .toc ul - { - padding-left: 0px; - } - - .content .toc h3 { - border-bottom: 0px; - margin-top: 0px; - } - - .content .toc h3 a:hover { - color: #00732F; - text-decoration: none; - } - - .content .toc .level2 - { - margin-left: 1.5em; - } - - .content .toc .level3 - { - margin-left: 3.0em; - } - - .content ul li - { - background: url(../images/bullet_sq.png) no-repeat 0 0.7em; - padding-left: 1em - } - - .content .toc li - { - background: url(../images/bullet_dn.png) no-repeat 0 5px; - padding-left: 1em - } - - .relpage - { - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - border: 1px solid #DDDDDD; - padding: 25px 25px; - clear: both; - } - .relpage ul - { - float: none; - padding: 1.5em; - } - - h3.fn, span.fn - { - -moz-border-radius:7px 7px 7px 7px; - -webkit-border-radius:7px 7px 7px 7px; - border-radius:7px 7px 7px 7px; - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - font-weight: bold; - word-spacing:3px; - padding:3px 5px; - } - - .functionIndex { - font-size:12pt; - word-spacing:10px; - margin-bottom:10px; - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - width:100%; - } - - .centerAlign - { - text-align:center; - } - - .rightAlign - { - text-align:right; - } - - .leftAlign - { - text-align:left; - } - - .topAlign{ - vertical-align:top - } - - .functionIndex a{ - display:inline-block; - } - -/* end content elements */ -/* footer elements */ - - .footer - { - color: #393735; - font-size: 0.75em; - text-align: center; - padding-top: 1.5em; - padding-bottom: 1em; - background-color: #E6E7E8; - margin: 0; - } - .footer p - { - margin: 0.25em - } - .small - { - font-size: 0.5em; - } -/* end footer elements */ - - .item { - float: left; - position: relative; - width: 100%; - overflow: hidden; - } - - - .item .primary { - margin-right: 220px; - position: relative; - } - - .item hr { - margin-left: -220px; - } - - .item .secondary { - float: right; - width: 200px; - position: relative; - } - - .item .cols { - clear: both; - display: block; - } - - .item .cols .col { - float: left; - margin-left: 1.5%; - } - - .item .cols .col.first { - margin-left: 0; - } - - .item .cols.two .col { - width: 45%; - } - - .item .box { - margin: 0 0 10px 0; - } - - .item .box h3 { - margin: 0 0 10px 0; - } - - .cols.unclear { - clear:none; - } -} - -/* end of screen media */ - -/* start of print media */ - -@media print -{ - input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult - { - display: none; - background: none; - } - .content - { - background: none; - display: block; - width: 100%; margin: 0; float: none; - } -} -/* end of print media */ diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index f157f0a2d98..5254c46eb5d 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -29,7 +29,7 @@ \page qdoc-index.html \nextpage Introduction to QDoc - \title Table of Contents + \title QDoc Manual \list \li \l {Introduction to QDoc} @@ -75,8 +75,8 @@ /*! \page 01-qdoc-manual.html - \contentspage Table of Contents - \previouspage Table of Contents + \contentspage QDoc Manual + \previouspage QDoc Manual \nextpage Command Index \title Introduction to QDoc @@ -229,7 +229,7 @@ /*! \page 03-qdoc-commands-markup.html - \contentspage Table of Contents + \contentspage QDoc Manual \previouspage Naming Things \nextpage Text Markup @@ -310,7 +310,7 @@ /*! \page 04-qdoc-commands-textmarkup.html - \contentspage Table of Contents + \contentspage QDoc Manual \previouspage Markup Commands \nextpage Document Structure @@ -924,7 +924,7 @@ /*! \page 05-qdoc-commands-documentstructure.html \previouspage Text Markup - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Including Code Inline \title Document Structure @@ -1146,7 +1146,7 @@ /*! \page 06-qdoc-commands-includecodeinline.html \previouspage Document Structure - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Including External Code \title Including Code Inline @@ -1392,7 +1392,7 @@ /*! \page 07-0-qdoc-commands-includingexternalcode.html \previouspage Including Code Inline - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Creating Links \title Including External Code @@ -2030,7 +2030,7 @@ /*! \page 07-1-example.html \previouspage Including External Code - \contentspage Table of Contents + \contentspage QDoc Manual \title Example File @@ -2040,7 +2040,7 @@ /*! \page 08-qdoc-commands-creatinglinks.html \previouspage Including External Code - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Including Images \title Creating Links @@ -2243,7 +2243,7 @@ The text up to the line break becomes the target name. Be sure to follow the target name with a line break. Curly brackets are not required around the target name, but they may be required when the - target name is used in a link cammand. See below. + target name is used in a link command. See below. \code / *! @@ -2339,7 +2339,7 @@ /*! \page 09-qdoc-commands-includingimages.html \previouspage Creating Links - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Tables and Lists \title Including Images @@ -2535,7 +2535,7 @@ /*! \page 10-qdoc-commands-tablesandlists.html \previouspage Including Images - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Special Content \title Tables and Lists @@ -3061,7 +3061,7 @@ /*! \page 11-qdoc-commands-specialcontent.html \previouspage Tables and Lists - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Miscellaneous \title Special Content @@ -3496,7 +3496,7 @@ /*! \page 12-0-qdoc-commands-miscellaneous.html \previouspage Special Content - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Creating DITA Maps \title Miscellaneous @@ -4061,10 +4061,10 @@ <shortdesc>the QWidget class is the base class of all user interface objects.</shortdesc> <prolog> <author>Qt Development Frameworks</author> - <publisher>Nokia</publisher> + <publisher>Qt Project</publisher> <copyright> - <copyryear year="2011"/> - <copyrholder>Nokia</copyrholder> + <copyryear year="2013"/> + <copyrholder>Qt Project</copyrholder> </copyright> <permissions view="all"/> <metadata> @@ -4247,7 +4247,7 @@ /*! \page 12-1-signalandslots.html \previouspage Miscellaneous - \contentspage Table of Contents + \contentspage QDoc Manual \title signalandslots.qdocinc @@ -4257,7 +4257,7 @@ /*! \page 12-2-objectmodel.html \previouspage Miscellaneous - \contentspage Table of Contents + \contentspage QDoc Manual \title objectmodel.qdocinc @@ -4267,7 +4267,7 @@ /*! \page 12-3-layoutmanagement.html \previouspage Miscellaneous - \contentspage Table of Contents + \contentspage QDoc Manual \title layoutmanagement.qdocinc @@ -4277,7 +4277,7 @@ /*! \page 13-qdoc-commands-topics.html \previouspage Command Index - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Context Commands \title Topic Commands @@ -5887,7 +5887,7 @@ /*! \page 14-qdoc-commands-contextcommands.html \previouspage Topic Commands - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Document Navigation \title Context Commands @@ -5929,7 +5929,7 @@ /*! \page 15-qdoc-commands-navigation.html \previouspage Context Commands - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Reporting Status \title Document Navigation @@ -6125,7 +6125,7 @@ /*! \page 16-qdoc-commands-status.html \previouspage Document Navigation - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Thread Support \title Reporting Status @@ -6427,7 +6427,7 @@ /*! \page 17-qdoc-commands-thread.html \previouspage Reporting Status - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Relating Things \title Thread Support @@ -6610,7 +6610,7 @@ /*! \page 18-qdoc-commands-relating.html \previouspage Thread Support - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Grouping Things \title Relating Things @@ -6795,7 +6795,7 @@ /*! \page 19-qdoc-commands-grouping.html \previouspage Relating Things - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Naming Things \title Grouping Things @@ -6909,7 +6909,7 @@ /*! \page 20-qdoc-commands-namingthings.html \previouspage Grouping Things - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Markup Commands \title Naming Things @@ -6997,7 +6997,7 @@ /*! \page 21-0-qdoc-creating-dita-maps.html \previouspage Miscellaneous - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage The QDoc Configuration File \title Creating DITA Maps @@ -7134,7 +7134,7 @@ /*! \page 21-0-qdoc-configuration.html \previouspage Creating DITA Maps - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Generic Configuration Variables \title The QDoc Configuration File @@ -7246,7 +7246,7 @@ /*! \page 21-1-minimum-qdocconf.html \previouspage qt.qdocconf - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Generating DITA XML Output \title minimum.qdocconf @@ -7257,7 +7257,7 @@ /*! \page 21-2-qt-qdocconf.html \previouspage Supporting Derived Projects - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage minimum.qdocconf \title qt.qdocconf @@ -7268,8 +7268,8 @@ /*! \page 21-3-qt-dita-xml-output.html \previouspage minimum.qdocconf - \contentspage Table of Contents - \nextpage Table of Contents + \contentspage QDoc Manual + \nextpage QDoc Manual \title Generating DITA XML Output @@ -7313,9 +7313,9 @@ \code dita.metadata.default.author = Qt Development Frameworks dita.metadata.default.permissions = all - dita.metadata.default.publisher = Nokia - dita.metadata.default.copyryear = 2011 - dita.metadata.default.copyrholder = Nokia + dita.metadata.default.publisher = Qt Project + dita.metadata.default.copyryear = 2013 + dita.metadata.default.copyrholder = Qt Project dita.metadata.default.audience = programmer \endcode @@ -7327,7 +7327,7 @@ /*! \page 22-qdoc-configuration-generalvariables.html \previouspage The QDoc Configuration File - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Creating Help Project Files \title Generic Configuration Variables @@ -8235,7 +8235,7 @@ /*! \page 22-creating-help-project-files.html \previouspage Generic Configuration Variables - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage C++ Specific Configuration Variables \title Creating Help Project Files @@ -8304,7 +8304,7 @@ /*! \page 23-qdoc-configuration-cppvariables.html \previouspage Creating Help Project Files - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage HTML Specific Configuration Variables \title C++ Specific Configuration Variables @@ -8418,7 +8418,7 @@ /*! \page 24-qdoc-configuration-htmlvariables.html \previouspage C++ Specific Configuration Variables - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Supporting Derived Projects \title HTML Specific Configuration Variables @@ -8533,7 +8533,7 @@ /*! \page 25-qdoc-configuration-derivedprojects.html \previouspage HTML Specific Configuration Variables - \contentspage Table of Contents + \contentspage QDoc Manual \title Supporting Derived Projects @@ -8674,7 +8674,7 @@ /*! \page 27-qdoc-commands-alphabetical.html \previouspage Introduction to QDoc - \contentspage Table of Contents + \contentspage QDoc Manual \nextpage Topic Commands \title Command Index diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 46d45f70086..95ba6d28bf6 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -476,13 +476,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool subdir) switch (node->type()) { case Node::Class: case Node::Namespace: - if (parentNode && !parentNode->name().isEmpty()) { - parentName.remove(QLatin1Char('.') + currentGenerator()->fileExtension()); - parentName += QLatin1Char('-') - + fileBase(node).toLower() + QLatin1Char('.') + currentGenerator()->fileExtension(); - } else { - parentName = fileBase(node) + QLatin1Char('.') + currentGenerator()->fileExtension(); - } + parentName = fileBase(node) + QLatin1Char('.') + currentGenerator()->fileExtension(); break; case Node::Function: { diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 551196f2f47..e4bc85b2bc1 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -66,6 +66,8 @@ class QDocDatabase; class Generator { + Q_DECLARE_TR_FUNCTIONS(QDoc::Generator) + public: enum Passes { Both, Prepare, Generate }; diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp index 09b3629ade4..fdba15700f3 100644 --- a/src/tools/qdoc/helpprojectwriter.cpp +++ b/src/tools/qdoc/helpprojectwriter.cpp @@ -429,17 +429,18 @@ void HelpProjectWriter::generateSections(HelpProject &project, // Ensure that we don't visit nodes more than once. QMap<QString, const Node*> childMap; - foreach (const Node *node, inner->childNodes()) { - if (node->access() == Node::Private) + foreach (const Node *childNode, inner->childNodes()) { + if (childNode->access() == Node::Private) continue; - if (node->type() == Node::Document) { + + if (childNode->type() == Node::Document) { /* Don't visit QML property group nodes, but visit their children, which are all QML property nodes. */ - if (node->subType() == Node::QmlPropertyGroup) { - const InnerNode* inner = static_cast<const InnerNode*>(node); + if (childNode->subType() == Node::QmlPropertyGroup) { + const InnerNode* inner = static_cast<const InnerNode*>(childNode); foreach (const Node* n, inner->childNodes()) { if (n->access() == Node::Private) continue; @@ -447,17 +448,24 @@ void HelpProjectWriter::generateSections(HelpProject &project, } } else - childMap[static_cast<const DocNode *>(node)->fullTitle()] = node; + childMap[static_cast<const DocNode *>(childNode)->fullTitle()] = childNode; } else { - if (node->type() == Node::Function) { - const FunctionNode *funcNode = static_cast<const FunctionNode *>(node); + // Store member status of children + project.memberStatus[node].insert(childNode->status()); + + if (childNode->type() == Node::Function) { + const FunctionNode *funcNode = static_cast<const FunctionNode *>(childNode); if (funcNode->isOverload()) continue; } - childMap[node->fullDocumentName()] = node; + childMap[childNode->fullDocumentName()] = childNode; } } + // Insert files for all/compatibility/obsolete members + addMembers(project, writer, node, false); + if (node->relates()) + addMembers(project, writer, node->relates(), false); foreach (const Node *child, childMap) generateSections(project, writer, child); @@ -483,6 +491,57 @@ void HelpProjectWriter::writeHashFile(QFile &file) hashFile.close(); } +void HelpProjectWriter::writeSection(QXmlStreamWriter &writer, const QString &path, + const QString &value) +{ + writer.writeStartElement(QStringLiteral("section")); + writer.writeAttribute(QStringLiteral("ref"), path); + writer.writeAttribute(QStringLiteral("title"), value); + writer.writeEndElement(); // section +} + +/* + Add files for all members, compatibility members and obsolete members + Also write subsections for these depending on 'writeSections' (default=true). +*/ +void HelpProjectWriter::addMembers(HelpProject &project, QXmlStreamWriter &writer, + const Node *node, bool writeSections) +{ + QString href = gen_->fullDocumentLocation(node,true); + href = href.left(href.size()-5); + if (href.isEmpty()) + return; + + Node::SubType subType = static_cast<const DocNode*>(node)->subType(); + + bool derivedClass = false; + if (node->type() == Node::Class) + derivedClass = !(static_cast<const ClassNode *>(node)->baseClasses().isEmpty()); + + // Do not generate a 'List of all members' for namespaces or header files, + // but always generate it for derived classes and QML classes + if (node->type() != Node::Namespace && subType != Node::HeaderFile && + (derivedClass || subType == Node::QmlClass || + !project.memberStatus[node].isEmpty())) { + QString membersPath = href + QStringLiteral("-members.html"); + project.files.insert(membersPath); + if (writeSections) + writeSection(writer, membersPath, tr("List of all members")); + } + if (project.memberStatus[node].contains(Node::Compat)) { + QString compatPath = href + QStringLiteral("-compat.html"); + project.files.insert(compatPath); + if (writeSections) + writeSection(writer, compatPath, tr("Compatibility members")); + } + if (project.memberStatus[node].contains(Node::Obsolete)) { + QString obsoletePath = href + QStringLiteral("-obsolete.html"); + project.files.insert(obsoletePath); + if (writeSections) + writeSection(writer, obsoletePath, tr("Obsolete members")); + } +} + void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node) { @@ -499,41 +558,12 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer else writer.writeAttribute("title", tr("%1 Class Reference").arg(objName)); - // Write subsections for all members, obsolete members and Qt 3 - // members. - if (!project.memberStatus[node].isEmpty()) { - QString membersPath = href.left(href.size()-5) + "-members.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", membersPath); - writer.writeAttribute("title", tr("List of all members")); - writer.writeEndElement(); // section - project.files.insert(membersPath); - } - if (project.memberStatus[node].contains(Node::Compat)) { - QString compatPath = href.left(href.size()-5) + "-compat.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", compatPath); - writer.writeAttribute("title", tr("Compatibility members")); - writer.writeEndElement(); // section - project.files.insert(compatPath); - } - if (project.memberStatus[node].contains(Node::Obsolete)) { - QString obsoletePath = href.left(href.size()-5) + "-obsolete.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", obsoletePath); - writer.writeAttribute("title", tr("Obsolete members")); - writer.writeEndElement(); // section - project.files.insert(obsoletePath); - } - + addMembers(project, writer, node); writer.writeEndElement(); // section break; case Node::Namespace: - writer.writeStartElement("section"); - writer.writeAttribute("ref", href); - writer.writeAttribute("title", objName); - writer.writeEndElement(); // section + writeSection(writer, href, objName); break; case Node::Document: { @@ -548,34 +578,8 @@ void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer else writer.writeAttribute("title", docNode->fullTitle()); - if ((docNode->subType() == Node::HeaderFile) || (docNode->subType() == Node::QmlClass)) { - // Write subsections for all members, obsolete members and Qt 3 - // members. - if (!project.memberStatus[node].isEmpty() || (docNode->subType() == Node::QmlClass)) { - QString membersPath = href.left(href.size()-5) + "-members.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", membersPath); - writer.writeAttribute("title", tr("List of all members")); - writer.writeEndElement(); // section - project.files.insert(membersPath); - } - if (project.memberStatus[node].contains(Node::Compat)) { - QString compatPath = href.left(href.size()-5) + "-compat.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", compatPath); - writer.writeAttribute("title", tr("Compatibility members")); - writer.writeEndElement(); // section - project.files.insert(compatPath); - } - if (project.memberStatus[node].contains(Node::Obsolete)) { - QString obsoletePath = href.left(href.size()-5) + "-obsolete.html"; - writer.writeStartElement("section"); - writer.writeAttribute("ref", obsoletePath); - writer.writeAttribute("title", tr("Obsolete members")); - writer.writeEndElement(); // section - project.files.insert(obsoletePath); - } - } + if ((docNode->subType() == Node::HeaderFile) || (docNode->subType() == Node::QmlClass)) + addMembers(project, writer, node); writer.writeEndElement(); // section } diff --git a/src/tools/qdoc/helpprojectwriter.h b/src/tools/qdoc/helpprojectwriter.h index adca31d814f..5dfa12cf737 100644 --- a/src/tools/qdoc/helpprojectwriter.h +++ b/src/tools/qdoc/helpprojectwriter.h @@ -85,6 +85,8 @@ struct HelpProject class HelpProjectWriter { + Q_DECLARE_TR_FUNCTIONS(QDoc::HelpProjectWriter) + public: HelpProjectWriter(const Config &config, const QString &defaultFileName, @@ -103,6 +105,10 @@ private: void writeHashFile(QFile &file); void writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node); void readSelectors(SubProject &subproject, const QStringList &selectors); + void addMembers(HelpProject &project, QXmlStreamWriter &writer, + const Node *node, bool writeSections = true); + void writeSection(QXmlStreamWriter &writer, const QString &path, + const QString &value); QDocDatabase* qdb_; Generator* gen_; diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index 132fb0927ab..65d874f619a 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -59,6 +59,8 @@ class HelpProjectWriter; class HtmlGenerator : public Generator { + Q_DECLARE_TR_FUNCTIONS(QDoc::HtmlGenerator) + public: enum SinceType { Namespace, diff --git a/src/tools/qdoc/jscodemarker.h b/src/tools/qdoc/jscodemarker.h index 59b17767286..123e3e2db7b 100644 --- a/src/tools/qdoc/jscodemarker.h +++ b/src/tools/qdoc/jscodemarker.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE class JsCodeMarker : public QmlCodeMarker { + Q_DECLARE_TR_FUNCTIONS(QDoc::JsCodeMarker) + public: JsCodeMarker(); ~JsCodeMarker(); diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h index 87aa9b5893d..20ddfd076e7 100644 --- a/src/tools/qdoc/location.h +++ b/src/tools/qdoc/location.h @@ -57,6 +57,8 @@ class QRegExp; class Location { + Q_DECLARE_TR_FUNCTIONS(QDoc::Location) + public: Location(); Location(const QString& filePath); diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 2625782cfbf..50632f1da46 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -110,12 +110,12 @@ static QString documentationPath; */ static void printHelp() { - Location::information(tr("Usage: qdoc [options] file1.qdocconf ...\n" + Location::information(QCoreApplication::translate("QDoc", "Usage: qdoc [options] file1.qdocconf ...\n" "Options:\n" " -D<name> " "Define <name> as a macro while parsing sources\n" " -depends " - "Specify dependant modules\n" + "Specify dependent modules\n" " -help " "Display this information and exit\n" " -highlighting " @@ -149,7 +149,7 @@ static void printHelp() */ static void printVersion() { - QString s = tr("qdoc version %1").arg(QT_VERSION_STR); + QString s = QCoreApplication::translate("QDoc", "qdoc version %1").arg(QT_VERSION_STR); Location::information(s); } @@ -250,7 +250,7 @@ static void processQdocconfFile(const QString &fileName) All the other classes are initialized with the config. Here we initialize the configuration with some default values. */ - Config config(tr("qdoc")); + Config config(QCoreApplication::translate("QDoc", "qdoc")); int i = 0; while (defaults[i].key) { config.setStringList(defaults[i].key, QStringList() << defaults[i].value); @@ -325,7 +325,7 @@ static void processQdocconfFile(const QString &fileName) while (fn != fileNames.constEnd()) { QTranslator *translator = new QTranslator(0); if (!translator->load(*fn)) - config.lastLocation().error(tr("Cannot load translator '%1'").arg(*fn)); + config.lastLocation().error(QCoreApplication::translate("QDoc", "Cannot load translator '%1'").arg(*fn)); QCoreApplication::instance()->installTranslator(translator); translators.append(translator); ++fn; @@ -489,7 +489,7 @@ static void processQdocconfFile(const QString &fileName) while (of != outputFormats.constEnd()) { Generator* generator = Generator::generatorForFormat(*of); if (generator == 0) - outputFormatsLocation.fatal(tr("Unknown output format '%1'").arg(*of)); + outputFormatsLocation.fatal(QCoreApplication::translate("QDoc", "Unknown output format '%1'").arg(*of)); generator->generateTree(); ++of; } diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 56da4ca1748..11c08fb6599 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -69,6 +69,8 @@ typedef QList<QPair<QString,QString> > ImportList; class Node { + Q_DECLARE_TR_FUNCTIONS(QDoc::Node) + public: enum Type { Namespace, @@ -596,6 +598,8 @@ class QmlPropertyNode; class QmlPropertyNode : public LeafNode { + Q_DECLARE_TR_FUNCTIONS(QDoc::QmlPropertyNode) + public: QmlPropertyNode(QmlClassNode *parent, const QString& name, diff --git a/src/tools/qdoc/openedlist.h b/src/tools/qdoc/openedlist.h index 7d40add8b10..cf7624b8e39 100644 --- a/src/tools/qdoc/openedlist.h +++ b/src/tools/qdoc/openedlist.h @@ -49,11 +49,14 @@ #include <qstring.h> #include "location.h" +#include "tr.h" QT_BEGIN_NAMESPACE class OpenedList { + Q_DECLARE_TR_FUNCTIONS(QDoc::OpenedList) + public: enum Style { Bullet, Tag, Value, Numeric, UpperAlpha, LowerAlpha, UpperRoman, LowerRoman }; diff --git a/src/tools/qdoc/puredocparser.h b/src/tools/qdoc/puredocparser.h index f25f7777336..0174af7a4e7 100644 --- a/src/tools/qdoc/puredocparser.h +++ b/src/tools/qdoc/puredocparser.h @@ -60,6 +60,8 @@ class Tree; class PureDocParser : public CppCodeParser { + Q_DECLARE_TR_FUNCTIONS(QDoc::PureDocParser) + public: PureDocParser(); virtual ~PureDocParser(); diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro index c0f3cd70d1e..9729a758f06 100644 --- a/src/tools/qdoc/qdoc.pro +++ b/src/tools/qdoc/qdoc.pro @@ -88,21 +88,6 @@ SOURCES += jscodemarker.cpp \ qtPrepareTool(QDOC, qdoc) qtPrepareTool(QHELPGENERATOR, qhelpgenerator) -equals(QMAKE_DIR_SEP, /) { - QDOC = QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QDOC -} else { - QDOC = set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QDOC - QDOC = $$replace(QDOC, "/", "\\") -} - -html-docs.commands = $$QDOC $$PWD/doc/config/qdoc.qdocconf -html-docs.files = $$PWD/doc/html - -qch-docs.commands = $$QHELPGENERATOR $$PWD/doc/html/qdoc.qhp -o $$PWD/doc/qch/qdoc.qch -qch-docs.files = $$PWD/doc/qch -qch-docs.path = $$[QT_INSTALL_DOCS] -qch-docs.CONFIG += no_check_exist directory - -QMAKE_EXTRA_TARGETS += html-docs qch-docs +QMAKE_DOCS = $$PWD/doc/config/qdoc.qdocconf load(qt_tool) diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index 21f955566f3..857fd301bbd 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -82,6 +82,8 @@ typedef QMultiMap<QString, TargetRec> TargetRecMultiMap; class QDocDatabase { + Q_DECLARE_TR_FUNCTIONS(QDoc::QDocDatabase) + public: static QDocDatabase* qdocDB(); static void destroyQdocDB(); diff --git a/src/tools/qdoc/qmlcodemarker.h b/src/tools/qdoc/qmlcodemarker.h index 7e801d083e7..bc2321e076d 100644 --- a/src/tools/qdoc/qmlcodemarker.h +++ b/src/tools/qdoc/qmlcodemarker.h @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE class QmlCodeMarker : public CppCodeMarker { + Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeMarker) + public: QmlCodeMarker(); ~QmlCodeMarker(); diff --git a/src/tools/qdoc/qmlcodeparser.h b/src/tools/qdoc/qmlcodeparser.h index 5a332385844..5bdcfbfbbf0 100644 --- a/src/tools/qdoc/qmlcodeparser.h +++ b/src/tools/qdoc/qmlcodeparser.h @@ -62,6 +62,8 @@ class Tree; class QmlCodeParser : public CodeParser { + Q_DECLARE_TR_FUNCTIONS(QDoc::QmlCodeParser) + public: QmlCodeParser(); virtual ~QmlCodeParser(); diff --git a/src/tools/qdoc/qmlparser/qqmljslexer_p.h b/src/tools/qdoc/qmlparser/qqmljslexer_p.h index f22325ebf92..cb6ff6bcdf3 100644 --- a/src/tools/qdoc/qmlparser/qqmljslexer_p.h +++ b/src/tools/qdoc/qmlparser/qqmljslexer_p.h @@ -55,6 +55,7 @@ #include "qqmljsglobal_p.h" #include "qqmljsgrammar_p.h" +#include "tr.h" #include <qstring.h> QT_QML_BEGIN_NAMESPACE @@ -87,6 +88,8 @@ public: class QML_PARSER_EXPORT Lexer: public QQmlJSGrammar { + Q_DECLARE_TR_FUNCTIONS(QDoc::QQmlJS::Lexer) + public: enum { T_ABSTRACT = T_RESERVED_WORD, diff --git a/src/tools/qdoc/qmlparser/qqmljsparser.cpp b/src/tools/qdoc/qmlparser/qqmljsparser.cpp index 104aa3d557b..b7f571aa629 100644 --- a/src/tools/qdoc/qmlparser/qqmljsparser.cpp +++ b/src/tools/qdoc/qmlparser/qqmljsparser.cpp @@ -40,12 +40,6 @@ ****************************************************************************/ #include <qdebug.h> -#ifdef QT_BOOTSTRAPPED -#define tr(x, y) QString(QLatin1String(y)) -#else -#include <qcoreapplication.h> -#define tr(x, y) QCoreApplication::translate(x, y) -#endif #include <string.h> diff --git a/src/tools/qdoc/qmlparser/qqmljsparser_p.h b/src/tools/qdoc/qmlparser/qqmljsparser_p.h index e59ef67ffd2..9fe7428bc27 100644 --- a/src/tools/qdoc/qmlparser/qqmljsparser_p.h +++ b/src/tools/qdoc/qmlparser/qqmljsparser_p.h @@ -75,6 +75,8 @@ class Engine; class QML_PARSER_EXPORT Parser: protected QQmlJSGrammar { + Q_DECLARE_TR_FUNCTIONS(QDoc::QQmlJS::Parser) + public: union Value { int ival; diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h index acf34ab95c1..172aca579a4 100644 --- a/src/tools/qdoc/qmlvisitor.h +++ b/src/tools/qdoc/qmlvisitor.h @@ -66,6 +66,8 @@ struct QmlPropArgs class QmlDocVisitor : public QQmlJS::AST::Visitor { + Q_DECLARE_TR_FUNCTIONS(QDoc::QmlDocVisitor) + public: QmlDocVisitor(const QString &filePath, const QString &code, diff --git a/src/tools/qdoc/quoter.h b/src/tools/qdoc/quoter.h index 9f2e3f7852e..223fdd96b30 100644 --- a/src/tools/qdoc/quoter.h +++ b/src/tools/qdoc/quoter.h @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE class Quoter { + Q_DECLARE_TR_FUNCTIONS(QDoc::Quoter) + public: Quoter(); diff --git a/src/tools/qdoc/separator.cpp b/src/tools/qdoc/separator.cpp index b9320449c6e..2403fb15c8f 100644 --- a/src/tools/qdoc/separator.cpp +++ b/src/tools/qdoc/separator.cpp @@ -51,14 +51,14 @@ QT_BEGIN_NAMESPACE QString separator(int index, int count) { if (index == count - 1) - return tr(".", "terminator"); + return QCoreApplication::translate("QDoc", ".", "terminator"); if (count == 2) - return tr(" and ", "separator when N = 2"); + return QCoreApplication::translate("QDoc", " and ", "separator when N = 2"); if (index == 0) - return tr(", ", "first separator when N > 2"); + return QCoreApplication::translate("QDoc", ", ", "first separator when N > 2"); if (index < count - 2) - return tr(", ", "general separator when N > 2"); - return tr(", and ", "last separator when N > 2"); + return QCoreApplication::translate("QDoc", ", ", "general separator when N > 2"); + return QCoreApplication::translate("QDoc", ", and ", "last separator when N > 2"); } QString comma(int index, int count) @@ -66,12 +66,12 @@ QString comma(int index, int count) if (index == count - 1) return QString(); if (count == 2) - return tr(" and ", "separator when N = 2"); + return QCoreApplication::translate("QDoc", " and ", "separator when N = 2"); if (index == 0) - return tr(", ", "first separator when N > 2"); + return QCoreApplication::translate("QDoc", ", ", "first separator when N > 2"); if (index < count - 2) - return tr(", ", "general separator when N > 2"); - return tr(", and ", "last separator when N > 2"); + return QCoreApplication::translate("QDoc", ", ", "general separator when N > 2"); + return QCoreApplication::translate("QDoc", ", and ", "last separator when N > 2"); } QT_END_NAMESPACE diff --git a/src/tools/qdoc/tokenizer.h b/src/tools/qdoc/tokenizer.h index ae67a9b8a91..4e2c622f3c4 100644 --- a/src/tools/qdoc/tokenizer.h +++ b/src/tools/qdoc/tokenizer.h @@ -96,6 +96,8 @@ enum { Tok_Eoi, Tok_Ampersand, Tok_Aster, Tok_Caret, Tok_LeftParen, class Tokenizer { + Q_DECLARE_TR_FUNCTIONS(QDoc::Tokenizer) + public: Tokenizer(const Location& loc, const QByteArray &in); Tokenizer(const Location& loc, QFile &file); diff --git a/src/tools/qdoc/tr.h b/src/tools/qdoc/tr.h index 686b9171ab3..36b0c47fef8 100644 --- a/src/tools/qdoc/tr.h +++ b/src/tools/qdoc/tr.h @@ -46,26 +46,36 @@ #ifndef TR_H #define TR_H -#ifndef QT_BOOTSTRAPPED -# include "qcoreapplication.h" +#include <qglobal.h> + +#if !defined(QT_BOOTSTRAPPED) && !defined(QT_NO_TRANSLATION) +# define TRANSLATE_QDOC #endif #include <qstring.h> +#ifdef TRANSLATE_QDOC +# include <qcoreapplication.h> +#endif QT_BEGIN_NAMESPACE -#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_TRANSLATION) +#ifndef TRANSLATE_QDOC + +#define Q_DECLARE_TR_FUNCTIONS(context) + inline QString tr(const char *sourceText, const char *comment = 0) { Q_UNUSED(comment); return QString( QLatin1String(sourceText) ); } -#else -inline QString tr(const char *sourceText, const char *comment = 0) + +struct QCoreApplication { - return QCoreApplication::instance()->translate("", sourceText, comment); -} -#endif + static inline QString translate(const char * /* context */ , const char *sourceText, const char * /* disambiguation */ = 0) + { return QLatin1String(sourceText); } +}; + +#endif // !TRANSLATE_QDOC QT_END_NAMESPACE diff --git a/src/tools/tools.pro b/src/tools/tools.pro index fa9ed54c500..c3a9ea228ec 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -41,3 +41,5 @@ SUBDIRS = $$TOOLS_SUBDIRS bootstrap_prepare_docs.depends += $${src_tools_qdoc.target}-make_first bootstrap_prepare_docs.target = $${src_tools_bootstrap.target}-prepare_docs QMAKE_EXTRA_TARGETS += bootstrap_prepare_docs + +TR_EXCLUDE += $$PWD/* diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in index 27f9c2e5a67..d9abb458437 100644 --- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in +++ b/src/widgets/Qt5WidgetsConfigExtras.cmake.in @@ -1,12 +1,10 @@ -get_filename_component(_qt5_widgets_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) - if (NOT TARGET Qt5::uic) add_executable(Qt5::uic IMPORTED) set_target_properties(Qt5::uic PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\" + IMPORTED_LOCATION \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\" !!ELSE IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\" !!ENDIF diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index d233df6351d..aab6494d98b 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -3577,7 +3577,7 @@ bool QWizardPage::validatePage() from the rest of your implementation, whenever the value of isComplete() changes. This ensures that QWizard updates the enabled or disabled state of its buttons. An example of the reimplementation is - available \l{http://qt.nokia.com/doc/qq/qq22-qwizard.html#validatebeforeitstoolate} + available \l{http://doc.qt.digia.com/qq/qq22-qwizard.html#validatebeforeitstoolate} {here}. \sa completeChanged(), isFinalPage() diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index 2cd6887f83e..e960ebfeba1 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtWidgets description = Qt Widgets Reference Documentation -url = http://qt-project.org/doc/qtwidgets -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtwidgets +version = $QT_VERSION examplesinstallpath = widgets qhp.projects = QtWidgets qhp.QtWidgets.file = qtwidgets.qhp -qhp.QtWidgets.namespace = org.qt-project.qtwidgets.510 +qhp.QtWidgets.namespace = org.qt-project.qtwidgets.$QT_VERSION_TAG qhp.QtWidgets.virtualFolder = qtwidgets qhp.QtWidgets.indexTitle = Qt Widgets qhp.QtWidgets.indexRoot = -qhp.QtWidgets.filterAttributes = qtwidgets 5.1.0 qtrefdoc -qhp.QtWidgets.customFilters.Qt.name = QtWidgets 5.1.0 -qhp.QtWidgets.customFilters.Qt.filterAttributes = qtwidgets 5.1.0 +qhp.QtWidgets.filterAttributes = qtwidgets $QT_VERSION qtrefdoc +qhp.QtWidgets.customFilters.Qt.name = QtWidgets $QT_VERSION +qhp.QtWidgets.customFilters.Qt.filterAttributes = qtwidgets $QT_VERSION qhp.QtWidgets.subprojects = classes qhp.QtWidgets.subprojects.classes.title = C++ Classes diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm new file mode 100755 index 00000000000..af21ee726ad --- /dev/null +++ b/src/widgets/doc/snippets/macmainwindow.mm @@ -0,0 +1,347 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "macmainwindow.h" +#import <Cocoa/Cocoa.h> +#include <QtGui> + + +#ifdef Q_WS_MAC + +#include <Carbon/Carbon.h> + +#ifdef QT_MAC_USE_COCOA + +//![0] +SearchWidget::SearchWidget(QWidget *parent) + : QMacCocoaViewContainer(0, parent) +{ + // Many Cocoa objects create temporary autorelease objects, + // so create a pool to catch them. + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + // Create the NSSearchField, set it on the QCocoaViewContainer. + NSSearchField *search = [[NSSearchField alloc] init]; + setCocoaView(search); + + // Use a Qt menu for the search field menu. + QMenu *qtMenu = createMenu(this); + NSMenu *nsMenu = qtMenu->macMenu(0); + [[search cell] setSearchMenuTemplate:nsMenu]; + + // Release our reference, since our super class takes ownership and we + // don't need it anymore. + [search release]; + + // Clean up our pool as we no longer need it. + [pool release]; +} +//![0] + +SearchWidget::~SearchWidget() +{ +} + +QSize SearchWidget::sizeHint() const +{ + return QSize(150, 40); +} + +#else + +// The SearchWidget class wraps a native HISearchField. +SearchWidget::SearchWidget(QWidget *parent) + :QWidget(parent) +{ + + // Create a native search field and pass its window id to QWidget::create. + searchFieldText = CFStringCreateWithCString(0, "search", 0); + HISearchFieldCreate(NULL/*bounds*/, kHISearchFieldAttributesSearchIcon | kHISearchFieldAttributesCancel, + NULL/*menu ref*/, searchFieldText, &searchField); + create(reinterpret_cast<WId>(searchField)); + + // Use a Qt menu for the search field menu. + QMenu *searchMenu = createMenu(this); + MenuRef menuRef = searchMenu->macMenu(0); + HISearchFieldSetSearchMenu(searchField, menuRef); + setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); +} + +SearchWidget::~SearchWidget() +{ + CFRelease(searchField); + CFRelease(searchFieldText); +} + +// Get the size hint from the search field. +QSize SearchWidget::sizeHint() const +{ + EventRef event; + HIRect optimalBounds; + CreateEvent(0, kEventClassControl, + kEventControlGetOptimalBounds, + GetCurrentEventTime(), + kEventAttributeUserEvent, &event); + + SendEventToEventTargetWithOptions(event, + HIObjectGetEventTarget(HIObjectRef(winId())), + kEventTargetDontPropagate); + + GetEventParameter(event, + kEventParamControlOptimalBounds, typeHIRect, + 0, sizeof(HIRect), 0, &optimalBounds); + + ReleaseEvent(event); + return QSize(optimalBounds.size.width + 100, // make it a bit wider. + optimalBounds.size.height); +} + +#endif + +QMenu *createMenu(QWidget *parent) +{ + QMenu *searchMenu = new QMenu(parent); + + QAction * indexAction = searchMenu->addAction("Index Search"); + indexAction->setCheckable(true); + indexAction->setChecked(true); + + QAction * fulltextAction = searchMenu->addAction("Full Text Search"); + fulltextAction->setCheckable(true); + + QActionGroup *searchActionGroup = new QActionGroup(parent); + searchActionGroup->addAction(indexAction); + searchActionGroup->addAction(fulltextAction); + searchActionGroup->setExclusive(true); + + return searchMenu; +} + +SearchWrapper::SearchWrapper(QWidget *parent) +:QWidget(parent) +{ + s = new SearchWidget(this); + s->move(2,2); + setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); +} + +QSize SearchWrapper::sizeHint() const +{ + return s->sizeHint() + QSize(6, 2); +} + +Spacer::Spacer(QWidget *parent) +:QWidget(parent) +{ + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setSizePolicy(sizePolicy); +} + +QSize Spacer::sizeHint() const +{ + return QSize(1, 1); +} + +MacSplitterHandle::MacSplitterHandle(Qt::Orientation orientation, QSplitter *parent) +: QSplitterHandle(orientation, parent) { } + +// Paint the horizontal handle as a gradient, paint +// the vertical handle as a line. +void MacSplitterHandle::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + + QColor topColor(145, 145, 145); + QColor bottomColor(142, 142, 142); + QColor gradientStart(252, 252, 252); + QColor gradientStop(223, 223, 223); + + if (orientation() == Qt::Vertical) { + painter.setPen(topColor); + painter.drawLine(0, 0, width(), 0); + painter.setPen(bottomColor); + painter.drawLine(0, height() - 1, width(), height() - 1); + + QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, height() -3)); + linearGrad.setColorAt(0, gradientStart); + linearGrad.setColorAt(1, gradientStop); + painter.fillRect(QRect(QPoint(0,1), size() - QSize(0, 2)), QBrush(linearGrad)); + } else { + painter.setPen(topColor); + painter.drawLine(0, 0, 0, height()); + } +} + +QSize MacSplitterHandle::sizeHint() const +{ + QSize parent = QSplitterHandle::sizeHint(); + if (orientation() == Qt::Vertical) { + return parent + QSize(0, 3); + } else { + return QSize(1, parent.height()); + } +} + +QSplitterHandle *MacSplitter::createHandle() +{ + return new MacSplitterHandle(orientation(), this); +} + +MacMainWindow::MacMainWindow() +{ + QSettings settings; + restoreGeometry(settings.value("Geometry").toByteArray()); + + setWindowTitle("Mac Main Window"); + + splitter = new MacSplitter(); + + // Set up the left-hand side blue side bar. + sidebar = new QTreeView(); + sidebar->setFrameStyle(QFrame::NoFrame); + sidebar->setAttribute(Qt::WA_MacShowFocusRect, false); + sidebar->setAutoFillBackground(true); + + // Set the palette. + QPalette palette = sidebar->palette(); + QColor macSidebarColor(231, 237, 246); + QColor macSidebarHighlightColor(168, 183, 205); + palette.setColor(QPalette::Base, macSidebarColor); + palette.setColor(QPalette::Highlight, macSidebarHighlightColor); + sidebar->setPalette(palette); + + sidebar->setModel(createItemModel()); + sidebar->header()->hide(); + sidebar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + sidebar->setTextElideMode(Qt::ElideMiddle); + + splitter->addWidget(sidebar); + + horizontalSplitter = new MacSplitter(); + horizontalSplitter->setOrientation(Qt::Vertical); + splitter->addWidget(horizontalSplitter); + + splitter->setStretchFactor(0, 0); + splitter->setStretchFactor(1, 1); + + // Set up the top document list view. + documents = new QListView(); + documents->setFrameStyle(QFrame::NoFrame); + documents->setAttribute(Qt::WA_MacShowFocusRect, false); + documents->setModel(createDocumentModel()); + documents->setAlternatingRowColors(true); + documents->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + horizontalSplitter->addWidget(documents); + horizontalSplitter->setStretchFactor(0, 0); + + // Set up the text view. + textedit = new QTextEdit(); + textedit->setFrameStyle(QFrame::NoFrame); + textedit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + textedit->setText("<br><br><br><br><br><br><center><b>This demo shows how to create a \ + Qt main window application that has the same appearance as other \ + Mac OS X applications such as Mail or iTunes. This includes \ + customizing the item views and QSplitter and wrapping native widgets \ + such as the search field.</b></center>"); + + horizontalSplitter->addWidget(textedit); + + setCentralWidget(splitter); + + toolBar = addToolBar(tr("Search")); + toolBar->addWidget(new Spacer()); + toolBar->addWidget(new SearchWrapper()); + + setUnifiedTitleAndToolBarOnMac(true); +} + +MacMainWindow::~MacMainWindow() +{ + QSettings settings; + settings.setValue("Geometry", saveGeometry()); +} + +QAbstractItemModel *MacMainWindow::createItemModel() +{ + QStandardItemModel *model = new QStandardItemModel(); + QStandardItem *parentItem = model->invisibleRootItem(); + + QStandardItem *documentationItem = new QStandardItem("Documentation"); + parentItem->appendRow(documentationItem); + + QStandardItem *assistantItem = new QStandardItem("Qt MainWindow Manual"); + documentationItem->appendRow(assistantItem); + + QStandardItem *designerItem = new QStandardItem("Qt Designer Manual"); + documentationItem->appendRow(designerItem); + + QStandardItem *qtItem = new QStandardItem("Qt Reference Documentation"); + qtItem->appendRow(new QStandardItem("Classes")); + qtItem->appendRow(new QStandardItem("Overviews")); + qtItem->appendRow(new QStandardItem("Tutorial & Examples")); + documentationItem->appendRow(qtItem); + + QStandardItem *bookmarksItem = new QStandardItem("Bookmarks"); + parentItem->appendRow(bookmarksItem); + bookmarksItem->appendRow(new QStandardItem("QWidget")); + bookmarksItem->appendRow(new QStandardItem("QObject")); + bookmarksItem->appendRow(new QStandardItem("QWizard")); + + return model; +} + +void MacMainWindow::resizeEvent(QResizeEvent *) +{ + if (toolBar) + toolBar->updateGeometry(); +} + +QAbstractItemModel *MacMainWindow::createDocumentModel() +{ + QStandardItemModel *model = new QStandardItemModel(); + QStandardItem *parentItem = model->invisibleRootItem(); + parentItem->appendRow(new QStandardItem("QWidget Class Reference")); + parentItem->appendRow(new QStandardItem("QObject Class Reference")); + parentItem->appendRow(new QStandardItem("QListView Class Reference")); + + return model; +} + +#endif // Q_WS_MAC diff --git a/src/widgets/doc/src/gestures.qdoc b/src/widgets/doc/src/gestures.qdoc index cc0bc76ea35..027f893db2c 100644 --- a/src/widgets/doc/src/gestures.qdoc +++ b/src/widgets/doc/src/gestures.qdoc @@ -68,7 +68,7 @@ required gesture type. The standard types are defined by the Qt::GestureType enum and include many commonly used gestures. - \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures + \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp enable gestures In the above code, the gestures are set up in the constructor of the target object itself. @@ -125,18 +125,18 @@ \l{QWidget::}{event()} handler function and delegates gesture events to a specialized gestureEvent() function: - \snippet examples/gestures/imagegestures/imagewidget.cpp event handler + \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp event handler The gesture events delivered to the target object can be examined individually and dealt with appropriately: - \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler + \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp gesture event handler Responding to a gesture is simply a matter of obtaining the QGesture object delivered in the QGestureEvent sent to the target object and examining the information it contains. - \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function + \snippet ../../../examples/gestures/imagegestures/imagewidget.cpp swipe function Here, we examine the direction in which the user swiped the widget and modify its contents accordingly. diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc index fac0be3b0a3..97d1c72e85c 100644 --- a/src/widgets/doc/src/modelview.qdoc +++ b/src/widgets/doc/src/modelview.qdoc @@ -576,7 +576,7 @@ problem. Qt Labs provides software called - \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, + \l{http://qt-project.org/wiki/Model_Test}{ModelTest}, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index 5d7ed8be1d4..b658fc809c1 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -249,7 +249,7 @@ For further guidance when implementing these functions, see the \e{Qt Quarterly} article - \l{http://doc.qt.nokia.com/qq/qq04-height-for-width.html} + \l{http://doc.qt.digia.com/qq/qq04-height-for-width.html} {Trading Height for Width}. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index f35002af4ca..78611a27cab 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -6280,7 +6280,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) // if the gesture was ignored by its target, we will update the // targetItems list with a possible target items (items that // want to receive partial gestures). - // ### wont' work if the target was destroyed in the event + // ### won't work if the target was destroyed in the event // we will just stop delivering it. if (receiver && receiver.data() == gestureTargets.value(g, 0)) ignoredGestures.insert(g); diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index 204444f6c0f..4101615fb36 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -466,7 +466,7 @@ static QSizeF closestAcceptableSize(const QSizeF &proposed, do { if (maxw - minw < 0.1) { - // we still havent found anything, cut off binary search + // we still haven't found anything, cut off binary search minw = maxw; minh = maxh; } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index be42c8dac05..8d0a578f614 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1100,7 +1100,7 @@ void QTreeView::scrollTo(const QModelIndex &index, ScrollHint hint) // Expand all parents if the parent(s) of the node are not expanded. QModelIndex parent = index.parent(); - while (parent.isValid() && state() == NoState && d->itemsExpandable) { + while (parent != d->root && parent.isValid() && state() == NoState && d->itemsExpandable) { if (!isExpanded(parent)) expand(parent); parent = d->model->parent(parent); diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 41958517c80..8e86775a2d1 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1896,7 +1896,7 @@ void QTreeWidgetItem::addChild(QTreeWidgetItem *child) /*! Inserts the \a child item at \a index in the list of children. - If the child has already been inserted somewhere else it wont be inserted again. + If the child has already been inserted somewhere else it won't be inserted again. */ void QTreeWidgetItem::insertChild(int index, QTreeWidgetItem *child) { @@ -1998,7 +1998,7 @@ void QTreeWidgetItem::addChildren(const QList<QTreeWidgetItem*> &children) Inserts the given list of \a children into the list of the item children at \a index . - Children that have already been inserted somewhere else wont be inserted. + Children that have already been inserted somewhere else won't be inserted. */ void QTreeWidgetItem::insertChildren(int index, const QList<QTreeWidgetItem*> &children) { @@ -2621,7 +2621,7 @@ int QTreeWidget::topLevelItemCount() const /*! Inserts the \a item at \a index in the top level in the view. - If the item has already been inserted somewhere else it wont be inserted. + If the item has already been inserted somewhere else it won't be inserted. \sa addTopLevelItem(), columnCount() */ @@ -2675,7 +2675,7 @@ int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const Inserts the list of \a items at \a index in the top level in the view. - Items that have already been inserted somewhere else wont be inserted. + Items that have already been inserted somewhere else won't be inserted. \sa addTopLevelItems() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 95a8840a9d7..4c6d8cfdc72 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2720,7 +2720,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if(e->spontaneous()) { // Capture the current mouse and keyboard states. Doing so here is - // required in order to support QTestLib synthesized events. Real mouse + // required in order to support Qt Test synthesized events. Real mouse // and keyboard state updates from the platform plugin are managed by // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); switch (e->type()) { diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 1323d2dcebd..31276d015df 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -109,7 +109,7 @@ QSizePolicy::operator QVariant() const be expressed using hasHeightForWidth(), heightForWidth(), and minimumHeightForWidth(). For more explanation see the \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq04-height-for-width.html}{Trading + \l{http://doc.qt.digia.com/qq/qq04-height-for-width.html}{Trading Height for Width}. \sa QLayout diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index a58f6e710b1..ccf783adb35 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4564,7 +4564,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; case SE_LineEditContents: rect = QCommonStyle::subElementRect(sr, opt, widget); - if(widget->parentWidget() && qobject_cast<const QComboBox*>(widget->parentWidget())) + if (widget && qobject_cast<const QComboBox*>(widget->parentWidget())) rect.adjust(-1, -2, 0, 0); else rect.adjust(-1, -1, 0, +1); diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index baa1ab2e9a5..1670d0ab57a 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -234,7 +234,7 @@ private: /*! \class QScroller \brief The QScroller class enables kinetic scrolling for any scrolling widget or graphics item. - \since 4.8 + \since 5.0 \inmodule QtWidgets diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index 8d8d731795e..209fb206e18 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -166,21 +166,29 @@ extern "C" LRESULT QT_WIN_CALLBACK qWindowsTrayconWndProc(HWND hwnd, UINT messag } // Invoke a service of the native Windows interface to create -// a non-visible message window. +// a non-visible toplevel window to receive tray messages. +// Note: Message windows (HWND_MESSAGE) are not sufficient, they +// will not receive the "TaskbarCreated" message. static inline HWND createTrayIconMessageWindow() { - if (QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface()) { - void *hwnd = 0; - void *wndProc = reinterpret_cast<void *>(qWindowsTrayconWndProc); - if (QMetaObject::invokeMethod(ni, "createMessageWindow", Qt::DirectConnection, - Q_RETURN_ARG(void *, hwnd), - Q_ARG(QString, QStringLiteral("QTrayIconMessageWindowClass")), - Q_ARG(QString, QStringLiteral("QTrayIconMessageWindow")), - Q_ARG(void *, wndProc)) && hwnd) { - return reinterpret_cast<HWND>(hwnd); - } + QPlatformNativeInterface *ni = QGuiApplication::platformNativeInterface(); + if (!ni) + return 0; + // Register window class in the platform plugin. + QString className; + void *wndProc = reinterpret_cast<void *>(qWindowsTrayconWndProc); + if (!QMetaObject::invokeMethod(ni, "registerWindowClass", Qt::DirectConnection, + Q_RETURN_ARG(QString, className), + Q_ARG(QString, QStringLiteral("QTrayIconMessageWindowClass")), + Q_ARG(void *, wndProc))) { + return 0; } - return 0; + const wchar_t windowName[] = L"QTrayIconMessageWindow"; + return CreateWindowEx(0, (wchar_t*)className.utf16(), + windowName, WS_OVERLAPPED, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, (HINSTANCE)GetModuleHandle(0), NULL); } QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object) diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 0f28854f5c4..1eadb62d5c6 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -85,7 +85,7 @@ developer to provide the autorelease pool. The following is a snippet of subclassing QMacCocoaViewContainer to wrap a NSSearchField. - \snippet widgets/mainwindows/macmainwindow/macmainwindow.mm 0 + \snippet macmainwindow.mm 0 */ diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 27ce9317bae..240bd6d92ef 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -72,10 +72,6 @@ \snippet qmacnativewidget/main.mm 0 - On Carbon, this would do the equivalent: - - \snippet qmacnativewidget/main.mm 1 - Note that QMacNativeWidget requires knowledge of Carbon or Cocoa. All it does is get the Qt hierarchy into a window not owned by Qt. It is then up to the programmer to ensure it is placed correctly in the window and diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp index 1ad8fe07cd3..3711b2f43e3 100644 --- a/src/widgets/widgets/qsplashscreen.cpp +++ b/src/widgets/widgets/qsplashscreen.cpp @@ -225,7 +225,7 @@ void QSplashScreen::clearMessage() repaint(); } -// A copy of QTestLib's qWaitForWindowExposed() and qSleep(). +// A copy of Qt Test's qWaitForWindowExposed() and qSleep(). inline static bool waitForWindowExposed(QWindow *window, int timeout = 1000) { enum { TimeOutMs = 10 }; diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index b8f7e7e1d4f..f033b6544c9 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -468,12 +468,16 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) the currentCharFormatChanged() signal is emitted to reflect the new attributes at the new cursor position. + The textChanged() signal is emitted whenever the text changes (as a result + of setText() or through the editor itself). + QTextEdit holds a QTextDocument object which can be retrieved using the document() method. You can also set your own document object using setDocument(). - QTextDocument emits a textChanged() signal if the text changes and it also - provides a isModified() function which will return true if the text has been - modified since it was either loaded or since the last call to setModified - with false as argument. In addition it provides methods for undo and redo. + + QTextDocument provides an \l {QTextDocument::isModified()}{isModified()} + function which will return true if the text has been modified since it was + either loaded or since the last call to setModified with false as argument. + In addition it provides methods for undo and redo. \section2 Drag and Drop diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 32eae0b9fe4..b8c920b8e68 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -25,3 +25,9 @@ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end load(qt_targets) wince*:QMAKE_POST_LINK = + +unix|win32-g++* { + lib_replace.match = $$[QT_INSTALL_LIBS/get] + lib_replace.replace = $$[QT_INSTALL_LIBS/raw] + QMAKE_PRL_INSTALL_REPLACE += lib_replace +} diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf index 028af1bf76f..4e8cf34b0cb 100644 --- a/src/xml/doc/qtxml.qdocconf +++ b/src/xml/doc/qtxml.qdocconf @@ -2,22 +2,22 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtXml description = Qt XML Reference Documentation -url = http://qt-project.org/doc/qtxml -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtxml +version = $QT_VERSION examplesinstallpath = xml qhp.projects = QtXml qhp.QtXml.file = qtxml.qhp -qhp.QtXml.namespace = org.qt-project.qtxml.510 +qhp.QtXml.namespace = org.qt-project.qtxml.$QT_VERSION_TAG qhp.QtXml.virtualFolder = qtxml qhp.QtXml.indexTitle = Qt XML qhp.QtXml.indexRoot = -qhp.QtXml.filterAttributes = qtxml 5.1.0 qtrefdoc -qhp.QtXml.customFilters.Qt.name = QtXml 5.1.0 -qhp.QtXml.customFilters.Qt.filterAttributes = qtxml 5.1.0 +qhp.QtXml.filterAttributes = qtxml $QT_VERSION qtrefdoc +qhp.QtXml.customFilters.Qt.name = QtXml $QT_VERSION +qhp.QtXml.customFilters.Qt.filterAttributes = qtxml $QT_VERSION qhp.QtXml.subprojects = classes qhp.QtXml.subprojects.classes.title = C++ Classes diff --git a/src/xml/doc/snippets/code/src_xml_dom_qdom.cpp b/src/xml/doc/snippets/code/src_xml_dom_qdom.cpp index 367bd22bbe7..6b7a9bfbceb 100644 --- a/src/xml/doc/snippets/code/src_xml_dom_qdom.cpp +++ b/src/xml/doc/snippets/code/src_xml_dom_qdom.cpp @@ -108,7 +108,7 @@ QDomElement element4 = document.createElement("MyElement"); //! [7] -<link href="http://qt.nokia.com" color="red" /> +<link href="http://qt-project.org" color="red" /> //! [7] @@ -116,10 +116,10 @@ QDomElement element4 = document.createElement("MyElement"); QDomElement e = //... //... QDomAttr a = e.attributeNode("href"); -cout << a.value() << endl; // prints "http://qt.nokia.com" -a.setValue("http://qt.nokia.com/doc"); // change the node's attribute +cout << a.value() << endl; // prints "http://qt-project.org" +a.setValue("http://qt-project.org/doc"); // change the node's attribute QDomAttr a2 = e.attributeNode("href"); -cout << a2.value() << endl; // prints "http://qt.nokia.com/doc" +cout << a2.value() << endl; // prints "http://qt-project.org/doc" //! [8] diff --git a/src/xml/doc/snippets/rsslisting/rsslisting.cpp b/src/xml/doc/snippets/rsslisting/listing.cpp index c62212713c7..c62212713c7 100644 --- a/src/xml/doc/snippets/rsslisting/rsslisting.cpp +++ b/src/xml/doc/snippets/rsslisting/listing.cpp diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 6b0fbd4baf4..c37172a1877 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -261,7 +261,7 @@ public: /** * If true, then the node will redirect insert/remove calls * to its parent by calling QDomNodePrivate::appendChild or removeChild. - * In addition the map wont increase or decrease the reference count + * In addition the map won't increase or decrease the reference count * of the nodes it contains. * * By default this value is false and the map will handle reference counting diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 18673dd5e61..689c75774e0 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -2365,7 +2365,7 @@ events are reported. it we can use the same handler for both of the following reader functions: - \snippet rsslisting/rsslisting.cpp 0 + \snippet rsslisting/listing.cpp 0 Since the reader will inform the handler of parsing errors, it is necessary to reimplement QXmlErrorHandler::fatalError() if, for |