From b67a98afc8cf3d83050e50ea3ece8531c782eb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Thu, 20 Dec 2012 18:09:42 +0100 Subject: Printer support needs user32.lib and gdi32.lib on Windows Task-number: QTBUG-28765 Change-Id: Ia43076e07adee38dfe20f8d25eb223bb6ea6ef51 Reviewed-by: Oswald Buddenhagen --- src/printsupport/kernel/kernel.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index 5f14c28616..8bdccd0f5b 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): { -- cgit v1.2.3 From d446a4f26d55ada699f7d3e45a937589c7d1275c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 24 Jan 2013 14:43:48 +0100 Subject: Doc: deleted short paragraph referring to non-existing snippet Reference to section 1, which does not exist. Task-number: QTBUG-29101 Change-Id: Ifd5ac58080033ea1d3f0a587f48f9510f24e75b1 Reviewed-by: Jerome Pasion --- src/widgets/widgets/qmacnativewidget_mac.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index 9bdd2da5c9..884a7ca007 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 -- cgit v1.2.3 From 829ada2129a01b02d7acedefddc5c99582c789f4 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 23 Jan 2013 14:16:43 +0100 Subject: Doc: added snippet file macmainwindow.mm Corrected path for snippet command Now refers to doc\snippets Removed trailing space Moved macmaindow.mm to src/widgets/doc/snippets Task-number: QTBUG-29101 Change-Id: If60c31909b2f5efad10ac8b735164a80522dcf62 Reviewed-by: Jerome Pasion --- src/widgets/doc/snippets/macmainwindow.mm | 347 ++++++++++++++++++++++ src/widgets/widgets/qmaccocoaviewcontainer_mac.mm | 2 +- 2 files changed, 348 insertions(+), 1 deletion(-) create mode 100755 src/widgets/doc/snippets/macmainwindow.mm diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm new file mode 100755 index 0000000000..af21ee726a --- /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 +#include + + +#ifdef Q_WS_MAC + +#include + +#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(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("





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.
"); + + 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/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 6c6953ee5e..ea14cf4c8e 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 */ -- cgit v1.2.3 From 1fbfbf6b6e50a6c2e3ce4eae72709ea53f56c4ab Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 23 Jan 2013 12:00:08 +0100 Subject: Doc: corrected path used for snippets. Added "../../../" to snippet command in gestures.qdoc Task-number: QTBUG-29101 Change-Id: Ie1d58355f43bcd939f6a178c64ab008b288af747 Reviewed-by: Jerome Pasion --- src/widgets/doc/src/gestures.qdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/doc/src/gestures.qdoc b/src/widgets/doc/src/gestures.qdoc index 466274eb48..4d26f965f5 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. -- cgit v1.2.3 From dca90252a785236df9f435b2b5e4cc297345ae7f Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 14 Jan 2013 14:10:40 +0000 Subject: Prevent GL/gl.h from including system glext.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows us to then use the up-to-date qopenglext.h header on Linux too. Some distro's are not yet shipping OpenGL 4.x compatible headers. This fixes compilation of Qt on CentOS 5.8 and RHEL Change-Id: Ia8022e0aaf215dac7ea2a23dc82c3ac117d9fd53 Reviewed-by: Samuel Rødal --- src/gui/opengl/qopengl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 5928b0be2f..ae02356f81 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -95,6 +95,7 @@ typedef GLfloat GLdouble; # if defined(Q_OS_WIN) # include # endif +# define GL_GLEXT_LEGACY // Prevents GL/gl.h form #including system glext.h # include # include # endif // Q_OS_MAC -- cgit v1.2.3 From ff9aa64c99bf04f7e45ee80c6c9fb4e0e69e9511 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 14 Jan 2013 15:33:24 +0000 Subject: Remove out-dated duplicate logic from qgl.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now use the updated logic for #including the correct GL headers already implemented in QtGui. This is needed to fix compilation of QtOpenGL on CentOS 5.8 and RHEL. Change-Id: Ifdedd13885566016073538f33aa6daf5902c3497 Reviewed-by: Andy Shaw Reviewed-by: Samuel Rødal --- src/opengl/qgl.h | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 1d21b42cd5..e2d8bbba16 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -44,6 +44,7 @@ #ifndef QT_NO_OPENGL +#include #include #include #include @@ -54,33 +55,6 @@ QT_BEGIN_HEADER -#if defined(Q_OS_WIN) -# include -#endif - -#if defined(Q_OS_MAC) -# if !defined(Q_OS_IOS) -# include -# else -# if defined(QT_OPENGL_ES_2) -# include -# endif -# endif -#elif defined(QT_OPENGL_ES_2) -# include -# else -# include -# 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 -- cgit v1.2.3 From f329dccb797bcbb45bb5fbf7e9234279454d6d1e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Jan 2013 14:54:57 +0100 Subject: use correct module names in pkg-config Requires: field Task-number: QTBUG-29309 Change-Id: Id22d4e2707ceb3421dc6eb5effe16a03c4769d26 Reviewed-by: Thiago Macieira --- mkspecs/features/qt_module.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 19cdc2a26a..6b58457a9a 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -206,7 +206,8 @@ unix { } unix|win32-g++* { - for(i, QT):QMAKE_PKGCONFIG_REQUIRES += $$eval(QT.$${i}.name) + for(i, QT): \ + QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION)) isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \ QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module } -- cgit v1.2.3 From 223ba7e66a5220e072f54861881ca85222ddd31b Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 25 Jan 2013 12:59:25 +0100 Subject: Doc: correct name of file with snippet Snippet not showing because qdoc read wrong snippet file. Due to 2 files having the same name. One was renamed: rsslisting.cpp --> listing.cpp Task-number: QTBUG-29101 Change-Id: I62b7eee6f2860613ee90538d8dea006b89000317 Reviewed-by: Venugopal Shivashankar Reviewed-by: Jerome Pasion --- src/xml/doc/snippets/rsslisting/listing.cpp | 251 +++++++++++++++++++++++++ src/xml/doc/snippets/rsslisting/rsslisting.cpp | 251 ------------------------- src/xml/sax/qxml.cpp | 2 +- 3 files changed, 252 insertions(+), 252 deletions(-) create mode 100644 src/xml/doc/snippets/rsslisting/listing.cpp delete mode 100644 src/xml/doc/snippets/rsslisting/rsslisting.cpp diff --git a/src/xml/doc/snippets/rsslisting/listing.cpp b/src/xml/doc/snippets/rsslisting/listing.cpp new file mode 100644 index 0000000000..15a46d4b41 --- /dev/null +++ b/src/xml/doc/snippets/rsslisting/listing.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + +/* +rsslisting.cpp + +Provides a widget for displaying news items from RDF news sources. +RDF is an XML-based format for storing items of information (see +http://www.w3.org/RDF/ for details). + +The widget itself provides a simple user interface for specifying +the URL of a news source, and controlling the downloading of news. + +The widget downloads and parses the XML asynchronously, feeding the +data to an XML reader in pieces. This allows the user to interrupt +its operation, and also allows very large data sources to be read. +*/ + + +#include +#include +#include +#include + +#include "rsslisting.h" + + +/* + Constructs an RSSListing widget with a simple user interface, and sets + up the XML reader to use a custom handler class. + + The user interface consists of a line edit, two push buttons, and a + list view widget. The line edit is used for entering the URLs of news + sources; the push buttons start and abort the process of reading the + news. +*/ + +RSSListing::RSSListing(QWidget *parent) + : QWidget(parent) +{ + lineEdit = new QLineEdit(this); + + fetchButton = new QPushButton(tr("Fetch"), this); + abortButton = new QPushButton(tr("Abort"), this); + abortButton->setEnabled(false); + + treeWidget = new QTreeWidget(this); + QStringList headerLabels; + headerLabels << tr("Title") << tr("Link"); + treeWidget->setHeaderLabels(headerLabels); + + handler = 0; + + connect(&http, SIGNAL(readyRead(QHttpResponseHeader)), + this, SLOT(readData(QHttpResponseHeader))); + + connect(&http, SIGNAL(requestFinished(int,bool)), + this, SLOT(finished(int,bool))); + + connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(fetch())); + connect(fetchButton, SIGNAL(clicked()), this, SLOT(fetch())); + connect(abortButton, SIGNAL(clicked()), &http, SLOT(abort())); + + QVBoxLayout *layout = new QVBoxLayout(this); + + QHBoxLayout *hboxLayout = new QHBoxLayout; + + hboxLayout->addWidget(lineEdit); + hboxLayout->addWidget(fetchButton); + hboxLayout->addWidget(abortButton); + + layout->addLayout(hboxLayout); + layout->addWidget(treeWidget); + + setWindowTitle(tr("RSS listing example")); +} + +/* + Starts fetching data from a news source specified in the line + edit widget. + + The line edit is made read only to prevent the user from modifying its + contents during the fetch; this is only for cosmetic purposes. + The fetch button is disabled, and the abort button is enabled to allow + the user to interrupt processing. The list view is cleared, and we + define the last list view item to be 0, meaning that there are no + existing items in the list. + + We reset the flag used to determine whether parsing should begin again + or continue. A new handler is created, if required, and made available + to the reader. + + The HTTP handler is supplied with the raw contents of the line edit and + a fetch is initiated. We keep the ID value returned by the HTTP handler + for future reference. +*/ + +void RSSListing::fetch() +{ + lineEdit->setReadOnly(true); + fetchButton->setEnabled(false); + abortButton->setEnabled(true); + treeWidget->clear(); + + lastItemCreated = 0; + + newInformation = true; + + if (handler != 0) + delete handler; + handler = new Handler; + +//! [0] + xmlReader.setContentHandler(handler); + xmlReader.setErrorHandler(handler); +//! [0] + + connect(handler, SIGNAL(newItem(QString&,QString&)), + this, SLOT(addItem(QString&,QString&))); + + QUrl url(lineEdit->text()); + + http.setHost(url.host()); + connectionId = http.get(url.path()); +} + +/* + Reads data received from the RDF source. + + We read all the available data, and pass it to the XML + input source. The first time we receive new information, + the reader is set up for a new incremental parse; + we continue parsing using a different function on + subsequent calls involving the same data source. + + If parsing fails for any reason, we abort the fetch. +*/ + +//! [1] +void RSSListing::readData(const QHttpResponseHeader &resp) +{ + bool ok; + + if (resp.statusCode() != 200) + http.abort(); + else { + xmlInput.setData(http.readAll()); + + if (newInformation) { + ok = xmlReader.parse(&xmlInput, true); + newInformation = false; + } + else + ok = xmlReader.parseContinue(); + + if (!ok) + http.abort(); + } +} +//! [1] + +/* + Finishes processing an HTTP request. + + The default behavior is to keep the text edit read only. + + If an error has occurred, the user interface is made available + to the user for further input, allowing a new fetch to be + started. + + If the HTTP get request has finished, we perform a final + parsing operation on the data returned to ensure that it was + well-formed. Whether this is successful or not, we make the + user interface available to the user for further input. +*/ + +void RSSListing::finished(int id, bool error) +{ + if (error) { + qWarning("Received error during HTTP fetch."); + lineEdit->setReadOnly(false); + abortButton->setEnabled(false); + fetchButton->setEnabled(true); + } + else if (id == connectionId) { + + bool ok = xmlReader.parseContinue(); + if (!ok) + qWarning("Parse error at the end of input."); + + lineEdit->setReadOnly(false); + abortButton->setEnabled(false); + fetchButton->setEnabled(true); + } +} + +/* + Adds an item to the list view as it is reported by the handler. + + We keep a record of the last item created to ensure that the + items are created in sequence. +*/ + +void RSSListing::addItem(QString &title, QString &link) +{ + QTreeWidgetItem *item; + + item = new QTreeWidgetItem(treeWidget, lastItemCreated); + item->setText(0, title); + item->setText(1, link); + + lastItemCreated = item; +} + diff --git a/src/xml/doc/snippets/rsslisting/rsslisting.cpp b/src/xml/doc/snippets/rsslisting/rsslisting.cpp deleted file mode 100644 index 15a46d4b41..0000000000 --- a/src/xml/doc/snippets/rsslisting/rsslisting.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation 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$ -** -****************************************************************************/ - -/* -rsslisting.cpp - -Provides a widget for displaying news items from RDF news sources. -RDF is an XML-based format for storing items of information (see -http://www.w3.org/RDF/ for details). - -The widget itself provides a simple user interface for specifying -the URL of a news source, and controlling the downloading of news. - -The widget downloads and parses the XML asynchronously, feeding the -data to an XML reader in pieces. This allows the user to interrupt -its operation, and also allows very large data sources to be read. -*/ - - -#include -#include -#include -#include - -#include "rsslisting.h" - - -/* - Constructs an RSSListing widget with a simple user interface, and sets - up the XML reader to use a custom handler class. - - The user interface consists of a line edit, two push buttons, and a - list view widget. The line edit is used for entering the URLs of news - sources; the push buttons start and abort the process of reading the - news. -*/ - -RSSListing::RSSListing(QWidget *parent) - : QWidget(parent) -{ - lineEdit = new QLineEdit(this); - - fetchButton = new QPushButton(tr("Fetch"), this); - abortButton = new QPushButton(tr("Abort"), this); - abortButton->setEnabled(false); - - treeWidget = new QTreeWidget(this); - QStringList headerLabels; - headerLabels << tr("Title") << tr("Link"); - treeWidget->setHeaderLabels(headerLabels); - - handler = 0; - - connect(&http, SIGNAL(readyRead(QHttpResponseHeader)), - this, SLOT(readData(QHttpResponseHeader))); - - connect(&http, SIGNAL(requestFinished(int,bool)), - this, SLOT(finished(int,bool))); - - connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(fetch())); - connect(fetchButton, SIGNAL(clicked()), this, SLOT(fetch())); - connect(abortButton, SIGNAL(clicked()), &http, SLOT(abort())); - - QVBoxLayout *layout = new QVBoxLayout(this); - - QHBoxLayout *hboxLayout = new QHBoxLayout; - - hboxLayout->addWidget(lineEdit); - hboxLayout->addWidget(fetchButton); - hboxLayout->addWidget(abortButton); - - layout->addLayout(hboxLayout); - layout->addWidget(treeWidget); - - setWindowTitle(tr("RSS listing example")); -} - -/* - Starts fetching data from a news source specified in the line - edit widget. - - The line edit is made read only to prevent the user from modifying its - contents during the fetch; this is only for cosmetic purposes. - The fetch button is disabled, and the abort button is enabled to allow - the user to interrupt processing. The list view is cleared, and we - define the last list view item to be 0, meaning that there are no - existing items in the list. - - We reset the flag used to determine whether parsing should begin again - or continue. A new handler is created, if required, and made available - to the reader. - - The HTTP handler is supplied with the raw contents of the line edit and - a fetch is initiated. We keep the ID value returned by the HTTP handler - for future reference. -*/ - -void RSSListing::fetch() -{ - lineEdit->setReadOnly(true); - fetchButton->setEnabled(false); - abortButton->setEnabled(true); - treeWidget->clear(); - - lastItemCreated = 0; - - newInformation = true; - - if (handler != 0) - delete handler; - handler = new Handler; - -//! [0] - xmlReader.setContentHandler(handler); - xmlReader.setErrorHandler(handler); -//! [0] - - connect(handler, SIGNAL(newItem(QString&,QString&)), - this, SLOT(addItem(QString&,QString&))); - - QUrl url(lineEdit->text()); - - http.setHost(url.host()); - connectionId = http.get(url.path()); -} - -/* - Reads data received from the RDF source. - - We read all the available data, and pass it to the XML - input source. The first time we receive new information, - the reader is set up for a new incremental parse; - we continue parsing using a different function on - subsequent calls involving the same data source. - - If parsing fails for any reason, we abort the fetch. -*/ - -//! [1] -void RSSListing::readData(const QHttpResponseHeader &resp) -{ - bool ok; - - if (resp.statusCode() != 200) - http.abort(); - else { - xmlInput.setData(http.readAll()); - - if (newInformation) { - ok = xmlReader.parse(&xmlInput, true); - newInformation = false; - } - else - ok = xmlReader.parseContinue(); - - if (!ok) - http.abort(); - } -} -//! [1] - -/* - Finishes processing an HTTP request. - - The default behavior is to keep the text edit read only. - - If an error has occurred, the user interface is made available - to the user for further input, allowing a new fetch to be - started. - - If the HTTP get request has finished, we perform a final - parsing operation on the data returned to ensure that it was - well-formed. Whether this is successful or not, we make the - user interface available to the user for further input. -*/ - -void RSSListing::finished(int id, bool error) -{ - if (error) { - qWarning("Received error during HTTP fetch."); - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } - else if (id == connectionId) { - - bool ok = xmlReader.parseContinue(); - if (!ok) - qWarning("Parse error at the end of input."); - - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } -} - -/* - Adds an item to the list view as it is reported by the handler. - - We keep a record of the last item created to ensure that the - items are created in sequence. -*/ - -void RSSListing::addItem(QString &title, QString &link) -{ - QTreeWidgetItem *item; - - item = new QTreeWidgetItem(treeWidget, lastItemCreated); - item->setText(0, title); - item->setText(1, link); - - lastItemCreated = item; -} - diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index ee40f9d753..3ed792418e 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 -- cgit v1.2.3 From f262815f2ef147113780312a410eccdf4b318a82 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 13:39:56 +0100 Subject: Fix some more old references and links to Nokia Task-number: QTBUG-28156 Change-Id: I9ba0d6f1e92103219bec1e61e716b6b2f269a8ad Reviewed-by: Laszlo Papp Reviewed-by: Jerome Pasion --- doc/src/snippets/code/src_network_access_qhttp.cpp | 6 +++--- examples/widgets/doc/src/codeeditor.qdoc | 2 +- examples/widgets/doc/src/syntaxhighlighter.qdoc | 2 +- examples/widgets/tutorials/addressbook-fr/README | 2 +- examples/widgets/tutorials/addressbook/README | 2 +- examples/widgets/widgets/stylesheet/mainwindow.cpp | 2 +- examples/xml/dombookmarks/frank.xbel | 8 ++++---- examples/xml/dombookmarks/jennifer.xbel | 8 ++++---- examples/xml/htmlinfo/simpleexample.html | 4 ++-- examples/xml/rsslisting/rsslisting.cpp | 2 +- examples/xml/saxbookmarks/frank.xbel | 8 ++++---- examples/xml/saxbookmarks/jennifer.xbel | 8 ++++---- examples/xml/streambookmarks/frank.xbel | 8 ++++---- examples/xml/streambookmarks/jennifer.xbel | 8 ++++---- src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp | 8 ++++---- src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp | 10 +++++----- src/corelib/doc/snippets/qxmlstreamwriter/main.cpp | 4 ++-- src/corelib/doc/src/eventsandfilters.qdoc | 2 +- src/corelib/global/qnamespace.qdoc | 2 +- src/corelib/io/qurl.cpp | 2 +- src/gui/image/qpixmapcache.cpp | 2 +- .../snippets/code/src_network_access_qnetworkaccessmanager.cpp | 4 ++-- .../doc/snippets/code/src_network_access_qnetworkdiskcache.cpp | 4 ++-- src/network/doc/snippets/code/src_network_kernel_qhostinfo.cpp | 6 +++--- src/widgets/dialogs/qwizard.cpp | 2 +- src/widgets/doc/src/modelview.qdoc | 2 +- src/widgets/doc/src/widgets-and-layouts/layout.qdoc | 2 +- src/widgets/kernel/qlayoutitem.cpp | 2 +- src/xml/doc/snippets/code/src_xml_dom_qdom.cpp | 8 ++++---- 29 files changed, 65 insertions(+), 65 deletions(-) diff --git a/doc/src/snippets/code/src_network_access_qhttp.cpp b/doc/src/snippets/code/src_network_access_qhttp.cpp index 8a0d0079a9..e4d8407d71 100644 --- a/doc/src/snippets/code/src_network_access_qhttp.cpp +++ b/doc/src/snippets/code/src_network_access_qhttp.cpp @@ -51,14 +51,14 @@ QString contentType = header.value("content-type"); //! [2] QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html")); -header.setValue("Host", "qt.nokia.com"); -http->setHost("qt.nokia.com"); +header.setValue("Host", "qt-project.org"); +http->setHost("qt-project.org"); http->request(header); //! [2] //! [3] -http->setHost("qt.nokia.com"); // id == 1 +http->setHost("qt-project.org"); // id == 1 http->get(QUrl::toPercentEncoding("/index.html")); // id == 2 //! [3] diff --git a/examples/widgets/doc/src/codeeditor.qdoc b/examples/widgets/doc/src/codeeditor.qdoc index 95b75cc82b..a4d1f46a58 100644 --- a/examples/widgets/doc/src/codeeditor.qdoc +++ b/examples/widgets/doc/src/codeeditor.qdoc @@ -192,6 +192,6 @@ fetched with QTextBlock::userData(). Matching parentheses can be highlighted with an extra selection. The "Matching Parentheses with QSyntaxHighlighter" article in Qt Quarterly 31 implements - this. You find it here: \l{http://doc.qt.nokia.com/qq/}. + this. You find it here: \l{http://doc.qt.digia.com/qq/}. */ diff --git a/examples/widgets/doc/src/syntaxhighlighter.qdoc b/examples/widgets/doc/src/syntaxhighlighter.qdoc index b417499f6f..ff2b20cad9 100644 --- a/examples/widgets/doc/src/syntaxhighlighter.qdoc +++ b/examples/widgets/doc/src/syntaxhighlighter.qdoc @@ -248,7 +248,7 @@ It is possible to implement parenthesis matching with QSyntaxHighlighter. The "Matching Parentheses with QSyntaxHighlighter" article in Qt Quarterly 31 - (\l{http://doc.qt.nokia.com/qq/}) implements this. We also have + (\l{http://doc.qt.digia.com/qq/}) implements this. We also have the \l{Code Editor Example}, which shows how to implement line numbers and how to highlight the current line. diff --git a/examples/widgets/tutorials/addressbook-fr/README b/examples/widgets/tutorials/addressbook-fr/README index d24cedf51e..07897b9683 100644 --- a/examples/widgets/tutorials/addressbook-fr/README +++ b/examples/widgets/tutorials/addressbook-fr/README @@ -4,7 +4,7 @@ Qt documentation, which can be viewed using Qt Assistant or a Web browser. The tutorial is also available online at -http://qt.nokia.com/doc/4.4/tutorial.html +http://qt-project.org/doc/qt-5.0/qtwidgets/tutorials-addressbook.html All programs corresponding to the chapters in the tutorial should automatically be built when Qt is compiled, or will be provided as diff --git a/examples/widgets/tutorials/addressbook/README b/examples/widgets/tutorials/addressbook/README index 39753b4b25..07897b9683 100644 --- a/examples/widgets/tutorials/addressbook/README +++ b/examples/widgets/tutorials/addressbook/README @@ -4,7 +4,7 @@ Qt documentation, which can be viewed using Qt Assistant or a Web browser. The tutorial is also available online at -http://qt.nokia.com/doc/tutorial.html +http://qt-project.org/doc/qt-5.0/qtwidgets/tutorials-addressbook.html All programs corresponding to the chapters in the tutorial should automatically be built when Qt is compiled, or will be provided as diff --git a/examples/widgets/widgets/stylesheet/mainwindow.cpp b/examples/widgets/widgets/stylesheet/mainwindow.cpp index df14090f5b..b1444ad069 100644 --- a/examples/widgets/widgets/stylesheet/mainwindow.cpp +++ b/examples/widgets/widgets/stylesheet/mainwindow.cpp @@ -67,7 +67,7 @@ void MainWindow::on_aboutAction_triggered() { QMessageBox::about(this, tr("About Style sheet"), tr("The Style Sheet example shows how widgets can be styled " - "using Qt " + "using Qt " "Style Sheets. Click File|Edit Style Sheet to pop up the " "style editor, and either choose an existing style sheet or design " "your own.")); diff --git a/examples/xml/dombookmarks/frank.xbel b/examples/xml/dombookmarks/frank.xbel index 6bd63b8b07..2fd5c2e09d 100644 --- a/examples/xml/dombookmarks/frank.xbel +++ b/examples/xml/dombookmarks/frank.xbel @@ -71,16 +71,16 @@ Qt - + Qt 2.3 Reference - + Qt 3.3 Reference - + Qt 4.0 Reference - + Qt Home Page diff --git a/examples/xml/dombookmarks/jennifer.xbel b/examples/xml/dombookmarks/jennifer.xbel index 36256fda0a..74b7f1519f 100644 --- a/examples/xml/dombookmarks/jennifer.xbel +++ b/examples/xml/dombookmarks/jennifer.xbel @@ -45,16 +45,16 @@ QtQuestions - + Qt Quarterly - + Qt home page - + Qt 4.0 documentation - + Frequently Asked Questions diff --git a/examples/xml/htmlinfo/simpleexample.html b/examples/xml/htmlinfo/simpleexample.html index 83a55cf00a..d46a494979 100644 --- a/examples/xml/htmlinfo/simpleexample.html +++ b/examples/xml/htmlinfo/simpleexample.html @@ -5,7 +5,7 @@

