From 826066dbe5f298ec0515d21fa182d15ee3762f37 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 12 Feb 2010 10:50:57 +0100 Subject: doc: Fixed several typos. Task: QTBUG-7997 --- doc/src/development/qmake-manual.qdoc | 8 ++++---- doc/src/development/qtestlib.qdoc | 4 ++-- doc/src/examples/googlesuggest.qdoc | 2 +- doc/src/porting/porting4.qdoc | 6 +++--- doc/src/porting/qt4-network.qdoc | 2 +- doc/src/scripting/scripting.qdoc | 2 +- doc/src/snippets/code/doc_src_porting4.qdoc | 2 +- doc/src/widgets-and-layouts/styles.qdoc | 2 +- doc/src/widgets-and-layouts/stylesheet.qdoc | 2 +- src/corelib/global/qnamespace.qdoc | 6 +++--- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- src/network/access/qnetworkaccessmanager.cpp | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 49e1e71..78dfefa 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -858,7 +858,7 @@ libraries are linked in the "Frameworks & Libraries" phase in the XCode build system. - Furthermore, The selected "Active Build Configuration" is stored + Furthermore, the selected "Active Build Configuration" is stored in a .pbxuser file, which is generated by xcode on first load, not created by qmake. @@ -979,7 +979,7 @@ If \c UID2 is not specified, it defaults to the same value as \c UID3. If \c UID3 is not specified, qmake will automatically generate a \c UID3 suitable for development and debugging. This value should be manually - specified for applications that are to be released. In order to optain + specified for applications that are to be released. In order to obtain an official UID, please contact Nokia. Both \c SID and \c VID default to empty values. For more information about unique identifiers and their meaning for @@ -3504,7 +3504,7 @@ For example: \target Properties \section1 Properties - \c qmake has a system of persistant information, this allows you to + \c qmake has a system of persistent information, this allows you to \c set a variable in qmake once, and each time qmake is invoked this value can be queried. Use the following to set a property in qmake: @@ -3682,7 +3682,7 @@ For example: the newly introduced libraries in the \c LIBS variable, and find their dependent .prl files, continuing until all libraries have been resolved. At this point, the Makefile is created as usual, and the libraries are - linked explicitlyy against the application. + linked explicitly against the application. The internals of the .prl file are left closed so they can easily change later. They are not designed to be changed by hand, should only diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 0835ff1..4b9c657 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -237,14 +237,14 @@ The code insde the QBENCHMARK macro will be measured, and possibly also repeated several times in order to get an accurate measurement. This depends on the selected - measurement back-end. Several back-ends are available an can be selected on the + measurement back-end. Several back-ends are available. They can be selected on the command line: \target testlib-benchmarking-measurement \table \header \o Name - \o Commmand-line Arguemnt + \o Commmand-line Argument \o Availability \row \o Walltime \o (default) diff --git a/doc/src/examples/googlesuggest.qdoc b/doc/src/examples/googlesuggest.qdoc index cd6c6b1..f2bdb4f 100644 --- a/doc/src/examples/googlesuggest.qdoc +++ b/doc/src/examples/googlesuggest.qdoc @@ -111,7 +111,7 @@ event processing. Key event handling is implemented so that Enter and Return execute the - selected link, while the Escape key hides the popup. Sine we want to be + selected link, while the Escape key hides the popup. Since we want to be able to navigate the list of suggestions using the different navigation keys on the keyboard we let Qt continue regular event processing for those by returning false from the eventFilter reimplementation. diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index d494b0c..68e6119 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -3201,8 +3201,8 @@ The \c QShared class has been obsoleted by the more powerful QSharedData and QSharedDataPointer as a means of creating custom - implicitly shared classes. It has been renamed Q3Shared moved to - the Qt3Support library. + implicitly shared classes. It has been renamed Q3Shared and moved + to the Qt3Support library. An easy way of porting to Qt 4 is to include this class into your project and to use it instead of \c QShared: @@ -3226,7 +3226,7 @@ \section1 QSimpleRichText QSimpleRichText has been obsoleted by QTextDocument. It has - bene renamed Q3SimpleRichText and moved to the Qt3Support + been renamed Q3SimpleRichText and moved to the Qt3Support library. Previously, you would do the following with Q3SimpleRichText: diff --git a/doc/src/porting/qt4-network.qdoc b/doc/src/porting/qt4-network.qdoc index 91c1c4e..60e6dbb 100644 --- a/doc/src/porting/qt4-network.qdoc +++ b/doc/src/porting/qt4-network.qdoc @@ -199,7 +199,7 @@ level QNetworkProtocol and QUrlOperator abstraction has been eliminated. These classes attempted the impossible (unify FTP and HTTP under one roof), and unsurprisingly failed at that. Qt 4 - still provides QFtp, and it also proveds the QNetworkAccessManager. + still provides QFtp, and it also provides the QNetworkAccessManager. The QSocket class in Qt 3 has been renamed QTcpSocket. The new class is reentrant and supports blocking. It's also easier to diff --git a/doc/src/scripting/scripting.qdoc b/doc/src/scripting/scripting.qdoc index edee52a..2c22989 100644 --- a/doc/src/scripting/scripting.qdoc +++ b/doc/src/scripting/scripting.qdoc @@ -1007,7 +1007,7 @@ Because of the presence of the built-in \c arguments object, implementing functions that take a variable number of arguments is simple. In fact, as we have seen, in the technical sense \e{all} - Qt Script functions can be seen as variable-argument functions). + Qt Script functions can be seen as variable-argument functions. As an example, consider a concat() function that takes an arbitrary number of arguments, converts the arguments to their string representation and concatenates the results; for example, diff --git a/doc/src/snippets/code/doc_src_porting4.qdoc b/doc/src/snippets/code/doc_src_porting4.qdoc index 4d24ba3..2f76591 100644 --- a/doc/src/snippets/code/doc_src_porting4.qdoc +++ b/doc/src/snippets/code/doc_src_porting4.qdoc @@ -452,7 +452,7 @@ QSimpleRichText richText(text, font); // Set the width of the paragraph to w richText.setWidth(w); -// Or set a resonable default size +// Or set a reasonable default size richText.adjustSize(); // Query for its used size diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index b7f7322..9a28715 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -125,7 +125,7 @@ necessary for drawing. Thanks to QStyleOption, it is possible to make QStyle draw widgets without linking in any code for the widget. This makes it possible to use \l{QStyle}'s draw functions on any paint - device. Ie you can draw a combobox on any widget, not just on a + device, i.e., you can draw a combobox on any widget, not just on a QComboBox. The widget is passed as the last argument in case the style needs diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index ebe67df..5f42f28 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -3822,7 +3822,7 @@ The tear indicator and the scroll buttons can be further customized as follows: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 148 - Sine Qt 4.6 the close button can be customized as follow: + Since Qt 4.6 the close button can be customized as follow: \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 159 \section2 Customizing QTableView diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6627c76..392ece3 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -157,7 +157,7 @@ \value AA_MacDontSwapCtrlAndMeta On Mac OS X by default, Qt swaps the Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt - sends Meta and whenever Meta is pressed Control is sent. When this + sends Meta, and whenever Meta is pressed Control is sent). When this attribute is true, Qt will not do the flip. QKeySequence::StandardShortcuts will also flip accordingly (i.e., QKeySequence::Copy will be Command+C on the keyboard regardless of the value set, though what is output for @@ -493,7 +493,7 @@ \omitvalue WordBreak \omitvalue TextForceLeftToRight \omitvalue TextForceRightToLeft - \omitvalue TextLongestVariant Always use the longest variant when computing the size of a multi-variant string + \omitvalue TextLongestVariant Always use the longest variant when computing the size of a multi-variant string. You can use as many modifier flags as you want, except that Qt::TextSingleLine and Qt::TextWordWrap cannot be combined. @@ -2115,7 +2115,7 @@ On some platforms this implies Qt::WindowSystemMenuHint for it to work. \value MacWindowToolBarButtonHint On Mac OS X adds a tool bar button (i.e., - the oblong button that is on the top right of windows that have toolbars. + the oblong button that is on the top right of windows that have toolbars). \value BypassGraphicsProxyWidget Prevents the window and its children from automatically embedding themselves into a QGraphicsProxyWidget if the diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 39c41c4..3cdf8ce 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -319,7 +319,7 @@ QGraphicsItem::keyPressEvent() and QGraphicsItem::keyReleaseEvent(). \value ItemClipsToShape The item clips to its own shape. The item cannot - draw or receive mouse, tablet, drag and drop or hover events outside ts + draw or receive mouse, tablet, drag and drop or hover events outside its shape. It is disabled by default. This behavior is enforced by QGraphicsView::drawItems() or QGraphicsScene::drawItems(). This flag was introduced in Qt 4.3. diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e16aedc..0b32533 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -549,7 +549,7 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar) /*! Posts a request to obtain the network headers for \a request - and returns a new QNetworkReply object which will contain such headers + and returns a new QNetworkReply object which will contain such headers. The function is named after the HTTP request associated (HEAD). */ -- cgit v0.12 From db849a123ee639a4a63aabd83a450b05542f917f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 12 Feb 2010 12:09:34 +0100 Subject: Add MSVC-specific expected failures for JS test suite These are not failing on MinGW. --- tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index 41df98c..10ff488 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -688,7 +688,7 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- -\"0x80000000\"", willFixInNextReleaseMessage); #endif -#ifdef Q_OS_WIN +#ifdef Q_CC_MSVC addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056"); addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.7.3 >>>", "QTBUG-8056"); addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 >>>=", "QTBUG-8056"); -- cgit v0.12 From 40bc32430551202ba519c4f0a95a341ea4547fb5 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 12 Feb 2010 13:12:37 +0200 Subject: Fix to S60 softkeys when no active Qt window or native widget is shown. Softkeys need to be updated also when Qt activewindow is set to NULL, this is needed that usecase where last Qt widget is closed works correctly. I.e. closed widget softkeys has to be removed, and replaced by default "Exit" softkey. Earlier only window activation or widget focusIn event caused softkey update. In addition IsDisplayingMenuOrDialog does not work correctly under all circumstances. Sometimes when menu is being launched the Qt gets focusChanged event before the menu is actually shown, but menu CBA is already created. This is fixed by checking that we update CBA only when AppUi CB is the current one. This assumption works as long as Qt uses only the CBA created by S60 application framwork and does not create other CEikButtonGroupContainer instances. Task-number: QTBUG-6115 Reviewed-by: Sami Merila --- src/gui/kernel/qsoftkeymanager_s60.cpp | 16 +++++++--------- src/gui/kernel/qsoftkeymanager_s60_p.h | 1 - src/gui/kernel/qwidget.cpp | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index af84a8f..8ac1e31 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -66,17 +66,18 @@ QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() cachedCbaIconSize[1] = QSize(0,0); cachedCbaIconSize[2] = QSize(0,0); cachedCbaIconSize[3] = QSize(0,0); - skipNextUpdate = false; } bool QSoftKeyManagerPrivateS60::skipCbaUpdate() { - // lets not update softkeys if + // Lets not update softkeys if // 1. We don't have application panes, i.e. cba - // 2. S60 native dialog or menu is shown - if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || - CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || skipNextUpdate) { - skipNextUpdate = false; + // 2. Our CBA is not active, i.e. S60 native dialog or menu with custom CBA is shown + // Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before + // menu/dialog CBA is actually displayed i.e. it is being costructed. + CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer(); + CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current(); + if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || appUiCba != currentCba) { return true; } return false; @@ -384,9 +385,6 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command) } qt_symbian_next_menu_from_action(actionContainer); QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL()); - // TODO: hack remove, it can happen that IsDisplayingMenuOrDialog return false - // in updateSoftKeys_sys, and we will override menu CBA with our own - skipNextUpdate = true; } else { Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey); QWidget *actionParent = action->parentWidget(); diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h index f8bd6d9..823a2db 100644 --- a/src/gui/kernel/qsoftkeymanager_s60_p.h +++ b/src/gui/kernel/qsoftkeymanager_s60_p.h @@ -98,7 +98,6 @@ private: private: QHash realSoftKeyActions; QSize cachedCbaIconSize[4]; - bool skipNextUpdate; }; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2a19d23..850e961 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8271,7 +8271,7 @@ bool QWidget::event(QEvent *event) } #ifdef QT_SOFTKEYS_ENABLED - if (isWindow() && isActiveWindow()) + if (isWindow()) QSoftKeyManager::updateSoftKeys(); #endif -- cgit v0.12 From ec7459fa77cfa4a6fc7e4fca14339a14ea27d83c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 12 Feb 2010 13:24:57 +0100 Subject: doc: Fixed several typos. Task: QTBUG-7997 --- doc/src/objectmodel/signalsandslots.qdoc | 2 +- src/corelib/io/qfsfileengine_win.cpp | 2 +- tests/auto/qprocess/tst_qprocess.cpp | 2 +- tests/auto/qurl/tst_qurl.cpp | 2 +- .../auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc index 951a396..0f3f618 100644 --- a/doc/src/objectmodel/signalsandslots.qdoc +++ b/doc/src/objectmodel/signalsandslots.qdoc @@ -379,7 +379,7 @@ \section1 Signals And Slots With Default Arguments The signatures of signals and slots may contain arguments, and the - arguments can have defualt values. Consider QObject::destroyed(): + arguments can have default values. Consider QObject::destroyed(): \code void destroyed(QObject* = 0); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index bec0075..139075f 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1484,7 +1484,7 @@ QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions() const { //### what to do with permissions if we don't use NTFS // for now just add all permissions and what about exe missions ?? - // also qt_ntfs_permission_lookup is now not set by defualt ... should it ? + // also qt_ntfs_permission_lookup is now not set by default ... should it ? ret |= QAbstractFileEngine::ReadOtherPerm | QAbstractFileEngine::ReadGroupPerm | QAbstractFileEngine::ReadOwnerPerm | QAbstractFileEngine::ReadUserPerm | QAbstractFileEngine::WriteUserPerm | QAbstractFileEngine::WriteOwnerPerm diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index ee3bb40..8dae9a0 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1652,7 +1652,7 @@ void tst_QProcess::failToStart() QSignalSpy finishedSpy(&process, SIGNAL(finished(int))); QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus))); -// Mac OS X and HP-UX have a really low defualt process limit (~100), so spawning +// Mac OS X and HP-UX have a really low default process limit (~100), so spawning // to many processes here will cause test failures later on. #if defined Q_OS_HPUX const int attempts = 15; diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index f108f4c..72ce393 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -1832,7 +1832,7 @@ void tst_QUrl::compat_constructor_01_data() QTest::addColumn("res"); //next we fill it with data - QTest::newRow( "data0" ) << QString("Makefile") << QString("Makefile"); // nolonger add file by defualt + QTest::newRow( "data0" ) << QString("Makefile") << QString("Makefile"); // nolonger add file by default QTest::newRow( "data1" ) << QString("Makefile") << QString("Makefile"); QTest::newRow( "data2" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); QTest::newRow( "data3" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml b/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml index edf9fee..050a340 100644 --- a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml +++ b/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml @@ -10,10 +10,10 @@ - + ]> Positive test DefaultDecl attributes values IMPLIED, REQUIRED, FIXED and default - \ No newline at end of file + -- cgit v0.12 From 43233652e753ffa2b97a8b6d56ae53bb02cbad6b Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 9 Feb 2010 10:50:27 +0100 Subject: Implemented GraphicsView Panel support for gestures. Events should not propagate outside the panel. Also when delivering gesture events we should respect panels modality. Task-number: QTBUG-7451 Reviewed-by: Mikko Harju Reviewed-by: Bradley T. Hughes --- src/gui/graphicsview/qgraphicsscene.cpp | 20 ++-- tests/auto/gestures/tst_gestures.cpp | 171 +++++++++++++++++++++++++++++++- 2 files changed, 183 insertions(+), 8 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 66707fc..96d2435 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5902,13 +5902,21 @@ void QGraphicsScenePrivate::getGestureTargets(const QSet &gestures, QList items = itemsAtPosition(screenPos, QPointF(), viewport); QList result; for (int j = 0; j < items.size(); ++j) { - QGraphicsObject *item = items.at(j)->toGraphicsObject(); - if (!item) - continue; - QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); - if (d->gestureContext.contains(gestureType)) { - result.append(item); + QGraphicsItem *item = items.at(j); + + // Check if the item is blocked by a modal panel and use it as + // a target instead of this item. + (void) item->isBlockedByModalPanel(&item); + + if (QGraphicsObject *itemobj = item->toGraphicsObject()) { + QGraphicsItemPrivate *d = item->d_func(); + if (d->gestureContext.contains(gestureType)) { + result.append(itemobj); + } } + // Don't propagate through panels. + if (item->isPanel()) + break; } DEBUG() << "QGraphicsScenePrivate::getGestureTargets:" << gesture << result; diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 952136b..986227d 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -333,6 +333,8 @@ private slots: void unregisterRecognizer(); void autoCancelGestures(); void autoCancelGestures2(); + void panelPropagation(); + void panelStacksBehindParent(); }; tst_Gestures::tst_Gestures() @@ -1457,9 +1459,7 @@ void tst_Gestures::autoCancelGestures2() event.serial = CustomGesture::SerialStartedThreshold; event.hasHotSpot = true; event.hotSpot = mapToGlobal(QPointF(5, 5), child, &view); - // qDebug() << event.hotSpot; scene.sendEvent(child, &event); - //QEventLoop().exec(); QCOMPARE(parent->events.all.count(), 1); QCOMPARE(child->events.started.count(), 1); QCOMPARE(child->events.canceled.count(), 1); @@ -1471,5 +1471,172 @@ void tst_Gestures::autoCancelGestures2() QCOMPARE(parent->events.all.count(), 2); } +void tst_Gestures::panelPropagation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item0 = new GestureItem("item0"); + scene.addItem(item0); + item0->setPos(0, 0); + item0->size = QRectF(0, 0, 200, 200); + item0->grabGesture(CustomGesture::GestureType); + item0->setZValue(1); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + scene.addItem(item1); + item1->setPos(10, 10); + item1->size = QRectF(0, 0, 180, 180); + item1->setZValue(2); + + GestureItem *item1_child1 = new GestureItem("item1_child1[panel]"); + item1_child1->setFlags(QGraphicsItem::ItemIsPanel); + item1_child1->setParentItem(item1); + item1_child1->grabGesture(CustomGesture::GestureType); + item1_child1->setPos(10, 10); + item1_child1->size = QRectF(0, 0, 160, 160); + item1_child1->setZValue(5); + + GestureItem *item1_child1_child1 = new GestureItem("item1_child1_child1"); + item1_child1_child1->setParentItem(item1_child1); + item1_child1_child1->grabGesture(CustomGesture::GestureType); + item1_child1_child1->setPos(10, 10); + item1_child1_child1->size = QRectF(0, 0, 140, 140); + item1_child1_child1->setZValue(10); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(5, 5), item1_child1_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item1_child1_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 0); + + item0->reset(); item1->reset(); item1_child1->reset(); item1_child1_child1->reset(); + + event.hotSpot = mapToGlobal(QPointF(5, 5), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item1_child1->reset(); item1_child1_child1->reset(); + // try with a modal panel + item1_child1->setPanelModality(QGraphicsItem::PanelModal); + + event.hotSpot = mapToGlobal(QPointF(5, 5), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 0); + + item0->reset(); item1->reset(); item1_child1->reset(); item1_child1_child1->reset(); + // try with a modal panel, however set the hotspot to be outside of the + // panel and its parent + item1_child1->setPanelModality(QGraphicsItem::PanelModal); + + event.hotSpot = mapToGlobal(QPointF(5, 5), item0, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item0->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item0->gestureOverrideEventsReceived, 0); + + item0->reset(); item1->reset(); item1_child1->reset(); item1_child1_child1->reset(); + // try with a scene modal panel + item1_child1->setPanelModality(QGraphicsItem::SceneModal); + + event.hotSpot = mapToGlobal(QPointF(5, 5), item0, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item1_child1_child1->gestureEventsReceived, 0); + QCOMPARE(item1_child1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(item0->gestureEventsReceived, 0); + QCOMPARE(item0->gestureOverrideEventsReceived, 0); +} + +void tst_Gestures::panelStacksBehindParent() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + scene.addItem(item1); + item1->setPos(10, 10); + item1->size = QRectF(0, 0, 180, 180); + item1->setZValue(2); + + GestureItem *panel = new GestureItem("panel"); + panel->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemStacksBehindParent); + panel->setPanelModality(QGraphicsItem::PanelModal); + panel->setParentItem(item1); + panel->grabGesture(CustomGesture::GestureType); + panel->setPos(-10, -10); + panel->size = QRectF(0, 0, 200, 200); + panel->setZValue(5); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(5, 5), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + QCOMPARE(item1->gestureEventsReceived, 0); + QCOMPARE(item1->gestureOverrideEventsReceived, 0); + QCOMPARE(panel->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(panel->gestureOverrideEventsReceived, 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" -- cgit v0.12 From 49228260b8a70a8177c5eb89b73ed6f3a07b7cc9 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 11 Feb 2010 15:24:48 +0100 Subject: Ignore touch and gesture events when excluding input events When asked to exclude input events when processing events in the event dispatcher we should also exclude touch and gesture events on Windows and Mac. Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/qeventdispatcher_win.cpp | 11 +++++++++++ src/gui/kernel/qeventdispatcher_mac.mm | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index cbc87f3..93becc8 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -68,6 +68,14 @@ extern uint qGlobalPostedEventsCount(); # define QS_RAWINPUT 0x0400 #endif +#ifndef WM_TOUCH +# define WM_TOUCH 0x0240 +#endif +#ifndef WM_GESTURE +# define WM_GESTURE 0x0119 +# define WM_GESTURENOTIFY 0x011A +#endif + enum { WM_QT_SOCKETNOTIFIER = WM_USER, WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, @@ -714,6 +722,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) && msg.message <= WM_MOUSELAST) || msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL + || msg.message == WM_TOUCH + || msg.message == WM_GESTURE + || msg.message == WM_GESTURENOTIFY || msg.message == WM_CLOSE)) { // queue user input events for later processing haveMessage = false; diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index c7c7caf..0b3d62f 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -492,6 +492,14 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) case NSOtherMouseDown: case NSOtherMouseUp: case NSOtherMouseDragged: +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + case NSEventTypeGesture: // touch events + case NSEventTypeMagnify: + case NSEventTypeSwipe: + case NSEventTypeRotate: + case NSEventTypeBeginGesture: + case NSEventTypeEndGesture: +#endif result = true; break; -- cgit v0.12 From 08c513d69ceff5c9f1e84c0356738eca1e0ae7e0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 12 Feb 2010 13:42:40 +0100 Subject: doc: Added some since version information. Task: QTBUG-7967 --- src/gui/graphicsview/qgraphicsitem.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3cdf8ce..2f208b7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -357,19 +357,22 @@ default, child items are stacked on top of the parent item. But setting this flag, the child will be stacked behind it. This flag is useful for drop shadow effects and for decoration objects that follow the parent - item's geometry without drawing on top of it. + item's geometry without drawing on top of it. This flag was introduced + in Qt 4.5. \value ItemUsesExtendedStyleOption The item makes use of either - \l{QStyleOptionGraphicsItem::}{exposedRect} or - \l{QStyleOptionGraphicsItem::}{matrix} in QStyleOptionGraphicsItem. By default, - the \l{QStyleOptionGraphicsItem::}{exposedRect} is initialized to the item's - boundingRect() and the \l{QStyleOptionGraphicsItem::}{matrix} is untransformed. - You can enable this flag for the style options to be set up with more - fine-grained values. - Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag + \l{QStyleOptionGraphicsItem::} {exposedRect} or + \l{QStyleOptionGraphicsItem::} {matrix} in + QStyleOptionGraphicsItem. By default, the + \l{QStyleOptionGraphicsItem::} {exposedRect} is initialized to the + item's boundingRect() and the + \l{QStyleOptionGraphicsItem::}{matrix} is untransformed. You can + enable this flag for the style options to be set up with more + fine-grained values. Note that + QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag and always initialized to 1. Use - QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need a higher - value. + QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need + a higher value. This flag was introduced in Qt 4.6. \value ItemHasNoContents The item does not paint anything (i.e., calling paint() on the item has no effect). You should set this flag on items that @@ -387,9 +390,10 @@ used for Asian languages. This flag was introduced in Qt 4.6. - \value ItemNegativeZStacksBehindParent The item automatically stacks behind - it's parent if it's z-value is negative. This flag enables setZValue() to - toggle ItemStacksBehindParent. + \value ItemNegativeZStacksBehindParent The item automatically + stacks behind it's parent if it's z-value is negative. This flag + enables setZValue() to toggle ItemStacksBehindParent. This flag + was introduced in Qt 4.6. \value ItemIsPanel The item is a panel. A panel provides activation and contained focus handling. Only one panel can be active at a time (see -- cgit v0.12 From f25099f400e7379f0a6e00500e990948b9785e63 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 12 Feb 2010 14:29:08 +0100 Subject: Implement the blend functions with SSE2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When available, use SSE2 to blend images, computation is done on 4 pixels at the time instead of 1 with MMX. Performance improvements: - Blending ARGB32 on RGB32/ARGB32, mostly opaque: 188% - Blending ARGB32 on RGB32/ARGB32, no opaque pixels: 180% - Blending ARGB32 on RGB32/ARGB32, with 0.5 opacity: 187% - Blending RGB32 on RGB32/ARGB32, with 0.5 opacity: 206% Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper.cpp | 49 ++++++-- src/gui/painting/qdrawhelper_sse2.cpp | 218 ++++++++++++++++++++++++++++++++++ src/gui/painting/qdrawhelper_x86_p.h | 8 ++ 3 files changed, 262 insertions(+), 13 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 7a3da20..070491d 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -8092,20 +8092,43 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse3dnow; } #endif // 3DNOW - extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha); - extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha); - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; - } + +#ifdef QT_HAVE_SSE2 + if (features & SSE2) { + extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + + + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; + } else +#endif + { + extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + + + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; + } +} #endif // SSE #ifdef QT_HAVE_IWMMXT diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index dd6fa1b..1dba914 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -57,6 +57,224 @@ QT_BEGIN_NAMESPACE +/* + * Multiply the components of pixelVector by alphaChannel + * Each 32bits components of alphaChannel must be in the form 0x00AA00AA + * colorMask must have 0x00ff00ff on each 32 bits component + * half must have the value 128 (0x80) for each 32 bits compnent + */ +Q_STATIC_INLINE_FUNCTION __m128i BYTE_MUL_SSE2(const __m128i pixelVector, const __m128i alphaChannel, const __m128i colorMask, const __m128i half) +{ + // 1. separate the colors in 2 vectors so each color is on 16 bits + // (in order to be multiplied by the alpha + // each 32 bit of dstVectorAG are in the form 0x00AA00GG + // each 32 bit of dstVectorRB are in the form 0x00RR00BB + __m128i pixelVectorAG = _mm_srli_epi16(pixelVector, 8); + __m128i pixelVectorRB = _mm_and_si128(pixelVector, colorMask); + + // 2. multiply the vectors by the alpha channel + pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); + pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); + + // 3. devide by 255, that's the tricky part. + // we do it like for BYTE_MUL(), with bit shift: X/255 ~= (X + X/256 + rounding)/256 + /// so first (X + X/256 + rounding) + pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); + pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); + pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); + pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); + + /// second devide by 256 + pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); + /// for AG, we could >> 8 to divide followed by << 8 to put the + /// bytes in the correct position. By masking instead, we execute + /// only one instruction + pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); + + // 4. combine the 2 pairs of colors + return _mm_or_si128(pixelVectorAG, pixelVectorRB); +} + +/* + * Each 32bits components of alphaChannel must be in the form 0x00AA00AA + * oneMinusAlphaChannel must be 255 - alpha for each 32 bits component + * colorMask must have 0x00ff00ff on each 32 bits component + * half must have the value 128 (0x80) for each 32 bits compnent + */ +Q_STATIC_INLINE_FUNCTION __m128i INTERPOLATE_PIXEL_255_SSE2(const __m128i srcVector, + const __m128i dstVector, + const __m128i alphaChannel, + const __m128i oneMinusAlphaChannel , + const __m128i colorMask, + const __m128i half) { + // interpolate AG + __m128i srcVectorAG = _mm_srli_epi16(srcVector, 8); + __m128i dstVectorAG = _mm_srli_epi16(dstVector, 8); + __m128i srcVectorAGalpha = _mm_mullo_epi16(srcVectorAG, alphaChannel); + __m128i dstVectorAGoneMinusAlphalpha = _mm_mullo_epi16(dstVectorAG, oneMinusAlphaChannel); + __m128i finalAG = _mm_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlphalpha); + finalAG = _mm_add_epi16(finalAG, _mm_srli_epi16(finalAG, 8)); + finalAG = _mm_add_epi16(finalAG, half); + finalAG = _mm_andnot_si128(colorMask, finalAG); + + // interpolate RB + __m128i srcVectorRB = _mm_and_si128(srcVector, colorMask); + __m128i dstVectorRB = _mm_and_si128(dstVector, colorMask); + __m128i srcVectorRBalpha = _mm_mullo_epi16(srcVectorRB, alphaChannel); + __m128i dstVectorRBoneMinusAlphalpha = _mm_mullo_epi16(dstVectorRB, oneMinusAlphaChannel); + __m128i finalRB = _mm_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlphalpha); + finalRB = _mm_add_epi16(finalRB, _mm_srli_epi16(finalRB, 8)); + finalRB = _mm_add_epi16(finalRB, half); + finalRB = _mm_srli_epi16(finalRB, 8); + + // combine + return _mm_or_si128(finalAG, finalRB); +} + +void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + const quint32 *src = (const quint32 *) srcPixels; + quint32 *dst = (uint *) destPixels; + if (const_alpha == 256) { + const __m128i alphaMask = _mm_set1_epi32(0xff000000); + const __m128i nullVector = _mm_set1_epi32(0); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + for (int y = 0; y < h; ++y) { + int x = 0; + for (; x < w-3; x += 4) { + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { + // all opaque + _mm_storeu_si128((__m128i *)&dst[x], srcVector); + } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { + // not fully transparent + // result = s + d * (1-alpha) + + // extract the alpha channel on 2 x 16 bits + // so we have room for the multiplication + // each 32 bits will be in the form 0x00AA00AA + // with A being the 1 - alpha + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); + alphaChannel = _mm_sub_epi16(one, alphaChannel); + + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + const __m128i destMultipliedByOneMinusAlpha = BYTE_MUL_SSE2(dstVector, alphaChannel, colorMask, half); + + // result = s + d * (1-alpha) + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); + _mm_storeu_si128((__m128i *)&dst[x], result); + } + } + for (; x= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + // dest = (s + d * sia) * ca + d * cia + // = s * ca + d * (sia * ca + cia) + // = s * ca + d * (1 - sa*ca) + const_alpha = (const_alpha * 255) >> 8; + const __m128i nullVector = _mm_set1_epi32(0); + const __m128i half = _mm_set1_epi16(0x80); + const __m128i one = _mm_set1_epi16(0xff); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + for (int y = 0; y < h; ++y) { + int x = 0; + for (; x < w-3; x += 4) { + __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { + srcVector = BYTE_MUL_SSE2(srcVector, constAlphaVector, colorMask, half); + + __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); + alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); + alphaChannel = _mm_sub_epi16(one, alphaChannel); + + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + const __m128i destMultipliedByOneMinusAlpha = BYTE_MUL_SSE2(dstVector, alphaChannel, colorMask, half); + + const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); + _mm_storeu_si128((__m128i *)&dst[x], result); + } + } + for (; x> 8; + int one_minus_const_alpha = 255 - const_alpha; + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); + for (int y = 0; y < h; ++y) { + int x = 0; + for (; x < w-3; x += 4) { + __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + const __m128i result = INTERPOLATE_PIXEL_255_SSE2(srcVector, + dstVector, + constAlphaVector, + oneMinusConstAlpha, + colorMask, + half); + _mm_storeu_si128((__m128i *)&dst[x], result); + } + } + for (; x Date: Fri, 12 Feb 2010 13:59:37 +0100 Subject: Add make stub_sis target, and add webkit stub to qt.iby qmake - add targets to wrapper make file make stub_sis createpackage - use -s or --stub to run makesis with the -s argument also copies the file to the right place in epoc32\data\system\installs qt.iby - add qt_stub.sis and qt_webkit_stub.sis Task-number: QTBUG-6570 Reviewed-by: Miikka Heikkinen --- bin/createpackage.pl | 90 +++++++++++++++++------------ doc/src/platforms/symbian-introduction.qdoc | 2 + qmake/generators/symbian/symmake.cpp | 34 +++++++++-- src/s60installs/qt.iby | 3 +- 4 files changed, 86 insertions(+), 43 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 6d4614e..7f803fd 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -54,6 +54,8 @@ use Getopt::Long; use File::Basename; # Use File::Spec services mainly rel2abs use File::Spec; +# Use File::Path - to make stub sis target directory +use File::Path; # use CWD abs_bath, which is exported only on request use Cwd 'abs_path'; @@ -111,11 +113,13 @@ my $install = ""; my $preprocessonly = ""; my $certfile = ""; my $preserveUnsigned = ""; +my $stub = ""; unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, 'c|certfile=s' => \$certfile, - 'u|unsigned' => \$preserveUnsigned,)){ + 'u|unsigned' => \$preserveUnsigned, + 's|stub' => \$stub,)){ Usage(); } @@ -153,6 +157,7 @@ my $sisoutputbasename = lc($pkgoutputbasename); $sisoutputbasename =~ s/_$targetplatform//g; my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis"; my $signed_sis_name = $sisoutputbasename.".sis"; +my $stub_sis_name = $sisoutputbasename."_stub.sis"; # Store some utility variables my $scriptpath = dirname(__FILE__); @@ -256,48 +261,57 @@ if ($preprocessonly) { exit; } -# Create SIS. -system ("makesis $pkgoutput $unsigned_sis_name"); - -# Sign SIS with certificate info given as an argument. -system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); - -# Check if creating signed SIS Succeeded -stat($signed_sis_name); -if( -e _ ) { - my $targetInsert = ""; - if ($targetplatform ne "-") { - $targetInsert = "for $targetplatform "; - } - print ("\nSuccessfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n"); +if($stub) { + if(!($ENV{EPOCROOT})) { die("EPOCROOT must be set to create stub sis files"); } + my $systeminstall = "$ENV{EPOCROOT}epoc32/data/z/system/install"; + mkpath($systeminstall); + my $stub_sis_name = $systeminstall."/".$stub_sis_name; + # Create stub SIS. + system ("makesis -s $pkgoutput $stub_sis_name"); +} else { + # Create SIS. + system ("makesis $pkgoutput $unsigned_sis_name"); + print("\n"); + + # Sign SIS with certificate info given as an argument. + system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); + + # Check if creating signed SIS Succeeded + stat($signed_sis_name); + if( -e _ ) { + my $targetInsert = ""; + if ($targetplatform ne "-") { + $targetInsert = "for $targetplatform "; + } + print ("Successfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n"); - # Sign with additional certificates & keys - for my $row ( @certificates ) { - # Get certificate absolute file names, relative paths are relative to certfilepath - my $abscert = File::Spec->rel2abs( $row->[0], $certfilepath); - my $abskey = File::Spec->rel2abs( $row->[1], $certfilepath); + # Sign with additional certificates & keys + for my $row ( @certificates ) { + # Get certificate absolute file names, relative paths are relative to certfilepath + my $abscert = File::Spec->rel2abs( $row->[0], $certfilepath); + my $abskey = File::Spec->rel2abs( $row->[1], $certfilepath); - system ("signsis $signed_sis_name $signed_sis_name $abscert $abskey $row->[2]"); - print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n"); - } + system ("signsis $signed_sis_name $signed_sis_name $abscert $abskey $row->[2]"); + print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n"); + } - # remove temporary pkg and unsigned sis - if (!$preservePkgOutput) { - unlink $pkgoutput; - } - if (!$preserveUnsigned) { - unlink $unsigned_sis_name; - } + # remove temporary pkg and unsigned sis + if (!$preservePkgOutput) { + unlink $pkgoutput; + } + if (!$preserveUnsigned) { + unlink $unsigned_sis_name; + } - # Install the sis if requested - if ($install) { - print ("\nInstalling $signed_sis_name...\n"); - system ("$signed_sis_name"); + # Install the sis if requested + if ($install) { + print ("\nInstalling $signed_sis_name...\n"); + system ("$signed_sis_name"); + } + } else { + # Lets leave the generated PKG for problem solving purposes + print ("\nSIS creation failed!\n"); } -} else { - # Lets leave the generated PKG for problem solving purposes - print ("\nSIS creation failed!\n"); } - #end of file diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 5cebee3..591d6f1 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -132,6 +132,8 @@ Smart installer will attempt to download missing dependencies in addition to just installing the application. + \row \o \c stub_sis \o Create a stub sis to allow upgradability of projects + that are deployed in ROM \endtable The following lines perform a debug build for the emulator diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 3ee3b3a..61988d3 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -88,8 +88,10 @@ #define SIS_TARGET "sis" #define INSTALLER_SIS_TARGET "installer_sis" +#define ROM_STUB_SIS_TARGET "stub_sis" #define OK_SIS_TARGET "ok_sis" #define OK_INSTALLER_SIS_TARGET "ok_installer_sis" +#define OK_ROM_STUB_SIS_TARGET "ok_stub_sis" #define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg" #define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache" @@ -1883,7 +1885,7 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) t << endl; t << SIS_TARGET ":" << endl; - QString siscommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ + QString siscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ "$(MAKE) -s -f $(MAKEFILE) %4," \ "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \ "$(MAKE) -s -f $(MAKEFILE) %5))," \ @@ -1899,7 +1901,7 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) t << OK_SIS_TARGET ":" << endl; - QString pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ + QString pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") .arg(fixedTarget) .arg("pkg"); @@ -1912,8 +1914,32 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) t << sisName << ":" << endl; t << "\t$(MAKE) -s -f $(MAKEFILE) " SIS_TARGET << endl << endl; + t << ROM_STUB_SIS_TARGET ":" << endl; + QString stubsiscommand = QString::fromLatin1("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ + "$(MAKE) -s -f $(MAKEFILE) %4," \ + "$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) %4," \ + "$(MAKE) -s -f $(MAKEFILE) %5))," \ + "$(MAKE) -s -f $(MAKEFILE) %6)") + .arg(fixedTarget) + .arg("pkg") + .arg(MAKE_CACHE_NAME) + .arg(OK_ROM_STUB_SIS_TARGET) + .arg(FAIL_SIS_NOCACHE_TARGET) + .arg(FAIL_SIS_NOPKG_TARGET); + t << stubsiscommand << endl; + t << endl; + + t << OK_ROM_STUB_SIS_TARGET ":" << endl; + + QString stubpkgcommand = QString::fromLatin1("\tcreatepackage.bat -s $(QT_SIS_OPTIONS) %1_template.%2 $(QT_SIS_TARGET) " \ + "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") + .arg(fixedTarget) + .arg("pkg"); + t << stubpkgcommand << endl; + t << endl; + t << INSTALLER_SIS_TARGET ": " << sisName << endl; - siscommand = QString("\t$(if $(wildcard %1_installer.%2)," \ + siscommand = QString::fromLatin1("\t$(if $(wildcard %1_installer.%2)," \ "$(MAKE) -s -f $(MAKEFILE) %3," \ "$(MAKE) -s -f $(MAKEFILE) %4)") .arg(fixedTarget) @@ -1925,7 +1951,7 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) t << OK_INSTALLER_SIS_TARGET ": " << endl; - pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \ + pkgcommand = QString::fromLatin1("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \ "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") .arg(fixedTarget) .arg("pkg"); diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index bdd668c..a6a96ec 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -113,6 +113,7 @@ data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resou data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin // Stub sis file -data=ZSYSTEM\install\qt.sis System\Install\qt.sis +data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis +data=ZSYSTEM\install\qtwebkit_stub.sis System\Install\qtwebkit_stub.sis #endif // __QT_IBY__ -- cgit v0.12 From 9924079427935f781083299d7ca030dafb4f2598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 9 Feb 2010 13:57:12 +0100 Subject: QTestLib: don't crash if data tag requested, none available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When specific test functions and data tags are requested from the command line, a non-existing data tag will produce error output *iif* data tags are available for the function. However, if no data tags are available, element 0 in testData would be dereferenced, resulting in a crash. Special case the empty data tag, even if no tags are available, because some loggers (e.g., the QXmlTestLogger) will output results with no tag the same way as those with an empty data tag. Reviewed-by: Morten Sørvig --- src/testlib/qtestcase.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index ecdcca8..1c2db2f 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1298,11 +1298,23 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0) const int dataCount = table.dataCount(); QTestResult::setSkipCurrentTest(false); + // Data tag requested but none available? + if (data && !dataCount) { + // Let empty data tag through. + if (!*data) + data = 0; + else { + printf("Unknown testdata for function %s: '%s'\n", slotName, data); + printf("Function has no testdata.\n"); + return false; + } + } + /* For each entry in the data table, do: */ do { if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) { foundFunction = true; - QTestDataSetter s(table.isEmpty() ? static_cast(0) + QTestDataSetter s(curDataIndex >= dataCount ? static_cast(0) : table.testData(curDataIndex)); qInvokeTestMethodDataEntry(slot); -- cgit v0.12 From a3127c9cd9c7ff408c79685464293224b2641f43 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 12 Feb 2010 17:28:25 +0100 Subject: Compile fix on Mac with 10.5 sdk. Reviewed-by: trustme --- src/gui/kernel/qeventdispatcher_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 0b3d62f..df09185 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -492,7 +492,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) case NSOtherMouseDown: case NSOtherMouseUp: case NSOtherMouseDragged: -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 case NSEventTypeGesture: // touch events case NSEventTypeMagnify: case NSEventTypeSwipe: -- cgit v0.12 From 995afbfc2ca81960ca840f50b2a837938a4f1d52 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Sun, 14 Feb 2010 12:16:00 +0200 Subject: Change a name of a variable to be more descriptive Currently when calculating a button content size, QS60Style has a variable called buttonWidth, which actually is the width of the content, not the button itself. Change this to buttonContentWidth. Reviewed-by: TrustMe --- src/gui/styles/qs60style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 9025e5b..14e9b95 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2559,11 +2559,11 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(option)) { const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; const int buttonMargin = spinbox->frame ? 2 : 0; - const int buttonWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; + const int buttonContentWidth = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; QSize buttonSize; buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness)); //width should at least be equal to height - buttonSize.setWidth(qMax(buttonSize.height(), buttonWidth)); + buttonSize.setWidth(qMax(buttonSize.height(), buttonContentWidth)); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); const int y = frameThickness + spinbox->rect.y(); -- cgit v0.12 From 1850c147d82cb1a98d819ac8e49070a2587239f7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 15 Feb 2010 12:04:08 +0100 Subject: Correctly mark QGraphicsScene::drawItems() as obsolete Since the \obsolete was not at the beginning of the function documentation it was not showing it correctly Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsscene.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 96d2435..86aaa78 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5132,6 +5132,8 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool } /*! + \obsolete + Paints the given \a items using the provided \a painter, after the background has been drawn, and before the foreground has been drawn. All painting is done in \e scene coordinates. Before @@ -5154,7 +5156,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool \snippet doc/src/snippets/graphicssceneadditemsnippet.cpp 0 - \obsolete Since Qt 4.6, this function is not called anymore unless + Since Qt 4.6, this function is not called anymore unless the QGraphicsView::IndirectPainting flag is given as an Optimization flag. -- cgit v0.12