From c85f6d9f5a844e28047216280182651bfc047754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 19 Feb 2013 13:22:53 +0100 Subject: Fixed qtbase examples build when configured with -no-opengl Change-Id: Idafdc3264f760d6400ce04bb9da36289b1f96438 Reviewed-by: Oswald Buddenhagen Reviewed-by: Gunnar Sletta --- examples/gui/gui.pro | 4 +++- examples/widgets/graphicsview/chip/view.cpp | 2 ++ examples/widgets/graphicsview/padnavigator/padnavigator.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/gui/gui.pro b/examples/gui/gui.pro index 1a4067e893..8758a1ba95 100644 --- a/examples/gui/gui.pro +++ b/examples/gui/gui.pro @@ -3,4 +3,6 @@ CONFIG += no_docs_target SUBDIRS += analogclock SUBDIRS += rasterwindow -SUBDIRS += openglwindow +contains(QT_CONFIG, opengl(es1|es2)?) { + SUBDIRS += openglwindow +} diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index aa3082d5e8..4b5b608163 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -47,6 +47,8 @@ #endif #ifndef QT_NO_OPENGL #include +#else +#include #endif #include diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp index e92f156ad6..82671578fb 100644 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp +++ b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp @@ -44,6 +44,8 @@ #ifndef QT_NO_OPENGL #include +#else +#include #endif //! [0] -- cgit v1.2.3 From 3bee02c1cad3bbeffbb51ca003ee79558919bb8b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 7 Feb 2013 14:16:36 +0100 Subject: Revert "QGtkStyle: GTK3 compatible combo boxes" This reverts commit 15fc255c7c0a6a693c754734c39c37bd50b0634b. The change was not compatible with the oxygen-gtk theme engine. Furthermore, GTK3 compatibility in QGtkStyle is not important, since it won't be feasible to support both GTK2 and GTK3 in the same style implementation. Conflicts: src/widgets/styles/qgtkstyle_p.cpp src/widgets/styles/qgtkstyle_p.h Task-number: QTCREATORBUG-8524 Change-Id: I8ea6dcfd1f432d51b306a5d9f6c4106137979c5a Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qgtkstyle.cpp | 30 ++++++++++++++++-------------- src/widgets/styles/qgtkstyle_p.cpp | 7 +------ src/widgets/styles/qgtkstyle_p_p.h | 2 -- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index da9c13b97f..159f8dce83 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -1881,8 +1881,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - const QHashableLatin1Literal comboBoxPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? - QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox"); + const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox"); // We use the gtk widget to position arrows and separators for us GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); @@ -1890,8 +1889,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); d->gtk_widget_size_allocate(gtkCombo, &geometry); - QHashableLatin1Literal buttonPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? - QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); + QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") + : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); if (gtkToggleButton && (appears_as_list || comboBox->editable)) { @@ -1900,8 +1899,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom // Draw the combo box as a line edit with a button next to it if (comboBox->editable || appears_as_list) { GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state; - QHashableLatin1Literal entryPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") - : comboBox->editable ? QHashableLatin1Literal("GtkComboBox.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); + QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame"); GtkWidget *gtkEntry = d->gtkWidget(entryPath); d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); QRect frameRect = option->rect; @@ -1969,7 +1967,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom // Draw the separator between label and arrows - QHashableLatin1Literal vSeparatorPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new + QHashableLatin1Literal vSeparatorPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator"); @@ -2006,7 +2004,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom state = GTK_STATE_NORMAL; QHashableLatin1Literal arrowPath(""); - if (comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new) { + if (comboBox->editable) { if (appears_as_list) arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); else @@ -2044,7 +2042,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (sunken) { int xoff, yoff; - const QHashableLatin1Literal toggleButtonPath = comboBox->editable && QGtkStylePrivate::gtk_combo_box_entry_new + const QHashableLatin1Literal toggleButtonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); @@ -3811,15 +3809,19 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple case CC_ComboBox: if (const QStyleOptionComboBox *box = qstyleoption_cast(option)) { // We employ the gtk widget to position arrows and separators for us - GtkWidget *gtkCombo = box->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? - d->gtkWidget("GtkComboBoxEntry") : d->gtkWidget("GtkComboBox"); + GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry") + : d->gtkWidget("GtkComboBox"); d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; d->gtk_widget_size_allocate(gtkCombo, &geometry); int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); - QHashableLatin1Literal arrowPath = box->editable && QGtkStylePrivate::gtk_combo_box_entry_new ? - QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") : box->editable || appears_as_list ? - QHashableLatin1Literal("GtkComboBox.GtkToggleButton") : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); + QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); + if (!box->editable) { + if (appears_as_list) + arrowPath = "GtkComboBox.GtkToggleButton"; + else + arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; + } GtkWidget *arrowWidget = d->gtkWidget(arrowPath); if (!arrowWidget) diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp index 4d16e5b9fe..810a8995f8 100644 --- a/src/widgets/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -133,7 +133,6 @@ Ptr_gtk_separator_tool_item_new QGtkStylePrivate::gtk_separator_tool_item_new = Ptr_gtk_tree_view_new QGtkStylePrivate::gtk_tree_view_new = 0; Ptr_gtk_combo_box_new QGtkStylePrivate::gtk_combo_box_new = 0; Ptr_gtk_combo_box_entry_new QGtkStylePrivate::gtk_combo_box_entry_new = 0; -Ptr_gtk_combo_box_new_with_entry QGtkStylePrivate::gtk_combo_box_new_with_entry = 0; Ptr_gtk_progress_bar_new QGtkStylePrivate::gtk_progress_bar_new = 0; Ptr_gtk_container_add QGtkStylePrivate::gtk_container_add = 0; Ptr_gtk_menu_shell_append QGtkStylePrivate::gtk_menu_shell_append = 0; @@ -411,7 +410,6 @@ void QGtkStylePrivate::resolveGtk() const gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new"); gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new"); gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new"); - gtk_combo_box_new_with_entry = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_new_with_entry"); gtk_range_get_adjustment = (Ptr_gtk_range_get_adjustment)libgtk.resolve("gtk_range_get_adjustment"); gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment"); gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted"); @@ -575,10 +573,7 @@ void QGtkStylePrivate::initGtkWidgets() const addWidget(QGtkStylePrivate::gtk_check_button_new()); addWidget(QGtkStylePrivate::gtk_radio_button_new(NULL)); addWidget(QGtkStylePrivate::gtk_combo_box_new()); - if (gtk_combo_box_entry_new) - addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); - if (gtk_combo_box_new_with_entry) - addWidget(QGtkStylePrivate::gtk_combo_box_new_with_entry()); + addWidget(QGtkStylePrivate::gtk_combo_box_entry_new()); GtkWidget *entry = QGtkStylePrivate::gtk_entry_new(); // gtk-im-context-none is supported in gtk+ since 2.19.5 // and also exists in gtk3 diff --git a/src/widgets/styles/qgtkstyle_p_p.h b/src/widgets/styles/qgtkstyle_p_p.h index 643f766215..fc77aea48b 100644 --- a/src/widgets/styles/qgtkstyle_p_p.h +++ b/src/widgets/styles/qgtkstyle_p_p.h @@ -143,7 +143,6 @@ typedef GtkWidget* (*Ptr_gtk_menu_bar_new)(void); typedef GtkWidget* (*Ptr_gtk_menu_new)(void); typedef GtkWidget* (*Ptr_gtk_combo_box_new)(void); typedef GtkWidget* (*Ptr_gtk_combo_box_entry_new)(void); -typedef GtkWidget* (*Ptr_gtk_combo_box_new_with_entry)(void); typedef GtkWidget* (*Ptr_gtk_toolbar_new)(void); typedef GtkWidget* (*Ptr_gtk_spin_button_new)(GtkAdjustment*, double, int); typedef GtkWidget* (*Ptr_gtk_button_new)(void); @@ -380,7 +379,6 @@ public: static Ptr_gtk_tree_view_get_column gtk_tree_view_get_column; static Ptr_gtk_combo_box_new gtk_combo_box_new; static Ptr_gtk_combo_box_entry_new gtk_combo_box_entry_new; - static Ptr_gtk_combo_box_new_with_entry gtk_combo_box_new_with_entry; static Ptr_gtk_progress_bar_new gtk_progress_bar_new; static Ptr_gtk_container_add gtk_container_add; static Ptr_gtk_menu_shell_append gtk_menu_shell_append; -- cgit v1.2.3 From f6c5452d97c5bc53fd29c32e7f9bee0f5e411283 Mon Sep 17 00:00:00 2001 From: Indrajit Tapadar Date: Wed, 23 Jan 2013 13:08:20 +0100 Subject: Fix for url encoding in QDesktopServices::openUrl(). URLs containing spaces (encoded) couldnt be opened using QDesktopServices::openUrl() -method. This is a regression as it works for 4.8, Using url.toEncoded() instead of url.toString() which removed percent encoding. The NSUrl uses RFC 2396 for parsing, and according to the documentation, of 2.4. Escape Sequences - Data must be escaped if it does not have a representation using an unreserved character; And as a space does not have a representation using unreserved character it needs to be escaped. Example: Using this url, http://www.google.com/search?q=testme%20withspace url.toString() returns "http://www.google.com/search?q=testme withspace" and url.toEncoded() returns, http://www.google.com/search?q=testme%20withspace" which is also the expected result. Task-number: QTBUG-29124 Change-Id: Ieed3d4cfb689b9311f6cf21e5098a1e70256ab03 Reviewed-by: Thiago Macieira --- src/plugins/platforms/cocoa/qcocoaservices.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaservices.mm b/src/plugins/platforms/cocoa/qcocoaservices.mm index dea23e7e53..e4cec8c5f8 100644 --- a/src/plugins/platforms/cocoa/qcocoaservices.mm +++ b/src/plugins/platforms/cocoa/qcocoaservices.mm @@ -55,7 +55,7 @@ bool QCocoaServices::openUrl(const QUrl &url) const QString scheme = url.scheme(); if (scheme.isEmpty()) return openDocument(url); - return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString())]]; + return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString(QUrl::FullyEncoded))]]; } bool QCocoaServices::openDocument(const QUrl &url) -- cgit v1.2.3 From e28c03cb829c229209090d7939a9aba1af1fdea9 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 19 Feb 2013 18:11:16 +0100 Subject: Fix reentrancy problem in image reading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were race conditions when accessing the plugin factory and the image reader plugins from different threads; ref QTBUG-29281. Added a mutex lock to avoid. Change-Id: Ic1a3b6cbaf5603f1bcf7025b58247a9a3f6d08a9 Reviewed-by: Samuel Rødal --- src/gui/image/qimagereader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5eaf7bb8f2..684778694e 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -133,6 +133,7 @@ // factory loader #include #include +#include // image handlers #include @@ -232,6 +233,9 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, QByteArray suffix; #ifndef QT_NO_IMAGEFORMATPLUGIN + static QMutex mutex; + QMutexLocker locker(&mutex); + typedef QMultiMap PluginKeyMap; // check if we have plugins that support the image format -- cgit v1.2.3 From b6ccdfa4823d4608f5cb94797b48fc82b8833581 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 15 Feb 2013 11:28:28 +0100 Subject: Fix multiselection by CTRL-click in QFileDialog/KDE. Task-number: QTBUG-29257 Change-Id: Idfac80e855455a4537dd38a23136762cd9398e15 Reviewed-by: David Faure (KDE) Reviewed-by: Frederik Gladhorn --- src/widgets/dialogs/qfiledialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 240e9979d8..c60f2476c3 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2966,7 +2966,11 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) lineEdit()->clear(); } } else { - q->accept(); + // Do not accept when shift-clicking to multi-select a file in environments with single-click-activation (KDE) + if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) + || q->fileMode() != QFileDialog::ExistingFiles || !(QGuiApplication::keyboardModifiers() & Qt::CTRL)) { + q->accept(); + } } } -- cgit v1.2.3 From 75087198306d615c7df1fb3763c5027834f0b99c Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 19 Feb 2013 12:09:12 +0100 Subject: Avoid potential crash when changing styles with stylesheet This is not always reproducible, but it probably crashed because QStyleSheetStyle::polish() can do some nasty things such as creating and deleting objects, which can leave the list with dangling QObject pointers. However, it should not delete QWidgets, so we make sure we only have a list of QWidgets before we perform the polish iteration. Change-Id: I84c1ca6a7316e72348248ff056b65dcbae3d20a3 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstylesheetstyle.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 6b9b96c171..7087e2a5ca 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2605,14 +2605,17 @@ static void updateObjects(const QList& objects) styleSheetCaches->renderRulesCache.remove(object); } } - for (int i = 0; i < objects.size(); ++i) { - QObject *object = const_cast(objects.at(i)); - if (object == 0) - continue; - if (QWidget *widget = qobject_cast(object)) - widget->style()->polish(widget); - QEvent event(QEvent::StyleChange); - QApplication::sendEvent(object, &event); + + QWidgetList widgets; + foreach (const QObject *object, objects) { + if (QWidget *w = qobject_cast(const_cast(object))) + widgets << w; + } + + QEvent event(QEvent::StyleChange); + foreach (QWidget *widget, widgets) { + widget->style()->polish(widget); + QApplication::sendEvent(widget, &event); } } -- cgit v1.2.3 From fcef9b42520c55f6482e4a6c86bd55246a85e88b Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Mon, 18 Feb 2013 11:29:45 -0600 Subject: Fix generated pkg-config files when cross-compiling The Libs: line of the pkg-config files is constructed by taking the name of the .pc file itself, and stripping off the path and extension. However, the code which does this does not handle path separators correctly when the target OS and local OS are different. To get around this, the custom string manipulation was replaced with a call to QFileInfo::completeBaseName(), which can handle the different path separators correctly. Task-number: QTBUG-29700 Change-Id: Ia817b415d303b249f56fcc3d1f073cae99c43046 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index b001fd930b..55c819657a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3158,11 +3158,8 @@ MakefileGenerator::pkgConfigFixPath(QString path) const void MakefileGenerator::writePkgConfigFile() { - QString fname = pkgConfigFileName(), lname = fname; + QString fname = pkgConfigFileName(); mkdir(fileInfo(fname).path()); - int slsh = lname.lastIndexOf(Option::dir_sep); - if(slsh != -1) - lname = lname.right(lname.length() - slsh - 1); QFile ft(fname); if(!ft.open(QIODevice::WriteOnly)) return; @@ -3249,7 +3246,7 @@ MakefileGenerator::writePkgConfigFile() pkgConfiglibName = "-framework " + bundle + " "; } else { pkgConfiglibDir = "-L${libdir}"; - pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length()); + pkgConfiglibName = "-l" + fileInfo(fname).completeBaseName(); if (project->isActiveConfig("shared")) pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString(); } -- cgit v1.2.3 From c90626f189d5a3942d1e240d30121a2bdafde454 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 20 Feb 2013 12:53:41 +0100 Subject: QMacStyle::drawControl(CE_ProgressBar): add missing null pointer check Do not spin off progress bar animations if QStyleOption::styleObject is not set. Task-number: QTBUG-29748 Change-Id: I4e17a4892e82cae48250afa7a270b15ca5730f46 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index bb9230804c..5d83804d51 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4259,7 +4259,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (isIndeterminate || tdi.value < tdi.max) { if (QProgressStyleAnimation *animation = qobject_cast(d->animation(opt->styleObject))) tdi.trackInfo.progress.phase = animation->animationStep(); - else + else if (opt->styleObject) d->startAnimation(new QProgressStyleAnimation(d->animateSpeed(QMacStylePrivate::AquaProgressBar), opt->styleObject)); } else { d->stopAnimation(opt->styleObject); -- cgit v1.2.3 From a595ac15cd723dbfcdc5a9d4c318334d959a06f9 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 18 Feb 2013 13:55:37 +0100 Subject: Doc: Document example manifest files in QDoc manual Adds documentation for example manifest files and the related qdoc configuration command \manifestmeta into QDoc manual. Change-Id: I6a627698ab14f57c9a117b6d4b794f352959f5ac Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- src/tools/qdoc/doc/qdoc-manual.qdoc | 93 +++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/tools/qdoc/doc/qdoc-manual.qdoc b/src/tools/qdoc/doc/qdoc-manual.qdoc index 4d70faa968..b715b200bf 100644 --- a/src/tools/qdoc/doc/qdoc-manual.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual.qdoc @@ -65,6 +65,7 @@ \li \l {C++ Specific Configuration Variables} \li \l {HTML Specific Configuration Variables} \li \l {Supporting Derived Projects} + \li \l {Example Manifest Files} \li \l {qt.qdocconf} \li \l {minimum.qdocconf} \li \l {Generating DITA XML Output} @@ -7154,6 +7155,7 @@ \li \l {22-qdoc-configuration-generalvariables.html#images.fileextensions-variable} {images.fileextensions} \li \l {22-qdoc-configuration-generalvariables.html#language-variable} {language} \li \l {22-qdoc-configuration-generalvariables.html#macro-variable} {macro} + \li \l {22-qdoc-configuration-generalvariables.html#manifestmeta-variable} {manifestmeta} \li \l {22-qdoc-configuration-generalvariables.html#outputdir-variable} {outputdir} \li \l {22-qdoc-configuration-generalvariables.html#outputformats-variable} {outputformats} \li \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} {sourcedirs} @@ -7850,6 +7852,14 @@ See also \l {alias-variable} {alias}. + \target manifestmeta-variable + \section1 manifestmeta + + The \c manifestmeta variable specifies additional meta-content + for the example manifest files generated by QDoc. + + See the \l{Manifest Meta Content} section for more information. + \target naturallanguage-variable \section1 naturallanguage @@ -8472,6 +8482,7 @@ \page 25-qdoc-configuration-derivedprojects.html \previouspage HTML Specific Configuration Variables \contentspage QDoc Manual + \nextpage Example Manifest Files \title Supporting Derived Projects @@ -8609,6 +8620,88 @@ write a new document. */ +/*! + \page 26-qdoc-configuration-example-manifest-files.html + \previouspage Supporting Derived Projects + \contentspage QDoc Manual + + \title Example Manifest Files + + QDoc generates XML files that contain information about all documented + examples and demos. These files, named \c {examples-manifest.xml} and + \c {demos-manifest.xml}, are used by Qt Creator to present a list of + examples in its welcome screen and to link to their documentation. + + \section1 Manifest XML Structure + + A manifest file has the following structure: + + \code + + + + + + analog,clock,window + gui/analogclock/main.cpp + + ... + + + \endcode + + Each \c {} element contains information about a name, + description, the location of the project file and documentation, + as well as a list of tags associated with the example. + + \target metacontent + \section1 Manifest Meta Content + + It is possible to augment the manifest files with additional + meta-content - that is, extra attributes and tags for selected + examples, using the \c manifestmeta configuration command. + + One use case for meta-content is highlighting a number of prominent + examples. Another is improving search functionality by adding + relevant keywords as tags for a certain category of examples. + + The examples for which meta-content is applied to is specified using + one or more filters. Matching examples to filters is done based on + names, with each example name prefixed with a module name and a + slash. Simple wildcard matching is supported; by using \c {*} at the + end it's possible to match multiple examples with a single string. + + Example: + + \code + manifestmeta.filters = highlighted sql webkit global + + manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example" \ + "QtWidgets/Analog Clock Example" + manifestmeta.highlighted.attributes = isHighlighted:true + + manifestmeta.sql.names = "QtSql/*" + manifestmeta.sql.tags = database,sql + + manifestmeta.webkit.names = "QtWebKitExamples/*" + manifestmeta.webkit.tags = webkit + + manifestmeta.global.names = * + manifestmeta.global.tags = qt5 + \endcode + + Above, an \c isHighlighted attribute is added to two examples. If + the attribute value is omitted, QDoc uses the string \c {true} by + default. Extra tags are added for Qt WebKit and Qt SQL examples, and + another tag is applied to all examples by using just \c {*} as the + match string. +*/ + /*! \page 27-qdoc-commands-alphabetical.html \previouspage Introduction to QDoc -- cgit v1.2.3 From 04441152117d5be78b87034421445c1f509f71fb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Feb 2013 18:17:13 +0100 Subject: fix libexec configure.exe status line Change-Id: I22b4c07a3d39ab2f3288d0872a0ccaff45b0c153 Reviewed-by: Joerg Bornemann --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 966571be77..d9e3340c70 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3430,7 +3430,7 @@ void Configure::displayConfig() sout << "Libraries installed to......" << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBS"]) << endl; sout << "Arch-dep. data to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_ARCHDATA"]) << endl; sout << "Plugins installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << endl; - sout << "Library execs installed to.." << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBEXEC"]) << endl; + sout << "Library execs installed to.." << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBEXECS"]) << endl; sout << "QML1 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << endl; sout << "QML2 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_QML"]) << endl; sout << "Binaries installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_BINS"]) << endl; -- cgit v1.2.3 From 218179ce2febc54d0fbcee388c810b592a4820cd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 19 Feb 2013 17:41:52 +0100 Subject: don't suppress building examples in non-prefix builds these have no (useful) install target, so it makes no sense to reduce the "build" to installing sources. suppressing the actual build can be achieved with -nomake examples instead. conversely, as the build dir is the install dir, people actually need to be able to (selectively) build examples in there. Task-number: QTBUG-29756 Change-Id: I98f34235442b552e51c0d5f5cec96a3eab4f1e7f Reviewed-by: Andy Shaw Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_example_installs.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf index ccb19fcbd4..04d7a17ab9 100644 --- a/mkspecs/features/qt_example_installs.prf +++ b/mkspecs/features/qt_example_installs.prf @@ -93,8 +93,8 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples) !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) { + # Do not actually build the examples in production builds with -prefix + !equals(TEMPLATE, subdirs):prefix_build:!contains(QT_CONFIG, private_tests) { TEMPLATE = aux CONFIG -= have_target qt staticlib dll SOURCES = -- cgit v1.2.3 From 67f20d66e4f8895492fad0944403a4947263ec5a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Feb 2013 13:53:46 +0100 Subject: remove pointless conditionals and expansions from qtLibraryTarget() this function is called only from library TEMPLATEs, and always with exactly one word as the only argument. Change-Id: I6282e3826791f89e6cf89dde625c8166e4e56028 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_functions.prf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index bac7ca1751..055be775f1 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -19,10 +19,7 @@ defineReplace(qtLibraryTarget) { MAJOR_VERSION = $$section(VERSION, ., 0, 0) LIBRARY_NAME ~= s,^Qt,Qt$$MAJOR_VERSION, } - unset(LIBRARY_SUFFIX) - contains(TEMPLATE, .*lib):LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() - isEmpty(LIBRARY_SUFFIX):return($$LIBRARY_NAME) - else:return($$member(LIBRARY_NAME, 0)$$LIBRARY_SUFFIX) + return($$LIBRARY_NAME$$qtPlatformTargetSuffix()) } defineTest(qtAddLibrary) { -- cgit v1.2.3 From 23762682c1e685fb93182031cf71f96d24d0f3f4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Feb 2013 14:20:29 +0100 Subject: simplify qtAddModule() by using $$qtPlatformTargetSuffix() Change-Id: I02b6c1eb2db0c8a36c50b1ec3c79dea215fba03a Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_functions.prf | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 055be775f1..478c255836 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -105,12 +105,7 @@ defineTest(qtAddModule) { isEmpty(LINKAGE) { !isEmpty(MODULE_LIBS_ADD): LINKAGE = -L$$MODULE_LIBS_ADD - lib = - if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32: lib = $${MODULE_NAME}$${QT_LIBINFIX}d - mac: lib = $${MODULE_NAME}$${QT_LIBINFIX}_debug - } - isEmpty(lib): lib = $${MODULE_NAME}$${QT_LIBINFIX} + lib = $${MODULE_NAME}$${QT_LIBINFIX}$$qtPlatformTargetSuffix() LINKAGE += -l$$lib contains(QT_CONFIG, rpath): QMAKE_RPATHDIR *= $$eval(QT.$${1}.rpath) -- cgit v1.2.3 From 3fdfde294ff0cfc09501e2d944043187e7e530c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Feb 2013 17:37:21 +0100 Subject: add -skip option to the configures this makes it possible to exclude modules from the build without moving their sources out of the way. substitutes the much-requested -no-webkit. not adding a symmetrical option, as it is relatively pointless: to build only specific "leaf" modules, you only need to run "make module-qt ..." once you configured. and removing particular "intermediate" modules is achieved with this very option. Task-number: QTBUG-26697 Change-Id: I25cebdbd029885a2c653c4cde696f9bb78691768 Reviewed-by: Tuukka Turunen Reviewed-by: Joerg Bornemann --- configure | 16 +++++++++++++++- dist/changes-5.0.2 | 3 +++ tools/configure/configureapp.cpp | 21 ++++++++++++++++++++- tools/configure/configureapp.h | 1 + tools/configure/main.cpp | 2 ++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4a1836e5b0..360e58dc2d 100755 --- a/configure +++ b/configure @@ -777,6 +777,7 @@ CFG_SQL_AVAILABLE= QT_DEFAULT_BUILD_PARTS="libs tools examples" CFG_BUILD_PARTS="" CFG_NOBUILD_PARTS="" +CFG_SKIP_MODULES="" CFG_RELEASE_QMAKE=no CFG_AUDIO_BACKEND=auto CFG_V8SNAPSHOT=auto @@ -995,7 +996,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style options that pass an argument - -prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-libexecdir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-qmldir|-archdatadir|-datadir|-libdir|-bindir|-libexecdir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-skip|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa|-qconfig) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1288,6 +1289,14 @@ while [ "$#" -gt 0 ]; do make) CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL" ;; + skip) + VAL=qt${VAL#qt} + if ! [ -d $relpath/../$VAL ]; then + echo "Attempting to skip non-existent module $VAL." >&2 + exit 1 + fi + CFG_SKIP_MODULES="$CFG_SKIP_MODULES $VAL" + ;; sdk) if [ "$BUILD_ON_MAC" = "yes" ]; then CFG_SDK="$VAL" @@ -3193,6 +3202,8 @@ Additional options: ($QT_DEFAULT_BUILD_PARTS) -nomake ..... Exclude part from the list of parts to be built. + -skip ..... Exclude an entire module from the build. + -no-gui ............ Don't build the Qt GUI module and dependencies. + -gui ............... Build the Qt GUI module and dependencies. @@ -6084,6 +6095,9 @@ QTMODULE="$outpath/mkspecs/qmodule.pri" echo "CONFIG += $QMAKE_CONFIG" >> "$QTMODULE.tmp" echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp" +if [ -n "$CFG_SKIP_MODULES" ]; then + echo "QT_SKIP_MODULES += $CFG_SKIP_MODULES" >> "$QTMODULE.tmp" +fi if [ -n "$QT_CFLAGS_PSQL" ]; then echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp" diff --git a/dist/changes-5.0.2 b/dist/changes-5.0.2 index 5e170a35be..108512a98a 100644 --- a/dist/changes-5.0.2 +++ b/dist/changes-5.0.2 @@ -22,6 +22,9 @@ information about a particular change. General Improvements -------------------- + - [QTBUG-26697] The -skip option was added to configure, which enables not + building particular modules. Typical use case: -skip webkit. + Third party components ---------------------- diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d9e3340c70..af470939e9 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1011,6 +1011,20 @@ void Configure::parseCmdLine() nobuildParts.append(configCmdLine.at(i)); } + else if (configCmdLine.at(i) == "-skip") { + ++i; + if (i == argCount) + break; + QString mod = configCmdLine.at(i); + if (!mod.startsWith(QStringLiteral("qt"))) + mod.insert(0, QStringLiteral("qt")); + if (!QFileInfo(sourcePath + "/../" + mod).isDir()) { + cout << "Attempting to skip non-existent module " << mod << "." << endl; + dictionary["DONE"] = "error"; + } + skipModules += mod; + } + // Directories ---------------------------------------------- else if (configCmdLine.at(i) == "-prefix") { ++i; @@ -1647,6 +1661,8 @@ bool Configure::displayHelp() desc( "", qPrintable(QString(" %1").arg(defaultBuildParts.at(i))), false, ' '); desc( "-nomake ", "Exclude part from the list of parts to be built.\n"); + desc( "-skip ", "Exclude an entire module from the build.\n"); + desc("WIDGETS", "no", "-no-widgets", "Disable Qt Widgets module.\n"); desc("ACCESSIBILITY", "no", "-no-accessibility", "Disable accessibility support.\n"); @@ -2778,7 +2794,10 @@ void Configure::generateCachefile() if (moduleFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file. QTextStream moduleStream(&moduleFile); - moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl << endl; + moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl; + if (!skipModules.isEmpty()) + moduleStream << "QT_SKIP_MODULES += " << skipModules.join(' ') << endl; + moduleStream << endl; if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE") moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl; diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 271a384be7..3cb5de8520 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -116,6 +116,7 @@ private: QStringList defaultBuildParts; QStringList buildParts; QStringList nobuildParts; + QStringList skipModules; QStringList licensedModules; QStringList allSqlDrivers; QStringList allConfigs; diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 1b402b1a59..c4154c8f38 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -58,6 +58,8 @@ int runConfigure( int argc, char** argv ) #if !defined(EVAL) app.validateArgs(); #endif + if (!app.isOk()) + return 3; if( app.displayHelp() ) return 1; -- cgit v1.2.3 From d3a4230757931a704f36dd1eb4917a5ce61f80b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 12 Feb 2013 12:32:29 +0100 Subject: Make QVector instances counter thread safe Change-Id: I7c7aa1eb0f8e91c43023882a3734e908be4ba4fe Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qvector/tst_qvector.cpp | 201 ++++++++++++----------- 1 file changed, 101 insertions(+), 100 deletions(-) diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 7c1e22689e..c5ed44b952 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include +#include #include struct Movable { @@ -47,21 +48,21 @@ struct Movable { : i(input) , state(Constructed) { - ++counter; + counter.fetchAndAddRelaxed(1); } Movable(const Movable &other) : i(other.i) , state(Constructed) { check(other.state, Constructed); - ++counter; + counter.fetchAndAddRelaxed(1); } ~Movable() { check(state, Constructed); i = 0; - --counter; + counter.fetchAndAddRelaxed(-1); state = Destructed; } @@ -80,7 +81,7 @@ struct Movable { return *this; } char i; - static int counter; + static QAtomicInt counter; private: enum State { Constructed = 106, Destructed = 110 }; State state; @@ -91,7 +92,7 @@ private: } }; -int Movable::counter = 0; +QAtomicInt Movable::counter = 0; QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE); QT_END_NAMESPACE @@ -103,21 +104,21 @@ struct Custom { , that(this) , state(Constructed) { - ++counter; + counter.fetchAndAddRelaxed(1); } Custom(const Custom &other) : that(this) , state(Constructed) { check(&other); - ++counter; + counter.fetchAndAddRelaxed(1); this->i = other.i; } ~Custom() { check(this); i = 0; - --counter; + counter.fetchAndAddRelaxed(-1); state = Destructed; } @@ -135,7 +136,7 @@ struct Custom { i = other.i; return *this; } - static int counter; + static QAtomicInt counter; char i; // used to identify orgin of an instance private: @@ -151,7 +152,7 @@ private: QCOMPARE(c->state, Constructed); } }; -int Custom::counter = 0; +QAtomicInt Custom::counter = 0; Q_DECLARE_METATYPE(Custom); @@ -415,16 +416,16 @@ void tst_QVector::copyConstructorInt() const void tst_QVector::copyConstructorMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); copyConstructor(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::copyConstructorCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); copyConstructor(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -465,16 +466,16 @@ void tst_QVector::addInt() const void tst_QVector::addMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); add(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::addCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); add(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -523,16 +524,16 @@ void tst_QVector::appendInt() const void tst_QVector::appendMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); append(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::appendCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); append(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::at() const @@ -602,16 +603,16 @@ void tst_QVector::capacityInt() const void tst_QVector::capacityMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); capacity(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::capacityCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); capacity(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -633,16 +634,16 @@ void tst_QVector::clearInt() const void tst_QVector::clearMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); clear(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::clearCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); clear(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::constData() const @@ -717,16 +718,16 @@ void tst_QVector::countInt() const void tst_QVector::countMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); count(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::countCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); count(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::data() const @@ -771,16 +772,16 @@ void tst_QVector::emptyInt() const void tst_QVector::emptyMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); empty(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::emptyCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); empty(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::endsWith() const @@ -826,16 +827,16 @@ void tst_QVector::eraseEmptyInt() const void tst_QVector::eraseEmptyMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); eraseEmpty(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::eraseEmptyCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); eraseEmpty(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -863,16 +864,16 @@ void tst_QVector::eraseEmptyReservedInt() const void tst_QVector::eraseEmptyReservedMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); eraseEmptyReserved(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::eraseEmptyReservedCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); eraseEmptyReserved(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -986,30 +987,30 @@ void tst_QVector::eraseIntShared() const void tst_QVector::eraseMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); erase(false); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::eraseMovableShared() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); erase(true); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::eraseCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); erase(false); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::eraseCustomShared() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); erase(true); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template void tst_QVector::eraseReserved() const @@ -1062,16 +1063,16 @@ void tst_QVector::eraseReservedInt() const void tst_QVector::eraseReservedMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); eraseReserved(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::eraseReservedCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); eraseReserved(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -1102,16 +1103,16 @@ void tst_QVector::fillInt() const void tst_QVector::fillMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); fill(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::fillCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); fill(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::first() const @@ -1152,16 +1153,16 @@ void tst_QVector::fromListInt() const void tst_QVector::fromListMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); fromList(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::fromListCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); fromList(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::fromStdVector() const @@ -1338,16 +1339,16 @@ void tst_QVector::prependInt() const void tst_QVector::prependMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); prepend(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::prependCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); prepend(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -1374,16 +1375,16 @@ void tst_QVector::removeInt() const void tst_QVector::removeMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); remove(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::removeCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); remove(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::resizePOD_data() const @@ -1510,7 +1511,7 @@ void tst_QVector::resizeComplexMovable_data() const void tst_QVector::resizeComplexMovable() const { - const int items = Movable::counter; + const int items = Movable::counter.loadAcquire(); { QFETCH(QVector, vector); QFETCH(int, size); @@ -1529,7 +1530,7 @@ void tst_QVector::resizeComplexMovable() const QCOMPARE(vector.size(), 0); QVERIFY(vector.capacity() <= capacity); } - QCOMPARE(items, Movable::counter); + QCOMPARE(items, Movable::counter.loadAcquire()); } void tst_QVector::resizeComplex_data() const @@ -1585,7 +1586,7 @@ void tst_QVector::resizeComplex_data() const void tst_QVector::resizeComplex() const { - const int items = Custom::counter; + const int items = Custom::counter.loadAcquire(); { QFETCH(QVector, vector); QFETCH(int, size); @@ -1604,12 +1605,12 @@ void tst_QVector::resizeComplex() const QVERIFY(vector.isEmpty()); QVERIFY(vector.capacity() <= capacity); } - QCOMPARE(Custom::counter, items); + QCOMPARE(Custom::counter.loadAcquire(), items); } void tst_QVector::resizeCtorAndDtor() const { - const int items = Custom::counter; + const int items = Custom::counter.loadAcquire(); { QVector null; QVector empty(0, '0'); @@ -1631,7 +1632,7 @@ void tst_QVector::resizeCtorAndDtor() const nonEmpty.resize(0); nonEmptyReserved.resize(2); } - QCOMPARE(Custom::counter, items); + QCOMPARE(Custom::counter.loadAcquire(), items); } template @@ -1661,16 +1662,16 @@ void tst_QVector::sizeInt() const void tst_QVector::sizeMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); size(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::sizeCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); size(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } // ::squeeze() is tested in ::capacity(). @@ -1720,16 +1721,16 @@ void tst_QVector::swapInt() const void tst_QVector::swapMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); swap(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::swapCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); swap(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::toList() const @@ -1947,16 +1948,16 @@ void tst_QVector::initializeListInt() void tst_QVector::initializeListMovable() { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); initializeList(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::initializeListCustom() { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); initializeList(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } void tst_QVector::const_shared_null() @@ -2084,16 +2085,16 @@ void tst_QVector::setSharableInt() void tst_QVector::setSharableMovable() { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); setSharable(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::setSharableCustom() { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); setSharable(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } template @@ -2200,16 +2201,16 @@ void tst_QVector::detachInt() const void tst_QVector::detachMovable() const { - const int instancesCount = Movable::counter; + const int instancesCount = Movable::counter.loadAcquire(); detach(); - QCOMPARE(instancesCount, Movable::counter); + QCOMPARE(instancesCount, Movable::counter.loadAcquire()); } void tst_QVector::detachCustom() const { - const int instancesCount = Custom::counter; + const int instancesCount = Custom::counter.loadAcquire(); detach(); - QCOMPARE(instancesCount, Custom::counter); + QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } QTEST_APPLESS_MAIN(tst_QVector) -- cgit v1.2.3 From dacc222d5a3327fb27d69e57d99111cdf9084304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 12 Feb 2013 14:08:48 +0100 Subject: Fix QVector detaching in one thread while another destroys it. The patch adds handling for a case when a QVector is shared between two threads. In such scenario detaching in one thread could collide with destruction in the other one, causing a memory leak or assert in debug mode. Task-number: QTBUG-29134 Change-Id: Idbff250d9cfc6cf83174954ea91dbf41f8ea4aa4 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/tools/qvector.h | 3 +- tests/auto/corelib/tools/qvector/tst_qvector.cpp | 78 +++++++++++++++++++++++- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 191be6292c..94f3008274 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -506,8 +506,7 @@ void QVector::reallocData(const int asize, const int aalloc, QArrayData::Allo } if (d != x) { if (!d->ref.deref()) { - Q_ASSERT(!isShared); - if (QTypeInfo::isStatic || !aalloc) { + if (QTypeInfo::isStatic || !aalloc || (isShared && QTypeInfo::isComplex)) { // data was copy constructed, we need to call destructors // or if !alloc we did nothing to the old 'd'. freeData(d); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index c5ed44b952..7738a2c797 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include #include struct Movable { @@ -272,6 +274,9 @@ private slots: void detachInt() const; void detachMovable() const; void detachCustom() const; + void detachThreadSafetyInt() const; + void detachThreadSafetyMovable() const; + void detachThreadSafetyCustom() const; private: template void copyConstructor() const; @@ -295,6 +300,7 @@ private: template void setSharable_data() const; template void setSharable() const; template void detach() const; + template void detachThreadSafety() const; }; @@ -2213,5 +2219,75 @@ void tst_QVector::detachCustom() const QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } -QTEST_APPLESS_MAIN(tst_QVector) +static QAtomicPointer > detachThreadSafetyDataInt; +static QAtomicPointer > detachThreadSafetyDataMovable; +static QAtomicPointer > detachThreadSafetyDataCustom; + +template QAtomicPointer > *detachThreadSafetyData(); +template<> QAtomicPointer > *detachThreadSafetyData() { return &detachThreadSafetyDataInt; } +template<> QAtomicPointer > *detachThreadSafetyData() { return &detachThreadSafetyDataMovable; } +template<> QAtomicPointer > *detachThreadSafetyData() { return &detachThreadSafetyDataCustom; } + +static QSemaphore detachThreadSafetyLock; + +template +void tst_QVector::detachThreadSafety() const +{ + delete detachThreadSafetyData()->fetchAndStoreOrdered(new QVector(SimpleValue::vector(400))); + + static const uint threadsCount = 5; + + struct : QThread { + void run() Q_DECL_OVERRIDE + { + QVector copy(*detachThreadSafetyData()->load()); + QVERIFY(!copy.isDetached()); + detachThreadSafetyLock.release(); + detachThreadSafetyLock.acquire(100); + copy.detach(); + } + } threads[threadsCount]; + + for (uint i = 0; i < threadsCount; ++i) + threads[i].start(); + QThread::yieldCurrentThread(); + detachThreadSafetyLock.acquire(threadsCount); + + // destroy static original data + delete detachThreadSafetyData()->fetchAndStoreOrdered(0); + + QVERIFY(threadsCount < 100); + detachThreadSafetyLock.release(threadsCount * 100); + QThread::yieldCurrentThread(); + + for (uint i = 0; i < threadsCount; ++i) + threads[i].wait(); +} + +void tst_QVector::detachThreadSafetyInt() const +{ + for (uint i = 0; i < 128; ++i) + detachThreadSafety(); +} + +void tst_QVector::detachThreadSafetyMovable() const +{ + const int instancesCount = Movable::counter.loadAcquire(); + for (uint i = 0; i < 128; ++i) { + detachThreadSafety(); + QCOMPARE(Movable::counter.loadAcquire(), instancesCount); + } +} + +void tst_QVector::detachThreadSafetyCustom() const +{ + const int instancesCount = Custom::counter.loadAcquire(); + for (uint i = 0; i < 128; ++i) { + detachThreadSafety(); + QCOMPARE(Custom::counter.loadAcquire(), instancesCount); + } +} + + +QTEST_MAIN(tst_QVector) #include "tst_qvector.moc" -- cgit v1.2.3 From 2cb22c6cc01627700ebfb8d2528ab4f700917a9b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Feb 2013 12:03:32 +0100 Subject: qdoc: QML Inheritance is not resolved correctly. This change adds some QML property, signal, and method data to the .index file. It also provides more robust resolving of QML inheritance for qml types. Task-number: QTBUG-29778 Change-Id: Iaefd64227913a19f427b21e904ca5e32c82d7b29 Reviewed-by: Jerome Pasion --- src/tools/qdoc/cppcodemarker.cpp | 18 ++++--- src/tools/qdoc/ditaxmlgenerator.cpp | 5 +- src/tools/qdoc/htmlgenerator.cpp | 5 +- src/tools/qdoc/node.cpp | 11 +++-- src/tools/qdoc/node.h | 30 ++++++++++-- src/tools/qdoc/qdocdatabase.cpp | 96 +++++++++++++++++++++++++++++++++---- src/tools/qdoc/qdocdatabase.h | 1 + src/tools/qdoc/qdocindexfiles.cpp | 54 ++++++++++++++++++--- src/tools/qdoc/qmlvisitor.cpp | 41 +++++++++++----- src/tools/qdoc/qmlvisitor.h | 3 +- 10 files changed, 215 insertions(+), 49 deletions(-) diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index c85c5c64ef..ff7d9254fc 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1287,17 +1287,15 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno } ++c; } - const DocNode* dn = current->qmlBaseNode(); - if (dn) { - if (dn->subType() == Node::QmlClass) - current = static_cast(dn); - else { - dn->doc().location().warning(tr("Base class of QML class '%1' is ambgiguous").arg(current->name())); - current = 0; - } + current = current->qmlBaseNode(); + while (current) { + if (current->isAbstract()) + break; + if (current->isInternal()) + current = current->qmlBaseNode(); + else + break; } - else - current = 0; } append(sections, all, true); } diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 22694dd0d3..21bbdafaf5 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -4198,7 +4198,10 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* qcn, CodeMarker* { if (!qcn) return; - const DocNode* base = qcn->qmlBaseNode(); + const QmlClassNode* base = qcn->qmlBaseNode(); + while (base && base->isInternal()) { + base = base->qmlBaseNode(); + } if (base) { writeStartTag(DT_qmlInherits); //writeStartTag(DT_qmlTypeDef); diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 2666f10eb4..69d1a69d31 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -3870,7 +3870,10 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* qcn, CodeMarker* mar { if (!qcn) return; - const DocNode* base = qcn->qmlBaseNode(); + const QmlClassNode* base = qcn->qmlBaseNode(); + while (base && base->isInternal()) { + base = base->qmlBaseNode(); + } if (base) { Text text; text << Atom::ParaLeft << "Inherits "; diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 5fbdb487db..abb348eb51 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -2161,10 +2161,13 @@ void QmlClassNode::subclasses(const QString& base, NodeList& subs) This function splits \a arg on the blank character to get a QML module name and version number. It then spilts the version number on the '.' character to get a major version number and - a minor vrsion number. Both version numbers must be present. - It stores these components separately. If all three are found, - true is returned. If any of the three is not found or is not - correct, false is returned. + a minor vrsion number. Both major the major and minor version + numbers should be present, but the minor version number is not + absolutely necessary. + + It stores the three components separately in this node. If all + three are found, true is returned. If any of the three is not + found or is not in the correct format, false is returned. */ bool Node::setQmlModuleInfo(const QString& arg) { diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index ecb3c5771e..f76b115416 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -65,7 +65,6 @@ typedef QList NodeList; typedef QMap NodeMap; typedef QMultiMap NodeMultiMap; typedef QMultiMap ExampleNodeMap; -typedef QList > ImportList; class Node { @@ -206,7 +205,7 @@ public: virtual bool hasProperty(const QString& ) const { return false; } virtual void getMemberNamespaces(NodeMap& ) { } virtual void getMemberClasses(NodeMap& ) { } - bool isInternal() const; + virtual bool isInternal() const; bool isIndexNode() const { return indexNodeFlag_; } bool wasSeen() const { return seen_; } Type type() const { return nodeType_; } @@ -530,6 +529,26 @@ private: QString imageFileName_; }; +struct ImportRec { + QString name_; // module name + QString version_; // . + QString importId_; // "as" name + QString importUri_; // subdirectory of module directory + + ImportRec(const QString& name, + const QString& version, + const QString& importId, + const QString& importUri) + : name_(name), version_(version), importId_(importId), importUri_(importUri) { } + QString& name() { return name_; } + QString& version() { return version_; } + QString& importId() { return importId_; } + QString& importUri() { return importUri_; } + bool isEmpty() const { return name_.isEmpty(); } +}; + +typedef QList ImportList; + class QmlClassNode : public DocNode { public: @@ -543,12 +562,13 @@ public: virtual void clearCurrentChild(); virtual bool isAbstract() const { return abstract_; } virtual void setAbstract(bool b) { abstract_ = b; } + virtual bool isInternal() const { return (status() == Internal); } const ImportList& importList() const { return importList_; } void setImportList(const ImportList& il) { importList_ = il; } const QString& qmlBaseName() const { return baseName_; } void setQmlBaseName(const QString& name) { baseName_ = name; } - const DocNode* qmlBaseNode() const { return baseNode_; } - void setQmlBaseNode(DocNode* b) { baseNode_ = b; } + const QmlClassNode* qmlBaseNode() const { return baseNode_; } + void setQmlBaseNode(QmlClassNode* b) { baseNode_ = b; } void requireCppClass() { cnodeRequired_ = true; } bool cppClassRequired() const { return cnodeRequired_; } static void addInheritedBy(const QString& base, Node* sub); @@ -564,7 +584,7 @@ private: bool cnodeRequired_; ClassNode* cnode_; QString baseName_; - DocNode* baseNode_; + QmlClassNode* baseNode_; ImportList importList_; }; diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 4208d529c8..256bc62dd2 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -291,18 +291,29 @@ DocNode* QDocDatabase::addToModule(const QString& name, Node* node) */ DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node) { + QString longQmid, shortQmid; + QStringList dotSplit; + QStringList blankSplit = name.split(QLatin1Char(' ')); + if (blankSplit.size() > 1) { + longQmid = blankSplit[0] + blankSplit[1]; + dotSplit = blankSplit[1].split(QLatin1Char('.')); + shortQmid = blankSplit[0] + dotSplit[0]; + } DocNode* dn = findQmlModule(name); dn->addMember(node); node->setQmlModuleInfo(name); if (node->subType() == Node::QmlClass) { - QString t = node->qmlModuleIdentifier() + "::" + node->name(); QmlClassNode* n = static_cast(node); - if (!qmlTypeMap_.contains(t)) - qmlTypeMap_.insert(t,n); - if (!masterMap_.contains(t)) - masterMap_.insert(t,node); - if (!masterMap_.contains(node->name(),node)) - masterMap_.insert(node->name(),node); + QString key = longQmid + "::" + node->name(); + for (int i=0; i<2; ++i) { + if (!qmlTypeMap_.contains(key)) + qmlTypeMap_.insert(key,n); + if (!masterMap_.contains(key)) + masterMap_.insert(key,node); + if (!masterMap_.contains(node->name(),node)) + masterMap_.insert(node->name(),node); + key = shortQmid + "::" + node->name(); + } } return dn; } @@ -332,7 +343,45 @@ QmlClassNode* QDocDatabase::findQmlType(const QString& qmid, const QString& name } } return 0; +} +/*! + Looks up the QML type node identified by the Qml module id + constructed from the strings in the \a import record and the + QML type \a name and returns a pointer to the QML type node. + If a QML type node is not found, 0 is returned. + */ +QmlClassNode* QDocDatabase::findQmlType(const ImportRec& import, const QString& name) const +{ + if (!import.isEmpty()) { + QStringList dotSplit; + dotSplit = name.split(QLatin1Char('.')); + QString qmName; + if (import.importUri_.isEmpty()) + qmName = import.name_; + else + qmName = import.importUri_; + for (int i=0; i 1) { + int dot = import.version_.lastIndexOf(QChar('.')); + if (dot > 0) { + qmid = import.name_ + import.version_.left(dot); + qualifiedName = qmid + "::" + dotSplit[i]; + qcn = qmlTypeMap_.value(qualifiedName); + if (qcn) { + return qcn; + } + } + } + } + } + return 0; } /*! @@ -836,14 +885,23 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root) if (child->type() == Node::Document && child->subType() == Node::QmlClass) { QmlClassNode* qcn = static_cast(child); if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) { - QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName()); + QmlClassNode* bqcn = 0; + const ImportList& imports = qcn->importList(); + for (int i=0; iqmlBaseName()); + if (bqcn) + break; + } + if (bqcn == 0) { + bqcn = findQmlType(QString(), qcn->qmlBaseName()); + } if (bqcn) { qcn->setQmlBaseNode(bqcn); } #if 0 else { - qDebug() << "Unable to resolve QML base type:" << qcn->qmlBaseName() - << "for QML type:" << qcn->name(); + qDebug() << "Temporary error message (ignore): UNABLE to resolve QML base type:" + << qcn->qmlBaseName() << "for QML type:" << qcn->name(); } #endif } @@ -851,6 +909,24 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root) } } +#if 0 +void QDocDatabase::resolveQmlInheritance(InnerNode* root) +{ + // Dop we need recursion? + foreach (Node* child, root->childNodes()) { + if (child->type() == Node::Document && child->subType() == Node::QmlClass) { + QmlClassNode* qcn = static_cast(child); + if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) { + QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName()); + if (bqcn) { + qcn->setQmlBaseNode(bqcn); + } + } + } + } +} +#endif + /*! */ void QDocDatabase::resolveTargets(InnerNode* root) diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index 9c6810941d..19dde361f8 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -107,6 +107,7 @@ class QDocDatabase DocNode* addToQmlModule(const QString& name, Node* node); QmlClassNode* findQmlType(const QString& qmid, const QString& name) const; + QmlClassNode* findQmlType(const ImportRec& import, const QString& name) const; void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 358c2a14d9..63d8639d0f 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -190,6 +190,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, ((element.nodeName() == "page") && (element.attribute("subtype") == "qmlclass"))) { QmlClassNode* qcn = new QmlClassNode(parent, name); qcn->setTitle(element.attribute("title")); + QString qmlModuleName = element.attribute("qml-module-name"); + QString qmlModuleVersion = element.attribute("qml-module-version"); + qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn); if (element.hasAttribute("location")) name = element.attribute("location", QString()); if (!indexUrl.isEmpty()) @@ -209,6 +212,31 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, location = Location(name); node = qbtn; } + else if (element.nodeName() == "qmlproperty") { + QmlClassNode* qcn = static_cast(parent); + QString type = element.attribute("type"); + bool attached = false; + if (element.attribute("attached") == "true") + attached = true; + bool readonly = false; + if (element.attribute("writable") == "false") + readonly = true; + QmlPropertyNode* qpn = new QmlPropertyNode(qcn, name, type, attached); + qpn->setReadOnly(readonly); + node = qpn; + } + else if ((element.nodeName() == "qmlmethod") || + (element.nodeName() == "qmlsignal") || + (element.nodeName() == "qmlsignalhandler")) { + Node::Type t = Node::QmlMethod; + if (element.nodeName() == "qmlsignal") + t = Node::QmlSignal; + else if (element.nodeName() == "qmlsignalhandler") + t = Node::QmlSignalHandler; + bool attached = false; + FunctionNode* fn = new FunctionNode(t, parent, name, attached); + node = fn; + } else if (element.nodeName() == "page") { Node::SubType subtype; Node::PageType ptype = Node::NoPageType; @@ -476,17 +504,22 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, InnerNode* inner = static_cast(node); QDomElement child = element.firstChildElement(); while (!child.isNull()) { - if (element.nodeName() == "class") + if (element.nodeName() == "class") { readIndexSection(child, inner, indexUrl); - else if (element.nodeName() == "qmlclass") + } + else if (element.nodeName() == "qmlclass") { readIndexSection(child, inner, indexUrl); - else if (element.nodeName() == "page") + } + else if (element.nodeName() == "page") { readIndexSection(child, inner, indexUrl); - else if (element.nodeName() == "namespace" && !name.isEmpty()) + } + else if (element.nodeName() == "namespace" && !name.isEmpty()) { // The root node in the index is a namespace with an empty name. readIndexSection(child, inner, indexUrl); - else + } + else { readIndexSection(child, parent, indexUrl); + } child = child.nextSiblingElement(); } } @@ -562,6 +595,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, return false; QString nodeName; + QString qmlModuleName; + QString qmlModuleVersion; switch (node->type()) { case Node::Namespace: nodeName = "namespace"; @@ -571,8 +606,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, break; case Node::Document: nodeName = "page"; - if (node->subType() == Node::QmlClass) + if (node->subType() == Node::QmlClass) { nodeName = "qmlclass"; + qmlModuleName = node->qmlModuleName(); + qmlModuleVersion = node->qmlModuleVersion(); + } else if (node->subType() == Node::QmlBasicType) nodeName = "qmlbasictype"; break; @@ -687,6 +725,10 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("status", status); writer.writeAttribute("name", objName); + if (!qmlModuleName.isEmpty()) { + writer.writeAttribute("qml-module-name", qmlModuleName); + writer.writeAttribute("qml-module-version", qmlModuleVersion); + } QString fullName = node->fullDocumentName(); if (fullName != objName) writer.writeAttribute("fullname", fullName); diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 15af03d9ba..8b6f81de3e 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -373,6 +373,24 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, } } +/*! + Reconstruct the qualified \a id using dot notation + and return the fully qualified string. + */ +QString QmlDocVisitor::getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id) +{ + QString result; + if (id) { + result = id->name.toString(); + id = id->next; + while (id != 0) { + result += QChar('.') + id->name.toString(); + id = id->next; + } + } + return result; +} + /*! Begin the visit of the object \a definition, recording it in the qdoc database. Increment the object nesting level, which is used @@ -381,7 +399,7 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation, */ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition) { - QString type = definition->qualifiedTypeNameId->name.toString(); + QString type = getFullyQualifiedId(definition->qualifiedTypeNameId); nestingLevel++; if (current->type() == Node::Namespace) { @@ -420,17 +438,18 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition) */ bool QmlDocVisitor::visit(QQmlJS::AST::UiImportList *imports) { - QQmlJS::AST::UiImport* imp = imports->import; - quint32 length = imp->versionToken.offset - imp->fileNameToken.offset - 1; - QString module = document.mid(imp->fileNameToken.offset,length); - QString version = document.mid(imp->versionToken.offset, imp->versionToken.length); - if (version.size() > 1) { - int dot = version.lastIndexOf(QChar('.')); - if (dot > 0) - version = version.left(dot); + while (imports != 0) { + QQmlJS::AST::UiImport* imp = imports->import; + + QString name = document.mid(imp->fileNameToken.offset, imp->fileNameToken.length); + if (name[0] == '\"') + name = name.mid(1, name.length()-2); + QString version = document.mid(imp->versionToken.offset, imp->versionToken.length); + QString importId = document.mid(imp->importIdToken.offset, imp->importIdToken.length); + QString importUri = getFullyQualifiedId(imp->importUri); + importList.append(ImportRec(name, version, importId, importUri)); + imports = imports->next; } - importList.append(QPair(module, version)); - return true; } diff --git a/src/tools/qdoc/qmlvisitor.h b/src/tools/qdoc/qmlvisitor.h index 172aca579a..bfec61eb34 100644 --- a/src/tools/qdoc/qmlvisitor.h +++ b/src/tools/qdoc/qmlvisitor.h @@ -97,6 +97,7 @@ public: void endVisit(QQmlJS::AST::UiQualifiedId *); private: + QString getFullyQualifiedId(QQmlJS::AST::UiQualifiedId *id); QQmlJS::AST::SourceLocation precedingComment(quint32 offset) const; bool applyDocumentation(QQmlJS::AST::SourceLocation location, Node *node); void applyMetacommands(QQmlJS::AST::SourceLocation location, Node* node, Doc& doc); @@ -110,7 +111,7 @@ private: QString filePath; QString name; QString document; - QList > importList; + ImportList importList; QSet commands; QSet topics; QSet usedComments; -- cgit v1.2.3 From c816a338f7facf00da85ae9d1546bc5906784760 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 20 Feb 2013 07:26:03 -0800 Subject: Doc: Update image in QPainter class reference docs The code snippet demonstrating the use of drawText() was already updated to use the text 'Qt Project' - update the image accordingly. Task-number: QTBUG-29784 Change-Id: Iea5e729bd26df2d8ab6a02bb7ea804494e554a28 Reviewed-by: Friedemann Kleint --- src/gui/doc/images/qpainter-text.png | Bin 1391 -> 1185 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/gui/doc/images/qpainter-text.png b/src/gui/doc/images/qpainter-text.png index e95c965d7b..e1b11d0790 100644 Binary files a/src/gui/doc/images/qpainter-text.png and b/src/gui/doc/images/qpainter-text.png differ -- cgit v1.2.3 From 20dbad1bbf59495b52bccf6ad44965e3953c72a3 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 20 Feb 2013 12:18:40 +0100 Subject: Emit which role actually changed Change-Id: I596a81628e5553779986a94769e114d89a44b264 Reviewed-by: Stephen Kelly --- src/corelib/itemmodels/qstringlistmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index 73fdd9eb97..c6fabfcaee 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -189,7 +189,7 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value, if (index.row() >= 0 && index.row() < lst.size() && (role == Qt::EditRole || role == Qt::DisplayRole)) { lst.replace(index.row(), value.toString()); - emit dataChanged(index, index); + emit dataChanged(index, index, QVector() << role); return true; } return false; -- cgit v1.2.3 From 70f6652ebd7153b4a381c30756e3e76fc3cab562 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 19 Feb 2013 23:51:31 +0100 Subject: Forward the 3rd parameter of dataChanged Change-Id: I94f893bf65cd150c3cb1099c91cb13882bcca79a Reviewed-by: Stephen Kelly --- src/corelib/itemmodels/qidentityproxymodel.cpp | 14 ++++---- src/corelib/itemmodels/qidentityproxymodel.h | 2 +- .../tst_qidentityproxymodel.cpp | 38 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index 3dbe93b21a..c36473a21f 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -74,7 +74,7 @@ class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles); void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); void _q_sourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint); @@ -371,8 +371,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) this, SLOT(_q_sourceModelAboutToBeReset())); disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(_q_sourceModelReset())); - disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); + disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); disconnect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList,QAbstractItemModel::LayoutChangeHint)), @@ -412,8 +412,8 @@ void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) SLOT(_q_sourceModelAboutToBeReset())); connect(sourceModel(), SIGNAL(modelReset()), SLOT(_q_sourceModelReset())); - connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); + connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), + SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); connect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); connect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList,QAbstractItemModel::LayoutChangeHint)), @@ -480,12 +480,12 @@ void QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(const QModelIndex &pare q->endRemoveColumns(); } -void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) +void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true); Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true); Q_Q(QIdentityProxyModel); - q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight)); + q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles); } void QIdentityProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last) diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h index da40836dd0..4125683f77 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.h +++ b/src/corelib/itemmodels/qidentityproxymodel.h @@ -102,7 +102,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)) Q_PRIVATE_SLOT(d_func(), void _q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)) - Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex)) + Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(QModelIndex,QModelIndex,QVector)) Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)) Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList &sourceParents, QAbstractItemModel::LayoutChangeHint hint)) diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index c7e4664007..f750b7a9d4 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -46,6 +46,20 @@ #include "dynamictreemodel.h" #include "qidentityproxymodel.h" +class DataChangedModel : public QAbstractListModel +{ +public: + int rowCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 1; } + QVariant data(const QModelIndex&, int) const { return QVariant(); } + QModelIndex index(int row, int column, const QModelIndex &) const { return createIndex(row, column); } + + void changeData() + { + const QModelIndex idx = index(0, 0, QModelIndex()); + Q_EMIT dataChanged(idx, idx, QVector() << 1); + } +}; + class tst_QIdentityProxyModel : public QObject { Q_OBJECT @@ -63,6 +77,7 @@ private slots: void removeRows(); void moveRows(); void reset(); + void dataChanged(); protected: void verifyIdentity(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex()); @@ -79,6 +94,7 @@ tst_QIdentityProxyModel::tst_QIdentityProxyModel() void tst_QIdentityProxyModel::initTestCase() { + qRegisterMetaType >(); m_model = new QStandardItemModel(0, 1); m_proxy = new QIdentityProxyModel(); } @@ -326,5 +342,27 @@ void tst_QIdentityProxyModel::reset() m_proxy->setSourceModel(0); } +void tst_QIdentityProxyModel::dataChanged() +{ + DataChangedModel model; + m_proxy->setSourceModel(&model); + + verifyIdentity(&model); + + QSignalSpy modelSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + QSignalSpy proxySpy(m_proxy, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector))); + + QVERIFY(modelSpy.isValid()); + QVERIFY(proxySpy.isValid()); + + model.changeData(); + + QCOMPARE(modelSpy.first().at(2).value >(), QVector() << 1); + QVERIFY(modelSpy.first().at(2) == proxySpy.first().at(2)); + + verifyIdentity(&model); + m_proxy->setSourceModel(0); +} + QTEST_MAIN(tst_QIdentityProxyModel) #include "tst_qidentityproxymodel.moc" -- cgit v1.2.3 From ec166aaa70d5451d84caf0a1ae984cacecd88d5b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 20 Feb 2013 17:53:54 -0800 Subject: Add qcore_mac_p.h to the list of headers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3a8db99166a34c15c19b142a05bf81ababb2eeb8 Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/kernel.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index d2de873cef..34e32a721d 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -92,6 +92,8 @@ mac { } mac:!nacl { + HEADERS += \ + kernel/qcore_mac_p.h SOURCES += \ kernel/qcore_mac.cpp OBJECTIVE_SOURCES += \ -- cgit v1.2.3 From b05f19f23217ebf982f021c71a04b1df73827c35 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 19 Feb 2013 16:56:30 +0100 Subject: moc: Fix infinite recursion in macro substitution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When performing macro argument substitution, one should keep the set of macro to exclude, else we can enter an infinite recursion. Testcase: #define M1(A) A #define M2 M1(M2) Task-number: QTBUG-29759 Change-Id: I564bbfed65e1c8599592eaf12c6d67285d2fd9ce Reviewed-by: Simon Hausmann Reviewed-by: Jędrzej Nowacki --- src/tools/moc/preprocessor.cpp | 7 +++++-- src/tools/moc/preprocessor.h | 3 ++- src/tools/moc/symbols.h | 15 ++++++++++++++- tests/auto/tools/moc/parse-defines.h | 5 +++++ tests/auto/tools/moc/tst_moc.cpp | 4 +++- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 96b920b7cd..8f4b84a9c8 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -536,12 +537,14 @@ static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode m return symbols; } -Symbols Preprocessor::macroExpand(Preprocessor *that, Symbols &toExpand, int &index, int lineNum, bool one) +Symbols Preprocessor::macroExpand(Preprocessor *that, Symbols &toExpand, int &index, + int lineNum, bool one, const QSet &excludeSymbols) { SymbolStack symbols; SafeSymbols sf; sf.symbols = toExpand; sf.index = index; + sf.excludedSymbols = excludeSymbols; symbols.push(sf); Symbols result; @@ -664,7 +667,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym if (i == macro.symbols.size() - 1 || macro.symbols.at(i + 1).token != PP_HASHHASH) { Symbols arg = arguments.at(index); int idx = 1; - expansion += macroExpand(that, arg, idx, lineNum, false); + expansion += macroExpand(that, arg, idx, lineNum, false, symbols.excludeSymbols()); } else { expansion += arguments.at(index); } diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h index 55e452a2bd..72d02a3292 100644 --- a/src/tools/moc/preprocessor.h +++ b/src/tools/moc/preprocessor.h @@ -85,7 +85,8 @@ public: void substituteUntilNewline(Symbols &substituted); static Symbols macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName); - static Symbols macroExpand(Preprocessor *that, Symbols &toExpand, int &index, int lineNum, bool one); + static Symbols macroExpand(Preprocessor *that, Symbols &toExpand, int &index, int lineNum, bool one, + const QSet &excludeSymbols = QSet()); int evaluateCondition(); diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h index 35d4ed6ec9..b588cd5beb 100644 --- a/src/tools/moc/symbols.h +++ b/src/tools/moc/symbols.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Olivier Goffart ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -134,6 +135,7 @@ typedef QVector Symbols; struct SafeSymbols { Symbols symbols; QByteArray expandedMacro; + QSet excludedSymbols; int index; }; @@ -159,6 +161,7 @@ public: inline QByteArray unquotedLexem() { return symbol().unquotedLexem(); } bool dontReplaceSymbol(const QByteArray &name); + QSet excludeSymbols(); }; inline bool SymbolStack::test(Token token) @@ -178,12 +181,22 @@ inline bool SymbolStack::test(Token token) inline bool SymbolStack::dontReplaceSymbol(const QByteArray &name) { for (int i = 0; i < size(); ++i) { - if (name == at(i).expandedMacro) + if (name == at(i).expandedMacro || at(i).excludedSymbols.contains(name)) return true; } return false; } +inline QSet SymbolStack::excludeSymbols() +{ + QSet set; + for (int i = 0; i < size(); ++i) { + set << at(i).expandedMacro; + set += at(i).excludedSymbols; + } + return set; +} + QT_END_NAMESPACE #endif // SYMBOLS_H diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index 3e5841835d..f12899e368 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -76,6 +76,9 @@ #endif +#define PD_ADD_SUFFIX(x) PD_DEFINE1(x,_SUFFIX) +#define PD_DEFINE_ITSELF PD_ADD_SUFFIX(PD_DEFINE_ITSELF) + PD_BEGIN_NAMESPACE class PD_CLASSNAME : public QObject @@ -128,6 +131,8 @@ public slots: void conditionSlot() {} #endif + void PD_DEFINE_ITSELF(int) {} + }; #undef QString diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index f0d1934a93..ee82dc0652 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -2772,7 +2772,6 @@ void tst_Moc::parseDefines() } if (!qstrcmp(mci.name(), "TestString2")) { ++count; - qDebug() << mci.value(); QVERIFY(!qstrcmp(mci.value(), "ParseDefine")); } if (!qstrcmp(mci.name(), "TestString3")) { @@ -2781,6 +2780,9 @@ void tst_Moc::parseDefines() } } QVERIFY(count == 3); + + index = mo->indexOfSlot("PD_DEFINE_ITSELF_SUFFIX(int)"); + QVERIFY(index != -1); } void tst_Moc::preprocessorOnly() -- cgit v1.2.3 From 057fabab7cbcb6b278771e1336c3a82f64106b2d Mon Sep 17 00:00:00 2001 From: Cyril Oblikov Date: Wed, 20 Feb 2013 17:19:15 +0300 Subject: Hiding scrollbar on MacOSX 10.7 if policy is set to ScrollBarAlwaysOff On Mac OS X 10.7 (if System Preferences -> General -> Show scroll bar is "When scrolling") scroll bar was shown even if policy was set to ScrollBarAlwaysOff. This is a regression from 5.0.0. Change-Id: I161b350874c085a1397df7b398af8f3fb0fbeacf Reviewed-by: Gabriel de Dietrich Reviewed-by: Jens Bache-Wiig --- src/widgets/widgets/qabstractscrollarea.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 24a92f383e..391a06917c 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -329,13 +329,13 @@ void QAbstractScrollAreaPrivate::layoutChildren() { Q_Q(QAbstractScrollArea); bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); - bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn && !transient) + bool needh = (hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !transient) || ((hbarpolicy == Qt::ScrollBarAsNeeded || transient) - && hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty()); + && hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty())); - bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn && !transient) + bool needv = (vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !transient) || ((vbarpolicy == Qt::ScrollBarAsNeeded || transient) - && vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty()); + && vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty())); QStyleOption opt(0); opt.init(q); @@ -1456,9 +1456,9 @@ void QAbstractScrollAreaPrivate::flashScrollBars() { Q_Q(QAbstractScrollArea); bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); - if (hbarpolicy == Qt::ScrollBarAsNeeded || transient) + if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || transient)) hbar->d_func()->flash(); - if (vbarpolicy == Qt::ScrollBarAsNeeded || transient) + if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || transient)) vbar->d_func()->flash(); } -- cgit v1.2.3 From 7477d50fce9a0008ff4e050285e146ebc0c1e163 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Feb 2013 20:00:28 +0100 Subject: Populate the cmake variables only one time. Since we're only including the Extras file one time, invoking set() for the include dirs again will overwrite the addition of include dirs in the extras file. We only need to populate these variables if not set anyway, so do that. Change-Id: I04dad0674778e79c8c12c18231b8ce6c92edf881 Reviewed-by: Alexander Neundorf Reviewed-by: Stephen Kelly --- .../features/data/cmake/Qt5BasicConfig.cmake.in | 127 +++++++++++---------- .../test_multiple_find_package/CMakeLists.txt | 4 + .../auto/cmake/test_multiple_find_package/main.cpp | 47 ++++++++ .../subdir1/CMakeLists.txt | 3 + 4 files changed, 118 insertions(+), 63 deletions(-) create mode 100644 tests/auto/cmake/test_multiple_find_package/main.cpp diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 51d66822ae..334c15a715 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -16,69 +16,6 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION) set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME}) -!!IF !no_module_headers -!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) -set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\") -set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" - \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" -) -!!ELSE -set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\") -set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS - \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" - \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" -) -!!ENDIF -!!ELSE -set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS) -set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) -!!ENDIF - -set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE}) -set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINE}) - -set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") - -set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED) -if (Qt5$${CMAKE_MODULE_NAME}_FIND_REQUIRED) - set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED REQUIRED) -endif() -set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_QUIET) -if (Qt5$${CMAKE_MODULE_NAME}_FIND_QUIETLY) - set(_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET QUIET) -endif() - -foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES}) - if (NOT Qt5${_module_dep}_FOUND) - find_package(Qt5${_module_dep} - ${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET} - ${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED} - PATHS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}\" NO_DEFAULT_PATH - ) - endif() - - if (NOT Qt5${_module_dep}_FOUND) - set(Qt5$${CMAKE_MODULE_NAME}_FOUND False) - return() - endif() - - list(APPEND Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${Qt5${_module_dep}_INCLUDE_DIRS}\") - list(APPEND Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}\") - list(APPEND Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS}) - list(APPEND Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS}) - list(APPEND Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS}) -endforeach() -list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS) -list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) -list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS) -list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS) -if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) - list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) -endif() - -set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\") - macro(_populate_imported_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) @@ -107,6 +44,70 @@ macro(_populate_imported_target_properties Configuration LIB_LOCATION IMPLIB_LOC endmacro() if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) + +!!IF !no_module_headers +!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) + set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\") + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS + \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" + \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" + ) +!!ELSE + set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\") + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS + \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}\" + \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/${Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING}/$${MODULE_INCNAME}\" + ) +!!ENDIF +!!ELSE + set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS) + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) +!!ENDIF + + set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE}) + set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINE}) + + set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") + + set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED) + if (Qt5$${CMAKE_MODULE_NAME}_FIND_REQUIRED) + set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED REQUIRED) + endif() + set(_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_QUIET) + if (Qt5$${CMAKE_MODULE_NAME}_FIND_QUIETLY) + set(_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET QUIET) + endif() + + foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES}) + if (NOT Qt5${_module_dep}_FOUND) + find_package(Qt5${_module_dep} + ${_Qt5$${CMAKE_MODULE_NAME}_DEPENDENCIES_FIND_QUIET} + ${_Qt5$${CMAKE_MODULE_NAME}_FIND_DEPENDENCIES_REQUIRED} + PATHS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}\" NO_DEFAULT_PATH + ) + endif() + + if (NOT Qt5${_module_dep}_FOUND) + set(Qt5$${CMAKE_MODULE_NAME}_FOUND False) + return() + endif() + + list(APPEND Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${Qt5${_module_dep}_INCLUDE_DIRS}\") + list(APPEND Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}\") + list(APPEND Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS}) + list(APPEND Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS}) + list(APPEND Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS}) + endforeach() + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS) + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS) + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS) + if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) + endif() + + set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\") + !!IF !isEmpty(CMAKE_STATIC_TYPE) add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX") diff --git a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt index dfac4ca3be..c0fdfd6b9a 100644 --- a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt +++ b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt @@ -5,5 +5,9 @@ project(test_multiple_find_package) find_package(Qt5Core REQUIRED) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + add_subdirectory(subdir1) +add_executable(exe1 "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp") +include_directories(${Qt5Core_INCLUDE_DIRS}) diff --git a/tests/auto/cmake/test_multiple_find_package/main.cpp b/tests/auto/cmake/test_multiple_find_package/main.cpp new file mode 100644 index 0000000000..82f1109395 --- /dev/null +++ b/tests/auto/cmake/test_multiple_find_package/main.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite 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 + +int main(int,char**) +{ + return 0; +} diff --git a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt index 86c05f5de5..0c7a113f50 100644 --- a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt +++ b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt @@ -1,2 +1,5 @@ find_package(Qt5Core REQUIRED) + +add_executable(exe2 "${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp") +include_directories(${Qt5Core_INCLUDE_DIRS}) -- cgit v1.2.3 From 7661e39c022f76da34fcd5d38ecb93c86e01f1b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 20 Feb 2013 09:48:17 +0100 Subject: Create module-specific internal cmake macros This ensures that invoking the macro from a different module (operating on a different target) is not possible. Change-Id: Idbcd41d03172a8f1dcea26954464ab981fce8879 Reviewed-by: Stephen Kelly --- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 334c15a715..ef41862634 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -16,7 +16,7 @@ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION) set(Qt5$${CMAKE_MODULE_NAME}_LIBRARIES Qt5::$${CMAKE_MODULE_NAME}) -macro(_populate_imported_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION) +macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration}) set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES @@ -120,9 +120,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !isEmpty(CMAKE_DEBUG_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_imported_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) !!ELSE - _populate_imported_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) @@ -141,9 +141,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_imported_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) !!ELSE - _populate_imported_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() !!ENDIF // CMAKE_RELEASE_TYPE @@ -153,9 +153,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!IF !isEmpty(CMAKE_RELEASE_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_imported_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) !!ELSE - _populate_imported_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) @@ -174,9 +174,9 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_imported_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) !!ELSE - _populate_imported_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() !!ENDIF // CMAKE_DEBUG_TYPE -- cgit v1.2.3 From d7ae34fdfde61838ce1e4fb13a945832841f61ab Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 21 Feb 2013 18:53:36 +0100 Subject: List the Release library before the Debug library in cmake files. This way, the Release library is chosen if Qt is configured to build both debug and release, and if the consumer configuration is not an exact match for 'Debug'. This means that RelWithDebInfo and MinSizeRel, which are 'standard' configurations in CMake with mulit-configuration generators, will use the Release version of Qt. All other configurations will also use the Release version, unless MAP_IMPORTED_CONFIG_ is used as described in: http://doc-snapshot.qt-project.org/5.0/qtdoc/cmake-manual.html and in the cmake documentation: http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:MAP_IMPORTED_CONFIG_CONFIG Task-number: QTBUG-29186 Change-Id: Ifc11a9e19fcb304297c204e34a3b25c510329767 Reviewed-by: Brad King Reviewed-by: Stephen Kelly --- .../features/data/cmake/Qt5BasicConfig.cmake.in | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index ef41862634..d70dbedbf4 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -118,71 +118,71 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1) !!ENDIF -!!IF !isEmpty(CMAKE_DEBUG_TYPE) +!!IF !isEmpty(CMAKE_RELEASE_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) !!ELSE - _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) -!!IF isEmpty(CMAKE_RELEASE_TYPE) +!!IF isEmpty(CMAKE_DEBUG_TYPE) !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ELSE - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" AND EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" AND EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ELSE !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ELSE - if (EXISTS \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" AND EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + if (EXISTS \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" AND EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) !!ELSE - _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() -!!ENDIF // CMAKE_RELEASE_TYPE +!!ENDIF // CMAKE_DEBUG_TYPE !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD -!!ENDIF // CMAKE_DEBUG_TYPE +!!ENDIF // CMAKE_RELEASE_TYPE -!!IF !isEmpty(CMAKE_RELEASE_TYPE) +!!IF !isEmpty(CMAKE_DEBUG_TYPE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) !!ELSE - _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD) -!!IF isEmpty(CMAKE_DEBUG_TYPE) +!!IF isEmpty(CMAKE_RELEASE_TYPE) !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ELSE - if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" AND EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" AND EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ELSE !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ELSE - if (EXISTS \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" AND EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + if (EXISTS \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" AND EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD !!ENDIF !!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD) - _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" ) !!ELSE - _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" ) + _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" ) !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD endif() -!!ENDIF // CMAKE_DEBUG_TYPE +!!ENDIF // CMAKE_RELEASE_TYPE !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD -!!ENDIF // CMAKE_RELEASE_TYPE +!!ENDIF // CMAKE_DEBUG_TYPE !!IF !isEmpty(CMAKE_MODULE_EXTRAS) include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\") -- cgit v1.2.3 From 1aa09f985985b4424073de6b9c0909c7270b5cb6 Mon Sep 17 00:00:00 2001 From: Richard Brinkman Date: Fri, 22 Feb 2013 09:02:31 +0100 Subject: ADD: -confirm-license option in output of configure --help Task-number: QTBUG-25185 Change-Id: I1578a023a8b4c030aaf4cd191203d5c28b950a0b Reviewed-by: Oswald Buddenhagen --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index 360e58dc2d..4bd39f5d11 100755 --- a/configure +++ b/configure @@ -3095,6 +3095,9 @@ Configure options: -opensource ........ Compile and link the Open-Source Edition of Qt. -commercial ........ Compile and link the Commercial Edition of Qt. + -confirm-license.... Automatically acknowledge the license (use with + either -opensource or -commercial) + -no-c++11 .......... Do not compile Qt with C++11 support enabled. + -c++11 ............. Compile Qt with C++11 support enabled. -- cgit v1.2.3 From ff05c481387afcd84516a9d11671dff0f5705a28 Mon Sep 17 00:00:00 2001 From: Richard Brinkman Date: Wed, 20 Feb 2013 13:18:10 +0100 Subject: FIX: misleading -(no)make option in configure --help Clarify in the configure --help documentation that the text between parentheses in the -make option indicates the default parts, not all the parts that can be chosen from. Task-number: QTBUG-28826 Change-Id: Iac9cf294b8054823ecfaf262aeafab7779ce4c8b Reviewed-by: Oswald Buddenhagen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 4bd39f5d11..3d511e3d72 100755 --- a/configure +++ b/configure @@ -3202,7 +3202,7 @@ Third Party Libraries: Additional options: -make ....... Add part to the list of parts to be built at make time. - ($QT_DEFAULT_BUILD_PARTS) + (defaults to: $QT_DEFAULT_BUILD_PARTS) -nomake ..... Exclude part from the list of parts to be built. -skip ..... Exclude an entire module from the build. -- cgit v1.2.3 From 298f0b65736adf21572fab022b71dfd18c847aec Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 22 Feb 2013 13:07:24 +0100 Subject: Fix indentation. Change-Id: I7d5e5549b265507f412c991087ebbec8f6abcc0c Reviewed-by: Oswald Buddenhagen --- mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index d70dbedbf4..2940ad9dc1 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -103,7 +103,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS) if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) - list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) endif() set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\") -- cgit v1.2.3 From bfce04fe5bef507ed1360198d1b0b71665aa8a25 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 21 Feb 2013 12:53:06 +0100 Subject: doc: QML Inheritance is not resolved correctly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qdoc did not resolve QML Inheritance correctly and the result was that QML inheritance was not shown correctly in the documentation. Part of the problem was that information was missing for QML types in the .index files produced by qdoc. qdoc also did not show inheritance properly when one of its base types was marked internal. These problems have now been fixed. This update also fixes the problem that caused qdoc to slow down to a snail's pace over time. The group members list for certain group pages was getting longer and longer, because qdoc added the same member to the member list an additional time every time qdoc was run in -prepare mode if you didn't clear the index files first. Now, qdoc only adds a member to the member list if it isn't already in the member list. Task-number: QTBUG-29778 Change-Id: Ie4f0458a2ea4ceb1a64cdcd7f60f16b124a20790 Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- src/tools/qdoc/cppcodemarker.cpp | 9 ++++----- src/tools/qdoc/node.cpp | 24 ++++++++++++++++++++++++ src/tools/qdoc/node.h | 4 +++- src/tools/qdoc/qdocdatabase.cpp | 15 ++++++++++----- src/tools/qdoc/qdocindexfiles.cpp | 7 +++++++ 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index ff7d9254fc..f0cfc18515 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1259,7 +1259,6 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno } else { FastSection all(qmlClassNode,QString(),QString(),"member","members"); - const QmlClassNode* current = qmlClassNode; while (current != 0) { NodeList::ConstIterator c = current->childNodes().constBegin(); @@ -1271,9 +1270,9 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno if ((*p)->type() == Node::QmlProperty) { QString key = current->name() + "::" + (*p)->name(); key = sortName(*p, &key); - if (!all.memberMap.contains(key)) + if (!all.memberMap.contains(key)) { all.memberMap.insert(key,*p); - //insert(all,*p,style,Okay); + } } ++p; } @@ -1281,9 +1280,9 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno else { QString key = current->name() + "::" + (*c)->name(); key = sortName(*c, &key); - if (!all.memberMap.contains(key)) + if (!all.memberMap.contains(key)) { all.memberMap.insert(key,*c); - //insert(all,*c,style,Okay); + } } ++c; } diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index abb348eb51..c293d48673 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -661,6 +661,16 @@ bool InnerNode::hasMembers() const return !members_.isEmpty(); } +/*! + Appends \a node to the members list, if and only if it + isn't already in the members list. + */ +void InnerNode::addMember(Node* node) +{ + if (!members_.contains(node)) + members_.append(node); +} + /*! Returns true if this node's members collection contains at least one namespace node. @@ -2187,6 +2197,20 @@ bool Node::setQmlModuleInfo(const QString& arg) return false; } +/*! + If this QML type node has a base type node, + return the fully qualified name of that QML + type, i.e. ::. + */ +QString QmlClassNode::qmlFullBaseName() const +{ + QString result; + if (baseNode_) { + result = baseNode_->qmlModuleIdentifier() + "::" + baseNode_->name(); + } + return result; +} + /*! The name of this QML class node might be the same as the name of some other QML class node. If so, then this node's diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index f76b115416..4802b6de54 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -240,6 +240,7 @@ public: QString guid() const; QString extractClassName(const QString &string) const; virtual QString qmlTypeName() const { return name_; } + virtual QString qmlFullBaseName() const { return QString(); } virtual QString qmlModuleName() const { return qmlModuleName_; } virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; } virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; } @@ -332,7 +333,7 @@ public: const NodeList & childNodes() const { return children_; } const NodeList & relatedNodes() const { return related_; } - virtual void addMember(Node* node) { members_.append(node); } + virtual void addMember(Node* node); const NodeList& members() const { return members_; } virtual bool hasMembers() const; virtual bool hasNamespaces() const; @@ -563,6 +564,7 @@ public: virtual bool isAbstract() const { return abstract_; } virtual void setAbstract(bool b) { abstract_ = b; } virtual bool isInternal() const { return (status() == Internal); } + virtual QString qmlFullBaseName() const; const ImportList& importList() const { return importList_; } void setImportList(const ImportList& il) { importList_ = il; } const QString& qmlBaseName() const { return baseName_; } diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 256bc62dd2..58c674de7a 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -886,11 +886,16 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root) QmlClassNode* qcn = static_cast(child); if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) { QmlClassNode* bqcn = 0; - const ImportList& imports = qcn->importList(); - for (int i=0; iqmlBaseName()); - if (bqcn) - break; + if (qcn->qmlBaseName().contains("::")) { + bqcn = qmlTypeMap_.value(qcn->qmlBaseName()); + } + else { + const ImportList& imports = qcn->importList(); + for (int i=0; iqmlBaseName()); + if (bqcn) + break; + } } if (bqcn == 0) { bqcn = findQmlType(QString(), qcn->qmlBaseName()); diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 63d8639d0f..466742ee3a 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -193,6 +193,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, QString qmlModuleName = element.attribute("qml-module-name"); QString qmlModuleVersion = element.attribute("qml-module-version"); qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn); + QString qmlFullBaseName = element.attribute("qml-base-type"); + if (!qmlFullBaseName.isEmpty()) + qcn->setQmlBaseName(qmlFullBaseName); if (element.hasAttribute("location")) name = element.attribute("location", QString()); if (!indexUrl.isEmpty()) @@ -597,6 +600,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QString nodeName; QString qmlModuleName; QString qmlModuleVersion; + QString qmlFullBaseName; switch (node->type()) { case Node::Namespace: nodeName = "namespace"; @@ -610,6 +614,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, nodeName = "qmlclass"; qmlModuleName = node->qmlModuleName(); qmlModuleVersion = node->qmlModuleVersion(); + qmlFullBaseName = node->qmlFullBaseName(); } else if (node->subType() == Node::QmlBasicType) nodeName = "qmlbasictype"; @@ -728,6 +733,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!qmlModuleName.isEmpty()) { writer.writeAttribute("qml-module-name", qmlModuleName); writer.writeAttribute("qml-module-version", qmlModuleVersion); + if (!qmlFullBaseName.isEmpty()) + writer.writeAttribute("qml-base-type", qmlFullBaseName); } QString fullName = node->fullDocumentName(); if (fullName != objName) -- cgit v1.2.3 From 3dc634be36326bc5e60f3baa4c5b8904e22347f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 4 Jan 2013 12:50:40 +0100 Subject: Cocoa: Add basic support for Qt::SubWindow. This allows embedding a QWindow in a foreign NSView hierarchy. Don't create a NSWindow. Add code paths for handling the embedded window case. Avoid changing the other window cases. There is potential for merging some of these cases but that can be done at a later point in time. Change-Id: I54c7b4eb82fad268f90ea6b716fc650ae31bd3af Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.h | 2 ++ src/plugins/platforms/cocoa/qcocoawindow.mm | 9 +++++- src/plugins/platforms/cocoa/qnsview.mm | 46 ++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 324a43c8ae..931319190c 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -162,6 +162,8 @@ public: // for QNSView QNSView *m_contentView; NSWindow *m_nsWindow; + bool m_contentViewIsEmbedded; // true if the m_contentView is embedded in a "foregin" NSView hiearchy + QNSWindowDelegate *m_nsWindowDelegate; Qt::WindowFlags m_windowFlags; Qt::WindowState m_synchedWindowState; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 45100f9906..f7348e7dda 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -186,6 +186,7 @@ static bool isMouseEvent(NSEvent *ev) QCocoaWindow::QCocoaWindow(QWindow *tlw) : QPlatformWindow(tlw) , m_nsWindow(0) + , m_contentViewIsEmbedded(false) , m_nsWindowDelegate(0) , m_synchedWindowState(Qt::WindowActive) , m_windowModality(Qt::NonModal) @@ -237,6 +238,10 @@ void QCocoaWindow::setGeometry(const QRect &rect) void QCocoaWindow::setCocoaGeometry(const QRect &rect) { QCocoaAutoReleasePool pool; + + if (m_contentViewIsEmbedded) + return; + if (m_nsWindow) { NSRect bounds = qt_mac_flipRect(rect, window()); [m_nsWindow setContentSize : bounds.size]; @@ -634,7 +639,9 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow) m_nsWindowDelegate = 0; } - if (!parentWindow) { + if (window()->type() == Qt::SubWindow) { + // Subwindows don't have a NSWindow. + } else if (!parentWindow) { // Create a new NSWindow if this is a top-level window. m_nsWindow = createNSWindow(); setNSWindow(m_nsWindow); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1d59592e7d..02635ea4ec 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -173,6 +173,36 @@ static QTouchDevice *touchDevice = 0; QWindowSystemInterface::handleExposeEvent(m_window, m_window->geometry()); } +- (void)viewDidMoveToSuperview +{ + if (!(m_window->type() & Qt::SubWindow)) + return; + + if ([self superview]) { + m_platformWindow->m_contentViewIsEmbedded = true; + QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry()); + QWindowSystemInterface::handleExposeEvent(m_window, m_platformWindow->geometry()); + QWindowSystemInterface::flushWindowSystemEvents(); + } else { + m_platformWindow->m_contentViewIsEmbedded = false; + } +} + +- (void)viewWillMoveToWindow:(NSWindow *)newWindow +{ + // ### Merge "normal" window code path with this one for 5.1. + if (!(m_window->type() & Qt::SubWindow)) + return; + + if (newWindow) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowNotification:) + name:nil // Get all notifications + object:newWindow]; + } else { + [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:[self window]]; + } +} - (void)updateGeometry { QRect geometry; @@ -181,6 +211,9 @@ static QTouchDevice *touchDevice = 0; NSRect rect = [self frame]; NSRect windowRect = [[self window] frame]; geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height); + } else if (m_window->type() & Qt::SubWindow) { + // embedded child window, use the frame rect ### merge with case below + geometry = qt_mac_toQRect([self bounds]); } else { // child window, use the frame rect geometry = qt_mac_toQRect([self frame]); @@ -198,6 +231,12 @@ static QTouchDevice *touchDevice = 0; // an infinite loop when this notification is triggered again.) m_platformWindow->QPlatformWindow::setGeometry(geometry); + // Don't send the geometry change if the QWindow is designated to be + // embedded in a foregin view hiearchy but has not actually been + // embedded yet - it's too early. + if ((m_window->type() & Qt::SubWindow) && !m_platformWindow->m_contentViewIsEmbedded) + return; + // Send a geometry change event to Qt, if it's ready to handle events if (!m_platformWindow->m_inConstructor) { QWindowSystemInterface::handleGeometryChange(m_window, geometry); @@ -317,7 +356,12 @@ static QTouchDevice *touchDevice = 0; ); CGImageRef bsCGImage = m_backingStore->getBackingStoreCGImage(); CGImageRef cleanImg = CGImageCreateWithImageInRect(bsCGImage, backingStoreRect); - CGContextSetBlendMode(cgContext, kCGBlendModeCopy); + + // Optimization: Copy frame buffer content instead of blending for + // top-level windows where Qt fills the entire window content area. + if (m_platformWindow->m_nsWindow) + CGContextSetBlendMode(cgContext, kCGBlendModeCopy); + CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg); // Clean-up: -- cgit v1.2.3 From 1b08e0307dfebe561fbb0819a2d6b53edd8e8e93 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 20 Feb 2013 17:53:39 -0800 Subject: Don't assume that all CFPropertyListRef are CFArrayRefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We might need more robust code in the future. But at least for this case it looks like a CFStringRef is also a possibility. Task-number: QTBUG-29776 Change-Id: Iaf50835122fcbb7e6e9c7fbf65e31e6143b2bc54 Reviewed-by: Morten Johan Sørvig Reviewed-by: Denis Dzyubenko --- src/corelib/kernel/qcore_mac_p.h | 1 + src/corelib/tools/qlocale_mac.mm | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index c3a3afaf6c..cbbbc18814 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -106,6 +106,7 @@ public: return *this; } inline T *operator&() { return &type; } + template X as() const { return reinterpret_cast(type); } static QCFType constructFromGet(const T &t) { CFRetain(t); diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 0dc6f389b3..0c35860b56 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -434,18 +434,26 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case CurrencyToString: return macFormatCurrency(in.value()); case UILanguages: { - QCFType languages = (CFArrayRef)CFPreferencesCopyValue( + QCFType languages = (CFArrayRef)CFPreferencesCopyValue( CFSTR("AppleLanguages"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages); QStringList result; - result.reserve(cnt); - for (int i = 0; i < cnt; ++i) { - const QString lang = QCFString::toQString( - static_cast(CFArrayGetValueAtIndex(languages, i))); - result.append(lang); + CFTypeID typeId = CFGetTypeID(languages); + if (typeId == CFArrayGetTypeID()) { + const int cnt = CFArrayGetCount(languages.as()); + result.reserve(cnt); + for (int i = 0; i < cnt; ++i) { + const QString lang = QCFString::toQString( + static_cast(CFArrayGetValueAtIndex(languages.as(), i))); + result.append(lang); + } + } else if (typeId == CFStringGetTypeID()) { + result = QStringList(QCFString::toQString(languages.as())); + } else { + qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org", + qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId)))); } return QVariant(result); } -- cgit v1.2.3 From 4b54c553058f278cedf1d40edacdc488aaa54f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 4 Feb 2013 15:59:22 +0100 Subject: Fix OpenGL context creation in the XCB plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to create a core context with OpenGL implementations that don't implement the compatibility profile or the GL_ARB_compatibility extension. Qt was effectively clamping the OpenGL version to 3.0 by assuming that the highest supported backwards compatible version is also the highest supported core version. Since there is no way to check if the implementation supports a context with a given set of attributes without trying to create the context, we have to try every known OpenGL version until we find one that's supported. Note that this commit does not fix similar breakage on other platforms. Change-Id: I9616762b059db9e6182f853ab7f24ff44dc7d529 Reviewed-by: Sean Harmer Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qglxintegration.cpp | 213 +++++++------------------- src/plugins/platforms/xcb/qglxintegration.h | 15 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 1 - src/plugins/platforms/xcb/qxcbintegration.cpp | 29 +--- src/plugins/platforms/xcb/qxcbintegration.h | 10 -- 5 files changed, 56 insertions(+), 212 deletions(-) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 11c74edc45..2a6ef5a6ee 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -104,57 +104,6 @@ static Window createDummyWindow(QXcbScreen *screen, GLXFBConfig config) return window; } -// Per-window data for active OpenGL contexts. -struct QOpenGLContextData -{ - QOpenGLContextData(Display *display, Window window, GLXContext context) - : m_display(display), - m_window(window), - m_context(context) - {} - - QOpenGLContextData() - : m_display(0), - m_window(0), - m_context(0) - {} - - Display *m_display; - Window m_window; - GLXContext m_context; -}; - -static inline QOpenGLContextData currentOpenGLContextData() -{ - QOpenGLContextData result; - result.m_display = glXGetCurrentDisplay(); - result.m_window = glXGetCurrentDrawable(); - result.m_context = glXGetCurrentContext(); - return result; -} - -static inline QOpenGLContextData createDummyWindowOpenGLContextData(QXcbScreen *screen) -{ - QOpenGLContextData result; - result.m_display = DISPLAY_FROM_XCB(screen); - - QSurfaceFormat format; - GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen), screen->screenNumber(), format); - if (config) { - result.m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, true); - result.m_window = createDummyWindow(screen, config); - } else { - XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(screen), screen->screenNumber(), &format); - if (!visualInfo) - qFatal("Could not initialize GLX"); - result.m_context = glXCreateContext(DISPLAY_FROM_XCB(screen), visualInfo, 0, true); - result.m_window = createDummyWindow(screen, visualInfo); - XFree(visualInfo); - } - - return result; -} - static inline QByteArray getGlString(GLenum param) { if (const GLubyte *s = glGetString(param)) @@ -202,70 +151,7 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setProfile(QSurfaceFormat::CompatibilityProfile); } -/*! - \class QOpenGLTemporaryContext - \brief A temporary context that can be instantiated on the stack. - - Functions like glGetString() only work if there is a current GL context. - - \internal - \ingroup qt-lighthouse-xcb -*/ -class QOpenGLTemporaryContext -{ - Q_DISABLE_COPY(QOpenGLTemporaryContext) -public: - QOpenGLTemporaryContext(QXcbScreen *screen); - ~QOpenGLTemporaryContext(); - -private: - const QOpenGLContextData m_previous; - const QOpenGLContextData m_current; -}; - -QOpenGLTemporaryContext::QOpenGLTemporaryContext(QXcbScreen *screen) - : m_previous(currentOpenGLContextData()), - m_current(createDummyWindowOpenGLContextData(screen)) -{ - // Make our temporary context current on our temporary window - glXMakeCurrent(m_current.m_display, m_current.m_window, m_current.m_context); -} - -QOpenGLTemporaryContext::~QOpenGLTemporaryContext() -{ - // Restore the previous context if possible, otherwise just release our temporary context - if (m_previous.m_display) - glXMakeCurrent(m_previous.m_display, m_previous.m_window, m_previous.m_context); - else - glXMakeCurrent(m_current.m_display, 0, 0); - - // Destroy our temporary window - XDestroyWindow(m_current.m_display, m_current.m_window); - - // Finally destroy our temporary context itself - glXDestroyContext(m_current.m_display, m_current.m_context); -} - -QOpenGLDefaultContextInfo::QOpenGLDefaultContextInfo() - : vendor(getGlString(GL_VENDOR)), - renderer(getGlString(GL_RENDERER)) -{ - updateFormatFromContext(format); -} - -QOpenGLDefaultContextInfo *QOpenGLDefaultContextInfo::create(QXcbScreen *screen) -{ - // We need a current context for getGLString() to work. To have - // the QOpenGLDefaultContextInfo contain the latest supported - // context version, we rely upon the QOpenGLTemporaryContext to - // correctly obtain a context with the latest version - QScopedPointer temporaryContext(new QOpenGLTemporaryContext(screen)); - QOpenGLDefaultContextInfo *result = new QOpenGLDefaultContextInfo; - return result; -} - - -QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo) +QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share) : QPlatformOpenGLContext() , m_screen(screen) , m_context(0) @@ -287,51 +173,60 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat QList glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' '); bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile"); - // Use glXCreateContextAttribsARB if is available + // Use glXCreateContextAttribsARB if available if (glxExt.contains("GLX_ARB_create_context") && glXCreateContextAttribsARB != 0) { - // We limit the requested version by the version of the static context as - // glXCreateContextAttribsARB fails and returns NULL if the requested context - // version is not supported. This means that we will get the closest supported - // context format that that which was requested and is supported by the driver - const int maxSupportedVersion = (defaultContextInfo->format.majorVersion() << 8) - + defaultContextInfo->format.minorVersion(); - const int requestedVersion = qMin((format.majorVersion() << 8) + format.minorVersion(), - maxSupportedVersion); - const int majorVersion = requestedVersion >> 8; - const int minorVersion = requestedVersion & 0xFF; - - QVector contextAttributes; - contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion - << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion; - - // If asking for OpenGL 3.2 or newer we should also specify a profile - if (supportsProfiles && (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1))) { - if (m_format.profile() == QSurfaceFormat::CoreProfile) - contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - else - contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } - - int flags = 0; - - if (m_format.testOption(QSurfaceFormat::DebugContext)) - flags |= GLX_CONTEXT_DEBUG_BIT_ARB; - - // A forward-compatible context may be requested for 3.0 and later - if (m_format.majorVersion() >= 3 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions)) - flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - - if (flags != 0) - contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags; - - contextAttributes << None; - - m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data()); - if (!m_context && m_shareContext) { - // re-try without a shared glx context - m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data()); - if (m_context) - m_shareContext = 0; + // Try to create an OpenGL context for each known OpenGL version in descending + // order from the requested version. + const int requestedVersion = format.majorVersion() * 10 + qMin(format.minorVersion(), 9); + + QVector glVersions; + if (requestedVersion > 43) + glVersions << requestedVersion; + + // Don't bother with versions below 2.0 + glVersions << 43 << 42 << 41 << 40 << 33 << 32 << 31 << 30 << 21 << 20; + + for (int i = 0; !m_context && i < glVersions.count(); i++) { + const int version = glVersions[i]; + if (version > requestedVersion) + continue; + + const int majorVersion = version / 10; + const int minorVersion = version % 10; + + QVector contextAttributes; + contextAttributes << GLX_CONTEXT_MAJOR_VERSION_ARB << majorVersion + << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion; + + // If asking for OpenGL 3.2 or newer we should also specify a profile + if (version >= 32 && supportsProfiles) { + if (m_format.profile() == QSurfaceFormat::CoreProfile) + contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + else + contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + } + + int flags = 0; + + if (m_format.testOption(QSurfaceFormat::DebugContext)) + flags |= GLX_CONTEXT_DEBUG_BIT_ARB; + + // A forward-compatible context may be requested for 3.0 and later + if (version >= 30 && !m_format.testOption(QSurfaceFormat::DeprecatedFunctions)) + flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + + if (flags != 0) + contextAttributes << GLX_CONTEXT_FLAGS_ARB << flags; + + contextAttributes << None; + + m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, m_shareContext, true, contextAttributes.data()); + if (!m_context && m_shareContext) { + // re-try without a shared glx context + m_context = glXCreateContextAttribsARB(DISPLAY_FROM_XCB(screen), config, 0, true, contextAttributes.data()); + if (m_context) + m_shareContext = 0; + } } } diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 78e9985334..98aee78b14 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -54,23 +54,10 @@ QT_BEGIN_NAMESPACE -class QOpenGLDefaultContextInfo -{ - Q_DISABLE_COPY(QOpenGLDefaultContextInfo) - QOpenGLDefaultContextInfo(); -public: - static QOpenGLDefaultContextInfo *create(QXcbScreen *screen); - - const QByteArray vendor; - const QByteArray renderer; - QSurfaceFormat format; -}; - - class QGLXContext : public QPlatformOpenGLContext { public: - QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo); + QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share); ~QGLXContext(); bool makeCurrent(QPlatformSurface *surface); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 32de54562a..4525cb8ccb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -222,7 +222,6 @@ void QXcbConnection::updateScreens() // Delete any existing screens which are not in activeScreens for (int i = m_screens.count() - 1; i >= 0; --i) { if (!activeScreens.contains(m_screens[i])) { - ((QXcbIntegration*)QGuiApplicationPrivate::platformIntegration())->removeDefaultOpenGLContextInfo(m_screens[i]); delete m_screens[i]; m_screens.removeAt(i); } diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 1840dd1ce5..60acf1ff02 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -121,9 +121,6 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters) QXcbIntegration::~QXcbIntegration() { -#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX) - qDeleteAll(m_defaultContextInfos); -#endif qDeleteAll(m_connections); } @@ -181,14 +178,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont { QXcbScreen *screen = static_cast(context->screen()->handle()); #if defined(XCB_USE_GLX) - QOpenGLDefaultContextInfo *defaultContextInfo; - if (m_defaultContextInfos.contains(screen)) { - defaultContextInfo = m_defaultContextInfos.value(screen); - } else { - defaultContextInfo = QOpenGLDefaultContextInfo::create(screen); - m_defaultContextInfos.insert(screen, defaultContextInfo); - } - return new QGLXContext(screen, context->format(), context->shareHandle(), defaultContextInfo); + return new QGLXContext(screen, context->format(), context->shareHandle()); #elif defined(XCB_USE_EGL) return new QEGLXcbPlatformContext(context->format(), context->shareHandle(), screen->connection()->egl_display(), screen->connection()); @@ -293,21 +283,4 @@ QPlatformTheme *QXcbIntegration::createPlatformTheme(const QString &name) const return QGenericUnixTheme::createUnixTheme(name); } -/*! - Called by QXcbConnection prior to a QQnxScreen being deleted. - - Destroys and cleans up any default OpenGL context info for this screen. -*/ -void QXcbIntegration::removeDefaultOpenGLContextInfo(QXcbScreen *screen) -{ -#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX) - if (!m_defaultContextInfos.contains(screen)) - return; - QOpenGLDefaultContextInfo* info = m_defaultContextInfos.take(screen); - delete info; -#else - Q_UNUSED(screen); -#endif -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index cd6c2fd73c..1dd8d4576b 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -52,10 +52,6 @@ class QAbstractEventDispatcher; class QXcbNativeInterface; class QXcbScreen; -#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX) -class QOpenGLDefaultContextInfo; -#endif - class QXcbIntegration : public QPlatformIntegration { public: @@ -97,8 +93,6 @@ public: QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; - void removeDefaultOpenGLContextInfo(QXcbScreen *screen); - private: QList m_connections; @@ -108,10 +102,6 @@ private: QScopedPointer m_inputContext; QAbstractEventDispatcher *m_eventDispatcher; -#if !defined(QT_NO_OPENGL) && defined(XCB_USE_GLX) - mutable QHash m_defaultContextInfos; -#endif - #ifndef QT_NO_ACCESSIBILITY QScopedPointer m_accessibility; #endif -- cgit v1.2.3 From d7dfab8cacff688b2f048097dc1a50eee81885f1 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Fri, 22 Feb 2013 14:50:14 +1000 Subject: Ofono also changed the context API. This updates it to work Change-Id: Ic3a055cb6a56be89b48a9ac77776217f910dee44 Reviewed-by: Lorn Potter --- src/plugins/bearer/connman/qconnmanengine.cpp | 4 +-- src/plugins/bearer/connman/qofonoservice_linux.cpp | 40 +++++++++++----------- src/plugins/bearer/connman/qofonoservice_linux_p.h | 8 ++--- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 2b28cdbf61..589b0e2c24 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -159,7 +159,7 @@ void QConnmanEngine::connectToId(const QString &id) QOfonoDataConnectionManagerInterface dc(modemPath,0); foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) { if(dcPath.path().contains(servicePath.section("_",-1))) { - QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0); + QOfonoConnectionContextInterface primaryContext(dcPath.path(),0); primaryContext.setActive(true); } } @@ -183,7 +183,7 @@ void QConnmanEngine::disconnectFromId(const QString &id) QOfonoDataConnectionManagerInterface dc(modemPath,0); foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) { if(dcPath.path().contains(servicePath.section("_",-1))) { - QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0); + QOfonoConnectionContextInterface primaryContext(dcPath.path(),0); primaryContext.setActive(false); } } diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index f6fb55522e..1983276d94 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -108,7 +108,7 @@ QDBusObjectPath QOfonoManagerInterface::currentModem() foreach (const QDBusObjectPath &modem, modems) { QOfonoModemInterface device(modem.path()); if (device.isPowered() && device.isOnline()) - return modem;; + return modem; } return QDBusObjectPath(); } @@ -770,7 +770,7 @@ QVariantMap QOfonoDataConnectionManagerInterface::getProperties() return reply.value(); } -QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent) +QOfonoConnectionContextInterface::QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent) : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE), dbusPathName, OFONO_DATA_CONTEXT_INTERFACE, @@ -778,68 +778,68 @@ QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QStri { } -QOfonoPrimaryDataContextInterface::~QOfonoPrimaryDataContextInterface() +QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface() { } -bool QOfonoPrimaryDataContextInterface::isActive() +bool QOfonoConnectionContextInterface::isActive() { QVariant var = getProperty("Active"); return qdbus_cast(var); } -QString QOfonoPrimaryDataContextInterface::getApName() +QString QOfonoConnectionContextInterface::getApName() { QVariant var = getProperty("AccessPointName"); return qdbus_cast(var); } -QString QOfonoPrimaryDataContextInterface::getType() +QString QOfonoConnectionContextInterface::getType() { QVariant var = getProperty("Type"); return qdbus_cast(var); } -QString QOfonoPrimaryDataContextInterface::getName() +QString QOfonoConnectionContextInterface::getName() { QVariant var = getProperty("Name"); return qdbus_cast(var); } -QVariantMap QOfonoPrimaryDataContextInterface::getSettings() +QVariantMap QOfonoConnectionContextInterface::getSettings() { QVariant var = getProperty("Settings"); return qdbus_cast(var); } -QString QOfonoPrimaryDataContextInterface::getInterface() +QString QOfonoConnectionContextInterface::getInterface() { QVariant var = getProperty("Interface"); return qdbus_cast(var); } -QString QOfonoPrimaryDataContextInterface::getAddress() +QString QOfonoConnectionContextInterface::getAddress() { QVariant var = getProperty("Address"); return qdbus_cast(var); } -bool QOfonoPrimaryDataContextInterface::setActive(bool on) +bool QOfonoConnectionContextInterface::setActive(bool on) { // this->setProperty("Active", QVariant(on)); return setProp("Active", QVariant::fromValue(on)); } -bool QOfonoPrimaryDataContextInterface::setApn(const QString &name) +bool QOfonoConnectionContextInterface::setApn(const QString &name) { return setProp("AccessPointName", QVariant::fromValue(name)); } -void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal) +void QOfonoConnectionContextInterface::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged); +// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged); // if (signal == propertyChangedSignal) { // if (!connection().connect(QLatin1String(OFONO_SERVICE), // this->path(), @@ -850,7 +850,7 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal) // } // } -// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChangedContext); +// static const QMetaMethod propertyChangedContextSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChangedContext); // if (signal == propertyChangedContextSignal) { // QOfonoDBusHelper *helper; // helper = new QOfonoDBusHelper(this); @@ -867,16 +867,16 @@ void QOfonoPrimaryDataContextInterface::connectNotify(const QMetaMethod &signal) // } } -void QOfonoPrimaryDataContextInterface::disconnectNotify(const QMetaMethod &signal) +void QOfonoConnectionContextInterface::disconnectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoPrimaryDataContextInterface::propertyChanged); +// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QOfonoConnectionContextInterface::propertyChanged); // if (signal == propertyChangedSignal) { // } } -QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property) +QVariant QOfonoConnectionContextInterface::getProperty(const QString &property) { QVariant var; QVariantMap map = getProperties(); @@ -888,13 +888,13 @@ QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property) return var; } -QVariantMap QOfonoPrimaryDataContextInterface::getProperties() +QVariantMap QOfonoConnectionContextInterface::getProperties() { QDBusReply reply = this->call(QLatin1String("GetProperties")); return reply.value(); } -bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const QVariant &var) +bool QOfonoConnectionContextInterface::setProp(const QString &property, const QVariant &var) { QList args; args << QVariant::fromValue(property) << QVariant::fromValue(QDBusVariant(var)); diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 00be9aa675..c73e8231a2 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -76,7 +76,7 @@ #define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator" #define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.DataConnectionManager" #define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager" -#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.PrimaryDataContext" +#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.ConnectionContext" #define OFONO_SMS_MANAGER_INTERFACE "org.ofono.SmsManager" #define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook" @@ -281,14 +281,14 @@ protected: }; -class QOfonoPrimaryDataContextInterface : public QDBusAbstractInterface +class QOfonoConnectionContextInterface : public QDBusAbstractInterface { Q_OBJECT public: - explicit QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent = 0); - ~QOfonoPrimaryDataContextInterface(); + explicit QOfonoConnectionContextInterface(const QString &dbusPathName, QObject *parent = 0); + ~QOfonoConnectionContextInterface(); QVariantMap getProperties(); -- cgit v1.2.3 From d9b04f8575745f699e39256c3c428e5c08d3bb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 8 Jan 2013 13:45:37 +0100 Subject: QCococaWindow: Add NSView hosting support. Add and export QCCoocaView::setContentView(NSView *), making it possible to host a foreign NSView in a QWindow. Change QCoocaWindow::m_contentView to be a generic NSView, instead of a QNSView. Add a separate m_qtView for code paths that expect a QNSView. Change-Id: I47935b69705c70ea7efbb03d6d4bf489947c3487 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 2 +- .../platforms/cocoa/qcocoanativeinterface.h | 3 +++ .../platforms/cocoa/qcocoanativeinterface.mm | 7 +++++++ src/plugins/platforms/cocoa/qcocoawindow.h | 4 +++- src/plugins/platforms/cocoa/qcocoawindow.mm | 22 ++++++++++++++++++---- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 7f022da4c3..d3d8369c9b 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -91,7 +91,7 @@ void QCocoaBackingStore::flush(QWindow *win, const QRegion ®ion, const QPoint CGImageRelease(m_cgImage); m_cgImage = 0; if (QCocoaWindow *cocoaWindow = static_cast(win->handle())) - [cocoaWindow->m_contentView flushBackingStore:this region:region offset:offset]; + [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset]; } void QCocoaBackingStore::resize(const QSize &size, const QRegion &) diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h index 9506f86238..2f79b49534 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -102,6 +102,9 @@ private: // QImage <-> CGImage conversion functions static CGImageRef qImageToCGImage(const QImage &image); static QImage cgImageToQImage(CGImageRef image); + + // Embedding NSViews as child QWindows + static void setWindowContentView(QPlatformWindow *window, void *nsViewContentView); }; #endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index bd3a909137..9990537c1f 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -113,6 +113,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage); if (resource.toLower() == "cgimagetoqimage") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage); + if (resource.toLower() == "setwindowcontentview") + return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setWindowContentView); return 0; } @@ -198,5 +200,10 @@ QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image) return qt_mac_toQImage(image); } +void QCocoaNativeInterface::setWindowContentView(QPlatformWindow *window, void *contentView) +{ + QCocoaWindow *cocoaPlatformWindow = static_cast(window); + cocoaPlatformWindow->setContentView(reinterpret_cast(contentView)); +} QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 931319190c..2422788f7a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -119,6 +119,7 @@ public: void setParent(const QPlatformWindow *window); NSView *contentView() const; + void setContentView(NSView *contentView); void windowWillMove(); void windowDidMove(); @@ -160,7 +161,8 @@ public: // for QNSView friend class QCocoaBackingStore; friend class QCocoaNativeInterface; - QNSView *m_contentView; + NSView *m_contentView; + QNSView *m_qtView; NSWindow *m_nsWindow; bool m_contentViewIsEmbedded; // true if the m_contentView is embedded in a "foregin" NSView hiearchy diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f7348e7dda..489c229187 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -201,7 +201,8 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) #endif QCocoaAutoReleasePool pool; - m_contentView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this]; + m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this]; + m_contentView = m_qtView; setGeometry(tlw->geometry()); recreateWindow(parent()); @@ -534,7 +535,7 @@ void QCocoaWindow::setMask(const QRegion ®ion) [m_nsWindow setBackgroundColor:[NSColor clearColor]]; } - [m_contentView setMaskRegion:®ion]; + [m_qtView setMaskRegion:®ion]; } bool QCocoaWindow::setKeyboardGrabEnabled(bool grab) @@ -578,6 +579,19 @@ NSView *QCocoaWindow::contentView() const return m_contentView; } +void QCocoaWindow::setContentView(NSView *contentView) +{ + // Remove and release the previous content view + [m_contentView removeFromSuperview]; + [m_contentView release]; + + // Insert and retain the new content view + [contentView retain]; + m_contentView = contentView; + m_qtView = 0; // The new content view is not a QNSView. + recreateWindow(parent()); // Adds the content view to parent NSView +} + void QCocoaWindow::windowWillMove() { // Close any open popups on window move @@ -590,7 +604,7 @@ void QCocoaWindow::windowWillMove() void QCocoaWindow::windowDidMove() { - [m_contentView updateGeometry]; + [m_qtView updateGeometry]; } void QCocoaWindow::windowDidResize() @@ -598,7 +612,7 @@ void QCocoaWindow::windowDidResize() if (!m_nsWindow) return; - [m_contentView updateGeometry]; + [m_qtView updateGeometry]; } void QCocoaWindow::windowWillClose() -- cgit v1.2.3 From cf885ee8363252a263bdbdde7cfcf3cf46a62835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 19 Feb 2013 14:42:05 +0100 Subject: Cocoa: Compile with Qt in a namespace. Task-number: QTBUG-29710 Change-Id: I28a4c213b78723aa369c7e00167401ec643155e6 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index d78ff73bb6..bdcad6f490 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -315,9 +315,12 @@ NSMenuItem *QCocoaMenuItem::sync() return m_native; } +QT_BEGIN_NAMESPACE +extern QString qt_mac_applicationmenu_string(int type); +QT_END_NAMESPACE + QString QCocoaMenuItem::mergeText() { - extern QString qt_mac_applicationmenu_string(int type); QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); if (m_native == [loader aboutMenuItem]) { return qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()); -- cgit v1.2.3 From d9ff510f02bba63dabe7a081a68296056a89ae4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20E=2E=20Narv=C3=A1ez?= Date: Sat, 23 Feb 2013 23:14:50 -0500 Subject: Rename qAbs Function for timeval This decouples it from qAbs which is declared as a constexpr under certain compilation flags and enables for qtbase to be compiled with GCC 4.8 Change-Id: I78e02256ffc8b460ca74ae5241e77dfac4e09ba9 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qtimerinfo_unix.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 0eee425cf9..7a29247fc5 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -94,8 +94,7 @@ timeval QTimerInfoList::updateCurrentTime() #if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED) -template <> -timeval qAbs(const timeval &t) +timeval qAbsTimeval(const timeval &t) { timeval tmp = t; if (tmp.tv_sec < 0) { @@ -144,7 +143,7 @@ bool QTimerInfoList::timeChanged(timeval *delta) timeval tickGranularity; tickGranularity.tv_sec = 0; tickGranularity.tv_usec = msPerTick * 1000; - return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10); + return elapsedTimeTicks < ((qAbsTimeval(*delta) - tickGranularity) * 10); } /* -- cgit v1.2.3 From 153d613353863987322db81f3c31e33541ef7226 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 10 Dec 2012 14:48:19 +0100 Subject: Transient QWindows centered; default-constructed geometry Default-constructed geometry does not mean put the window at 0,0, and it does not mean center the window on the screen: it means let the window manager position the window. If the window is explicitly positioned at 0,0 though, that is a higher priority than the transient hint; without this change, the transientFor property had no effect. On X11, transient means use center "gravity" to make the transient window exactly centered. But the user can still override the geometry of a transient window, as with any window. On OSX and Windows, neither transient window functionality nor smart initial positioning are provided, so a window with no position set will be centered on the screen, and a transient window will be put at the center of its transientParent. Change-Id: I4f5e37480eef5d105e45ffd60362a57f13ec55f5 Task-number: QTBUG-26903 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qguiapplication.cpp | 2 + src/gui/kernel/qplatformwindow.cpp | 39 +++++++++++++++++ src/gui/kernel/qplatformwindow.h | 3 ++ src/gui/kernel/qwindow.cpp | 17 +++++++- src/gui/kernel/qwindow_p.h | 2 + src/plugins/platforms/cocoa/qcocoawindow.mm | 8 +++- src/plugins/platforms/windows/qwindowswindow.cpp | 12 +++++- src/plugins/platforms/xcb/qxcbwindow.cpp | 49 ++++++++++++++++------ src/widgets/kernel/qwidget_qpa.cpp | 28 ++++--------- tests/auto/opengl/qgl/tst_qgl.cpp | 8 +++- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 2 +- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 5 +++ 12 files changed, 135 insertions(+), 40 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c155ecfe0c..d0b37b7f1b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1559,6 +1559,8 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate } QGuiApplicationPrivate::focus_window = newFocus; + if (!qApp) + return; if (previous) { QFocusEvent focusOut(QEvent::FocusOut); diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index b710701e7f..79e4cbf674 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -41,11 +41,13 @@ #include "qplatformwindow.h" #include "qplatformwindow_p.h" +#include "qplatformscreen.h" #include #include #include #include +#include QT_BEGIN_NAMESPACE @@ -448,6 +450,43 @@ QString QPlatformWindow::formatWindowTitle(const QString &title, const QString & return fullTitle; } +/*! + Helper function to get initial geometry on windowing systems which do not + do smart positioning and also do not provide a means of centering a + transient window w.r.t. its parent. For example this is useful on Windows + and MacOS but not X11, because an X11 window manager typically tries to + layout new windows to optimize usage of the available desktop space. + However if the given window already has geometry which the application has + initialized, it takes priority. +*/ +QRect QPlatformWindow::initialGeometry(const QWindow *w, + const QRect &initialGeometry, int defaultWidth, int defaultHeight) +{ + QRect rect(initialGeometry); + if (rect.isNull()) { + QSize minimumSize = w->minimumSize(); + if (minimumSize.width() > 0 || minimumSize.height() > 0) { + rect.setSize(minimumSize); + } else { + rect.setWidth(defaultWidth); + rect.setHeight(defaultHeight); + } + } + if (w->isTopLevel() && qt_window_private(const_cast(w))->positionAutomatic) { + const QWindow *tp = w->transientParent(); + if (tp) { + // A transient window should be centered w.r.t. its transient parent. + rect.moveCenter(tp->geometry().center()); + } else { + // Center the window on the screen. (Only applicable on platforms + // which do not provide a better way.) + QPlatformScreen *scr = QPlatformScreen::platformScreenForWindow(w); + rect.moveCenter(scr->availableGeometry().center()); + } + } + return rect; +} + /*! \class QPlatformWindow \since 4.8 diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h index fe62d7b67b..410e7ea9bb 100644 --- a/src/gui/kernel/qplatformwindow.h +++ b/src/gui/kernel/qplatformwindow.h @@ -130,6 +130,9 @@ public: virtual void setFrameStrutEventsEnabled(bool enabled); virtual bool frameStrutEventsEnabled() const; + static QRect initialGeometry(const QWindow *w, + const QRect &initialGeometry, int defaultWidth, int defaultHeight); + protected: static QString formatWindowTitle(const QString &title, const QString &separator); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2fcad5706f..2a2e30634a 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -126,6 +126,18 @@ QT_BEGIN_NAMESPACE and can keep rendering until it isExposed() returns false. To find out when isExposed() changes, reimplement exposeEvent(). The window will always get a resize event before the first expose event. + + \section1 Initial geometry + + If the window's width and height are left uninitialized, the window will + get a reasonable default geometry from the platform window. If the position + is left uninitialized, then the platform window will allow the windowing + system to position the window. For example on X11, the window manager + usually does some kind of smart positioning to try to avoid having new + windows completely obscure existing windows. However setGeometry() + initializes both the position and the size, so if you want a fixed size but + an automatic position, you should call resize() or setWidth() and + setHeight() instead. */ /*! @@ -962,7 +974,7 @@ void QWindow::setY(int arg) void QWindow::setWidth(int arg) { if (width() != arg) - setGeometry(QRect(x(), y(), arg, height())); + resize(arg, height()); } /*! @@ -972,7 +984,7 @@ void QWindow::setWidth(int arg) void QWindow::setHeight(int arg) { if (height() != arg) - setGeometry(QRect(x(), y(), width(), arg)); + resize(width(), arg); } /*! @@ -1095,6 +1107,7 @@ void QWindow::setGeometry(int posx, int posy, int w, int h) void QWindow::setGeometry(const QRect &rect) { Q_D(QWindow); + d->positionAutomatic = false; if (rect == geometry()) return; QRect oldRect = geometry(); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 6933c892a0..26bf0700f2 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -88,6 +88,7 @@ public: , resizeEventPending(true) , receivedExpose(false) , positionPolicy(WindowFrameExclusive) + , positionAutomatic(true) , contentOrientation(Qt::PrimaryOrientation) , opacity(qreal(1.0)) , minimumSize(0, 0) @@ -137,6 +138,7 @@ public: bool resizeEventPending; bool receivedExpose; PositionPolicy positionPolicy; + bool positionAutomatic; Qt::ScreenOrientation contentOrientation; qreal opacity; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 489c229187..2adf0d24a1 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -58,6 +58,11 @@ #include +enum { + defaultWindowWidth = 160, + defaultWindowHeight = 160 +}; + static bool isMouseEvent(NSEvent *ev) { switch ([ev type]) { @@ -683,7 +688,8 @@ NSWindow * QCocoaWindow::createNSWindow() { QCocoaAutoReleasePool pool; - NSRect frame = qt_mac_flipRect(window()->geometry(), window()); + QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight); + NSRect frame = qt_mac_flipRect(rect, window()); Qt::WindowType type = window()->type(); Qt::WindowFlags flags = window()->flags(); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 07dc668b3f..20000ea0a9 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -64,6 +64,11 @@ QT_BEGIN_NAMESPACE +enum { + defaultWindowWidth = 160, + defaultWindowHeight = 160 +}; + Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &); static QByteArray debugWinStyle(DWORD style) @@ -468,6 +473,8 @@ QWindowsWindow::WindowData const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL); + QRect rect = QPlatformWindow::initialGeometry(w, geometry, defaultWindowWidth, defaultWindowHeight); + if (title.isEmpty() && (result.flags & Qt::WindowTitleHint)) title = topLevel ? qAppName() : w->objectName(); @@ -475,14 +482,14 @@ QWindowsWindow::WindowData const wchar_t *classNameUtf16 = reinterpret_cast(windowClassName.utf16()); // Capture events before CreateWindowEx() returns. - const QWindowCreationContextPtr context(new QWindowCreationContext(w, geometry, style, exStyle)); + const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, style, exStyle)); QWindowsContext::instance()->setWindowCreationContext(context); if (QWindowsContext::verboseWindows) qDebug().nospace() << "CreateWindowEx: " << w << *this << " class=" <frameWidth << 'x' << context->frameHeight << '+' << context->frameX << '+' << context->frameY; @@ -775,6 +782,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : QWindowsWindow::~QWindowsWindow() { #ifndef Q_OS_WINCE + QWindowSystemInterface::flushWindowSystemEvents(); if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); #endif // !Q_OS_WINCE diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c0ddf5c0ae..abd2f7a147 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -113,6 +113,10 @@ #endif #define XCOORD_MAX 16383 +enum { + defaultWindowWidth = 160, + defaultWindowHeight = 160 +}; //#ifdef NET_WM_STATE_DEBUG @@ -219,8 +223,16 @@ void QXcbWindow::create() QRect rect = window()->geometry(); QPlatformWindow::setGeometry(rect); - rect.setWidth(qBound(1, rect.width(), XCOORD_MAX)); - rect.setHeight(qBound(1, rect.height(), XCOORD_MAX)); + QSize minimumSize = window()->minimumSize(); + if (rect.width() > 0 || rect.height() > 0) { + rect.setWidth(qBound(1, rect.width(), XCOORD_MAX)); + rect.setHeight(qBound(1, rect.height(), XCOORD_MAX)); + } else if (minimumSize.width() > 0 || minimumSize.height() > 0) { + rect.setSize(minimumSize); + } else { + rect.setWidth(defaultWindowWidth); + rect.setHeight(defaultWindowHeight); + } xcb_window_t xcb_parent_id = m_screen->root(); if (parent()) @@ -436,15 +448,23 @@ void QXcbWindow::setGeometry(const QRect &rect) propagateSizeHints(); const QRect wmGeometry = windowToWmGeometry(rect); - const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; - const qint32 values[] = { - qBound(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX), - qBound(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX), - qBound(1, wmGeometry.width(), XCOORD_MAX), - qBound(1, wmGeometry.height(), XCOORD_MAX), - }; - - Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast(values))); + if (qt_window_private(window())->positionAutomatic) { + const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + const qint32 values[] = { + qBound(1, wmGeometry.width(), XCOORD_MAX), + qBound(1, wmGeometry.height(), XCOORD_MAX), + }; + Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast(values))); + } else { + const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + const qint32 values[] = { + qBound(-XCOORD_MAX, wmGeometry.x(), XCOORD_MAX), + qBound(-XCOORD_MAX, wmGeometry.y(), XCOORD_MAX), + qBound(1, wmGeometry.width(), XCOORD_MAX), + qBound(1, wmGeometry.height(), XCOORD_MAX), + }; + Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast(values))); + } xcb_flush(xcb_connection()); } @@ -563,6 +583,7 @@ void QXcbWindow::show() if (!transientXcbParent) transientXcbParent = static_cast(screen())->clientLeader(); if (transientXcbParent) { // ICCCM 4.1.2.6 + m_gravity = XCB_GRAVITY_CENTER; Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, 1, &transientXcbParent)); @@ -1221,8 +1242,10 @@ void QXcbWindow::propagateSizeHints() QWindow *win = window(); - xcb_size_hints_set_position(&hints, true, rect.x(), rect.y()); - xcb_size_hints_set_size(&hints, true, rect.width(), rect.height()); + if (!qt_window_private(win)->positionAutomatic) + xcb_size_hints_set_position(&hints, true, rect.x(), rect.y()); + if (rect.width() < QWINDOWSIZE_MAX || rect.height() < QWINDOWSIZE_MAX) + xcb_size_hints_set_size(&hints, true, rect.width(), rect.height()); xcb_size_hints_set_win_gravity(&hints, m_gravity); QSize minimumSize = win->minimumSize(); diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 84693d02a5..2ffe9c5de5 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -109,7 +109,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setFlags(data.window_flags); fixPosIncludesFrame(); - win->setGeometry(q->geometry()); + if (q->testAttribute(Qt::WA_Moved)) + win->setGeometry(q->geometry()); + else + win->resize(q->size()); win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0)); if (q->testAttribute(Qt::WA_TranslucentBackground)) { @@ -466,19 +469,6 @@ void QWidget::activateWindow() wnd->requestActivate(); } -// Position top level windows at the center, avoid showing -// Windows at the default 0,0 position excluding the frame. -static inline QRect positionTopLevelWindow(QRect geometry, const QScreen *screen) -{ - if (screen && geometry.x() == 0 && geometry.y() == 0) { - const QRect availableGeometry = screen->availableGeometry(); - if (availableGeometry.width() > geometry.width() - && availableGeometry.height() > geometry.height()) - geometry.moveCenter(availableGeometry.center()); - } - return geometry; -} - // move() was invoked with Qt::WA_WState_Created not set (frame geometry // unknown), that is, crect has a position including the frame. // If we can determine the frame strut, fix that and clear the flag. @@ -529,16 +519,16 @@ void QWidgetPrivate::show_sys() if (q->isWindow()) fixPosIncludesFrame(); QRect geomRect = q->geometry(); - if (q->isWindow()) { - if (!q->testAttribute(Qt::WA_Moved)) - geomRect = positionTopLevelWindow(geomRect, window->screen()); - } else { + if (!q->isWindow()) { QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint()); geomRect.moveTopLeft(topLeftOfWindow); } const QRect windowRect = window->geometry(); if (windowRect != geomRect) { - window->setGeometry(geomRect); + if (q->testAttribute(Qt::WA_Moved)) + window->setGeometry(geomRect); + else + window->resize(geomRect.size()); } if (QBackingStore *store = q->backingStore()) { diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 6c5c90d737..3bae5d5103 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -78,7 +78,6 @@ private slots: void shareRegister(); void textureCleanup(); #endif - void graphicsViewClipping(); void partialGLWidgetUpdates_data(); void partialGLWidgetUpdates(); void glWidgetWithAlpha(); @@ -98,6 +97,7 @@ private slots: void destroyFBOAfterContext(); void threadImages(); void nullRectCrash(); + void graphicsViewClipping(); }; tst_QGL::tst_QGL() @@ -865,7 +865,11 @@ void tst_QGL::graphicsViewClipping() scene.setSceneRect(view.viewport()->rect()); - QVERIFY(QTest::qWaitForWindowActive(&view)); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + #ifdef Q_OS_MAC + // The black rectangle jumps from the center to the upper left for some reason. + QTest::qWait(100); + #endif QImage image = viewport->grabFrameBuffer(); QImage expected = image; diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index c1927c9d1f..78fce7661e 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5430,7 +5430,7 @@ void tst_QWidget::setToolTip() QScopedPointer popup(new QWidget(0, Qt::Popup)); popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass)); popup->setWindowTitle(popup->objectName()); - popup->resize(150, 50); + popup->setGeometry(50, 50, 150, 50); QFrame *frame = new QFrame(popup.data()); frame->setGeometry(0, 0, 50, 50); frame->setFrameStyle(QFrame::Box | QFrame::Plain); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 210e52f0aa..3fa669c1fb 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -3902,6 +3902,11 @@ void tst_QLineEdit::inputMethod() // removing focus allows input method to commit preedit testWidget->setText(""); testWidget->activateWindow(); + // TODO setFocus should not be necessary here, because activateWindow + // should focus it, and the window is the QLineEdit. But the test can fail + // on Windows if we don't do this. If each test had a unique QLineEdit + // instance, maybe such problems would go away. + testWidget->setFocus(); QTRY_VERIFY(testWidget->hasFocus()); QTRY_COMPARE(qApp->focusObject(), testWidget); -- cgit v1.2.3 From 395f00ae185dba0b514e446762ab2d9ccb08e0a3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 20 Feb 2013 12:02:17 +0100 Subject: Remove debug output that can cause crashes in static builds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently static builds ignore the accessibility plugins. The debug output would also potentially crash for other events when they could not create interfaces. Task-number: QTBUG-28707 Change-Id: I5ae20cac89bd7f4a74add2b80834f4e9d4fa438c Reviewed-by: Jan Arve Sæther --- .../linuxaccessibility/atspiadaptor.cpp | 65 ++++++++++++++++++---- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 4cd81b2389..001976e9fe 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1104,23 +1104,64 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } break; } + // For now we ignore these events case QAccessible::TableModelChanged: - // For now we ignore this event and hope that - // setting manages_descendants works. - break; + // For tables, setting manages_descendants should + // indicate to the client that it cannot cache these + // interfaces. case QAccessible::ParentChanged: - break; case QAccessible::DialogStart: - break; case QAccessible::DialogEnd: - break; case QAccessible::SelectionRemove: - break; - default: - QAIPointer iface = QAIPointer(event->accessibleInterface()); - qAtspiDebug() << "QSpiAccessible::accessibleEvent not handled: " << QString::number(event->type(), 16) - << " obj: " << iface->object() - << ((iface->isValid() && iface->object()) ? iface->object()->objectName() : QLatin1String(" invalid interface!")); + case QAccessible::PopupMenuStart: + case QAccessible::PopupMenuEnd: + case QAccessible::SoundPlayed: + case QAccessible::Alert: + case QAccessible::ForegroundChanged: + case QAccessible::MenuStart: + case QAccessible::MenuEnd: + case QAccessible::ContextHelpStart: + case QAccessible::ContextHelpEnd: + case QAccessible::DragDropStart: + case QAccessible::DragDropEnd: + case QAccessible::ScrollingStart: + case QAccessible::ScrollingEnd: + case QAccessible::MenuCommand: + case QAccessible::ActionChanged: + case QAccessible::ActiveDescendantChanged: + case QAccessible::AttributeChanged: + case QAccessible::DocumentContentChanged: + case QAccessible::DocumentLoadComplete: + case QAccessible::DocumentLoadStopped: + case QAccessible::DocumentReload: + case QAccessible::HyperlinkEndIndexChanged: + case QAccessible::HyperlinkNumberOfAnchorsChanged: + case QAccessible::HyperlinkSelectedLinkChanged: + case QAccessible::HypertextLinkActivated: + case QAccessible::HypertextLinkSelected: + case QAccessible::HyperlinkStartIndexChanged: + case QAccessible::HypertextChanged: + case QAccessible::HypertextNLinksChanged: + case QAccessible::ObjectAttributeChanged: + case QAccessible::PageChanged: + case QAccessible::SectionChanged: + case QAccessible::TableCaptionChanged: + case QAccessible::TableColumnDescriptionChanged: + case QAccessible::TableColumnHeaderChanged: + case QAccessible::TableRowDescriptionChanged: + case QAccessible::TableRowHeaderChanged: + case QAccessible::TableSummaryChanged: + case QAccessible::TextAttributeChanged: + case QAccessible::TextColumnChanged: + case QAccessible::VisibleDataChanged: + case QAccessible::ObjectReorder: + case QAccessible::SelectionAdd: + case QAccessible::SelectionWithin: + case QAccessible::LocationChanged: + case QAccessible::HelpChanged: + case QAccessible::DefaultActionChanged: + case QAccessible::AcceleratorChanged: + case QAccessible::InvalidEvent: break; } } -- cgit v1.2.3 From a00e74914cfdd4cb37e669a86963523149b85d40 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 20 Feb 2013 12:06:12 +0100 Subject: Remove extra $ in default libexec directory Produces qt_lbexpath=$PREFIX/29677QT_INSTALL_LIBEXECS_DIRNAME in qconfig.cpp Change-Id: Ie6f208d759a748dfcd4f1547943a1dfb4b7aedd5 Reviewed-by: Oswald Buddenhagen Reviewed-by: Kai Koehne --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 360e58dc2d..6d6b816c30 100755 --- a/configure +++ b/configure @@ -2832,7 +2832,7 @@ else fi if [ -z "$QT_INSTALL_LIBEXECS" ]; then #default - QT_INSTALL_LIBEXECS="$QT_INSTALL_ARCHDATA/$$QT_INSTALL_LIBEXECS_DIRNAME" #fallback + QT_INSTALL_LIBEXECS="$QT_INSTALL_ARCHDATA/$QT_INSTALL_LIBEXECS_DIRNAME" #fallback fi QT_INSTALL_LIBEXECS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBEXECS"` -- cgit v1.2.3 From 22bda3360e675d1bac9961769710755c75d22a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 29 Jan 2013 10:24:36 +0100 Subject: Set correct image format for non-alpha windows. Use QImage::Format_RGB32. Change-Id: I4be6b6271034be8dad5cfcb85f89fe33a817b78f Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index d3d8369c9b..31726268f1 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -73,7 +73,9 @@ QPaintDevice *QCocoaBackingStore::paintDevice() } #endif - m_qImage = QImage(m_requestedSize * scaleFactor, QImage::Format_ARGB32_Premultiplied); + QImage::Format format = window()->format().hasAlpha() + ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + m_qImage = QImage(m_requestedSize * scaleFactor, format); m_qImage.setDevicePixelRatio(scaleFactor); } return &m_qImage; -- cgit v1.2.3 From 720a44359d7b91fda851127639887fd7033f07d2 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Tue, 19 Feb 2013 16:20:48 +0100 Subject: Blackberry adding some compiler optimizations Change-Id: I78364f7e697b5c54ce49c1ed6c3b8526af1d8c6e Reviewed-by: Bernd Weimer Reviewed-by: Thomas McGuire --- mkspecs/blackberry-armv7le-qcc/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/blackberry-armv7le-qcc/qmake.conf b/mkspecs/blackberry-armv7le-qcc/qmake.conf index 45883b05ec..2e24e4e0d3 100644 --- a/mkspecs/blackberry-armv7le-qcc/qmake.conf +++ b/mkspecs/blackberry-armv7le-qcc/qmake.conf @@ -15,7 +15,7 @@ contains(QT_CONFIG, stack-protector-strong) { QMAKE_CFLAGS += -fstack-protector -fstack-protector-all } -QMAKE_CFLAGS += -mcpu=cortex-a9 +QMAKE_CFLAGS += -mcpu=cortex-a9 -mtune=cortex-a9 -mthumb -D_FORTIFY_SOURCE=2 QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now -- cgit v1.2.3 From fa5bd4ed981f107339194905dc3197a5e52eab3f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 29 Oct 2012 19:32:47 +0100 Subject: Added transient window manual test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I05e657488bb05e1aa6343270946512c8793f1e68 Reviewed-by: Samuel Rødal --- tests/manual/transientwindow/main.cpp | 51 ++++++++++++++++++ tests/manual/transientwindow/mainwindow.cpp | 66 ++++++++++++++++++++++++ tests/manual/transientwindow/mainwindow.h | 64 +++++++++++++++++++++++ tests/manual/transientwindow/transientwindow.pro | 6 +++ 4 files changed, 187 insertions(+) create mode 100644 tests/manual/transientwindow/main.cpp create mode 100644 tests/manual/transientwindow/mainwindow.cpp create mode 100644 tests/manual/transientwindow/mainwindow.h create mode 100644 tests/manual/transientwindow/transientwindow.pro diff --git a/tests/manual/transientwindow/main.cpp b/tests/manual/transientwindow/main.cpp new file mode 100644 index 0000000000..aebb051688 --- /dev/null +++ b/tests/manual/transientwindow/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite 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 "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/tests/manual/transientwindow/mainwindow.cpp b/tests/manual/transientwindow/mainwindow.cpp new file mode 100644 index 0000000000..25123c4936 --- /dev/null +++ b/tests/manual/transientwindow/mainwindow.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite 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 "mainwindow.h" +#include + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), m_showButton("Toggle visible", this), m_window(0) +{ + connect(&m_showButton, SIGNAL(clicked()), this, SLOT(toggleVisible())); + setWindowTitle(QString::fromLatin1("Main Window")); + m_showButton.setVisible(true); + setMinimumSize(300, 200); +} + +MainWindow::~MainWindow() +{ +} + +void MainWindow::toggleVisible() +{ + if (!m_window) { + m_window = new QWindow(); + m_window->setTransientParent(windowHandle()); + m_window->setMinimumSize(QSize(200, 100)); + m_window->setTitle("Transient Window"); + } + m_window->setVisible(!m_window->isVisible()); +} diff --git a/tests/manual/transientwindow/mainwindow.h b/tests/manual/transientwindow/mainwindow.h new file mode 100644 index 0000000000..352fc961e1 --- /dev/null +++ b/tests/manual/transientwindow/mainwindow.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +public slots: + void toggleVisible(); + +private: + QPushButton m_showButton; + QWindow* m_window; +}; + +#endif // MAINWINDOW_H diff --git a/tests/manual/transientwindow/transientwindow.pro b/tests/manual/transientwindow/transientwindow.pro new file mode 100644 index 0000000000..a07ee09dbc --- /dev/null +++ b/tests/manual/transientwindow/transientwindow.pro @@ -0,0 +1,6 @@ +QT += core gui widgets +TARGET = transientwindow +TEMPLATE = app +SOURCES += main.cpp\ + mainwindow.cpp +HEADERS += mainwindow.h -- cgit v1.2.3 From 6d270051a23fbfe1cb148ced365ea3a6aecf5e60 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Mon, 25 Feb 2013 13:26:07 +0800 Subject: Doc: Add the missing \since 5.0 Change-Id: I79f67e18b64efe7d22ed80adbc6f024ef35b3aac Reviewed-by: Thiago Macieira Reviewed-by: Friedemann Kleint --- src/corelib/io/qurlquery.cpp | 1 + src/corelib/kernel/qpointer.cpp | 1 + src/corelib/tools/qstring.cpp | 2 ++ src/widgets/itemviews/qheaderview.cpp | 14 ++++++++++++++ 4 files changed, 18 insertions(+) diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 23c0b948e8..547084840f 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QUrlQuery \inmodule QtCore + \since 5.0 \brief The QUrlQuery class provides a way to manipulate a key-value pairs in a URL's query. diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index eea90be5eb..4fd6cd1779 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -158,6 +158,7 @@ /*! \fn void QPointer::clear() + \since 5.0 Clears this QPointer object. diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 61d5073a1f..c9525cf0ae 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9169,6 +9169,8 @@ QVector QStringRef::toUcs4() const */ /*! + \since 5.0 + Converts a plain text string to an HTML string with HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML entities. diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index ec5620c14c..5599d251a1 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1082,6 +1082,8 @@ int QHeaderView::logicalIndex(int visualIndex) const } /*! + \since 5.0 + If \a movable is true, the header may be moved by the user; otherwise it is fixed in place. @@ -1105,6 +1107,8 @@ void QHeaderView::setSectionsMovable(bool movable) */ /*! + \since 5.0 + Returns true if the header can be moved by the user; otherwise returns false. @@ -1128,6 +1132,8 @@ bool QHeaderView::sectionsMovable() const */ /*! + \since 5.0 + If \a clickable is true, the header will respond to single clicks. \sa sectionsClickable(), sectionClicked(), sectionPressed(), @@ -1151,6 +1157,8 @@ void QHeaderView::setSectionsClickable(bool clickable) */ /*! + \since 5.0 + Returns true if the header is clickable; otherwise returns false. A clickable header could be set up to allow the user to change the representation of the data in the view related to the header. @@ -1187,6 +1195,8 @@ bool QHeaderView::highlightSections() const } /*! + \since 5.0 + Sets the constraints on how the header can be resized to those described by the given \a mode. @@ -1205,6 +1215,8 @@ void QHeaderView::setSectionResizeMode(ResizeMode mode) } /*! + \since 5.0 + Sets the constraints on how the section specified by \a logicalIndex in the header can be resized to those described by the given \a mode. The logical index should exist at the time this function is called. @@ -1259,6 +1271,8 @@ void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode) */ /*! + \since 5.0 + Returns the resize mode that applies to the section specified by the given \a logicalIndex. -- cgit v1.2.3 From faefc09e93f99b86820ca50495351825059dc3c9 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Thu, 21 Feb 2013 18:57:51 +0100 Subject: Fix qfile autotest on qnx This fixes the compilation of the qfile autotest on qnx. Change-Id: Iab099e8b754a4341152e338ff6e3d22a83c625e3 Reviewed-by: Thomas McGuire --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index df7b397481..6fa222dd72 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -82,6 +82,12 @@ QT_END_NAMESPACE # include #endif +#ifdef Q_OS_QNX +#ifdef open +#undef open +#endif +#endif + #include #include -- cgit v1.2.3 From 0c8487156ea53bf0da84cd149dd504c8e16fee33 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Mon, 25 Feb 2013 17:24:47 +0100 Subject: QNX post an expose event when the window is hidden When the window is hidden, an expose event has to be be posted. This is e.g. needed by the qquickwindow. A exposeEvent calles the exposureChanged function of the window manager there. Change-Id: I9d891e07f81192dcd6674743620319c44da19c48 Reviewed-by: Wolfgang Bremer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index ab9c94772b..43e24034c9 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -272,9 +272,9 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); if (window()->isTopLevel()) { - if (visible) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - } else { + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + + if (!visible) { // Flush the context, otherwise it won't disappear immediately screen_flush_context(m_screenContext, 0); } -- cgit v1.2.3 From e37d5791839a55428a396b7a93b9284d82dace8f Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Fri, 8 Feb 2013 07:58:11 +0000 Subject: Add device mkspec for i.MX53 devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is tested with eglfs plugin on the Yocto Project's Poky distribution. Change-Id: I73edd66d6cd62febb2f699ac5b1ca1f1c0dea449 Reviewed-by: Oswald Buddenhagen Reviewed-by: Andreas Holzammer Reviewed-by: Samuel Rødal --- mkspecs/devices/linux-imx53qsb-g++/qmake.conf | 37 +++++++++++++++++++ mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h | 42 ++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 mkspecs/devices/linux-imx53qsb-g++/qmake.conf create mode 100644 mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h diff --git a/mkspecs/devices/linux-imx53qsb-g++/qmake.conf b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf new file mode 100644 index 0000000000..0a5ed89feb --- /dev/null +++ b/mkspecs/devices/linux-imx53qsb-g++/qmake.conf @@ -0,0 +1,37 @@ +# +# qmake configuration for the Freescale iMX53 board +# +# This mkspec is based and tested on the Yocto Project's Poky Distribution +# with libEGL.so from Freescale without the X11 dependency. +# +# This mkspec is tested with a framebuffer (eglfs) configuration +# +# A typical configure line looks like: +# +# export PATH=/opt/imx53qsb/x86_64-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi:$PATH +# +# ./configure -prefix /usr/local/qt5-imx53 -hostprefix /opt/imx53qsb/x86_64-linux/usr/local/qt5-imx53 -release -device linux-imx53qsb-g++ +# -opensource -confirm-license -no-gtkstyle -device-option CROSS_COMPILE=arm-poky-linux-gnueabi- -sysroot /opt/imx53qsb/sysroot +# -eglfs -no-pch -opengl es2 -no-xcb -silent + +include(../common/linux_device_pre.conf) + +QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include +QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib + +QMAKE_LIBS_EGL += -lEGL +QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL +QMAKE_LIBS_OPENVG += -lOpenVG -lEGL + +QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib + +IMX5_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -Wno-psabi +IMX5_CFLAGS_RELEASE = -O2 $$IMX5_CFLAGS +QMAKE_CFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE +QMAKE_CFLAGS_DEBUG += $$IMX5_CFLAGS +QMAKE_CXXFLAGS_DEBUG += $$IMX5_CFLAGS + +include(../common/linux_device_post.conf) + +load(qt_config) diff --git a/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h new file mode 100644 index 0000000000..461f3d5589 --- /dev/null +++ b/mkspecs/devices/linux-imx53qsb-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the qmake spec 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 "../../linux-g++/qplatformdefs.h" -- cgit v1.2.3 From 47e12eafdd7d2b2bc0e4db67cef5e063dfdc7aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 25 Feb 2013 14:14:47 +0100 Subject: Cocoa: Make grabWindow work on retina displays. Not taking the devicePixelRatio into account causes us to either grab a quarter of the screen or do a low-resolution grab. Change-Id: Ie6b681e3a089f17b63554c8158bb471a14963d7a Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 7fcdab4d97..93831158d0 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -170,13 +170,13 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height windowSize.setHeight(windowRect.height()); } - QPixmap windowPixmap(windowSize); + QPixmap windowPixmap(windowSize * devicePixelRatio()); windowPixmap.fill(Qt::transparent); for (uint i = 0; i < displayCount; ++i) { const CGRect bounds = CGDisplayBounds(displays[i]); - int w = (width < 0 ? bounds.size.width : width); - int h = (height < 0 ? bounds.size.height : height); + int w = (width < 0 ? bounds.size.width : width) * devicePixelRatio(); + int h = (height < 0 ? bounds.size.height : height) * devicePixelRatio(); QRect displayRect = QRect(x, y, w, h); QCFType image = CGDisplayCreateImageForRect(displays[i], CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height())); -- cgit v1.2.3 From d400666c61b5c4b49da25a18ab5bd77089ee4d80 Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Fri, 22 Feb 2013 17:42:55 +0100 Subject: Cocoa: Fix appearance of transient light scroll bars. On dark background scroll bars will be rendered light. Since the scroller object is shared across intances, this flag also has to be reset. Otherwise all scrollbars are drawn light. Change-Id: I3800cc783d7fd7ebff296d9db7454efb5b33e7a3 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 5d83804d51..ea73ff6296 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -5017,6 +5017,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bgColor.blue() < 128; if (isDarkBg) [scroller setKnobStyle:NSScrollerKnobStyleLight]; + else + [scroller setKnobStyle:NSScrollerKnobStyleDefault]; [scroller setControlSize:(tdi.kind == kThemeSmallScrollBar ? NSMiniControlSize : NSRegularControlSize)]; -- cgit v1.2.3 From 17501e09b9a812cf41bef2ad5c83da747bb44d9a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 25 Feb 2013 15:29:56 +0100 Subject: Fix warnings about extra tokens after preprocessor directive. Change-Id: I7f18ec42f6f6dd697947654384767c2c6b211498 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowsintegration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 24dc01f0bd..ca484415be 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -78,7 +78,7 @@ public: # ifndef QT_NO_DRAGANDDROP virtual QPlatformDrag *drag() const; # endif -#endif !QT_NO_CLIPBOARD +#endif // !QT_NO_CLIPBOARD virtual QPlatformInputContext *inputContext() const; #ifndef QT_NO_ACCESSIBILITY virtual QPlatformAccessibility *accessibility() const; -- cgit v1.2.3 From 8b29c7539d87a387854cf06782a7b078dce63612 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Feb 2013 17:24:22 +0100 Subject: Fix compilation with QT_NO_ACCESSIBILITY. Task-number: QTBUG-27860 Change-Id: If3b17e7c5dcba69c351025d97c7ab43498c9dcda Reviewed-by: Konstantin Ritt --- src/widgets/styles/qwindowsvistastyle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 48d2027834..a621cab04d 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -520,7 +520,11 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } break; case PE_Frame: { +#ifndef QT_NO_ACCESSIBILITY if (QStyleHelper::isInstanceOf(option->styleObject, QAccessible::EditableText)) { +#else + if (false) { +#endif painter->save(); int stateId = ETS_NORMAL; if (!(state & State_Enabled)) -- cgit v1.2.3 From cdca61f09ab9f9f443786bebf65bb8c153202f94 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 25 Feb 2013 15:42:06 +0100 Subject: Extract some cmake related functions for re-use. These will be used by ctest_testcase.prf. Change-Id: I8a0e6e1eb110daba41b007c8309f3cb9a2059ecb Reviewed-by: Oswald Buddenhagen --- mkspecs/features/cmake_functions.prf | 26 ++++++++++++++++++++++++++ mkspecs/features/create_cmake.prf | 16 +--------------- 2 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 mkspecs/features/cmake_functions.prf diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf new file mode 100644 index 0000000000..62634d9b88 --- /dev/null +++ b/mkspecs/features/cmake_functions.prf @@ -0,0 +1,26 @@ +# +# 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. +# + +defineReplace(cmakeModuleName) { + _module = $$1 + _name = $$eval(QT.$${_module}.name) + cmake_module_name = $$replace(_name, ^Qt, ) + return ($$cmake_module_name) +} + +defineReplace(cmakeModuleList) { + variable = $$1 + out = + for(v, variable) { + out += $$cmakeModuleName($$v) + } + return ($$join(out, ";")) +} diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 43dca4cd70..428a3a4d43 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -9,21 +9,7 @@ # We mean it. # -defineReplace(cmakeModuleName) { - _module = $$1 - _name = $$eval(QT.$${_module}.name) - cmake_module_name = $$replace(_name, ^Qt, ) - return ($$cmake_module_name) -} - -defineReplace(cmakeModuleList) { - variable = $$1 - out = - for(v, variable) { - out += $$cmakeModuleName($$v) - } - return ($$join(out, ";")) -} +load(cmake_functions) defineReplace(cmakeRelativePath) { path = $$relative_path($$1, $$2) -- cgit v1.2.3 From 97e755945c0a95d4c82ef4b1897226b340bd9e82 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 25 Feb 2013 11:26:53 +0100 Subject: Automatically find external dependencies in cmake tests. Currently the Qt5_MODULE_TEST_DEPENDS variable is maintained individually in each repo. This patch makes that obsolete. Change-Id: I1a72bb4da70b9ace6f79296d6a3fb295eaa999ff Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly --- mkspecs/features/ctest_testcase.prf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/ctest_testcase.prf b/mkspecs/features/ctest_testcase.prf index 7f86ca0052..7e841de790 100644 --- a/mkspecs/features/ctest_testcase.prf +++ b/mkspecs/features/ctest_testcase.prf @@ -31,6 +31,8 @@ isEmpty(CMAKE_VERSION) { isEmpty(VERSION_OK) { message("cmake $$CMAKE_VERSION is too old for this test.") } else { + load(cmake_functions) + CMAKE_BUILD_TYPE = Debug CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release win32-g++*:CMAKE_GENERATOR = -G \"MinGW Makefiles\" @@ -41,9 +43,13 @@ isEmpty(CMAKE_VERSION) { CMAKE_PREFIX_PATH *= $$dirname(d) } + dependentmodules = $$resolve_depends(CMAKE_QT_MODULES_UNDER_TEST, "QT.") + dependentmodules -= $$CMAKE_QT_MODULES_UNDER_TEST + dependentmodules = $$cmakeModuleList($$dependentmodules) + check.commands = \ $(MKDIR) $$BUILD_DIR && cd $$BUILD_DIR && \ - cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" && \ + cmake $$_PRO_FILE_PWD_ $$CMAKE_GENERATOR -DCMAKE_BUILD_TYPE=$${CMAKE_BUILD_TYPE} -DCMAKE_PREFIX_PATH=\"$$join(CMAKE_PREFIX_PATH, ;)\" -DQt5_MODULE_TEST_DEPENDS=\"$${dependentmodules}\" && \ $(TESTRUNNER) ctest --output-on-failure } -- cgit v1.2.3 From f136701bc50b63b90281856c2ab5953a40f4b868 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 21 Feb 2013 00:01:30 +0100 Subject: Use the base implementation of QAbstractItemModel::sibling in QSIM. QStandardItemModel doesn't really benefit from a reimplementation of sibling, and the current implementation is buggy. Task-number: 29540 Change-Id: Icf8dca29b6e1394a378db5bf6abd884f2d7fd9b9 Reviewed-by: Olivier Goffart --- src/gui/itemmodels/qstandarditemmodel.cpp | 2 +- src/gui/itemmodels/qstandarditemmodel.h | 1 + tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index d6161671b1..d5d742c9b3 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2714,7 +2714,7 @@ bool QStandardItemModel::hasChildren(const QModelIndex &parent) const */ QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const { - return createIndex(row, column, idx.internalPointer()); + return QAbstractItemModel::sibling(row, column, idx); } /*! diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h index b4f03008fd..0d6649039c 100644 --- a/src/gui/itemmodels/qstandarditemmodel.h +++ b/src/gui/itemmodels/qstandarditemmodel.h @@ -332,6 +332,7 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + // Qt 6: Remove QModelIndex sibling(int row, int column, const QModelIndex &idx) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index 5fb8df3f59..085dfd0461 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -718,6 +718,8 @@ void tst_QStandardItemModel::checkChildren() QVERIFY(!model.hasChildren()); QCOMPARE(model.rowCount(), 0); QCOMPARE(model.columnCount(), 1); + + QVERIFY(!model.index(0,0).sibling(100,100).isValid()); } void tst_QStandardItemModel::data() -- cgit v1.2.3 From f28b6f8453b745fe437f841ded1928e6ba6085df Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Wed, 20 Feb 2013 13:12:57 +0100 Subject: Doc: Added the missing example snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The snippet files referred were outside the scope exampledirs for QtCore. I made of a copy of those files in the snippets folder to fix this issue. Task-number: QTBUG-29755 Change-Id: I2f765104394071d035e9cee610945ae290033deb Reviewed-by: Jerome Pasion Reviewed-by: Topi Reiniö Reviewed-by: Martin Smith Reviewed-by: Nico Vertriest --- .../doc/snippets/plugins/extrafiltersplugin.h | 65 +++++++++ src/corelib/doc/snippets/plugins/interfaces.h | 114 ++++++++++++++++ src/corelib/doc/snippets/timers/analogclock.cpp | 145 +++++++++++++++++++++ src/corelib/doc/src/plugins-howto.qdoc | 4 +- src/corelib/doc/src/timers.qdoc | 14 +- src/corelib/itemmodels/qabstractitemmodel.cpp | 1 - 6 files changed, 333 insertions(+), 10 deletions(-) create mode 100644 src/corelib/doc/snippets/plugins/extrafiltersplugin.h create mode 100644 src/corelib/doc/snippets/plugins/interfaces.h create mode 100644 src/corelib/doc/snippets/timers/analogclock.cpp diff --git a/src/corelib/doc/snippets/plugins/extrafiltersplugin.h b/src/corelib/doc/snippets/plugins/extrafiltersplugin.h new file mode 100644 index 0000000000..7add7abb53 --- /dev/null +++ b/src/corelib/doc/snippets/plugins/extrafiltersplugin.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +#ifndef EXTRAFILTERSPLUGIN_H +#define EXTRAFILTERSPLUGIN_H + +//! [0] +#include +#include +#include +#include + +#include + +class ExtraFiltersPlugin : public QObject, public FilterInterface +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface" FILE "extrafilters.json") + Q_INTERFACES(FilterInterface) + +public: + QStringList filters() const; + QImage filterImage(const QString &filter, const QImage &image, + QWidget *parent); +}; +//! [0] + +#endif diff --git a/src/corelib/doc/snippets/plugins/interfaces.h b/src/corelib/doc/snippets/plugins/interfaces.h new file mode 100644 index 0000000000..b2261a1eb2 --- /dev/null +++ b/src/corelib/doc/snippets/plugins/interfaces.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +#ifndef INTERFACES_H +#define INTERFACES_H + +#include + +QT_BEGIN_NAMESPACE +class QImage; +class QPainter; +class QWidget; +class QPainterPath; +class QPoint; +class QRect; +class QString; +class QStringList; +QT_END_NAMESPACE + +//! [0] +class BrushInterface +{ +public: + virtual ~BrushInterface() {} + + virtual QStringList brushes() const = 0; + virtual QRect mousePress(const QString &brush, QPainter &painter, + const QPoint &pos) = 0; + virtual QRect mouseMove(const QString &brush, QPainter &painter, + const QPoint &oldPos, const QPoint &newPos) = 0; + virtual QRect mouseRelease(const QString &brush, QPainter &painter, + const QPoint &pos) = 0; +}; +//! [0] + +//! [1] +class ShapeInterface +{ +public: + virtual ~ShapeInterface() {} + + virtual QStringList shapes() const = 0; + virtual QPainterPath generateShape(const QString &shape, + QWidget *parent) = 0; +}; +//! [1] + +//! [2] +class FilterInterface +{ +public: + virtual ~FilterInterface() {} + + virtual QStringList filters() const = 0; + virtual QImage filterImage(const QString &filter, const QImage &image, + QWidget *parent) = 0; +}; +//! [2] + +QT_BEGIN_NAMESPACE +//! [3] //! [4] +#define BrushInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" + +Q_DECLARE_INTERFACE(BrushInterface, BrushInterface_iid) +//! [3] + +#define ShapeInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.ShapeInterface" + +Q_DECLARE_INTERFACE(ShapeInterface, ShapeInterface_iid) +//! [5] +#define FilterInterface_iid "org.qt-project.Qt.Examples.PlugAndPaint.FilterInterface" + +Q_DECLARE_INTERFACE(FilterInterface, FilterInterface_iid) +//! [4] //! [5] +QT_END_NAMESPACE + +#endif diff --git a/src/corelib/doc/snippets/timers/analogclock.cpp b/src/corelib/doc/snippets/timers/analogclock.cpp new file mode 100644 index 0000000000..6c0de25397 --- /dev/null +++ b/src/corelib/doc/snippets/timers/analogclock.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2012 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$ +** +****************************************************************************/ + +#include + +#include "analogclock.h" + +//! [0] //! [1] +AnalogClock::AnalogClock(QWidget *parent) +//! [0] //! [2] + : QWidget(parent) +//! [2] //! [3] +{ +//! [3] //! [4] + QTimer *timer = new QTimer(this); +//! [4] //! [5] + connect(timer, SIGNAL(timeout()), this, SLOT(update())); +//! [5] //! [6] + timer->start(1000); +//! [6] + + setWindowTitle(tr("Analog Clock")); + resize(200, 200); +//! [7] +} +//! [1] //! [7] + +//! [8] //! [9] +void AnalogClock::paintEvent(QPaintEvent *) +//! [8] //! [10] +{ + static const QPoint hourHand[3] = { + QPoint(7, 8), + QPoint(-7, 8), + QPoint(0, -40) + }; + static const QPoint minuteHand[3] = { + QPoint(7, 8), + QPoint(-7, 8), + QPoint(0, -70) + }; + + QColor hourColor(127, 0, 127); + QColor minuteColor(0, 127, 127, 191); + + int side = qMin(width(), height()); + QTime time = QTime::currentTime(); +//! [10] + +//! [11] + QPainter painter(this); +//! [11] //! [12] + painter.setRenderHint(QPainter::Antialiasing); +//! [12] //! [13] + painter.translate(width() / 2, height() / 2); +//! [13] //! [14] + painter.scale(side / 200.0, side / 200.0); +//! [9] //! [14] + +//! [15] + painter.setPen(Qt::NoPen); +//! [15] //! [16] + painter.setBrush(hourColor); +//! [16] + +//! [17] //! [18] + painter.save(); +//! [17] //! [19] + painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0))); + painter.drawConvexPolygon(hourHand, 3); + painter.restore(); +//! [18] //! [19] + +//! [20] + painter.setPen(hourColor); +//! [20] //! [21] + + for (int i = 0; i < 12; ++i) { + painter.drawLine(88, 0, 96, 0); + painter.rotate(30.0); + } +//! [21] + +//! [22] + painter.setPen(Qt::NoPen); +//! [22] //! [23] + painter.setBrush(minuteColor); + +//! [24] + painter.save(); + painter.rotate(6.0 * (time.minute() + time.second() / 60.0)); + painter.drawConvexPolygon(minuteHand, 3); + painter.restore(); +//! [23] //! [24] + +//! [25] + painter.setPen(minuteColor); +//! [25] //! [26] + +//! [27] + for (int j = 0; j < 60; ++j) { + if ((j % 5) != 0) + painter.drawLine(92, 0, 96, 0); + painter.rotate(6.0); + } +//! [27] +} +//! [26] diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc index af15d94af2..060df8fa18 100644 --- a/src/corelib/doc/src/plugins-howto.qdoc +++ b/src/corelib/doc/src/plugins-howto.qdoc @@ -184,12 +184,12 @@ For example, here's the definition of an interface class: - \snippet tools/plugandpaint/interfaces.h 2 + \snippet plugins/interfaces.h 2 Here's the definition of a plugin class that implements that interface: - \snippet tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h 0 + \snippet plugins/extrafiltersplugin.h 0 The \l{tools/plugandpaint}{Plug & Paint} example documentation explains this process in detail. See also \l{Creating Custom diff --git a/src/corelib/doc/src/timers.qdoc b/src/corelib/doc/src/timers.qdoc index 5e8095ae58..dcff26ea18 100644 --- a/src/corelib/doc/src/timers.qdoc +++ b/src/corelib/doc/src/timers.qdoc @@ -102,14 +102,14 @@ QTimer to redraw a widget at regular intervals. From \c{AnalogClock}'s implementation: - \snippet analogclock.cpp 0 - \snippet analogclock.cpp 2 - \snippet analogclock.cpp 3 - \snippet analogclock.cpp 4 - \snippet analogclock.cpp 5 - \snippet analogclock.cpp 6 + \snippet timers/analogclock.cpp 0 + \snippet timers/analogclock.cpp 2 + \snippet timers/analogclock.cpp 3 + \snippet timers/analogclock.cpp 4 + \snippet timers/analogclock.cpp 5 + \snippet timers/analogclock.cpp 6 \dots - \snippet analogclock.cpp 7 + \snippet timers/analogclock.cpp 7 Every second, QTimer will call the QWidget::update() slot to refresh the clock's display. diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index cc9a74d99d..12029f4a23 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -2274,7 +2274,6 @@ void QAbstractItemModel::doSetRoleNames(const QHash &roleNames) Returns the model's role names. - \sa setRoleNames() */ QHash QAbstractItemModel::roleNames() const { -- cgit v1.2.3 From 2bab4a65521ec1de264f3f00addf2da4902c00b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Feb 2013 13:35:14 +0100 Subject: Fix Qt Designer warning about being unable to handle property. Qt Designer warns: "The property "document" of type 1053 (user type) is not supported yet!" when loading forms containing a QTextEdit. Introduced by 468c22f6732b5755b68f658dbd7a9c4e9e9601d1 . Change-Id: Ia1b7bdc9f7188e0b092c010056fcd12c9e891fd7 Reviewed-by: J-P Nurmi --- src/widgets/widgets/qtextedit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index 7256e9b84e..b44083a502 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -86,7 +86,7 @@ class Q_WIDGETS_EXPORT QTextEdit : public QAbstractScrollArea Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) - Q_PROPERTY(QTextDocument *document READ document WRITE setDocument) + Q_PROPERTY(QTextDocument *document READ document WRITE setDocument DESIGNABLE false) public: enum LineWrapMode { NoWrap, -- cgit v1.2.3 From cd1e24587709d09c22256dede900629743cf6b6b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Feb 2013 11:05:26 +0100 Subject: QStandardPaths: Use forward slash consistently. Task-number: QTBUG-29249 Change-Id: I027f9ae18544dc47e1378214244487c8a5ae704c Reviewed-by: Frederik Gladhorn Reviewed-by: Thiago Macieira --- src/corelib/io/qstandardpaths_win.cpp | 4 ++-- .../auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 478db6c299..d4e0779381 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -160,10 +160,10 @@ QString QStandardPaths::writableLocation(StandardLocation type) // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache // location for everyone. Most applications seem to be using a // cache directory located in their AppData directory - return writableLocation(DataLocation) + QLatin1String("\\cache"); + return writableLocation(DataLocation) + QLatin1String("/cache"); case GenericCacheLocation: - return writableLocation(GenericDataLocation) + QLatin1String("\\cache"); + return writableLocation(GenericDataLocation) + QLatin1String("/cache"); case RuntimeLocation: case HomeLocation: diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index c4453fd5f2..f94c8eac4f 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #ifdef Q_OS_UNIX #include @@ -72,6 +73,7 @@ private slots: void testCustomRuntimeDirectory(); void testAllWritableLocations_data(); void testAllWritableLocations(); + void testCleanPath(); private: #ifdef Q_XDG_PLATFORM @@ -430,6 +432,18 @@ void tst_qstandardpaths::testAllWritableLocations() QCOMPARE(loc.endsWith(QLatin1Char('/')), false); } +void tst_qstandardpaths::testCleanPath() +{ + const QRegExp filter(QStringLiteral("\\\\")); + QVERIFY(filter.isValid()); + for (int i = 0; i <= QStandardPaths::GenericCacheLocation; ++i) { + const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::StandardLocation(i)); + QVERIFY2(paths.filter(filter).isEmpty(), + qPrintable(QString::fromLatin1("Backslash found in %1 %2") + .arg(i).arg(paths.join(QLatin1Char(','))))); + } +} + QTEST_MAIN(tst_qstandardpaths) #include "tst_qstandardpaths.moc" -- cgit v1.2.3 From 6269c9a4141b942b1c30788a41311f3bac1838a6 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 25 Feb 2013 12:30:31 +0100 Subject: Fix some punctuation errors. Change-Id: I6aa2ad2b506466fbef6a22380d151988930807c9 Reviewed-by: Jerome Pasion --- src/gui/doc/src/dnd.qdoc | 3 +-- src/widgets/graphicsview/qgraphicsitem.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc index 50b8c80ff3..1c6ca9c81c 100644 --- a/src/gui/doc/src/dnd.qdoc +++ b/src/gui/doc/src/dnd.qdoc @@ -33,8 +33,7 @@ \ingroup qt-gui-concepts Drag and drop provides a simple visual mechanism which users can use - to transfer information between and within applications. (In the - literature this is referred to as a "direct manipulation model".) Drag + to transfer information between and within applications. Drag and drop is similar in function to the clipboard's cut and paste mechanism. diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 86fd3ce04a..5c9651f1c9 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7340,8 +7340,8 @@ void QGraphicsItem::updateMicroFocus() /*! This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes. By reimplementing this - function, your can react to a change, and in some cases, (depending on \a - change,) adjustments can be made. + function, you can react to a change, and in some cases (depending on \a + change), adjustments can be made. \a change is the parameter of the item that is changing. \a value is the new value; the type of the value depends on \a change. -- cgit v1.2.3 From 4a6a066df2f104763c35eaaaf8dc7b1366d483b2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 26 Feb 2013 09:59:24 +0100 Subject: Fix generation of XCode projects for XCode 4.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a framework is referenced in the XCode project then it is known as a framework by the lastKnownFileType and not the reference type. This ensures it works in both XCode 3 and XCode 4. Task-number: QTBUG-29371 Change-Id: I434246a46d6c5bfd50ba7de1a7c710c0caf0bc0a Reviewed-by: Oswald Buddenhagen Reviewed-by: Tor Arne Vestbø --- qmake/generators/mac/pbuilder_pbx.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 9893a7a7a4..c5b2c56f8f 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -902,12 +902,14 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString key = keyFor(library); bool is_frmwrk = (library.endsWith(".framework")); t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference"), SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n" - << "\t\t" << "};" << "\n"; + << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; + if (is_frmwrk) + t << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.framework") << ";" << "\n"; + t << "\t\t" << "};" << "\n"; project->values("QMAKE_PBX_LIBRARIES").append(key); QString build_key = keyFor(library + ".BUILDABLE"); t << "\t\t" << build_key << " = {" << "\n" -- cgit v1.2.3 From a65982d659226ace42fe0a0ca0a2f15523e95e4b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 26 Feb 2013 17:13:44 +0100 Subject: Add snippet for QT_VERSION_CHECK. Change-Id: I048771f21ce694329a7e9acd4dbfbebfec964b05 Reviewed-by: Jerome Pasion Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp | 10 ++++++++++ src/corelib/global/qglobal.cpp | 4 ++++ 2 files changed, 14 insertions(+) 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 ddb84bcc74..7d7d71ac50 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -598,3 +598,13 @@ bool readConfiguration(const QFile &file) break; } //! [qunreachable-switch] + +//! [qt-version-check] +#include + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#include +#else +#include +#endif +//! [qt-version-check] diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 7fd9283579..f0fb9c1a02 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -846,6 +846,10 @@ Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can be compared with another similarly processed version id. + Example: + + \snippet code/src_corelib_global_qglobal.cpp qt-version-check + \sa QT_VERSION */ -- cgit v1.2.3 From 7867f03f8a26f94c6e6e4386a28fddb875d29e36 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Feb 2013 09:46:27 +0100 Subject: Stabilize tst_qprogressbar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Wait for shown to ensure events are processed. - Move away from screen corners/potential task bar areas. Change-Id: I2c3aa9b675c6b33ca0da67ee99cc6f76c502098a Reviewed-by: Samuel Rødal --- tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 5ad9aa7690..0696aa11d2 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -113,7 +113,9 @@ void tst_QProgressBar::minMaxSameValue() QProgressBar bar; bar.setRange(10, 10); bar.setValue(10); + bar.move(300, 300); bar.show(); + QVERIFY(QTest::qWaitForWindowExposed(&bar)); } void tst_QProgressBar::destroyIndeterminate() @@ -123,7 +125,9 @@ void tst_QProgressBar::destroyIndeterminate() // it's deleted. QPointer bar = new QProgressBar; bar->setMaximum(0); + bar->move(300, 300); bar->show(); + QVERIFY(QTest::qWaitForWindowExposed(bar.data())); QEventLoop loop; QTimer::singleShot(500, bar, SLOT(deleteLater())); @@ -166,8 +170,10 @@ void tst_QProgressBar::format() ProgressBar bar; bar.setRange(0, 10); bar.setValue(1); + bar.move(300, 300); bar.show(); QVERIFY(QTest::qWaitForWindowExposed(&bar)); + QVERIFY(QTest::qWaitForWindowExposed(&bar)); QTest::qWait(20); bar.repainted = false; @@ -202,6 +208,7 @@ void tst_QProgressBar::setValueRepaint() pbar.setMinimum(0); pbar.setMaximum(10); pbar.setFormat("%v"); + pbar.move(300, 300); pbar.show(); QVERIFY(QTest::qWaitForWindowExposed(&pbar)); @@ -224,7 +231,9 @@ void tst_QProgressBar::setMinMaxRepaint() pbar.setMinimum(0); pbar.setMaximum(10); pbar.setFormat("%v"); + pbar.move(300, 300); pbar.show(); + qApp->setActiveWindow(&pbar); QVERIFY(QTest::qWaitForWindowActive(&pbar)); // No repaint when setting minimum to the current minimum @@ -319,7 +328,9 @@ void tst_QProgressBar::task245201_testChangeStyleAndDelete() QStyle *style = QStyleFactory::create(style1_str); bar->setStyle(style); + bar->move(300, 300); bar->show(); + QVERIFY(QTest::qWaitForWindowExposed(bar)); QStyle *style2 = QStyleFactory::create(style2_str); bar->setStyle(style2); QTest::qWait(10); -- cgit v1.2.3 From e265a1a4bd5e161344babe51be424c7e9d561411 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Feb 2013 16:20:43 +0100 Subject: Disable maximize button for fixed-size windows. Task-number: QTBUG-28407 Change-Id: I5bab7fcf4ad3ecc7008ef02b9d3575d75893895d Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 20000ea0a9..7a68cdeb47 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -203,17 +203,16 @@ static inline QSize clientSize(HWND hwnd) return qSizeOfRect(rect); } -// from qwidget_win.cpp/maximum layout size check removed. -static bool shouldShowMaximizeButton(Qt::WindowFlags flags) +// from qwidget_win.cpp +static bool shouldShowMaximizeButton(const QWindow *w) { - if (flags & Qt::MSWindowsFixedSizeDialogHint) + const Qt::WindowFlags flags = w->flags(); + if ((flags & Qt::MSWindowsFixedSizeDialogHint) || !(flags & Qt::WindowMaximizeButtonHint)) return false; // if the user explicitly asked for the maximize button, we try to add // it even if the window has fixed size. - if (flags & Qt::CustomizeWindowHint && - flags & Qt::WindowMaximizeButtonHint) - return true; - return flags & Qt::WindowMaximizeButtonHint; + return (flags & Qt::CustomizeWindowHint) || + w->maximumSize() == QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX); } // Set the WS_EX_LAYERED flag on a HWND if required. This is required for @@ -432,7 +431,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag style |= WS_SYSMENU; if (flags & Qt::WindowMinimizeButtonHint) style |= WS_MINIMIZEBOX; - if (shouldShowMaximizeButton(flags)) + if (shouldShowMaximizeButton(w)) style |= WS_MAXIMIZEBOX; if (tool) exStyle |= WS_EX_TOOLWINDOW; -- cgit v1.2.3 From 01292ac849363eea97bcb981ccded1279dc95e6c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Feb 2013 12:20:32 +0100 Subject: Make -force-debug-info option work Should be applied to Qt modules. Not interesting for third party users. Change-Id: I8fce821af397e3ace011a426c762319f6d30004f Reviewed-by: Oswald Buddenhagen Reviewed-by: Eskil Abrahamsen Blomfeldt --- configure | 2 +- tools/configure/configureapp.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 3d511e3d72..5f6075d722 100755 --- a/configure +++ b/configure @@ -2609,7 +2609,7 @@ if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then fi if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then - QT_CONFIG="$QT_CONFIG force_debug_info" + QMAKE_CONFIG="$QMAKE_CONFIG force_debug_info" fi # pass on $CFG_SDK to the arch/configure tests. diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index af470939e9..5ff4a67315 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2545,7 +2545,7 @@ void Configure::generateOutputVars() qtConfig += "build_all"; } if (dictionary[ "FORCEDEBUGINFO" ] == "yes") - qtConfig += "force_debug_info"; + qmakeConfig += "force_debug_info"; qmakeConfig += dictionary[ "BUILD" ]; dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ]; -- cgit v1.2.3 From f3f60743551936e3d06f7f5c8bb2c76eab6d536c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 20 Feb 2013 11:58:35 +0100 Subject: Document MSVC-restrictions regarding QStringLiteral. Task-number: QTBUG-28885 Change-Id: I02eed2b27970ec31479a6c80fbe4c336431e13de Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- src/corelib/tools/qstring.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c9525cf0ae..404e3be289 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9239,6 +9239,19 @@ QString QString::toHtmlEscaped() const \code if (attribute.name() == QLatin1String("http-contents-length")) //... \endcode + + \note There some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets provided here + fail to compile with them. + \list + \li Concatenated string literals cannot be used with QStringLiteral. + \code + QString s = QStringLiteral("a" "b"); + \endcode + \li QStringLiteral cannot be used to initialize lists or arrays of QString. + \code + QString a[] = { QStringLiteral("a"), QStringLiteral("b") }; + \endcode + \endlist */ QT_END_NAMESPACE -- cgit v1.2.3 From 1a8f67938c4146614fec3788c7868dc1a314cc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Fri, 22 Feb 2013 09:58:41 +0100 Subject: Fix CreateFileMapping() error handling CreateFileMapping() returns NULL in case of an error. The patch corrects the wrong testing on INVALID_HANDLE_VALUE, and sets NULL for invalid handles. Change-Id: Iaab4945ed88ee92bbf9a0871e95a5820dd1a56ed Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- src/corelib/io/qfsfileengine.cpp | 2 +- src/corelib/io/qfsfileengine_win.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index b1d7ca9dd1..3963416084 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -128,7 +128,7 @@ void QFSFileEnginePrivate::init() #ifdef Q_OS_WIN fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; - mapHandle = INVALID_HANDLE_VALUE; + mapHandle = NULL; #ifndef Q_OS_WINCE cachedFd = -1; #endif diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 1cb3c03c30..24631f11c7 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -900,7 +900,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, return 0; } - if (mapHandle == INVALID_HANDLE_VALUE) { + if (mapHandle == NULL) { // get handle to the file HANDLE handle = fileHandle; @@ -933,7 +933,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, // first create the file mapping handle DWORD protection = (openMode & QIODevice::WriteOnly) ? PAGE_READWRITE : PAGE_READONLY; mapHandle = ::CreateFileMapping(handle, 0, protection, 0, 0, 0); - if (mapHandle == INVALID_HANDLE_VALUE) { + if (mapHandle == NULL) { q->setError(QFile::PermissionsError, qt_error_string()); #ifdef Q_USE_DEPRECATED_MAP_API ::CloseHandle(handle); @@ -976,6 +976,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, } ::CloseHandle(mapHandle); + mapHandle = NULL; return 0; } @@ -995,7 +996,7 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) maps.remove(ptr); if (maps.isEmpty()) { ::CloseHandle(mapHandle); - mapHandle = INVALID_HANDLE_VALUE; + mapHandle = NULL; } return true; -- cgit v1.2.3 From a2432510915a99c6c2ebf339bc38ceca9b5a7ba1 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Thu, 21 Feb 2013 14:55:38 +0100 Subject: qcocamenubar: force update after destructor Task-number: QTCREATORBUG-8785 Change-Id: I1e782cab36f4fea331561f016ea67a73deb63c37 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoamenubar.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index bae52c91b8..c0c8caed05 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -77,8 +77,10 @@ QCocoaMenuBar::~QCocoaMenuBar() [m_nativeMenu release]; static_menubars.removeOne(this); - if (m_window) + if (m_window && m_window->menubar() == this) { m_window->setMenubar(0); + updateMenuBarImmediately(); + } } void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) -- cgit v1.2.3 From 42507173bd985d8b3875d9fd0141a1dd7ad4e544 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Feb 2013 14:54:38 +0100 Subject: Fix automatic hiding/restoring of transient children. Task-number: QTBUG-28408 Change-Id: I31382c4edc213961dfb132af3bf5202e178e7a57 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowscontext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 99ef3aacf3..1ea660d944 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -854,10 +854,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; case QtWindows::ShowEvent: platformWindow->handleShown(); - return true; + return false; // Indicate transient children should be shown by windows (SW_PARENTOPENING) case QtWindows::HideEvent: platformWindow->handleHidden(); - return true; + return false;// Indicate transient children should be hidden by windows (SW_PARENTCLOSING) case QtWindows::CloseEvent: QWindowSystemInterface::handleCloseEvent(platformWindow->window()); return true; -- cgit v1.2.3