A paragraph.

-

A second paragraph. Check out our developer blogs

-

And the last paragraph. Or our online documentation.

+

A second paragraph. Check out our developer blogs

+

And the last paragraph. Or our online documentation.

diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp index d535f679fb..87147e5696 100644 --- a/examples/xml/rsslisting/rsslisting.cpp +++ b/examples/xml/rsslisting/rsslisting.cpp @@ -76,7 +76,7 @@ RSSListing::RSSListing(QWidget *parent) { lineEdit = new QLineEdit(this); - lineEdit->setText("http://labs.qt.nokia.com/blogs/feed"); + lineEdit->setText("http://blog.qt.digia.com/feed/"); fetchButton = new QPushButton(tr("Fetch"), this); diff --git a/examples/xml/saxbookmarks/frank.xbel b/examples/xml/saxbookmarks/frank.xbel index 6bd63b8b07..2fd5c2e09d 100644 --- a/examples/xml/saxbookmarks/frank.xbel +++ b/examples/xml/saxbookmarks/frank.xbel @@ -71,16 +71,16 @@ Qt - + Qt 2.3 Reference - + Qt 3.3 Reference - + Qt 4.0 Reference - + Qt Home Page diff --git a/examples/xml/saxbookmarks/jennifer.xbel b/examples/xml/saxbookmarks/jennifer.xbel index d6a5b41d05..d37b8224df 100644 --- a/examples/xml/saxbookmarks/jennifer.xbel +++ b/examples/xml/saxbookmarks/jennifer.xbel @@ -45,16 +45,16 @@ QtQuestions
- + Qt Quarterly - + qt home page - + Qt 4.0 documentation - + Frequently Asked Questions diff --git a/examples/xml/streambookmarks/frank.xbel b/examples/xml/streambookmarks/frank.xbel index 6bd63b8b07..2fd5c2e09d 100644 --- a/examples/xml/streambookmarks/frank.xbel +++ b/examples/xml/streambookmarks/frank.xbel @@ -71,16 +71,16 @@ Qt - + Qt 2.3 Reference - + Qt 3.3 Reference - + Qt 4.0 Reference - + Qt Home Page diff --git a/examples/xml/streambookmarks/jennifer.xbel b/examples/xml/streambookmarks/jennifer.xbel index 36256fda0a..74b7f1519f 100644 --- a/examples/xml/streambookmarks/jennifer.xbel +++ b/examples/xml/streambookmarks/jennifer.xbel @@ -45,16 +45,16 @@ QtQuestions - + Qt Quarterly - + Qt home page - + Qt 4.0 documentation - + Frequently Asked Questions 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 432b0b9167..ca178e03a0 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_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index eef026af75..759c31c098 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/qxmlstreamwriter/main.cpp b/src/corelib/doc/snippets/qxmlstreamwriter/main.cpp index 2a436f1a4c..5af3596171 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/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc index 6986309c42..22a6d240dc 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/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 0b0d089ba5..448451fc12 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2492,7 +2492,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/qurl.cpp b/src/corelib/io/qurl.cpp index 2a439b3a7c..38eb0ed1e3 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3861,7 +3861,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/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index c9560fd816..f996d032b8 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE 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. 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 7424f4d4b5..6569b90b14 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 bd7a744ac1..51524b2b52 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 f329da66ef..f45b232a91 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/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 241e9f678a..4f5898ed88 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -3573,7 +3573,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/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc index 304af0058d..96f978f9d4 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 7b88a3a63d..911974fbce 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/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 7de3f47c5b..cea11243ee 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/xml/doc/snippets/code/src_xml_dom_qdom.cpp b/src/xml/doc/snippets/code/src_xml_dom_qdom.cpp index 480de0daee..76eb24e8bf 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] - + //! [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] -- cgit v1.2.3 From 747348f4556440aa21c0c8aeb76cbd71da49d007 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 24 Jan 2013 14:59:55 +0100 Subject: Doc: Fixing snippets and input file for a Qt Core article. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -copied snippet and input files from Qt Widgets. -adapted new paths in the resource-system.qdoc file. -removed the old path entry in qdocconf. Task-number: QTBUG-29101 Change-Id: Ieeb118106756a1a39890ab219294de18f437c56c Reviewed-by: Topi Reiniö Reviewed-by: Nico Vertriest Reviewed-by: Geir Vattekar --- src/corelib/doc/qtcore.qdocconf | 3 +- .../doc/snippets/resource-system/application.pro | 14 + .../doc/snippets/resource-system/application.qrc | 10 + .../doc/snippets/resource-system/mainwindow.cpp | 392 +++++++++++++++++++++ src/corelib/doc/src/resource-system.qdoc | 6 +- 5 files changed, 420 insertions(+), 5 deletions(-) create mode 100644 src/corelib/doc/snippets/resource-system/application.pro create mode 100644 src/corelib/doc/snippets/resource-system/application.qrc create mode 100644 src/corelib/doc/snippets/resource-system/mainwindow.cpp diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index cb87530f54..dc239ccf6f 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -36,7 +36,6 @@ exampledirs += \ ../ \ snippets \ ../../../examples/threads/ \ - ../../../examples/tools/ \ - ../../../examples/widgets/ + ../../../examples/tools/ imagedirs += images 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 0000000000..652cc73485 --- /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 0000000000..0a776fab4d --- /dev/null +++ b/src/corelib/doc/snippets/resource-system/application.qrc @@ -0,0 +1,10 @@ + + + images/copy.png + images/cut.png + images/new.png + images/open.png + images/paste.png + images/save.png + + 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 0000000000..8bdd0303de --- /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 + +#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 Application 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/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 18a6759d53..1dec196d21 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 -- cgit v1.2.3 From 03e8824211ebc75ec48d1eaf3c4962ff926575f9 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 11:53:27 +0100 Subject: testlib: Remove old 'Partner Directory' external link This reference was removed by dc0d5bf387a0b440c74b9e822c46b09e20e00720 Change-Id: I941dbd24815caf7f2f33e757215815d9ca4e581c Reviewed-by: Venugopal Shivashankar Reviewed-by: Jerome Pasion --- src/testlib/doc/src/qt-webpages.qdoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc index 452af99368..e945ea7f17 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 -*/ -- cgit v1.2.3 From 2dc99546a1affb06914183519246a21a195e2531 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 00:12:58 +0100 Subject: Fix warnings about files that can't be found in QtConcurrent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I712e3de68bd329fc5e615b08278e719619f856b2 Reviewed-by: Venugopal Shivashankar Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- .../qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc | 2 +- examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc | 2 +- .../progressdialog/doc/src/qtconcurrent-progressdialog.qdoc | 2 +- examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc | 2 +- examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc index c270bda102..a4f395596e 100644 --- a/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc +++ b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example qtconcurrent/imagescaling + \example imagescaling \title Image Scaling Example \brief Demonstrates how to asynchronously scale images. \ingroup qtconcurrentexamples diff --git a/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc b/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc index 7522baf2c4..d97e7f192a 100644 --- a/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc +++ b/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example qtconcurrent/map + \example map \title Map Example \brief Demonstrates how to scale images synchronously. \ingroup qtconcurrentexamples diff --git a/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc b/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc index aa5cd517a5..e0b827dbee 100644 --- a/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc +++ b/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example qtconcurrent/progressdialog + \example progressdialog \title QtConcurrent Progress Dialog Example \brief Demonstrates how to monitor the progress of the active processes. \ingroup qtconcurrentexamples diff --git a/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc b/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc index 1c4e367240..502e770487 100644 --- a/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc +++ b/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example qtconcurrent/runfunction + \example runfunction \title Run Function Example \brief Demonstrates how to run standard functions concurrently. \ingroup qtconcurrentexamples diff --git a/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc b/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc index b8d04fa553..b159fd9791 100644 --- a/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc +++ b/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example qtconcurrent/wordcount + \example wordcount \title QtConcurrent Word Count Example \brief Demonstrates how to use the map-reduce algorithm \ingroup qtconcurrentexamples -- cgit v1.2.3 From ca7056ce5b467951060cb1dd13d7d274f10b70c5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Jan 2013 14:58:36 +0100 Subject: include all module dependencies into pkg-config Requires: field previously, we'd miss the -private ones (which imply the non-private version). Change-Id: Ib5ae2afaa5b5efda9639b7cc4a080432f2fcce2a Reviewed-by: Thiago Macieira Reviewed-by: Dihan Wickremasuriya Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_module.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 6b58457a9a..771ddb19da 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -206,7 +206,7 @@ unix { } unix|win32-g++* { - for(i, QT): \ + for(i, MODULE_DEPENDS): \ QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION)) isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \ QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module -- cgit v1.2.3 From 50a416889e4b8f033567a634be15b877ecfae981 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Jan 2013 15:08:17 +0100 Subject: explicitly set QMAKE_PKGCONFIG_NAME otherwise qmake will just take TARGET and lowercase and capitalize it, which not only looks weird, but also does not match the Requires: fields we generate. Change-Id: I4a070ff256fffd2b780acb0361d4213d0032dbb9 Reviewed-by: Thiago Macieira Reviewed-by: Dihan Wickremasuriya Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_module.prf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 771ddb19da..50e946937c 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -206,6 +206,7 @@ unix { } unix|win32-g++* { + QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, Qt$$section(VERSION, ., 0, 0)) for(i, MODULE_DEPENDS): \ QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION)) isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \ -- cgit v1.2.3 From f4065db172f11b751af03c04a21bd0b4097d1779 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 25 Jan 2013 16:52:34 +0100 Subject: fix overquoting of GNUPATH Task-number: QTBUG-28841 Change-Id: Ifa62a273acefc240953633bbd099384a635f29c6 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- src/angle/src/config.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 6ba2cbdf7a..4e52358205 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:)=^)%)" } } -- cgit v1.2.3 From f0c8e63e5bbd5d5265478a8740cc7f0d587bfdb9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Jan 2013 16:50:59 +0100 Subject: Fix documented signature for QtMessageHandler Task-number: QTBUG-29352 Change-Id: I46190a59cd73e53e778551a2d33c6b2801e9587e Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a3a458fbc7..62ce04a6f8 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] -- cgit v1.2.3 From 7c38be7e0c085d1d6590324f697af29734e0793d Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 10 Jan 2013 16:32:23 +0100 Subject: Update changes file for 5.0.1 release Change-Id: If32a0e76606dc887a133fe55dc1154ca512b0218 Reviewed-by: Oswald Buddenhagen Reviewed-by: Sergio Ahumada --- dist/changes-5.0.1 | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 4 deletions(-) diff --git a/dist/changes-5.0.1 b/dist/changes-5.0.1 index bf5df25b53..022b149397 100644 --- a/dist/changes-5.0.1 +++ b/dist/changes-5.0.1 @@ -40,37 +40,66 @@ Legal * Library * **************************************************************************** - QtCore ----- + - Fix QMutex::tryLock with negative values + - Fix a leak in case the QMetaObject::Connection survives the sender object, + after a successful disconnect(). + - Speed up and fix QByteArray::setNum() + - [QTBUG-28924] Don't increase the reference count if dynamic_cast failed + QtGui ----- + - Fix QGuiApplication::keyboardModifiers() and QGuiApplication::mouseButtons() + - Fix styleName support in QPA font database + - Make QImage::mirrored() propagate devicePixelRatio + - [QTBUG-28324] Fixed invalid memory read in SSSE3 image blending code. + QtWidgets --------- + - Do not inform that a widget is not visible when it's disabled. + - [QTBUG-28031, QTBUG-2596] QMenu: Do not set snapToMouse if a caused-widget exists. + - [QTBUG-28321] Fix focusproxy-relayed crash in QGraphicsItem destructor. + - [QTBUG-28446] Fix compilation when Q_NO_USING_KEYWORD is defined + - [QTBUG-28477] Fix QWidget::setWindowOpacity() when called before show(). + - [QTBUG-28506] Style animations: fix QCommonStylePrivate::stopAnimation() + - [QTBUG-28557] Fix QGtkPainter::reset() to reset the clip rect + QtNetwork --------- + - [QTBUG-28937] SSL certificates: blacklist mis-issued Turktrust certificates + QtDBus ------ + - qdbusxml2cpp: Check string length before checking for \r\n. + QtConcurrent ------------ QtOpenGL -------- -QtScript --------- + - Fix compilation of Open GL ES 2 examples when using a Qt-namespace. + - Fixed deadlock situation in QtOpenGL's texture management. + - updating qeglfshooks_imx6.cpp to 12.09.01 (L3.0.35) opengl-drivers + - [QTBUG-27512] Entered hardcoded urls for and + - [QTBUG-28875] Fix bug in multisampling handling when converting from surface format QTestLib -------- + - Add qtest_widget.h to the list of testlib headers + QtSql ----- + - Fix QSqlQuery test in relation to PSQL support + **************************************************************************** * Database Drivers * **************************************************************************** @@ -81,6 +110,8 @@ sqlite postgres -------- + - Use PG_VERSION if PG_MAJORVERSION is not defined + **************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -88,19 +119,44 @@ postgres Qt for Linux/X11 ---------------- + - XCB: add support for getting and setting appTime and appUserTime. + - [QTBUG-28561] Fixed incorrect handling of extra mouse buttons in XCB platform plugin. + Qt for Windows -------------- + - DBUS: Fix linker errors on Windows. + - Define Q_COMPILER_AUTO_FUNCTION for MVSC + - [QTBUG-28611] Fix warnings about not being able to set Window geometry on Windows. + - [QTBUG-28611] QMdiArea: Increase minimum size for Windows 8/Large fonts. + - [QTBUG-28645] Rename conflicting symbol QVariantToVARIANT + - [QTBUG-28876] QWindowsVistaStyle: fix frame rendering + Qt for Mac OS X --------------- + - Ignore ScrollBarAlwaysOn policy for transient scrollbars + - New rendering for disclose triangle, get proper color when selected + - [QTBUG-27415] Fix bugs for font selection in QFontDialog + - [QTBUG-28161] Ensure the native filedialog starts up with the right directory + - [QTBUG-28443] Cocoa: Re-enable per class palette on QPA plugin + - [QTBUG-28669] Fix transient QScrollBar flashing + - [QTBUG-28738] Bring back proper layout in QMessageBox + +Qt for BlackBerry +----------------- + + - Reset virtual keyboard when shown. + - Disable Q_COMPILER_RVALUE_REFS on QNX + - Fix QNX QPA plugin clipboard impl + - Don't crash because the window hasn't been initialized yet. + Qt for Embedded Linux --------------------- Qt for Windows CE ----------------- - **************************************************************************** * Compiler Specific Changes * **************************************************************************** @@ -111,11 +167,41 @@ Qt for Windows CE * Tools * **************************************************************************** +configure +--------- + + - Remove the -fast configure option as it was pretty much broken + - [QTBUG-23569, QTBUG-25760] Check for gtk_adjustment_configure as this is not always implemented + +mkspecs +------- + + - Fix the computation of the location of mkspecs. + - [QTBUG-28215] Enable forcing generation of static plugin imports + - [QTBUG-28606] Fix installation of plugin module .pris in static Qt builds + +moc +--- + + - [QTBUG-26589] Remove the timestamp info in genarated files to optimize rebuilds with ccache + +qmake +----- + + - Do not fixify + create QMAKE_{PKGCONFIG,LIBTOOL}_DESTDIR + - Fix qtCompileTest for cross building modules + - [QTBUG-28104] Respect the OBJECTS_DIR setting for XCode projects + - [QTBUG-24589] Fix handling of precompiled header files in XCode projects + - [QTBUG-28624] accept hex/octal values for RC_LANG and RC_CODEPAGE + - [QTBUG-28625] fix duplicate TRANSLATION entry in generated RC file + - [QTBUG-28682, QTBUG-28683] fix DLL manifest resource ids for debug builds **************************************************************************** * Plugins * **************************************************************************** + - Accessibility Linux: Prevent access to invalid interfaces + - Call QAccessible::updateAccessibility when caret moves in QTextEdit **************************************************************************** * Important Behavior Changes * -- cgit v1.2.3 From 839009c74f88e397f5bc6fad4dc5ce497072ef4b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Jan 2013 20:32:30 +0100 Subject: fix duplicated installation of qml example files we need to collect the sources of the install targets for the check that all files have been properly handled, but of course we must not add these files to the source install target, as that would mean double installation. Change-Id: I6acb56f2a993b6ed81d1031d5dc0a0da30a53b54 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_example_installs.prf | 42 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 5417469909..5a87eeba64 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -9,6 +9,22 @@ # We mean it. # +defineTest(addInstallFiles) { + for(sf, 2) { + sf = $$relative_path($$sf, $$_PRO_FILE_PWD_) + contains(sf, \\..*) { + check_examples: message("Notice: $$_PRO_FILE_ refers to $$sf") + } else { + sfp = $$replace(sf, /.*, ) + !equals(sfp, $$sf): \ + $$1 *= $$sfp + else: \ + $$1 += $$sf + } + } + export($$1) +} + probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples) !isEmpty(probase):!contains(probase, ^\\..*) { for(ex, EXAMPLE_FILES): \ @@ -42,34 +58,26 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples) # Just for Qt Creator OTHER_FILES += $$sourcefiles - for(inst, INSTALLS): \ - !equals(inst, target):!contains($${inst}.CONFIG, no_check_exist): \ - for(file, $${inst}.files): \ - sourcefiles += $$files($$absolute_path($$file, $$_PRO_FILE_PWD_)) sourcefiles += \ $$_PRO_FILE_ $$RC_FILE $$DEF_FILE \ $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \ $$DBUS_ADAPTORS $$DBUS_INTERFACES - for(sf, sourcefiles) { - sf = $$relative_path($$sf, $$_PRO_FILE_PWD_) - contains(sf, \\..*) { - check_examples: message("Notice: $$_PRO_FILE_ refers to $$sf") - } else { - sfp = $$replace(sf, /.*, ) - !equals(sfp, $$sf): \ - sources.files *= $$sfp - else: \ - sources.files += $$sf - } - } + addInstallFiles(sources.files, $$sourcefiles) sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase INSTALLS += sources check_examples { + srcfiles = $$sources.files + for(inst, INSTALLS): \ + !equals(inst, target):!contains($${inst}.CONFIG, no_check_exist): \ + for(file, $${inst}.files): \ + instfiles += $$files($$absolute_path($$file, $$_PRO_FILE_PWD_)) + addInstallFiles(srcfiles, $$instfiles) + thefiles = $$files($$_PRO_FILE_PWD_/*) for(i, thefiles): \ allfiles += $$relative_path($$i, $$_PRO_FILE_PWD_) - for(i, sources.files): \ + for(i, srcfiles): \ allfiles -= $$relative_path($$i, $$_PRO_FILE_PWD_) for(i, SUBDIRS) { sd = $$eval($${i}.file) -- cgit v1.2.3 From b644ed510af512c5688f139317249eea869e2853 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 24 Jan 2013 22:12:17 +0100 Subject: don't build shared demo library which is not used anyway this amends 5a2fc03ef4 Change-Id: I42b2141ad33b75041ee2bb58af642fc3d07f290e Reviewed-by: hjk Reviewed-by: Joerg Bornemann --- examples/widgets/painting/painting.pro | 27 +++++++-------------------- examples/widgets/painting/shared/shared.pro | 26 -------------------------- 2 files changed, 7 insertions(+), 46 deletions(-) delete mode 100644 examples/widgets/painting/shared/shared.pro diff --git a/examples/widgets/painting/painting.pro b/examples/widgets/painting/painting.pro index 7459dd3e94..a9749a560d 100644 --- a/examples/widgets/painting/painting.pro +++ b/examples/widgets/painting/painting.pro @@ -1,28 +1,15 @@ TEMPLATE = subdirs SUBDIRS = basicdrawing \ concentriccircles \ - examples_affine \ - examples_composition \ - examples_deform \ - examples_gradients \ - examples_pathstroke \ - painting_shared \ + affine \ + composition \ + deform \ + gradients \ + pathstroke \ imagecomposition \ painterpaths \ transformations \ fontsampler -examples_affine.subdir = affine -examples_composition.subdir = composition -examples_deform.subdir = deform -examples_gradients.subdir = gradients -examples_pathstroke.subdir = pathstroke -painting_shared.subdir = shared - -!ordered { - examples_affine.depends = painting_shared - examples_deform.depends = painting_shared - examples_gradients.depends = painting_shared - examples_composition.depends = painting_shared - examples_pathstroke.depends = painting_shared -} +EXAMPLE_FILES = \ + shared diff --git a/examples/widgets/painting/shared/shared.pro b/examples/widgets/painting/shared/shared.pro deleted file mode 100644 index 2756bf75ca..0000000000 --- a/examples/widgets/painting/shared/shared.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = lib -CONFIG += static - -qtHaveModule(opengl) { - DEFINES += QT_OPENGL_SUPPORT - QT += opengl -} -QT += widgets - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} -TARGET = demo_shared - -SOURCES += \ - arthurstyle.cpp\ - arthurwidgets.cpp \ - hoverpoints.cpp - -HEADERS += \ - arthurstyle.h \ - arthurwidgets.h \ - hoverpoints.h - -RESOURCES += shared.qrc -- cgit v1.2.3 From 6c9e2219aca80e4fd426c9364eb93a880e9052ca Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 21 Dec 2012 14:14:40 +0100 Subject: push feature conditionals down to subdirectories the top-level project is not installed, and the meta-project which is used instead does not know anything about conditionals. Task-number: QTBUG-28414 Change-Id: Id5785ab5f92373ece74699e3c28220fc7f9689ac Reviewed-by: Joerg Bornemann --- examples/dbus/dbus.pro | 2 ++ examples/embedded/embedded.pro | 2 ++ examples/examples.pro | 39 +++++++++++++++------------------- examples/gestures/gestures.pro | 2 ++ examples/ipc/ipc.pro | 2 ++ examples/opengl/opengl.pro | 2 ++ examples/qtconcurrent/qtconcurrent.pro | 2 ++ examples/qtestlib/qtestlib.pro | 2 ++ examples/sql/sql.pro | 3 ++- examples/tools/tools.pro | 2 ++ examples/touch/touch.pro | 2 ++ examples/widgets/widgets.pro | 2 ++ 12 files changed, 39 insertions(+), 23 deletions(-) diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro index fd43c23fa3..083e442dfb 100644 --- a/examples/dbus/dbus.pro +++ b/examples/dbus/dbus.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(dbus)) + TEMPLATE = subdirs SUBDIRS = listnames \ pingpong \ diff --git a/examples/embedded/embedded.pro b/examples/embedded/embedded.pro index d7d69d3efe..90ee504adf 100644 --- a/examples/embedded/embedded.pro +++ b/examples/embedded/embedded.pro @@ -1,3 +1,5 @@ +requires(if(wince|embedded|x11):qtHaveModule(gui)) + TEMPLATE = subdirs SUBDIRS = styleexample raycasting flickable digiflip diff --git a/examples/examples.pro b/examples/examples.pro index e66226703e..7ba0de9438 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,28 +1,23 @@ TEMPLATE = subdirs CONFIG += no_docs_target -SUBDIRS = \ - gui \ - network \ - threads \ - xml \ - qpa - -qtHaveModule(widgets) { - SUBDIRS += widgets \ - ipc \ - sql \ - tools \ - touch \ - gestures -} - -wince*|embedded|x11:qtHaveModule(gui): SUBDIRS += embedded - -contains(QT_BUILD_PARTS, tools):qtHaveModule(gui):qtHaveModule(widgets): SUBDIRS += qtestlib -qtHaveModule(opengl):qtHaveModule(widgets): SUBDIRS += opengl -qtHaveModule(dbus): SUBDIRS += dbus -qtHaveModule(concurrent): SUBDIRS += qtconcurrent +SUBDIRS = \ + dbus \ + embedded \ + gestures \ + gui \ + ipc \ + network \ + opengl \ + qpa \ + qtconcurrent \ + qtestlib \ + sql \ + threads \ + tools \ + touch \ + widgets \ + xml aggregate.files = aggregate/examples.pro aggregate.path = $$[QT_INSTALL_EXAMPLES] diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index 35b60bef38..ecbcf07480 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = \ subdirs SUBDIRS = \ diff --git a/examples/ipc/ipc.pro b/examples/ipc/ipc.pro index ffa313beef..f302b836af 100644 --- a/examples/ipc/ipc.pro +++ b/examples/ipc/ipc.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = subdirs # no QSharedMemory !vxworks:!qnx:SUBDIRS = sharedmemory diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 25c337fdad..54b0321b26 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(opengl)) + TEMPLATE = subdirs contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ diff --git a/examples/qtconcurrent/qtconcurrent.pro b/examples/qtconcurrent/qtconcurrent.pro index dafbabb5c3..1df6f2d8cf 100644 --- a/examples/qtconcurrent/qtconcurrent.pro +++ b/examples/qtconcurrent/qtconcurrent.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(concurrent)) + TEMPLATE = subdirs SUBDIRS = imagescaling \ map \ diff --git a/examples/qtestlib/qtestlib.pro b/examples/qtestlib/qtestlib.pro index 383e5aa9e3..4a7663a088 100644 --- a/examples/qtestlib/qtestlib.pro +++ b/examples/qtestlib/qtestlib.pro @@ -1,2 +1,4 @@ +requires(contains(QT_BUILD_PARTS,tools):qtHaveModule(widgets)) + TEMPLATE = subdirs SUBDIRS = tutorial1 tutorial2 tutorial3 tutorial4 tutorial5 diff --git a/examples/sql/sql.pro b/examples/sql/sql.pro index 95bf6404db..eeed18379e 100644 --- a/examples/sql/sql.pro +++ b/examples/sql/sql.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = subdirs SUBDIRS = books \ @@ -19,4 +21,3 @@ SUBDIRS = books \ } EXAMPLE_FILES = connection.h - diff --git a/examples/tools/tools.pro b/examples/tools/tools.pro index 10b487d6ae..36fa776980 100644 --- a/examples/tools/tools.pro +++ b/examples/tools/tools.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = subdirs CONFIG += ordered SUBDIRS = contiguouscache \ diff --git a/examples/touch/touch.pro b/examples/touch/touch.pro index d5983eb581..018ec134eb 100644 --- a/examples/touch/touch.pro +++ b/examples/touch/touch.pro @@ -1,2 +1,4 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = subdirs SUBDIRS = pinchzoom fingerpaint knobs dials diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro index 87054cff0d..768b602e61 100644 --- a/examples/widgets/widgets.pro +++ b/examples/widgets/widgets.pro @@ -1,3 +1,5 @@ +requires(qtHaveModule(widgets)) + TEMPLATE = subdirs CONFIG += no_docs_target -- cgit v1.2.3 From 2b397f985e4ef6ae5c0571a928bb1320fb048c61 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 21 Dec 2012 19:36:12 +0100 Subject: do not actually build examples in production builds -developer-build enables an actual build of examples, based on the assumption that developers want to test it (it can be still disabled with -nomake examples). regular users otoh want only the examples sources installed. Change-Id: Ifc6a108099929175a3960480802b271a758fdd38 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_example_installs.prf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index 5a87eeba64..ccb19fcbd4 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -92,4 +92,12 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples) allfiles -= doc !isEmpty(allfiles): warning("remaining files in $$_PRO_FILE_PWD_: $$allfiles") } + + # Do not actually build the examples in production builds + !equals(TEMPLATE, subdirs):!contains(QT_CONFIG, private_tests) { + TEMPLATE = aux + CONFIG -= have_target qt staticlib dll + SOURCES = + INSTALLS -= target + } } -- cgit v1.2.3 From 8f61befb532b1f9daf5a9aa7ab2bca5cdcdd9edb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Jan 2013 11:59:57 +0100 Subject: fix install locations of examples/widgets/tools amends cb961007c5 Change-Id: I725042c55816832eeb5b0d8a3522911877279aae Reviewed-by: Joerg Bornemann --- examples/widgets/tools/codecs/codecs.pro | 2 +- examples/widgets/tools/completer/completer.pro | 2 +- examples/widgets/tools/customcompleter/customcompleter.pro | 2 +- examples/widgets/tools/echoplugin/echoplugin.pro | 2 +- examples/widgets/tools/echoplugin/echowindow/echowindow.pro | 2 +- examples/widgets/tools/echoplugin/plugin/plugin.pro | 2 +- examples/widgets/tools/i18n/i18n.pro | 2 +- examples/widgets/tools/plugandpaint/plugandpaint.pro | 2 +- examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro | 2 +- .../widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro | 2 +- examples/widgets/tools/regexp/regexp.pro | 2 +- examples/widgets/tools/settingseditor/settingseditor.pro | 2 +- examples/widgets/tools/styleplugin/plugin/plugin.pro | 2 +- examples/widgets/tools/styleplugin/styleplugin.pro | 2 +- examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro | 2 +- examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro | 2 +- examples/widgets/tools/undo/undo.pro | 2 +- examples/widgets/tools/undoframework/undoframework.pro | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/widgets/tools/codecs/codecs.pro b/examples/widgets/tools/codecs/codecs.pro index 7b2baa3ec8..985952ed64 100644 --- a/examples/widgets/tools/codecs/codecs.pro +++ b/examples/widgets/tools/codecs/codecs.pro @@ -9,7 +9,7 @@ SOURCES += main.cpp \ EXAMPLE_FILES = encodedfiles # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/codecs +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/codecs INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/completer/completer.pro b/examples/widgets/tools/completer/completer.pro index b47b7a9057..96b4efe497 100644 --- a/examples/widgets/tools/completer/completer.pro +++ b/examples/widgets/tools/completer/completer.pro @@ -8,7 +8,7 @@ SOURCES = fsmodel.cpp \ RESOURCES = completer.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/completer +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/completer INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/customcompleter/customcompleter.pro b/examples/widgets/tools/customcompleter/customcompleter.pro index b8ccc83744..4905c0b7d8 100644 --- a/examples/widgets/tools/customcompleter/customcompleter.pro +++ b/examples/widgets/tools/customcompleter/customcompleter.pro @@ -8,7 +8,7 @@ SOURCES = main.cpp \ RESOURCES = customcompleter.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/customcompleter INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/echoplugin/echoplugin.pro b/examples/widgets/tools/echoplugin/echoplugin.pro index 986ba9c9c3..d95eb6b64a 100644 --- a/examples/widgets/tools/echoplugin/echoplugin.pro +++ b/examples/widgets/tools/echoplugin/echoplugin.pro @@ -5,5 +5,5 @@ SUBDIRS = echowindow \ #! [0] # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/echoplugin INSTALLS += target diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro b/examples/widgets/tools/echoplugin/echowindow/echowindow.pro index c8dc000678..2d14e5ba03 100644 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro +++ b/examples/widgets/tools/echoplugin/echowindow/echowindow.pro @@ -15,7 +15,7 @@ win32 { } # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/echoplugin INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/echoplugin/plugin/plugin.pro b/examples/widgets/tools/echoplugin/plugin/plugin.pro index 235358d52c..4afe56c024 100644 --- a/examples/widgets/tools/echoplugin/plugin/plugin.pro +++ b/examples/widgets/tools/echoplugin/plugin/plugin.pro @@ -12,5 +12,5 @@ DESTDIR = ../plugins EXAMPLE_FILES = echoplugin.json # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin/plugin +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/echoplugin/plugin INSTALLS += target diff --git a/examples/widgets/tools/i18n/i18n.pro b/examples/widgets/tools/i18n/i18n.pro index 8095e44b3c..38d2bd978f 100644 --- a/examples/widgets/tools/i18n/i18n.pro +++ b/examples/widgets/tools/i18n/i18n.pro @@ -22,7 +22,7 @@ TRANSLATIONS += translations/i18n_ar.ts \ translations/i18n_zh.ts # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/i18n +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/i18n INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/plugandpaint/plugandpaint.pro b/examples/widgets/tools/plugandpaint/plugandpaint.pro index 0b20f81a1f..965eacf388 100644 --- a/examples/widgets/tools/plugandpaint/plugandpaint.pro +++ b/examples/widgets/tools/plugandpaint/plugandpaint.pro @@ -19,5 +19,5 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { #! [0] # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint INSTALLS += target diff --git a/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro b/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro index aac2edce00..670ebb5709 100644 --- a/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro +++ b/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro @@ -10,5 +10,5 @@ DESTDIR = ../../plugandpaint/plugins #! [0] # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint/plugins +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins INSTALLS += target diff --git a/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro b/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro index 3280f119cf..aa0ead87bc 100644 --- a/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro +++ b/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro @@ -10,5 +10,5 @@ DESTDIR = ../../plugandpaint/plugins #! [0] # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint/plugins +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/plugandpaint/plugins INSTALLS += target diff --git a/examples/widgets/tools/regexp/regexp.pro b/examples/widgets/tools/regexp/regexp.pro index 0d2a9a280c..5fb17b50bc 100644 --- a/examples/widgets/tools/regexp/regexp.pro +++ b/examples/widgets/tools/regexp/regexp.pro @@ -5,7 +5,7 @@ SOURCES = regexpdialog.cpp \ main.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/regexp +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/regexp INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/settingseditor/settingseditor.pro b/examples/widgets/tools/settingseditor/settingseditor.pro index 69b8a04c92..c144a3ee36 100644 --- a/examples/widgets/tools/settingseditor/settingseditor.pro +++ b/examples/widgets/tools/settingseditor/settingseditor.pro @@ -13,7 +13,7 @@ SOURCES = locationdialog.cpp \ EXAMPLE_FILES = inifiles # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/settingseditor +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/settingseditor INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/styleplugin/plugin/plugin.pro b/examples/widgets/tools/styleplugin/plugin/plugin.pro index 605e196bd9..c7e8de6ee2 100644 --- a/examples/widgets/tools/styleplugin/plugin/plugin.pro +++ b/examples/widgets/tools/styleplugin/plugin/plugin.pro @@ -18,5 +18,5 @@ win32 { EXAMPLE_FILES += simplestyle.json # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/styles +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/styleplugin/styles INSTALLS += target diff --git a/examples/widgets/tools/styleplugin/styleplugin.pro b/examples/widgets/tools/styleplugin/styleplugin.pro index d7129e724b..b9f251116d 100644 --- a/examples/widgets/tools/styleplugin/styleplugin.pro +++ b/examples/widgets/tools/styleplugin/styleplugin.pro @@ -3,5 +3,5 @@ SUBDIRS = stylewindow \ plugin # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/styleplugin INSTALLS += target diff --git a/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro b/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro index 12adce4872..56aa373b0e 100644 --- a/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro +++ b/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro @@ -13,5 +13,5 @@ win32 { } # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/styleplugin INSTALLS += target diff --git a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro index 56e0cee210..6a8f5ef3a1 100644 --- a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro +++ b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro @@ -8,7 +8,7 @@ SOURCES = treemodelcompleter.cpp \ RESOURCES = treemodelcompleter.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/treemodelcompleter +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/treemodelcompleter INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/undo/undo.pro b/examples/widgets/tools/undo/undo.pro index 5e0f1d7817..3727c8cbde 100644 --- a/examples/widgets/tools/undo/undo.pro +++ b/examples/widgets/tools/undo/undo.pro @@ -12,5 +12,5 @@ build_all:!build_pass { RESOURCES += undo.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/undo +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/undo INSTALLS += target diff --git a/examples/widgets/tools/undoframework/undoframework.pro b/examples/widgets/tools/undoframework/undoframework.pro index 9cea99f105..d6bf6b8b97 100644 --- a/examples/widgets/tools/undoframework/undoframework.pro +++ b/examples/widgets/tools/undoframework/undoframework.pro @@ -12,7 +12,7 @@ SOURCES = commands.cpp \ RESOURCES = undoframework.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/tools/undoframework +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/undoframework INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) -- cgit v1.2.3 From f75e897519183f4c5503f5c4d1c0b7046dc9d81c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Jan 2013 20:25:33 +0100 Subject: centralize detection of prefix builds this makes the use sites more expressive Change-Id: Ib879de65d1cc26462fa61f5339e951f294515faf Reviewed-by: Joerg Bornemann --- mkspecs/features/qml_module.prf | 2 +- mkspecs/features/qt_build_config.prf | 5 ++++- mkspecs/features/qt_build_paths.prf | 4 ++-- mkspecs/features/qt_module.prf | 2 +- mkspecs/features/qt_tool.prf | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf index e7d0b386b1..db5f6787b3 100644 --- a/mkspecs/features/qml_module.prf +++ b/mkspecs/features/qml_module.prf @@ -25,7 +25,7 @@ qml1_target: \ else: \ instbase = $$[QT_INSTALL_QML] -exists($$[QT_HOST_PREFIX]/.qmake.cache) { +!prefix_build { # These bizarre rules copy the files to the qtbase build directory defineReplace(qmlModStripSrcDir) { diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index 48d6001aa9..4f5b62e1e5 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -20,7 +20,10 @@ debug(1, "Not loading qmodule.pri twice") } -!build_pass:!isEmpty(_QMAKE_SUPER_CACHE_):!exists($$[QT_HOST_DATA]/.qmake.cache) { +!exists($$[QT_HOST_DATA]/.qmake.cache): \ + CONFIG += prefix_build + +!build_pass:!isEmpty(_QMAKE_SUPER_CACHE_):prefix_build { # When doing a -prefix build of top-level qt5/qt.pro, we need to announce # this repo's module pris' location to the other repos. isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$shadowed($$dirname(_QMAKE_CONF_)) diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf index 123c87de3b..03b43e3153 100644 --- a/mkspecs/features/qt_build_paths.prf +++ b/mkspecs/features/qt_build_paths.prf @@ -16,8 +16,8 @@ isEmpty(MODULE_BASE_DIR): MODULE_BASE_DIR = $$MODULE_PROFILE_DIR isEmpty(MODULE_BASE_OUTDIR): MODULE_BASE_OUTDIR = $$shadowed($$MODULE_BASE_DIR) isEmpty(MODULE_QMAKE_OUTDIR): MODULE_QMAKE_OUTDIR = $$MODULE_BASE_OUTDIR -QTDIR = $$[QT_HOST_PREFIX] -exists($$QTDIR/.qmake.cache) { +!prefix_build { + QTDIR = $$[QT_HOST_PREFIX] # Permit modules to enforce being built outside QTDIR ... !force_independent: MODULE_BASE_OUTDIR = $$QTDIR # ... though this sort of breaks the idea. diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 50e946937c..810356c8b1 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -112,7 +112,7 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}.private_inclu #other TEMPLATE = lib DESTDIR = $$eval(QT.$${MODULE}.libs) -win32:!wince*:exists($$[QT_INSTALL_PREFIX]/.qmake.cache): DLLDESTDIR = $$eval(QT.$${MODULE}.bins) +win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE}.bins) CONFIG += qmake_cache target_qt diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index 16db6c7972..b449e4074d 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -31,7 +31,7 @@ load(qt_targets) # If we are doing a prefix build, create a "module" pri which enables # qtPrepareTool() to work with the non-installed build. -!build_pass:!exists($$[QT_INSTALL_PREFIX]/.qmake.cache) { +!build_pass:prefix_build { isEmpty(MODULE):MODULE = $$TARGET -- cgit v1.2.3 From 9e388bf692d4a499ec110132464190a7ec73e50b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Jan 2013 21:07:14 +0100 Subject: qt_module_fwdpri.prf => qt_module_pris.prf move the regular pri file creation into the "sub-prf" and rename it accordingly. the original reason for the split was the deep magic in activeqt (and phonon), which is gone now. Change-Id: If40e941afc9293725630ed6bcf3e4ef18a692f66 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_module.prf | 60 +------------- mkspecs/features/qt_module_fwdpri.prf | 92 ---------------------- mkspecs/features/qt_module_pris.prf | 144 ++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 151 deletions(-) delete mode 100644 mkspecs/features/qt_module_fwdpri.prf create mode 100644 mkspecs/features/qt_module_pris.prf diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 810356c8b1..855251425c 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -45,65 +45,7 @@ else: \ MODULE_DEFINE = QT_$${ucmodule}_LIB MODULE_DEFINES = $$MODULE_DEFINE $$MODULE_DEFINES -load(qt_build_paths) -MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri - -!build_pass { - - # Create a module .pri file - unix:!static: \ - module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]" - else: \ - module_rpath = - !isEmpty(QT_FOR_PRIVATE) { - contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.") - module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE" - } else { - module_privdep = - } - static: \ - module_build_type = "QT.$${MODULE}.module_config = staticlib" - else:mac:contains(QT_CONFIG, qt_framework): \ - module_build_type = "QT.$${MODULE}.module_config = lib_bundle" - else: \ - module_build_type = - !isEmpty(MODULE_CONFIG): \ - module_config = "QT.$${MODULE}.CONFIG = $$MODULE_CONFIG" - else: \ - module_config = - !no_module_headers { - MODULE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME" - MODULE_PRIVATE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION \ - \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME" - } - MODULE_PRI_CONT = \ - "QT.$${MODULE}.VERSION = $${VERSION}" \ - "QT.$${MODULE}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \ - "QT.$${MODULE}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \ - "QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \ - "" \ - "QT.$${MODULE}.name = $$TARGET" \ - "QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \ - "QT.$${MODULE}.includes = $$MODULE_INCLUDES" \ - "QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES" \ - "QT.$${MODULE}.libs = \$\$QT_MODULE_LIB_BASE" \ - "QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \ - $$module_rpath \ - "QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \ - "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \ - "QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" \ - "QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ - $$module_privdep \ - $$module_build_type \ - $$module_config \ - "QT.$${MODULE}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting - "" \ - "QT_CONFIG += $$MODULE" # this is obsolete, but some code still depends on it - write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") - -} # !build_pass - -load(qt_module_fwdpri) +load(qt_module_pris) INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}.private_includes) diff --git a/mkspecs/features/qt_module_fwdpri.prf b/mkspecs/features/qt_module_fwdpri.prf deleted file mode 100644 index 58b016803e..0000000000 --- a/mkspecs/features/qt_module_fwdpri.prf +++ /dev/null @@ -1,92 +0,0 @@ -# -# W A R N I N G -# ------------- -# -# This file is not part of the Qt API. It exists purely as an -# implementation detail. It may change from version to version -# without notice, or even be removed. -# -# We mean it. -# - -!build_pass { - - load(qt_build_paths) - - MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri - - # -rpath-link is used by the linker to find depedencies of dynamic - # libraries which were NOT specified on the command line. - # This means that .libs of each module's regular .depends (QT) don't - # need to be put there, as they appear on the linker line anyway. - # A module's QT_PRIVATE's .libs OTOH need to be put there. - # .depends_private (QT_FOR_PRIVATE) is somewhat special: if the privates - # are used, the libraries are explicitly linked. If not, their locations - # need to be put into -rpath-link. As QT_FOR_PRIVATE cannot in turn - # contain privates, they always end up in -rpath-link of dependant - # modules. - # For simplicity of use, each module's rpath list has all dependencies - # transitively resolved already. - pubqt = $$MODULE_DEPENDS $$QT_FOR_PRIVATE - pubdep = $$resolve_depends(pubqt, "QT.") - privqt = $$replace(QT_PRIVATE, -private$, ) - privdep = $$resolve_depends(privqt, "QT.") - rpaths = - alldep = $$pubdep $$privdep - for(dep, alldep) { # Inherit link-rpaths from all our dependencies - rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private) - } - privdep -= $$pubdep - for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths - rpaths += $$eval(QT.$${dep}.libs) - !isEmpty(rpaths) { - rpaths = $$unique(rpaths) - module_rpathlink = "QT.$${MODULE}.rpath_link = $$val_escape(rpaths)" - } else { - module_rpathlink = - } - rpaths_priv = - xtradep = $$resolve_depends(QT_FOR_PRIVATE, "QT.") - for(dep, xtradep): \ # Add our private API's dependencies' lib paths as new link-rpaths - rpaths_priv += $$eval(QT.$${dep}.libs) - rpaths_priv = $$unique(rpaths_priv) - rpaths_priv -= $$rpaths - !isEmpty(rpaths_priv) { - module_rpathlink_priv = "QT.$${MODULE}.rpath_link_private = $$val_escape(rpaths_priv)" - } else { - module_rpathlink_priv = - } - - # Create a forwarding module .pri file - MODULE_FWD_PRI_CONT = \ - "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \ - "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \ - "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \ - "QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \ - "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ - "QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \ - "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ - $$module_rpathlink \ - $$module_rpathlink_priv \ - "include($$MODULE_PRI)" - write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") - touch($$MODULE_FWD_PRI, $$MODULE_PRI) - - # Then, inject the new module into the current cache state - !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI) { # before the actual include()! - added = $$MODULE_PRI $$MODULE_FWD_PRI - cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, added) - unset(added) - } - include($$MODULE_FWD_PRI) - for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ - name depends private_depends module_config CONFIG DEFINES sources \ - includes private_includes bins libs libexecs plugins imports qml \ - rpath_link rpath_link_private \ - )):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient) - cache(QT_CONFIG, transient) - -} # !build_pass - -# Schedule the regular .pri file for installation -CONFIG += qt_install_module diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf new file mode 100644 index 0000000000..7a3e7397b9 --- /dev/null +++ b/mkspecs/features/qt_module_pris.prf @@ -0,0 +1,144 @@ +# +# W A R N I N G +# ------------- +# +# This file is not part of the Qt API. It exists purely as an +# implementation detail. It may change from version to version +# without notice, or even be removed. +# +# We mean it. +# + +load(qt_build_paths) +MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri + +!build_pass { + + # Create a module .pri file + unix:!static: \ + module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]" + else: \ + module_rpath = + !isEmpty(QT_FOR_PRIVATE) { + contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.") + module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE" + } else { + module_privdep = + } + static: \ + module_build_type = "QT.$${MODULE}.module_config = staticlib" + else:mac:contains(QT_CONFIG, qt_framework): \ + module_build_type = "QT.$${MODULE}.module_config = lib_bundle" + else: \ + module_build_type = + !isEmpty(MODULE_CONFIG): \ + module_config = "QT.$${MODULE}.CONFIG = $$MODULE_CONFIG" + else: \ + module_config = + !no_module_headers { + MODULE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME" + MODULE_PRIVATE_INCLUDES = "\$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION \ + \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME" + } + MODULE_PRI_CONT = \ + "QT.$${MODULE}.VERSION = $${VERSION}" \ + "QT.$${MODULE}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \ + "QT.$${MODULE}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \ + "QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \ + "" \ + "QT.$${MODULE}.name = $$TARGET" \ + "QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \ + "QT.$${MODULE}.includes = $$MODULE_INCLUDES" \ + "QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES" \ + "QT.$${MODULE}.libs = \$\$QT_MODULE_LIB_BASE" \ + "QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \ + $$module_rpath \ + "QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \ + "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \ + "QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" \ + "QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ + $$module_privdep \ + $$module_build_type \ + $$module_config \ + "QT.$${MODULE}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting + "" \ + "QT_CONFIG += $$MODULE" # this is obsolete, but some code still depends on it + write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") + + MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri + + # -rpath-link is used by the linker to find depedencies of dynamic + # libraries which were NOT specified on the command line. + # This means that .libs of each module's regular .depends (QT) don't + # need to be put there, as they appear on the linker line anyway. + # A module's QT_PRIVATE's .libs OTOH need to be put there. + # .depends_private (QT_FOR_PRIVATE) is somewhat special: if the privates + # are used, the libraries are explicitly linked. If not, their locations + # need to be put into -rpath-link. As QT_FOR_PRIVATE cannot in turn + # contain privates, they always end up in -rpath-link of dependant + # modules. + # For simplicity of use, each module's rpath list has all dependencies + # transitively resolved already. + pubqt = $$MODULE_DEPENDS $$QT_FOR_PRIVATE + pubdep = $$resolve_depends(pubqt, "QT.") + privqt = $$replace(QT_PRIVATE, -private$, ) + privdep = $$resolve_depends(privqt, "QT.") + rpaths = + alldep = $$pubdep $$privdep + for(dep, alldep) { # Inherit link-rpaths from all our dependencies + rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private) + } + privdep -= $$pubdep + for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths + rpaths += $$eval(QT.$${dep}.libs) + !isEmpty(rpaths) { + rpaths = $$unique(rpaths) + module_rpathlink = "QT.$${MODULE}.rpath_link = $$val_escape(rpaths)" + } else { + module_rpathlink = + } + rpaths_priv = + xtradep = $$resolve_depends(QT_FOR_PRIVATE, "QT.") + for(dep, xtradep): \ # Add our private API's dependencies' lib paths as new link-rpaths + rpaths_priv += $$eval(QT.$${dep}.libs) + rpaths_priv = $$unique(rpaths_priv) + rpaths_priv -= $$rpaths + !isEmpty(rpaths_priv) { + module_rpathlink_priv = "QT.$${MODULE}.rpath_link_private = $$val_escape(rpaths_priv)" + } else { + module_rpathlink_priv = + } + + # Create a forwarding module .pri file + MODULE_FWD_PRI_CONT = \ + "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \ + "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \ + "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \ + "QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \ + "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ + "QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \ + "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ + $$module_rpathlink \ + $$module_rpathlink_priv \ + "include($$MODULE_PRI)" + write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") + touch($$MODULE_FWD_PRI, $$MODULE_PRI) + + # Then, inject the new module into the current cache state + !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI) { # before the actual include()! + added = $$MODULE_PRI $$MODULE_FWD_PRI + cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, added) + unset(added) + } + include($$MODULE_FWD_PRI) + for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ + name depends private_depends module_config CONFIG DEFINES sources \ + includes private_includes bins libs libexecs plugins imports qml \ + rpath_link rpath_link_private \ + )):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient) + cache(QT_CONFIG, transient) + +} # !build_pass + +# Schedule the regular .pri file for installation +CONFIG += qt_install_module -- cgit v1.2.3 From 6654a05fcad565a302e205e7f7deaa0b2757082d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Jan 2013 20:25:44 +0100 Subject: don't create forwarding module pris for non-prefix builds as everything is built inside the common build/install dir, there is no point in the fwd pri stuff. as a "side effect", this makes it more straight-forward to relocate non-prefix builds, which is the default on windows. Task-number: QTBUG-28827 Change-Id: I010246a9ad87cf74974dc168768b1a8625f73260 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_module_pris.prf | 140 ++++++++++++++++++++---------------- 1 file changed, 78 insertions(+), 62 deletions(-) diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 7a3e7397b9..7b5ccc0983 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -10,7 +10,11 @@ # load(qt_build_paths) -MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri +MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri +prefix_build: \ + MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri +else: \ + MODULE_PRI = $$MODULE_FWD_PRI !build_pass { @@ -64,72 +68,84 @@ MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri "" \ "QT_CONFIG += $$MODULE" # this is obsolete, but some code still depends on it write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") + MODULE_PRI_FILES = $$MODULE_PRI - MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri + prefix_build { - # -rpath-link is used by the linker to find depedencies of dynamic - # libraries which were NOT specified on the command line. - # This means that .libs of each module's regular .depends (QT) don't - # need to be put there, as they appear on the linker line anyway. - # A module's QT_PRIVATE's .libs OTOH need to be put there. - # .depends_private (QT_FOR_PRIVATE) is somewhat special: if the privates - # are used, the libraries are explicitly linked. If not, their locations - # need to be put into -rpath-link. As QT_FOR_PRIVATE cannot in turn - # contain privates, they always end up in -rpath-link of dependant - # modules. - # For simplicity of use, each module's rpath list has all dependencies - # transitively resolved already. - pubqt = $$MODULE_DEPENDS $$QT_FOR_PRIVATE - pubdep = $$resolve_depends(pubqt, "QT.") - privqt = $$replace(QT_PRIVATE, -private$, ) - privdep = $$resolve_depends(privqt, "QT.") - rpaths = - alldep = $$pubdep $$privdep - for(dep, alldep) { # Inherit link-rpaths from all our dependencies - rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private) - } - privdep -= $$pubdep - for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths - rpaths += $$eval(QT.$${dep}.libs) - !isEmpty(rpaths) { - rpaths = $$unique(rpaths) - module_rpathlink = "QT.$${MODULE}.rpath_link = $$val_escape(rpaths)" - } else { - module_rpathlink = - } - rpaths_priv = - xtradep = $$resolve_depends(QT_FOR_PRIVATE, "QT.") - for(dep, xtradep): \ # Add our private API's dependencies' lib paths as new link-rpaths - rpaths_priv += $$eval(QT.$${dep}.libs) - rpaths_priv = $$unique(rpaths_priv) - rpaths_priv -= $$rpaths - !isEmpty(rpaths_priv) { - module_rpathlink_priv = "QT.$${MODULE}.rpath_link_private = $$val_escape(rpaths_priv)" - } else { - module_rpathlink_priv = - } + # -rpath-link is used by the linker to find depedencies of dynamic + # libraries which were NOT specified on the command line. + # This means that .libs of each module's regular .depends (QT) don't + # need to be put there, as they appear on the linker line anyway. + # A module's QT_PRIVATE's .libs OTOH need to be put there. + # .depends_private (QT_FOR_PRIVATE) is somewhat special: if the privates + # are used, the libraries are explicitly linked. If not, their locations + # need to be put into -rpath-link. As QT_FOR_PRIVATE cannot in turn + # contain privates, they always end up in -rpath-link of dependant + # modules. + # For simplicity of use, each module's rpath list has all dependencies + # transitively resolved already. + pubqt = $$MODULE_DEPENDS $$QT_FOR_PRIVATE + pubdep = $$resolve_depends(pubqt, "QT.") + privqt = $$replace(QT_PRIVATE, -private$, ) + privdep = $$resolve_depends(privqt, "QT.") + rpaths = + alldep = $$pubdep $$privdep + for(dep, alldep) { # Inherit link-rpaths from all our dependencies + rpaths += $$eval(QT.$${dep}.rpath_link) $$eval(QT.$${dep}.rpath_link_private) + } + privdep -= $$pubdep + for(dep, privdep): \ # Add our private dependencies' lib paths as new link-rpaths + rpaths += $$eval(QT.$${dep}.libs) + !isEmpty(rpaths) { + rpaths = $$unique(rpaths) + module_rpathlink = "QT.$${MODULE}.rpath_link = $$val_escape(rpaths)" + } else { + module_rpathlink = + } + rpaths_priv = + xtradep = $$resolve_depends(QT_FOR_PRIVATE, "QT.") + for(dep, xtradep): \ # Add our private API's dependencies' lib paths as new link-rpaths + rpaths_priv += $$eval(QT.$${dep}.libs) + rpaths_priv = $$unique(rpaths_priv) + rpaths_priv -= $$rpaths + !isEmpty(rpaths_priv) { + module_rpathlink_priv = "QT.$${MODULE}.rpath_link_private = $$val_escape(rpaths_priv)" + } else { + module_rpathlink_priv = + } - # Create a forwarding module .pri file - MODULE_FWD_PRI_CONT = \ - "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \ - "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \ - "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \ - "QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \ - "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ - "QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \ - "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ - $$module_rpathlink \ - $$module_rpathlink_priv \ - "include($$MODULE_PRI)" - write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") - touch($$MODULE_FWD_PRI, $$MODULE_PRI) + # Create a forwarding module .pri file + MODULE_FWD_PRI_CONT = \ + "QT_MODULE_BIN_BASE = $$MODULE_BASE_OUTDIR/bin" \ + "QT_MODULE_INCLUDE_BASE = $$MODULE_BASE_OUTDIR/include" \ + "QT_MODULE_IMPORT_BASE = $$MODULE_BASE_OUTDIR/imports" \ + "QT_MODULE_QML_BASE = $$MODULE_BASE_OUTDIR/qml" \ + "QT_MODULE_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ + "QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \ + "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ + $$module_rpathlink \ + $$module_rpathlink_priv \ + "include($$MODULE_PRI)" + write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") + touch($$MODULE_FWD_PRI, $$MODULE_PRI) + MODULE_PRI_FILES += $$MODULE_FWD_PRI + + } else { # prefix_build + + # This is needed for the direct include() below. + QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS] + QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS] + QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS] + QT_MODULE_QML_BASE = $$[QT_INSTALL_QML] + QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS] + QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS] + QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS] - # Then, inject the new module into the current cache state - !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI) { # before the actual include()! - added = $$MODULE_PRI $$MODULE_FWD_PRI - cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, added) - unset(added) } + + # Then, inject the new module into the current cache state + !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI): \ # before the actual include()! + cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES) include($$MODULE_FWD_PRI) for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ name depends private_depends module_config CONFIG DEFINES sources \ -- cgit v1.2.3