From dcaa2b69af5d242248c8e12355539b6e8349f5d5 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 25 Nov 2010 10:17:13 +0100 Subject: Doc: Fixing typo --- src/gui/painting/qdrawingprimitive_sse2_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index d8f6bf5..64f17d2 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); \ pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); \ \ - /* 3. devide by 255, that's the tricky part. \ + /* 3. divide 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)); \ @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); \ pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); \ \ - /** second devide by 256 */\ + /** second divide 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 \ @@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE } // Basically blend src over dst with the const alpha defined as constAlphaVector. -// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +// nullVector, half, one, colorMask are constant across the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); //const __m128i half = _mm_set1_epi16(0x80); //const __m128i one = _mm_set1_epi16(0xff); @@ -186,7 +186,7 @@ QT_BEGIN_NAMESPACE } // Basically blend src over dst with the const alpha defined as constAlphaVector. -// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as: +// nullVector, half, one, colorMask are constant across the whole image/texture, and should be defined as: //const __m128i nullVector = _mm_set1_epi32(0); //const __m128i half = _mm_set1_epi16(0x80); //const __m128i one = _mm_set1_epi16(0xff); -- cgit v0.12 From 9d80633e7dea2e054b4b748032879dc302b36a23 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Nov 2010 16:21:29 +0100 Subject: Add a way to set QHeaderView initial sort order Merge-request: 814 Reviewed-by: Thierry Bastian --- src/corelib/global/qnamespace.h | 1 + src/corelib/global/qnamespace.qdoc | 28 +++++++++++++++------------- src/gui/itemviews/qheaderview.cpp | 14 +++++++++++--- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 3ed6291..830d35b 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1617,6 +1617,7 @@ public: AccessibleDescriptionRole = 12, // More general purpose SizeHintRole = 13, + InitialSortOrderRole = 14, // Internal UiLib roles. Start worrying when public roles go that high. DisplayPropertyRole = 27, DecorationPropertyRole = 28, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f097f2a..c923a41 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2679,19 +2679,21 @@ Roles describing appearance and meta data (with associated types): - \value FontRole The font used for items rendered with the default - delegate. (QFont) - \value TextAlignmentRole The alignment of the text for items rendered with the - default delegate. (Qt::AlignmentFlag) - \value BackgroundRole The background brush used for items rendered with - the default delegate. (QBrush) - \value BackgroundColorRole This role is obsolete. Use BackgroundRole instead. - \value ForegroundRole The foreground brush (text color, typically) - used for items rendered with the default delegate. - (QBrush) - \value TextColorRole This role is obsolete. Use ForegroundRole instead. - \value CheckStateRole This role is used to obtain the checked state of - an item. (Qt::CheckState) + \value FontRole The font used for items rendered with the default + delegate. (QFont) + \value TextAlignmentRole The alignment of the text for items rendered with the + default delegate. (Qt::AlignmentFlag) + \value BackgroundRole The background brush used for items rendered with + the default delegate. (QBrush) + \value BackgroundColorRole This role is obsolete. Use BackgroundRole instead. + \value ForegroundRole The foreground brush (text color, typically) + used for items rendered with the default delegate. + (QBrush) + \value TextColorRole This role is obsolete. Use ForegroundRole instead. + \value CheckStateRole This role is used to obtain the checked state of + an item. (Qt::CheckState) + \value InitialSortOrderRole This role is used to obtain the initial sort order + of a header view section. (Qt::SortOrder) Accessibility roles (with associated types): diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 7eb3ddc..754e8b5 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -3274,9 +3274,17 @@ void QHeaderViewPrivate::clear() void QHeaderViewPrivate::flipSortIndicator(int section) { Q_Q(QHeaderView); - bool ascending = (sortIndicatorSection != section - || sortIndicatorOrder == Qt::DescendingOrder); - q->setSortIndicator(section, ascending ? Qt::AscendingOrder : Qt::DescendingOrder); + Qt::SortOrder sortOrder; + if (sortIndicatorSection == section) { + sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder; + } else { + const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole); + if (value.canConvert(QVariant::Int)) + sortOrder = static_cast(value.toInt()); + else + sortOrder = Qt::AscendingOrder; + } + q->setSortIndicator(section, sortOrder); } void QHeaderViewPrivate::cascadingResize(int visual, int newSize) -- cgit v0.12 From 2bfeab705c659cf12a6e7863d86da1ccdb2089dc Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Nov 2010 16:21:34 +0100 Subject: Mention when the role was introduced Merge-request: 814 Reviewed-by: Thierry Bastian --- src/corelib/global/qnamespace.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c923a41..d911c4c 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2693,7 +2693,8 @@ \value CheckStateRole This role is used to obtain the checked state of an item. (Qt::CheckState) \value InitialSortOrderRole This role is used to obtain the initial sort order - of a header view section. (Qt::SortOrder) + of a header view section. (Qt::SortOrder). This + role was introduced in Qt 4.8. Accessibility roles (with associated types): -- cgit v0.12 From d8ee9ddffa4e0cad8c1d991ab6fb84b705c075e5 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Nov 2010 16:21:39 +0100 Subject: Autotest illustrating Qt::InitialSortOrderRole Merge-request: 814 Reviewed-by: Thierry Bastian --- tests/auto/qheaderview/tst_qheaderview.cpp | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 5252ec6..2128880 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -195,6 +195,8 @@ private slots: void QTBUG8650_crashOnInsertSections(); void QTBUG12268_hiddenMovedSectionSorting(); + void initialSortOrderRole(); + protected: QWidget *topLevel; QHeaderView *view; @@ -2097,5 +2099,40 @@ void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting() QCOMPARE(view.horizontalHeader()->hiddenSectionCount(), 1); } +void tst_QHeaderView::initialSortOrderRole() +{ + QTableView view; + QStandardItemModel *model = new QStandardItemModel(4, 3, &view); + for (int i = 0; i< model->rowCount(); ++i) + for (int j = 0; j< model->columnCount(); ++j) + model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j)); + QStandardItem *ascendingItem = new QStandardItem(); + QStandardItem *descendingItem = new QStandardItem(); + ascendingItem->setData(Qt::AscendingOrder, Qt::InitialSortOrderRole); + descendingItem->setData(Qt::DescendingOrder, Qt::InitialSortOrderRole); + model->setHorizontalHeaderItem(1, ascendingItem); + model->setHorizontalHeaderItem(2, descendingItem); + view.setModel(model); + view.setSortingEnabled(true); + view.sortByColumn(0, Qt::AscendingOrder); + view.show(); + QTest::qWaitForWindowShown(&view); + + const int column1Pos = view.horizontalHeader()->sectionViewportPosition(1) + 5; // +5 not to be on the handle + QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(column1Pos, 0)); + QCOMPARE(view.horizontalHeader()->sortIndicatorSection(), 1); + QCOMPARE(view.horizontalHeader()->sortIndicatorOrder(), Qt::AscendingOrder); + + const int column2Pos = view.horizontalHeader()->sectionViewportPosition(2) + 5; // +5 not to be on the handle + QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(column2Pos, 0)); + QCOMPARE(view.horizontalHeader()->sortIndicatorSection(), 2); + QCOMPARE(view.horizontalHeader()->sortIndicatorOrder(), Qt::DescendingOrder); + + const int column0Pos = view.horizontalHeader()->sectionViewportPosition(0) + 5; // +5 not to be on the handle + QTest::mouseClick(view.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(column0Pos, 0)); + QCOMPARE(view.horizontalHeader()->sortIndicatorSection(), 0); + QCOMPARE(view.horizontalHeader()->sortIndicatorOrder(), Qt::AscendingOrder); +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" -- cgit v0.12 From 4ccef56d692e549e00b0c381f1ceb8e9191a3b15 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 26 Nov 2010 17:24:51 +0100 Subject: Compile fix on solaris Task-number: QTBUG-15323 Reviewed-by: TrustMe --- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ae46fe6..e6af8fb 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10599,7 +10599,7 @@ void tst_QWidget::nativeChildFocus() QTest::qWaitForWindowShown(&w); QCOMPARE(QApplication::activeWindow(), &w); - QCOMPARE(QApplication::focusWidget(), p1); + QCOMPARE(QApplication::focusWidget(), static_cast(p1)); } QTEST_MAIN(tst_QWidget) -- cgit v0.12 From fa74b4a710618f2c738030550ff7c6b668980324 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 1 Dec 2010 16:53:59 +0100 Subject: Fixed a problem with toolbars not relayouting This could happen when dragging an extended toolbar from a mainwindow PAtch was provided on IRC by ravek (#dev) Task-number: QTBUG-10920 Reviewed-by: Trust-Me --- src/gui/widgets/qtoolbarlayout.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 59b027e..f25d97d 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -647,15 +647,15 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const void QToolBarLayout::setExpanded(bool exp) { - if (exp == expanded) + QWidget *tb = qobject_cast(parentWidget()); + if (!tb) + return; + if (exp == expanded && !tb->isWindow()) return; expanded = exp; extension->setChecked(expanded); - QToolBar *tb = qobject_cast(parentWidget()); - if (!tb) - return; if (QMainWindow *win = qobject_cast(tb->parentWidget())) { #ifdef QT_NO_DOCKWIDGET animating = false; -- cgit v0.12 From bcdfd348e433f21f18711a1b6f7fee8248de767f Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 8 Dec 2010 12:32:44 +0100 Subject: Cleanup unused QAccessWidget Merge-request: 2519 Reviewed-by: Thierry Bastian --- src/gui/widgets/qeffects.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index a56d093..b875aa4 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -55,19 +55,6 @@ QT_BEGIN_NAMESPACE /* - Internal class to get access to protected QWidget-members -*/ - -class QAccessWidget : public QWidget -{ - friend class QAlphaWidget; - friend class QRollEffect; -public: - QAccessWidget(QWidget* parent=0, Qt::WindowFlags f = 0) - : QWidget(parent, f) {} -}; - -/* Internal class QAlphaWidget. The QAlphaWidget is shown while the animation lasts @@ -98,7 +85,7 @@ private: QImage backImage; QImage frontImage; QImage mixedImage; - QPointer widget; + QPointer widget; int duration; int elapsed; bool showWidget; @@ -119,7 +106,7 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) setEnabled(false); #endif setAttribute(Qt::WA_NoSystemBackground, true); - widget = (QAccessWidget*)w; + widget = w; windowOpacity = w->windowOpacity(); alpha = 0; } @@ -370,7 +357,7 @@ private slots: void scroll(); private: - QPointer widget; + QPointer widget; int currentHeight; int currentWidth; @@ -401,7 +388,7 @@ QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient) setEnabled(false); #endif - widget = (QAccessWidget*) w; + widget = w; Q_ASSERT(widget); setAttribute(Qt::WA_NoSystemBackground, true); -- cgit v0.12 From 50fc438d989fe9e4ecb431e2f6a5e4d1ccafbeac Mon Sep 17 00:00:00 2001 From: miniak Date: Wed, 8 Dec 2010 12:32:50 +0100 Subject: fix qFadeEffect windowOpacity issue on Windows Merge-request: 2519 Reviewed-by: Thierry Bastian --- src/gui/widgets/qeffects.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index b875aa4..77d5257 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -91,7 +91,6 @@ private: bool showWidget; QTimer anim; QElapsedTimer checkTime; - double windowOpacity; }; static QAlphaWidget* q_blend = 0; @@ -107,7 +106,6 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) #endif setAttribute(Qt::WA_NoSystemBackground, true); widget = w; - windowOpacity = w->windowOpacity(); alpha = 0; } @@ -116,7 +114,7 @@ QAlphaWidget::~QAlphaWidget() #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) // Restore user-defined opacity value if (widget) - widget->setWindowOpacity(windowOpacity); + widget->setWindowOpacity(1); #endif } @@ -255,10 +253,10 @@ void QAlphaWidget::render() alpha = 1; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - if (alpha >= windowOpacity || !showWidget) { + if (alpha >= 1 || !showWidget) { anim.stop(); qApp->removeEventFilter(this); - widget->setWindowOpacity(windowOpacity); + widget->setWindowOpacity(1); q_blend = 0; deleteLater(); } else { -- cgit v0.12 From 14f89148d8c6b12c8c6bfb4554428b30bb24b4bc Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 22 Dec 2010 10:47:10 +0100 Subject: Fixed a double selection in QFileDialog when saving Task-number: QTBUG-15504 Reviewed-by: Trust-Me --- src/gui/dialogs/qfiledialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 9509330..9060fae 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -2996,6 +2996,7 @@ void QFileDialogPrivate::_q_useNameFilter(int index) const int fileNameExtensionLength = fileNameExtension.count(); fileName.replace(fileName.count() - fileNameExtensionLength, fileNameExtensionLength, newNameFilterExtension); + qFileDialogUi->listView->clearSelection(); lineEdit()->setText(fileName); } } -- cgit v0.12 From 6edc055659bb930dac7a5a96f2a8535b72d86ace Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Wed, 19 Jan 2011 11:43:52 +0100 Subject: Fix and enable the tests that were disabled. This is basically doing the same fixes as commit 5c129ceed8cb157354250e1a938f0b8af5dfe507 did in 4.7 branch. (except that in 4.7 branch the tests were removed and then re-added) --- .../tst_qgraphicsgridlayout.cpp | 70 ++++++++++------------ 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 27b8330..7346221 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -2536,7 +2536,7 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 0, 50,10) << QRectF(50, 0, 50,10) << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400) ); -#if 0 + QTest::newRow("hfw-100x470") << (ItemList() << ItemDesc(0,0) .minSize(QSizeF(1,1)) @@ -2551,9 +2551,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,10)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) + .sizeHint(Qt::MinimumSize, QSizeF(40,40)) + .sizeHint(Qt::PreferredSize, QSizeF(50,400)) + .sizeHint(Qt::MaximumSize, QSizeF(500,500)) .dynamicConstraint(hfw1, Qt::Vertical) ) << QSizeF(100, 470) @@ -2562,7 +2562,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400) ); - // change layout width and verify QTest::newRow("hfw-100x401") << (ItemList() << ItemDesc(0,0) @@ -2578,9 +2577,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,10)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) + .minSize(QSizeF(-1,-1)) + .preferredSize(QSizeF(-1,-1)) + .maxSize(QSizeF(-1, -1)) .dynamicConstraint(hfw1, Qt::Vertical) ) << QSizeF(100, 401) @@ -2589,7 +2588,7 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400) ); - QTest::newRow("hfw-160x400") << (ItemList() + QTest::newRow("hfw-160x350") << (ItemList() << ItemDesc(0,0) .minSize(QSizeF(1,1)) .preferredSize(QSizeF(50,10)) @@ -2603,18 +2602,17 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,10)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .dynamicConstraint(hfw1, Qt::Vertical) + .sizeHint(Qt::MinimumSize, QSizeF(40,40)) + .sizeHint(Qt::PreferredSize, QSizeF(50,400)) + .sizeHint(Qt::MaximumSize, QSizeF(5000,5000)) + .dynamicConstraint(hfw1, Qt::Vertical) ) - << QSizeF(160, 400) + << QSizeF(160, 350) << (RectList() << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100) << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250) ); - QTest::newRow("hfw-160x300") << (ItemList() << ItemDesc(0,0) .minSize(QSizeF(1,1)) @@ -2629,9 +2627,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,10)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) + .sizeHint(Qt::MinimumSize, QSizeF(40,40)) + .sizeHint(Qt::PreferredSize, QSizeF(50,400)) + .sizeHint(Qt::MaximumSize, QSizeF(5000, 5000)) .dynamicConstraint(hfw1, Qt::Vertical) ) << QSizeF(160, 300) @@ -2642,11 +2640,11 @@ void tst_QGraphicsGridLayout::geometries_data() QTest::newRow("hfw-20x40") << (ItemList() << ItemDesc(0,0) - .minSize(QSizeF(1,1)) + .minSize(QSizeF(1,10)) .preferredSize(QSizeF(50,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(0,1) - .minSize(QSizeF(1,10)) + .minSize(QSizeF(1,1)) .preferredSize(QSizeF(50,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,0) @@ -2654,9 +2652,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,50)) - .maxSize(QSizeF(100, 100)) + .sizeHint(Qt::MinimumSize, QSizeF(1, 1)) + .sizeHint(Qt::PreferredSize, QSizeF(50, 50)) + .sizeHint(Qt::MaximumSize, QSizeF(100, 100)) .dynamicConstraint(hfw3, Qt::Vertical) ) << QSizeF(20, 40) @@ -2679,9 +2677,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(10,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(10,10)) - .preferredSize(QSizeF(400,50)) - .maxSize(QSizeF(5000, 5000)) + .sizeHint(Qt::MinimumSize, QSizeF(10,10)) + .sizeHint(Qt::PreferredSize, QSizeF(400,50)) + .sizeHint(Qt::MaximumSize, QSizeF(5000, 5000)) .dynamicConstraint(wfh1, Qt::Horizontal) ) << QSizeF(300, 160) @@ -2706,9 +2704,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,50)) - .maxSize(QSizeF(100, 100)) + .sizeHint(Qt::MinimumSize, QSizeF(1,1)) + .sizeHint(Qt::PreferredSize, QSizeF(50,50)) + .sizeHint(Qt::MaximumSize, QSizeF(100, 100)) .dynamicConstraint(wfh2, Qt::Horizontal) ) << QSizeF(40, 20) @@ -2731,9 +2729,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,50)) - .maxSize(QSizeF(100, 100)) + .sizeHint(Qt::MinimumSize, QSizeF(1,1)) + .sizeHint(Qt::PreferredSize, QSizeF(50,50)) + .sizeHint(Qt::MaximumSize, QSizeF(100, 100)) .dynamicConstraint(wfh2, Qt::Horizontal) ) @@ -2762,9 +2760,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(10,50)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(10,50)) - .maxSize(QSizeF(500, 500)) + .sizeHint(Qt::MinimumSize, QSizeF(1,1)) + .sizeHint(Qt::PreferredSize, QSizeF(10,50)) + .sizeHint(Qt::MaximumSize, QSizeF(500, 500)) .dynamicConstraint(wfh2, Qt::Horizontal) ) << QSizeF(160, 100) @@ -2772,7 +2770,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 0, 80, 50) << QRectF( 80, 0, 80, 50) << QRectF(0, 50, 80, 50) << QRectF( 80, 50, 50, 50) ); -#endif QTest::newRow("hfw-h470") << (ItemList() << ItemDesc(0,0) @@ -2799,7 +2796,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400) ); - // change layout width and verify QTest::newRow("hfw-w100") << (ItemList() << ItemDesc(0,0) -- cgit v0.12 From fc2b2b3fdb2fb2ee9e632a0c3df4f783b26397f8 Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Wed, 19 Jan 2011 14:03:22 +0100 Subject: Fix some wrong tests in heightForWidth() This aligns better with heightForWidth() as it is in 4.7. However, I've left out the exact matching with stretch factors, (the expectedWidth() function tried to deal with that) because it makes the test less robust (relies on undocumented behaviour and floating point number comparisions). --- .../tst_qgraphicsgridlayout.cpp | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 7346221..0ec67f6 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -3060,25 +3060,24 @@ void tst_QGraphicsGridLayout::heightForWidth() layout->setSpacing(0); RectWidget *w00 = new RectWidget; w00->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w00->setSizeHint(Qt::PreferredSize, QSizeF(50,50)); + w00->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); w00->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); layout->addItem(w00, 0, 0); RectWidget *w01 = new RectWidget; w01->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w01->setSizeHint(Qt::PreferredSize, QSizeF(50,50)); + w01->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); w01->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); layout->addItem(w01, 0, 1); RectWidget *w10 = new RectWidget; w10->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w10->setSizeHint(Qt::PreferredSize, QSizeF(50,50)); + w10->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); w10->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); layout->addItem(w10, 1, 0); RectWidget *w11 = new RectWidget; w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w11->setSizeHint(Qt::PreferredSize, QSizeF(50,400)); w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000)); w11->setConstraintFunction(hfw); QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -3087,29 +3086,33 @@ void tst_QGraphicsGridLayout::heightForWidth() layout->addItem(w11, 1, 1); QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1)), QSizeF(2, 2)); - QEXPECT_FAIL("", "QTBUG-14693", Continue); QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)), QSizeF(210, 110)); QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, -1)), QSizeF(30100, 30100)); QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001)); - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20050)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20010)); QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 20100)); - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)), QSizeF(20, 1 + 2000)); - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)), QSizeF(20, 50 + 2000)); - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)), QSizeF(20, 100 + 2000)); + // Since 20 is somewhere between "minimum width hint" (2) and + // "preferred width hint" (210), it will try to do distribution by + // stretching them with different factors. + // Since column 1 has a "preferred width" of 200 it means that + // column 1 will be a bit wider than column 0. Thus it will also be a bit + // shorter than 2001, (the expected height if all columns had width=10) + QSizeF sh = layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)); + // column 1 cannot be wider than 19, which means that it must be taller than 20000/19~=1052 + QVERIFY(sh.height() < 2000 + 1 && sh.height() > 1052 + 1); - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(300, -1)), QSizeF(300, 1 + 100)); - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(300, -1)), QSizeF(300, 50 + 100)); - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(300, -1)), QSizeF(300, 100 + 100)); + sh = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)); + QVERIFY(sh.height() < 2000 + 10 && sh.height() > 1052 + 10); + + sh = layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)); + QVERIFY(sh.height() < 2000 + 100 && sh.height() > 1052 + 100); // the height of the hfw widget is shorter than the one to the left, which is 100, so // the total height of the last row is 100 (which leaves the layout height to be 200) QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(500, -1)), QSizeF(500, 100 + 100)); - // hfw item size: (500, 40) -> preferred size is maxed up to preferred size of item w10 (50) - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(600, -1)), QSizeF(600, 50 + 50)); - } void tst_QGraphicsGridLayout::widthForHeight() -- cgit v0.12 From 43f8762367fa6ffc228ae6e97192766475b02ac0 Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Wed, 19 Jan 2011 21:55:06 +0100 Subject: Enable the widthForHeight() test case. While I did that I also found a copy-paste (?) bug in the WFH case of QGridLayoutEngine::sizeHint() that caused the widthForHeight() case to fail. Task-number: QTBUG-14693 --- src/gui/graphicsview/qgridlayoutengine.cpp | 2 +- tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 75f1cf5..23cae94 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -1174,7 +1174,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), 0, sizehint_totalBoxes[Ver], q_infos[Ver]); - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal); sizeHintCalculated = true; } } diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 0ec67f6..92cf7fe 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -3117,7 +3117,6 @@ void tst_QGraphicsGridLayout::heightForWidth() void tst_QGraphicsGridLayout::widthForHeight() { -#if 0 QGraphicsWidget *widget = new QGraphicsWidget; QGraphicsGridLayout *layout = new QGraphicsGridLayout; widget->setLayout(layout); @@ -3144,9 +3143,10 @@ void tst_QGraphicsGridLayout::widthForHeight() layout->addItem(w10, 1, 0); RectWidget *w11 = new RectWidget; - w11->setMinimumSize(1,1); - w11->setPreferredSize(50, 50); - w11->setMaximumSize(30000,30000); + w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w11->setSizeHint(Qt::PreferredSize, QSizeF(50,50)); + w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000)); + // This will make sure its always square. w11->setConstraintFunction(wfh); QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -3190,7 +3190,6 @@ void tst_QGraphicsGridLayout::widthForHeight() QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, 300)), QSizeF(1 + 200, 300)); QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, 300)), QSizeF(50 + 200, 300)); QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, 300)), QSizeF(100 + 200, 300)); -#endif } void tst_QGraphicsGridLayout::heightForWidthWithSpanning() -- cgit v0.12 From a38a14b9fb411231443e80cf14d397492f3412dc Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 10 Feb 2011 11:00:11 +0100 Subject: Added QMdiArea::tabsMovable and tabsClosable Task-number: QTBUG-3864 Reviewed-by: Thierry Bastian Merge-request: 2522 --- src/gui/widgets/qmdiarea.cpp | 79 ++++++++++++++++++++++++++++++++++++ src/gui/widgets/qmdiarea.h | 12 +++++- src/gui/widgets/qmdiarea_p.h | 4 ++ tests/auto/qmdiarea/tst_qmdiarea.cpp | 73 +++++++++++++++++++++++++++++++++ 4 files changed, 167 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index b02db4c..2a486bb 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -674,6 +674,8 @@ QMdiAreaPrivate::QMdiAreaPrivate() viewMode(QMdiArea::SubWindowView), #ifndef QT_NO_TABBAR documentMode(false), + tabsClosable(false), + tabsMovable(false), #endif #ifndef QT_NO_TABWIDGET tabShape(QTabWidget::Rounded), @@ -792,6 +794,27 @@ void QMdiAreaPrivate::_q_currentTabChanged(int index) #endif // QT_NO_TABBAR } +void QMdiAreaPrivate::_q_closeTab(int index) +{ +#ifdef QT_NO_TABBAR + Q_UNUSED(index); +#else + QMdiSubWindow *subWindow = childWindows.at(index); + Q_ASSERT(subWindow); + subWindow->close(); +#endif // QT_NO_TABBAR +} + +void QMdiAreaPrivate::_q_moveTab(int from, int to) +{ +#ifdef QT_NO_TABBAR + Q_UNUSED(from); + Q_UNUSED(to); +#else + childWindows.move(from, to); +#endif // QT_NO_TABBAR +} + /*! \internal */ @@ -1519,6 +1542,8 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode) Q_ASSERT(!tabBar); tabBar = new QMdiAreaTabBar(q); tabBar->setDocumentMode(documentMode); + tabBar->setTabsClosable(tabsClosable); + tabBar->setMovable(tabsMovable); #ifndef QT_NO_TABWIDGET tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition)); #endif @@ -1550,6 +1575,8 @@ void QMdiAreaPrivate::setViewMode(QMdiArea::ViewMode mode) updateTabBarGeometry(); QObject::connect(tabBar, SIGNAL(currentChanged(int)), q, SLOT(_q_currentTabChanged(int))); + QObject::connect(tabBar, SIGNAL(tabCloseRequested(int)), q, SLOT(_q_closeTab(int))); + QObject::connect(tabBar, SIGNAL(tabMoved(int,int)), q, SLOT(_q_moveTab(int,int))); } else #endif // QT_NO_TABBAR { // SubWindowView @@ -1636,6 +1663,8 @@ void QMdiAreaPrivate::refreshTabBar() return; tabBar->setDocumentMode(documentMode); + tabBar->setTabsClosable(tabsClosable); + tabBar->setMovable(tabsMovable); #ifndef QT_NO_TABWIDGET tabBar->setShape(tabBarShapeFrom(tabShape, tabPosition)); #endif @@ -2114,6 +2143,56 @@ void QMdiArea::setDocumentMode(bool enabled) d->documentMode = enabled; d->refreshTabBar(); } + +/*! + \property QMdiArea::tabsClosable + \brief whether the tab bar should place close buttons on each tab in tabbed view mode. + \since 4.8 + + Tabs are not closable by default. + + \sa QTabBar::tabsClosable, setViewMode() +*/ +bool QMdiArea::tabsClosable() const +{ + Q_D(const QMdiArea); + return d->tabsClosable; +} + +void QMdiArea::setTabsClosable(bool closable) +{ + Q_D(QMdiArea); + if (d->tabsClosable == closable) + return; + + d->tabsClosable = closable; + d->refreshTabBar(); +} + +/*! + \property QMdiArea::tabsMovable + \brief whether the user can move the tabs within the tabbar area in tabbed view mode. + \since 4.8 + + Tabs are not movable by default. + + \sa QTabBar::tabsMovable, setViewMode() +*/ +bool QMdiArea::tabsMovable() const +{ + Q_D(const QMdiArea); + return d->tabsMovable; +} + +void QMdiArea::setTabsMovable(bool movable) +{ + Q_D(QMdiArea); + if (d->tabsMovable == movable) + return; + + d->tabsMovable = movable; + d->refreshTabBar(); +} #endif // QT_NO_TABBAR #ifndef QT_NO_TABWIDGET diff --git a/src/gui/widgets/qmdiarea.h b/src/gui/widgets/qmdiarea.h index 809bfe4..a4b357c 100644 --- a/src/gui/widgets/qmdiarea.h +++ b/src/gui/widgets/qmdiarea.h @@ -65,6 +65,8 @@ class Q_GUI_EXPORT QMdiArea : public QAbstractScrollArea Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) #ifndef QT_NO_TABBAR Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode) + Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable) + Q_PROPERTY(bool tabsMovable READ tabsMovable WRITE setTabsMovable) #endif #ifndef QT_NO_TABWIDGET Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape) @@ -116,6 +118,12 @@ public: #ifndef QT_NO_TABBAR bool documentMode() const; void setDocumentMode(bool enabled); + + void setTabsClosable(bool closable); + bool tabsClosable() const; + + void setTabsMovable(bool movable); + bool tabsMovable() const; #endif #ifndef QT_NO_TABWIDGET void setTabShape(QTabWidget::TabShape shape); @@ -156,7 +164,9 @@ private: Q_DECLARE_PRIVATE(QMdiArea) Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows()) Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates)) - Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int index)) + Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int)) + Q_PRIVATE_SLOT(d_func(), void _q_closeTab(int)) + Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int, int)) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiArea::AreaOptions) diff --git a/src/gui/widgets/qmdiarea_p.h b/src/gui/widgets/qmdiarea_p.h index 5d85659..e5e2057 100644 --- a/src/gui/widgets/qmdiarea_p.h +++ b/src/gui/widgets/qmdiarea_p.h @@ -165,6 +165,8 @@ public: QMdiArea::ViewMode viewMode; #ifndef QT_NO_TABBAR bool documentMode; + bool tabsClosable; + bool tabsMovable; #endif #ifndef QT_NO_TABWIDGET QTabWidget::TabShape tabShape; @@ -189,6 +191,8 @@ public: void _q_deactivateAllWindows(QMdiSubWindow *aboutToActivate = 0); void _q_processWindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState); void _q_currentTabChanged(int index); + void _q_closeTab(int index); + void _q_moveTab(int from, int to); // Functions. void appendChild(QMdiSubWindow *child); diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index d44e632..67d3d0d 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -287,6 +287,8 @@ private slots: void setActivationOrder(); void tabBetweenSubWindows(); void setViewMode(); + void setTabsClosable(); + void setTabsMovable(); void setTabShape(); void setTabPosition_data(); void setTabPosition(); @@ -2464,6 +2466,77 @@ void tst_QMdiArea::setViewMode() QCOMPARE(mdiArea.viewMode(), QMdiArea::SubWindowView); } +void tst_QMdiArea::setTabsClosable() +{ + QMdiArea mdiArea; + mdiArea.addSubWindow(new QWidget); + + // test default + QCOMPARE(mdiArea.tabsClosable(), false); + + // change value before tab bar exists + QTabBar *tabBar = qFindChild(&mdiArea); + QVERIFY(!tabBar); + mdiArea.setTabsClosable(true); + QCOMPARE(mdiArea.tabsClosable(), true); + + // force tab bar creation + mdiArea.setViewMode(QMdiArea::TabbedView); + tabBar = qFindChild(&mdiArea); + QVERIFY(tabBar); + + // value must've been propagated + QCOMPARE(tabBar->tabsClosable(), true); + + // change value when tab bar exists + mdiArea.setTabsClosable(false); + QCOMPARE(mdiArea.tabsClosable(), false); + QCOMPARE(tabBar->tabsClosable(), false); +} + +void tst_QMdiArea::setTabsMovable() +{ + QMdiArea mdiArea; + QMdiSubWindow *subWindow1 = mdiArea.addSubWindow(new QWidget); + QMdiSubWindow *subWindow2 = mdiArea.addSubWindow(new QWidget); + QMdiSubWindow *subWindow3 = mdiArea.addSubWindow(new QWidget); + + // test default + QCOMPARE(mdiArea.tabsMovable(), false); + + // change value before tab bar exists + QTabBar *tabBar = qFindChild(&mdiArea); + QVERIFY(!tabBar); + mdiArea.setTabsMovable(true); + QCOMPARE(mdiArea.tabsMovable(), true); + + // force tab bar creation + mdiArea.setViewMode(QMdiArea::TabbedView); + tabBar = qFindChild(&mdiArea); + QVERIFY(tabBar); + + // value must've been propagated + QCOMPARE(tabBar->isMovable(), true); + + // test tab moving + QList subWindows; + subWindows << subWindow1 << subWindow2 << subWindow3; + QCOMPARE(mdiArea.subWindowList(QMdiArea::CreationOrder), subWindows); + tabBar->moveTab(1, 2); // 1,3,2 + subWindows.clear(); + subWindows << subWindow1 << subWindow3 << subWindow2; + QCOMPARE(mdiArea.subWindowList(QMdiArea::CreationOrder), subWindows); + tabBar->moveTab(0, 2); // 3,2,1 + subWindows.clear(); + subWindows << subWindow3 << subWindow2 << subWindow1; + QCOMPARE(mdiArea.subWindowList(QMdiArea::CreationOrder), subWindows); + + // change value when tab bar exists + mdiArea.setTabsMovable(false); + QCOMPARE(mdiArea.tabsMovable(), false); + QCOMPARE(tabBar->isMovable(), false); +} + void tst_QMdiArea::setTabShape() { QMdiArea mdiArea; -- cgit v0.12 From b428301a2af0a68ff40d75003ed85aafb19f03f7 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 14 Feb 2011 17:42:03 +1000 Subject: Add support for anchor mirroring Task-number: QTBUG-15879 Reviewed-by: Michael Brasser Change-Id: I833132153ba95437a86bb840a96d5507612d3fa8 --- .../graphicsitems/qdeclarativeanchors.cpp | 111 +- .../graphicsitems/qdeclarativeanchors_p.h | 5 + .../graphicsitems/qdeclarativeanchors_p_p.h | 5 +- .../declarative/qdeclarativeanchors/data/fill.qml | 8 +- .../qdeclarativeanchors/data/margins.qml | 6 +- .../tst_qdeclarativeanchors.cpp | 201 ++- .../qdeclarativestates/tst_qdeclarativestates.cpp | 122 ++ .../animation/reanchorRTL/data/reanchor.0.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.1.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.10.png | Bin 0 -> 647 bytes .../animation/reanchorRTL/data/reanchor.11.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.12.png | Bin 0 -> 636 bytes .../animation/reanchorRTL/data/reanchor.2.png | Bin 0 -> 636 bytes .../animation/reanchorRTL/data/reanchor.3.png | Bin 0 -> 647 bytes .../animation/reanchorRTL/data/reanchor.4.png | Bin 0 -> 641 bytes .../animation/reanchorRTL/data/reanchor.5.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.6.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.7.png | Bin 0 -> 636 bytes .../animation/reanchorRTL/data/reanchor.8.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.9.png | Bin 0 -> 637 bytes .../animation/reanchorRTL/data/reanchor.qml | 1499 ++++++++++++++++++++ .../qmlvisual/animation/reanchorRTL/reanchor.qml | 69 + 22 files changed, 1988 insertions(+), 38 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.0.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.1.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.10.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.11.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.12.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.2.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.3.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.4.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.5.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.6.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.7.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.8.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.9.png create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/reanchorRTL/reanchor.qml diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index 444bbd4..a2d6261 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -181,10 +181,12 @@ void QDeclarativeAnchorsPrivate::fillChanged() if (updatingFill < 2) { ++updatingFill; + qreal horizontalMargin = isMirrored() ? rightMargin : leftMargin; + if (fill == item->parentItem()) { //child-parent - setItemPos(QPointF(leftMargin, topMargin)); + setItemPos(QPointF(horizontalMargin, topMargin)); } else if (fill->parentItem() == item->parentItem()) { //siblings - setItemPos(QPointF(fill->x()+leftMargin, fill->y()+topMargin)); + setItemPos(QPointF(fill->x()+horizontalMargin, fill->y()+topMargin)); } QGraphicsItemPrivate *fillPrivate = QGraphicsItemPrivate::get(fill); setItemSize(QSizeF(fillPrivate->width()-leftMargin-rightMargin, fillPrivate->height()-topMargin-bottomMargin)); @@ -204,13 +206,15 @@ void QDeclarativeAnchorsPrivate::centerInChanged() if (updatingCenterIn < 2) { ++updatingCenterIn; + + qreal effectiveHCenterOffset = isMirrored() ? -hCenterOffset : hCenterOffset; if (centerIn == item->parentItem()) { - QPointF p(hcenter(item->parentItem()) - hcenter(item) + hCenterOffset, + QPointF p(hcenter(item->parentItem()) - hcenter(item) + effectiveHCenterOffset, vcenter(item->parentItem()) - vcenter(item) + vCenterOffset); setItemPos(p); } else if (centerIn->parentItem() == item->parentItem()) { - QPointF p(centerIn->x() + hcenter(centerIn) - hcenter(item) + hCenterOffset, + QPointF p(centerIn->x() + hcenter(centerIn) - hcenter(item) + effectiveHCenterOffset, centerIn->y() + vcenter(centerIn) - vcenter(item) + vCenterOffset); setItemPos(p); } @@ -498,6 +502,11 @@ bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1 return invalid; } +bool QDeclarativeAnchorsPrivate::isMirrored() const +{ + return layoutDirection == Qt::RightToLeft; +} + void QDeclarativeAnchorsPrivate::updateVerticalAnchors() { if (fill || centerIn || !isItemComplete()) @@ -570,58 +579,93 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() } } +inline QDeclarativeAnchorLine::AnchorLine reverseAnchorLine(QDeclarativeAnchorLine::AnchorLine anchorLine) { + if (anchorLine == QDeclarativeAnchorLine::Left) { + return QDeclarativeAnchorLine::Right; + } else if (anchorLine == QDeclarativeAnchorLine::Right) { + return QDeclarativeAnchorLine::Left; + } else { + return anchorLine; + } +} + void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() { if (fill || centerIn || !isItemComplete()) return; - if (updatingHorizontalAnchor < 2) { + if (updatingHorizontalAnchor < 3) { ++updatingHorizontalAnchor; + qreal effectiveRightMargin, effectiveLeftMargin, effectiveHorizontalCenterOffset; + QDeclarativeAnchorLine effectiveLeft, effectiveRight, effectiveHorizontalCenter; + QDeclarativeAnchors::Anchor effectiveLeftAnchor, effectiveRightAnchor; + if (isMirrored()) { + effectiveLeftAnchor = QDeclarativeAnchors::RightAnchor; + effectiveRightAnchor = QDeclarativeAnchors::LeftAnchor; + effectiveLeft.item = right.item; + effectiveLeft.anchorLine = reverseAnchorLine(right.anchorLine); + effectiveRight.item = left.item; + effectiveRight.anchorLine = reverseAnchorLine(left.anchorLine); + effectiveHorizontalCenter.item = hCenter.item; + effectiveHorizontalCenter.anchorLine = reverseAnchorLine(hCenter.anchorLine); + effectiveLeftMargin = rightMargin; + effectiveRightMargin = leftMargin; + effectiveHorizontalCenterOffset = -hCenterOffset; + } else { + effectiveLeftAnchor = QDeclarativeAnchors::LeftAnchor; + effectiveRightAnchor = QDeclarativeAnchors::RightAnchor; + effectiveLeft = left; + effectiveRight = right; + effectiveHorizontalCenter = hCenter; + effectiveLeftMargin = leftMargin; + effectiveRightMargin = rightMargin; + effectiveHorizontalCenterOffset = hCenterOffset; + } + QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item); - if (usedAnchors & QDeclarativeAnchors::LeftAnchor) { + if (usedAnchors & effectiveLeftAnchor) { //Handle stretching bool invalid = true; qreal width = 0.0; - if (usedAnchors & QDeclarativeAnchors::RightAnchor) { - invalid = calcStretch(left, right, leftMargin, -rightMargin, QDeclarativeAnchorLine::Left, width); + if (usedAnchors & effectiveRightAnchor) { + invalid = calcStretch(effectiveLeft, effectiveRight, effectiveLeftMargin, -effectiveRightMargin, QDeclarativeAnchorLine::Left, width); } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { - invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QDeclarativeAnchorLine::Left, width); + invalid = calcStretch(effectiveLeft, effectiveHorizontalCenter, effectiveLeftMargin, effectiveHorizontalCenterOffset, QDeclarativeAnchorLine::Left, width); width *= 2; } if (!invalid) setItemWidth(width); //Handle left - if (left.item == item->parentItem()) { - setItemX(adjustedPosition(left.item, left.anchorLine) + leftMargin); - } else if (left.item->parentItem() == item->parentItem()) { - setItemX(position(left.item, left.anchorLine) + leftMargin); + if (effectiveLeft.item == item->parentItem()) { + setItemX(adjustedPosition(effectiveLeft.item, effectiveLeft.anchorLine) + effectiveLeftMargin); + } else if (effectiveLeft.item->parentItem() == item->parentItem()) { + setItemX(position(effectiveLeft.item, effectiveLeft.anchorLine) + effectiveLeftMargin); } - } else if (usedAnchors & QDeclarativeAnchors::RightAnchor) { + } else if (usedAnchors & effectiveRightAnchor) { //Handle stretching (left + right case is handled in updateLeftAnchor) if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { qreal width = 0.0; - bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin, + bool invalid = calcStretch(effectiveHorizontalCenter, effectiveRight, effectiveHorizontalCenterOffset, -effectiveRightMargin, QDeclarativeAnchorLine::Left, width); if (!invalid) setItemWidth(width*2); } //Handle right - if (right.item == item->parentItem()) { - setItemX(adjustedPosition(right.item, right.anchorLine) - itemPrivate->width() - rightMargin); - } else if (right.item->parentItem() == item->parentItem()) { - setItemX(position(right.item, right.anchorLine) - itemPrivate->width() - rightMargin); + if (effectiveRight.item == item->parentItem()) { + setItemX(adjustedPosition(effectiveRight.item, effectiveRight.anchorLine) - itemPrivate->width() - effectiveRightMargin); + } else if (effectiveRight.item->parentItem() == item->parentItem()) { + setItemX(position(effectiveRight.item, effectiveRight.anchorLine) - itemPrivate->width() - effectiveRightMargin); } } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { //Handle hCenter - if (hCenter.item == item->parentItem()) { - setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - hcenter(item) + hCenterOffset); - } else if (hCenter.item->parentItem() == item->parentItem()) { - setItemX(position(hCenter.item, hCenter.anchorLine) - hcenter(item) + hCenterOffset); + if (effectiveHorizontalCenter.item == item->parentItem()) { + setItemX(adjustedPosition(effectiveHorizontalCenter.item, effectiveHorizontalCenter.anchorLine) - hcenter(item) + effectiveHorizontalCenterOffset); + } else if (effectiveHorizontalCenter.item->parentItem() == item->parentItem()) { + setItemX(position(effectiveHorizontalCenter.item, effectiveHorizontalCenter.anchorLine) - hcenter(item) + effectiveHorizontalCenterOffset); } } - --updatingHorizontalAnchor; } else { // ### Make this certain :) @@ -1042,6 +1086,25 @@ QDeclarativeAnchors::Anchors QDeclarativeAnchors::usedAnchors() const return d->usedAnchors; } + +Qt::LayoutDirection QDeclarativeAnchors::layoutDirection() const +{ + Q_D(const QDeclarativeAnchors); + return d->layoutDirection; +} + +void QDeclarativeAnchors::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + Q_D(QDeclarativeAnchors); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; + d->fillChanged(); + d->centerInChanged(); + d->updateHorizontalAnchors(); + emit layoutDirectionChanged(); + } +} + bool QDeclarativeAnchorsPrivate::checkHValid() const { if (usedAnchors & QDeclarativeAnchors::LeftAnchor && diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index d2c0a89..90a3508 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -79,6 +79,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) public: QDeclarativeAnchors(QObject *parent=0); @@ -160,6 +161,9 @@ public: Anchors usedAnchors() const; + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection (Qt::LayoutDirection); + void classBegin(); void componentComplete(); @@ -181,6 +185,7 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); void baselineOffsetChanged(); + Q_REVISION(1) void layoutDirectionChanged(); private: friend class QDeclarativeItem; diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h index c4508e0..ec96582 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h @@ -94,7 +94,7 @@ public: : componentComplete(true), updatingMe(false), updatingHorizontalAnchor(0), updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0), - margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0) + margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), layoutDirection(Qt::LeftToRight) { } @@ -133,6 +133,7 @@ public: bool checkVAnchorValid(QDeclarativeAnchorLine anchor) const; bool calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, qreal offset1, qreal offset2, QDeclarativeAnchorLine::AnchorLine line, qreal &stretch); + bool isMirrored() const; void updateHorizontalAnchors(); void updateVerticalAnchors(); void fillChanged(); @@ -160,6 +161,8 @@ public: qreal vCenterOffset; qreal hCenterOffset; qreal baselineOffset; + + Qt::LayoutDirection layoutDirection; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativeanchors/data/fill.qml b/tests/auto/declarative/qdeclarativeanchors/data/fill.qml index 50fbbe0..ff19675 100644 --- a/tests/auto/declarative/qdeclarativeanchors/data/fill.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/fill.qml @@ -6,9 +6,9 @@ Rectangle { objectName: "filler" width: 50; height: 50; color: "blue" anchors.fill: parent; - anchors.leftMargin: 10; - anchors.rightMargin: 20; - anchors.topMargin: 30; - anchors.bottomMargin: 40; + anchors.leftMargin: 10; + anchors.rightMargin: 20; + anchors.topMargin: 30; + anchors.bottomMargin: 40; } } diff --git a/tests/auto/declarative/qdeclarativeanchors/data/margins.qml b/tests/auto/declarative/qdeclarativeanchors/data/margins.qml index dace9c0..685346a 100644 --- a/tests/auto/declarative/qdeclarativeanchors/data/margins.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/margins.qml @@ -6,8 +6,8 @@ Rectangle { objectName: "filler" width: 50; height: 50; color: "blue" anchors.fill: parent; - anchors.margins: 10 - anchors.leftMargin: 5 - anchors.topMargin: 6 + anchors.margins: 10 + anchors.leftMargin: 5 + anchors.topMargin: 6 } } diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index e880857..79e233b 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -65,13 +65,10 @@ class tst_qdeclarativeanchors : public QObject public: tst_qdeclarativeanchors() {} - template - T *findItem(QGraphicsObject *parent, const QString &id); - QGraphicsObject *findObject(QGraphicsObject *parent, const QString &objectName); - private slots: void basicAnchors(); void basicAnchorsQGraphicsWidget(); + void basicAnchorsRTL(); void loops(); void illegalSets(); void illegalSets_data(); @@ -82,16 +79,20 @@ private slots: void nullItem_data(); void crash1(); void centerIn(); + void centerInRTL(); void hvCenter(); + void hvCenterRTL(); void fill(); + void fillRTL(); void margins(); + void marginsRTL(); }; /* Find an item with the specified id. */ template -T *tst_qdeclarativeanchors::findItem(QGraphicsObject *parent, const QString &objectName) +T *findItem(QGraphicsObject *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; QList children = parent->childItems(); @@ -110,7 +111,7 @@ T *tst_qdeclarativeanchors::findItem(QGraphicsObject *parent, const QString &obj return 0; } -QGraphicsObject *tst_qdeclarativeanchors::findObject(QGraphicsObject *parent, const QString &objectName) +QGraphicsObject *findObject(QGraphicsObject *parent, const QString &objectName) { QList children = parent->childItems(); for (int i = 0; i < children.count(); ++i) { @@ -263,6 +264,95 @@ void tst_qdeclarativeanchors::basicAnchorsQGraphicsWidget() delete view; } +QDeclarativeItem* childItem(QDeclarativeItem *parentItem, const char * itemString) { + return findItem(parentItem, QLatin1String(itemString)); +} + +qreal offsetMasterRTL(QDeclarativeItem *rootItem, const char * itemString) { + QDeclarativeItem* masterItem = findItem(rootItem, QLatin1String("masterRect")); + return masterItem->width()+2*masterItem->x()-findItem(rootItem, QLatin1String(itemString))->width(); +} + +qreal offsetParentRTL(QDeclarativeItem *rootItem, const char * itemString) { + return rootItem->width()+2*rootItem->x()-findItem(rootItem, QLatin1String(itemString))->width(); +} + +void mirrorAnchors(QDeclarativeItem *item) { + QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); + itemPrivate->anchors()->setLayoutDirection(Qt::RightToLeft); +} + +void tst_qdeclarativeanchors::basicAnchorsRTL() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); + + qApp->processEvents(); + + QDeclarativeItem* rootItem = qobject_cast(view->rootObject()); + foreach(QObject *child, rootItem->children()) + mirrorAnchors(qobject_cast(child)); + + //sibling horizontal + QCOMPARE(childItem(rootItem, "rect1")->x(), offsetMasterRTL(rootItem, "rect1")-26.0); + QCOMPARE(childItem(rootItem, "rect2")->x(), offsetMasterRTL(rootItem, "rect2")-122.0); + QCOMPARE(childItem(rootItem, "rect3")->x(), offsetMasterRTL(rootItem, "rect3")-74.0); + QCOMPARE(childItem(rootItem, "rect4")->x(), offsetMasterRTL(rootItem, "rect4")-16.0); + QCOMPARE(childItem(rootItem, "rect5")->x(), offsetMasterRTL(rootItem, "rect5")-112.0); + QCOMPARE(childItem(rootItem, "rect6")->x(), offsetMasterRTL(rootItem, "rect6")-64.0); + + //parent horizontal + QCOMPARE(childItem(rootItem, "rect7")->x(), offsetParentRTL(rootItem, "rect7")-0.0); + QCOMPARE(childItem(rootItem, "rect8")->x(), offsetParentRTL(rootItem, "rect8")-240.0); + QCOMPARE(childItem(rootItem, "rect9")->x(), offsetParentRTL(rootItem, "rect9")-120.0); + QCOMPARE(childItem(rootItem, "rect10")->x(), offsetParentRTL(rootItem, "rect10")+10.0); + QCOMPARE(childItem(rootItem, "rect11")->x(), offsetParentRTL(rootItem, "rect11")-230.0); + QCOMPARE(childItem(rootItem, "rect12")->x(), offsetParentRTL(rootItem, "rect12")-110.0); + + //vertical + QCOMPARE(childItem(rootItem, "rect13")->y(), 20.0); + QCOMPARE(childItem(rootItem, "rect14")->y(), 155.0); + + //stretch + QCOMPARE(childItem(rootItem, "rect15")->x(), offsetMasterRTL(rootItem, "rect15")-26.0); + QCOMPARE(childItem(rootItem, "rect15")->width(), 96.0); + QCOMPARE(childItem(rootItem, "rect16")->x(), offsetMasterRTL(rootItem, "rect16")-26.0); + QCOMPARE(childItem(rootItem, "rect16")->width(), 192.0); + QCOMPARE(childItem(rootItem, "rect17")->x(), offsetMasterRTL(rootItem, "rect17")+70.0); + QCOMPARE(childItem(rootItem, "rect17")->width(), 192.0); + + //vertical stretch + QCOMPARE(childItem(rootItem, "rect18")->y(), 20.0); + QCOMPARE(childItem(rootItem, "rect18")->height(), 40.0); + + //more parent horizontal + QCOMPARE(childItem(rootItem, "rect19")->x(), offsetParentRTL(rootItem, "rect19")-115.0); + QCOMPARE(childItem(rootItem, "rect20")->x(), offsetParentRTL(rootItem, "rect20")-235.0); + QCOMPARE(childItem(rootItem, "rect21")->x(), offsetParentRTL(rootItem, "rect21")+5.0); + + //centerIn + QCOMPARE(childItem(rootItem, "rect22")->x(), offsetMasterRTL(rootItem, "rect22")-69.0); + QCOMPARE(childItem(rootItem, "rect22")->y(), 5.0); + + //margins + QCOMPARE(childItem(rootItem, "rect23")->x(), offsetMasterRTL(rootItem, "rect23")-31.0); + QCOMPARE(childItem(rootItem, "rect23")->y(), 5.0); + QCOMPARE(childItem(rootItem, "rect23")->width(), 86.0); + QCOMPARE(childItem(rootItem, "rect23")->height(), 10.0); + + // offsets + QCOMPARE(childItem(rootItem, "rect24")->x(), offsetMasterRTL(rootItem, "rect24")-26.0); + QCOMPARE(childItem(rootItem, "rect25")->y(), 60.0); + QCOMPARE(childItem(rootItem, "rect26")->y(), 5.0); + + //baseline + QDeclarativeText *text1 = findItem(rootItem, QLatin1String("text1")); + QDeclarativeText *text2 = findItem(rootItem, QLatin1String("text2")); + QCOMPARE(text1->y(), text2->y()); + + delete view; +} + // mostly testing that we don't crash void tst_qdeclarativeanchors::loops() { @@ -514,6 +604,31 @@ void tst_qdeclarativeanchors::fill() delete view; } +void tst_qdeclarativeanchors::fillRTL() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + mirrorAnchors(rect); + + QCOMPARE(rect->x(), 0.0 + 20.0); + QCOMPARE(rect->y(), 0.0 + 30.0); + QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0); + //Alter Offsets (tests QTBUG-6631) + rectPrivate->anchors()->setLeftMargin(20.0); + rectPrivate->anchors()->setRightMargin(0.0); + rectPrivate->anchors()->setBottomMargin(0.0); + rectPrivate->anchors()->setTopMargin(10.0); + QCOMPARE(rect->x(), 0.0 + 0.0); + QCOMPARE(rect->y(), 0.0 + 10.0); + QCOMPARE(rect->width(), 200.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 10.0); + + delete view; +} void tst_qdeclarativeanchors::centerIn() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); @@ -521,6 +636,7 @@ void tst_qdeclarativeanchors::centerIn() qApp->processEvents(); QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + QCOMPARE(rect->x(), 75.0 + 10); QCOMPARE(rect->y(), 75.0 + 30); //Alter Offsets (tests QTBUG-6631) @@ -532,6 +648,27 @@ void tst_qdeclarativeanchors::centerIn() delete view; } + +void tst_qdeclarativeanchors::centerInRTL() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + mirrorAnchors(rect); + + QCOMPARE(rect->x(), 75.0 - 10); + QCOMPARE(rect->y(), 75.0 + 30); + //Alter Offsets (tests QTBUG-6631) + rectPrivate->anchors()->setHorizontalCenterOffset(-20.0); + rectPrivate->anchors()->setVerticalCenterOffset(-10.0); + QCOMPARE(rect->x(), 75.0 + 20.0); + QCOMPARE(rect->y(), 75.0 - 10.0); + + delete view; +} + void tst_qdeclarativeanchors::hvCenter() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/hvCenter.qml")); @@ -539,12 +676,39 @@ void tst_qdeclarativeanchors::hvCenter() qApp->processEvents(); QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + // test QTBUG-10999 QCOMPARE(rect->x(), 10.0); QCOMPARE(rect->y(), 19.0); + + rectPrivate->anchors()->setHorizontalCenterOffset(-5.0); + rectPrivate->anchors()->setVerticalCenterOffset(5.0); + QCOMPARE(rect->x(), 10.0 - 5.0); + QCOMPARE(rect->y(), 19.0 + 5.0); + delete view; } +void tst_qdeclarativeanchors::hvCenterRTL() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/hvCenter.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + mirrorAnchors(rect); + + // test QTBUG-10999 + QCOMPARE(rect->x(), 10.0); + QCOMPARE(rect->y(), 19.0); + + rectPrivate->anchors()->setHorizontalCenterOffset(-5.0); + rectPrivate->anchors()->setVerticalCenterOffset(5.0); + QCOMPARE(rect->x(), 10.0 + 5.0); + QCOMPARE(rect->y(), 19.0 + 5.0); + + delete view; +} void tst_qdeclarativeanchors::margins() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); @@ -568,6 +732,31 @@ void tst_qdeclarativeanchors::margins() delete view; } +void tst_qdeclarativeanchors::marginsRTL() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + + QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("filler")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + mirrorAnchors(rect); + + QCOMPARE(rect->x(), 10.0); + QCOMPARE(rect->y(), 6.0); + QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0); + QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0); + + rectPrivate->anchors()->setTopMargin(0.0); + rectPrivate->anchors()->setMargins(20.0); + + QCOMPARE(rect->x(), 20.0); + QCOMPARE(rect->y(), 20.0); + QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 20.0 - 20.0); + + delete view; +} + + QTEST_MAIN(tst_qdeclarativeanchors) #include "tst_qdeclarativeanchors.moc" diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 56bed30..2220b6d 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -120,6 +120,9 @@ private slots: void anchorChanges3(); void anchorChanges4(); void anchorChanges5(); + void anchorChangesRTL(); + void anchorChangesRTL2(); + void anchorChangesRTL3(); void anchorChangesCrash(); void anchorRewindBug(); void anchorRewindBug2(); @@ -813,6 +816,125 @@ void tst_qdeclarativestates::anchorChanges5() delete rect; } +void mirrorAnchors(QDeclarativeItem *item) { + QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); + itemPrivate->anchors()->setLayoutDirection(Qt::RightToLeft); +} + +qreal offsetRTL(QDeclarativeItem *anchorItem, QDeclarativeItem *item) { + return anchorItem->width()+2*anchorItem->x()-item->width(); +} + +void tst_qdeclarativestates::anchorChangesRTL() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml"); + QDeclarativeRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QDeclarativeRectangle *innerRect = qobject_cast(rect->findChild("MyRect")); + QVERIFY(innerRect != 0); + mirrorAnchors(innerRect); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rectPrivate->setState("right"); + QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150)); + QCOMPARE(aChanges->object(), qobject_cast(innerRect)); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all) + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); + + rectPrivate->setState(""); + QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) -qreal(5)); + + delete rect; +} + +void tst_qdeclarativestates::anchorChangesRTL2() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); + QDeclarativeRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QDeclarativeRectangle *innerRect = qobject_cast(rect->findChild("MyRect")); + QVERIFY(innerRect != 0); + mirrorAnchors(innerRect); + + rectPrivate->setState("right"); + QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150)); + + rectPrivate->setState(""); + QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(5)); + + delete rect; +} + +void tst_qdeclarativestates::anchorChangesRTL3() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); + QDeclarativeRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QDeclarativeRectangle *innerRect = qobject_cast(rect->findChild("MyRect")); + QVERIFY(innerRect != 0); + mirrorAnchors(innerRect); + + QDeclarativeItem *leftGuideline = qobject_cast(rect->findChild("LeftGuideline")); + QVERIFY(leftGuideline != 0); + + QDeclarativeItem *bottomGuideline = qobject_cast(rect->findChild("BottomGuideline")); + QVERIFY(bottomGuideline != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rectPrivate->setState("reanchored"); + QCOMPARE(aChanges->object(), qobject_cast(innerRect)); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().item, QDeclarativeItemPrivate::get(leftGuideline)->left().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->left().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().item, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().anchorLine); + + QCOMPARE(innerRect->x(), offsetRTL(leftGuideline, innerRect) - qreal(10)); + QCOMPARE(innerRect->y(), qreal(0)); + // between left side of parent and leftGuideline.x: 10, which has width 0 + QCOMPARE(innerRect->width(), qreal(10)); + QCOMPARE(innerRect->height(), qreal(150)); + + rectPrivate->setState(""); + QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(0)); + QCOMPARE(innerRect->y(), qreal(10)); + // between right side of parent and left side of rightGuideline.x: 150, which has width 0 + QCOMPARE(innerRect->width(), qreal(50)); + QCOMPARE(innerRect->height(), qreal(190)); + + delete rect; +} + //QTBUG-9609 void tst_qdeclarativestates::anchorChangesCrash() { diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.0.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.0.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.0.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.1.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.1.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.1.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.10.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.10.png new file mode 100644 index 0000000..1ccab41 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.10.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.11.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.11.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.11.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.12.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.12.png new file mode 100644 index 0000000..f25bd7c Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.12.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.2.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.2.png new file mode 100644 index 0000000..f25bd7c Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.2.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.3.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.3.png new file mode 100644 index 0000000..dad1de4 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.3.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.4.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.4.png new file mode 100644 index 0000000..cd4f23a Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.4.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.5.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.5.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.5.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.6.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.6.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.6.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.7.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.7.png new file mode 100644 index 0000000..f25bd7c Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.7.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.8.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.8.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.8.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.9.png b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.9.png new file mode 100644 index 0000000..160155e Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.9.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.qml b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.qml new file mode 100644 index 0000000..e858c11 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/data/reanchor.qml @@ -0,0 +1,1499 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "reanchor.0.png" + } + Frame { + msec: 32 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 48 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 64 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 80 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 96 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 112 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 128 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 144 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 160 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 176 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 192 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 208 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 224 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 240 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 256 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 272 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 288 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 304 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 320 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 336 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 352 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 368 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 384 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 400 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 416 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 432 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 448 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 464 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 480 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 496 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 512 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 528 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 544 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 560 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 576 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 592 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 608 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 624 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 640 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 656 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 672 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 688 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 704 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 720 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 736 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 752 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 768 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 784 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 800 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 816 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 832 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 848 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 864 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 880 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 896 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 912 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 928 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 944 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 960 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 976 + image: "reanchor.1.png" + } + Frame { + msec: 992 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1008 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1024 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1040 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1056 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 164; y: 196 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1072 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1088 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1104 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1120 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1136 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 164; y: 196 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1152 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 1168 + hash: "f7814217626627ce70ca0e9487354ba9" + } + Frame { + msec: 1184 + hash: "7825b2b77e441ca6f46dbca80c7fe602" + } + Frame { + msec: 1200 + hash: "0ac443a9946b0bcf8db768af7d16d51e" + } + Frame { + msec: 1216 + hash: "c943d5d46f0d527690f38a9c8bd7be51" + } + Frame { + msec: 1232 + hash: "38151db0c9964d33bcb2ff155ebd468c" + } + Frame { + msec: 1248 + hash: "0fb8c53587a95a12cced6d30018edec1" + } + Frame { + msec: 1264 + hash: "2c684a649652270a638aca41a80e327c" + } + Frame { + msec: 1280 + hash: "60dd5c448ef8b97ec13ad3140a584229" + } + Frame { + msec: 1296 + hash: "d564f28f9d528daca729db6fab163b6c" + } + Frame { + msec: 1312 + hash: "4c07b33632ec4f30ee31141099c15a88" + } + Frame { + msec: 1328 + hash: "9facfd27fa16ee9d493e7fb7bcfadbf8" + } + Frame { + msec: 1344 + hash: "fc0fbb8aac8f389841e615be1e7b06de" + } + Frame { + msec: 1360 + hash: "579c18fa201b5609276c761ffd42df33" + } + Frame { + msec: 1376 + hash: "5b3630c37acfc2599a5a8b2e11aaa34c" + } + Frame { + msec: 1392 + hash: "2c1ee8aca06dccf0d39287721bf76aa7" + } + Frame { + msec: 1408 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1424 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1440 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1456 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1472 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1488 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1504 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1520 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1536 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1552 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1568 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1584 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1600 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1616 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1632 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1648 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1664 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1680 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1696 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1712 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1728 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1744 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1760 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1776 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1792 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1808 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1824 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1840 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1856 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1872 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1888 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1904 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1920 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1936 + image: "reanchor.2.png" + } + Frame { + msec: 1952 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1968 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 1984 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2000 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2016 + hash: "c03bb338fff252a100b080366ac907b5" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 170; y: 120 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2032 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2048 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2064 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2080 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2096 + hash: "c03bb338fff252a100b080366ac907b5" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 170; y: 120 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2112 + hash: "c03bb338fff252a100b080366ac907b5" + } + Frame { + msec: 2128 + hash: "e9d7372c17ca1510eb15faff5d0794b2" + } + Frame { + msec: 2144 + hash: "60f897e2b9594c4b5c02ce2fbdf9ae3c" + } + Frame { + msec: 2160 + hash: "c35ead9a8e682e8f3c0a091d232310f7" + } + Frame { + msec: 2176 + hash: "272632b0568391022590edc09ea30e28" + } + Frame { + msec: 2192 + hash: "9d4cdb31b01e86a31627e3ff9bb64100" + } + Frame { + msec: 2208 + hash: "5ee65b0290721fe47508c6435c18554b" + } + Frame { + msec: 2224 + hash: "8dd65e1a9417318d793d2027de4fe6ae" + } + Frame { + msec: 2240 + hash: "bcce6d1fd7d2c1539ad9ac42c0552d5e" + } + Frame { + msec: 2256 + hash: "e01f5850113c178da3383406fe73d6e0" + } + Frame { + msec: 2272 + hash: "968fc6b2bf6b7d43e05254339cf6123f" + } + Frame { + msec: 2288 + hash: "30f25fdde31e13934e328fa1d2655ccb" + } + Frame { + msec: 2304 + hash: "f58a21e96037813c9dd7f933405c9b11" + } + Frame { + msec: 2320 + hash: "1fe42c887f2eaf7696fcf0b8b884d0fd" + } + Frame { + msec: 2336 + hash: "848a27b9e4f4c0bcc1a11d6dba7ce92b" + } + Frame { + msec: 2352 + hash: "ca92736257db83e39f54b04325201942" + } + Frame { + msec: 2368 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2384 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2400 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2416 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2432 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2448 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2464 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2480 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 2496 + hash: "9082504eee5e0c3cbef9fd9545f09dcb" + } + Frame { + msec: 2512 + hash: "dbe5169edb4400c74841a8af64e0949f" + } + Frame { + msec: 2528 + hash: "d588405fc5e2423cdb954c5624172209" + } + Frame { + msec: 2544 + hash: "ed2b273ea36fb7d8feaca4d5dae72f81" + } + Frame { + msec: 2560 + hash: "5249e4824eb169b5ee3f7fb52fe09aa7" + } + Frame { + msec: 2576 + hash: "2838eff2a1a299c9e47cf78be99172ca" + } + Frame { + msec: 2592 + hash: "c47f6a937a4a6ef045159d7ba04de8af" + } + Frame { + msec: 2608 + hash: "fd3bc1b9ba2629bccb0fec04deffcdad" + } + Frame { + msec: 2624 + hash: "54c9b8599a32ac95aff324977b34f7e6" + } + Frame { + msec: 2640 + hash: "cc5652a05828146cdc9c9b8430f5f59c" + } + Frame { + msec: 2656 + hash: "ce5815fb51a4bd697a2fde46084e118b" + } + Frame { + msec: 2672 + hash: "01dfd2604263f1fd24382ce876af10f9" + } + Frame { + msec: 2688 + hash: "45ea282d20ee9e345eb2cac8c22c42e0" + } + Frame { + msec: 2704 + hash: "afd26ac9776e57c94e4b52ebfeb7206c" + } + Frame { + msec: 2720 + hash: "97aeed321d4d92cb1ec236d2a98fbe9b" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2736 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 2752 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 2768 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 2784 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 2800 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2816 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 2832 + hash: "81b8228c6aeefe8072b7704f11e6707e" + } + Frame { + msec: 2848 + hash: "617e416bf117a51b756c90321ebb1449" + } + Frame { + msec: 2864 + hash: "656d8d5d54c9ee137aceb519aff72cce" + } + Frame { + msec: 2880 + hash: "94ba3b6f558c010cdd32f54cce436388" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2896 + image: "reanchor.3.png" + } + Frame { + msec: 2912 + hash: "0bc822fdd4caac17aab80e8601d3a523" + } + Frame { + msec: 2928 + hash: "886d0407ac76d7344f7a314f07b3efff" + } + Frame { + msec: 2944 + hash: "eb6c46af5037f24348edbe0dda48fb62" + } + Frame { + msec: 2960 + hash: "1c578a1eeb67c6833241bcb3214f06fb" + } + Frame { + msec: 2976 + hash: "55f1631ef567217a5945b2a23c59b549" + } + Frame { + msec: 2992 + hash: "25fdd4d54ddb035b082dc3a0d0816114" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 134; y: 106 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 3008 + hash: "25fdd4d54ddb035b082dc3a0d0816114" + } + Frame { + msec: 3024 + hash: "efd61e7c1aaffec77bd3d2de6645b2c0" + } + Frame { + msec: 3040 + hash: "02ac5ca0fa7d2ec3903fccd5dc556fa5" + } + Frame { + msec: 3056 + hash: "daf52e45b8fc68f74e424554074678cc" + } + Frame { + msec: 3072 + hash: "9e2def87e83b0c4b9f26684665aa1e51" + } + Frame { + msec: 3088 + hash: "0e72fc762cc9a061e91692376d65d292" + } + Frame { + msec: 3104 + hash: "c5ac37e4a5250b35a4976bcb31505cca" + } + Frame { + msec: 3120 + hash: "eefe6bb7963c580c68198ee6098a36f4" + } + Frame { + msec: 3136 + hash: "7b78d77ac11b72d1fb827ebb66a04c8e" + } + Frame { + msec: 3152 + hash: "ce5815fb51a4bd697a2fde46084e118b" + } + Frame { + msec: 3168 + hash: "94ba3b6f558c010cdd32f54cce436388" + } + Frame { + msec: 3184 + hash: "61a56140e5a6a2bfcee5c6322b37e130" + } + Frame { + msec: 3200 + hash: "a67b22c0a966fe3fbe869497dc00960f" + } + Frame { + msec: 3216 + hash: "4edd212676ac93ae761039e80f989349" + } + Frame { + msec: 3232 + hash: "fea5797441d65625c400238f73d94807" + } + Frame { + msec: 3248 + hash: "23e9209ff0257343016cffdf7ea6571c" + } + Frame { + msec: 3264 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3280 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3296 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3312 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3328 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3344 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3360 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3376 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3392 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3408 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3424 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3440 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3456 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3472 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3488 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3504 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3520 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3536 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3552 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3568 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3584 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3600 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3616 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3632 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3648 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3664 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3680 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3696 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3712 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3728 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3744 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3760 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3776 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3792 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3808 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3824 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3840 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3856 + image: "reanchor.4.png" + } + Frame { + msec: 3872 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3888 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3904 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3920 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3936 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3952 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3968 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 3984 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4000 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4016 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4032 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4048 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4064 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4080 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4096 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4112 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4128 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4144 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4160 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4176 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 124; y: 113 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4192 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4208 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4224 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4240 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4256 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 124; y: 113 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4272 + hash: "3a1fc9be558078e35a9828e411847c19" + } + Frame { + msec: 4288 + hash: "81b8228c6aeefe8072b7704f11e6707e" + } + Frame { + msec: 4304 + hash: "617e416bf117a51b756c90321ebb1449" + } + Frame { + msec: 4320 + hash: "656d8d5d54c9ee137aceb519aff72cce" + } + Frame { + msec: 4336 + hash: "94ba3b6f558c010cdd32f54cce436388" + } + Frame { + msec: 4352 + hash: "5b0679ff3730cba4ac026e89c7811fbe" + } + Frame { + msec: 4368 + hash: "0bc822fdd4caac17aab80e8601d3a523" + } + Frame { + msec: 4384 + hash: "886d0407ac76d7344f7a314f07b3efff" + } + Frame { + msec: 4400 + hash: "eb6c46af5037f24348edbe0dda48fb62" + } + Frame { + msec: 4416 + hash: "1c578a1eeb67c6833241bcb3214f06fb" + } + Frame { + msec: 4432 + hash: "55f1631ef567217a5945b2a23c59b549" + } + Frame { + msec: 4448 + hash: "25fdd4d54ddb035b082dc3a0d0816114" + } + Frame { + msec: 4464 + hash: "295ea6ff4d3c2c7de0cfbc29b2bd2c38" + } + Frame { + msec: 4480 + hash: "26b978ab645c04731703bcf15ac34a11" + } + Frame { + msec: 4496 + hash: "0db4c2515b89506df51732c4b9bf75dc" + } + Frame { + msec: 4512 + hash: "3cf30f3a06e325e195a4a7dec1e04c01" + } + Frame { + msec: 4528 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4544 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4560 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4576 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4592 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4608 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4624 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4640 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4656 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4672 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4688 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4704 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4720 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4736 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4752 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4768 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4784 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4800 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4816 + image: "reanchor.5.png" + } + Frame { + msec: 4832 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4848 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4864 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4880 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4896 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4912 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4928 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4944 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4960 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4976 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 4992 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5008 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5024 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5040 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5056 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5072 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5088 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5104 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5120 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5136 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5152 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5168 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5184 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5200 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5216 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5232 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5248 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5264 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5280 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5296 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5312 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5328 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5344 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5360 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5376 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5392 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5408 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5424 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5440 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5456 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5472 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5488 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5504 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5520 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5536 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5552 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5568 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } + Frame { + msec: 5584 + hash: "0009d8bfdfaed2a4f05aacb7a7992234" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/reanchorRTL/reanchor.qml b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/reanchor.qml new file mode 100644 index 0000000..ba37737 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/reanchorRTL/reanchor.qml @@ -0,0 +1,69 @@ +import QtQuick 1.1 + +Rectangle { + id: container + width: 200; height: 200 + Rectangle { + id: myRect + anchors.layoutDirection: Qt.RightToLeft + objectName: "MyRect" + color: "green"; + anchors.left: parent.left + anchors.right: rightGuideline.left + anchors.top: topGuideline.top + anchors.bottom: container.bottom + } + Item { id: leftGuideline; x: 10 } + Item { id: rightGuideline; x: 150 } + Item { id: topGuideline; y: 10 } + Item { id: bottomGuideline; y: 150 } + Item { id: topGuideline2; y: 50 } + Item { id: bottomGuideline2; y: 175 } + MouseArea { + id: wholeArea + anchors.fill: parent + onClicked: { + if (container.state == "") { + container.state = "reanchored"; + } else if (container.state == "reanchored") { + container.state = "reanchored2"; + } else if (container.state == "reanchored2") + container.state = "reanchored"; + } + } + + states: [ State { + name: "reanchored" + AnchorChanges { + target: myRect; + anchors.left: leftGuideline.left + anchors.right: container.right + anchors.top: container.top + anchors.bottom: bottomGuideline.bottom + } + }, State { + name: "reanchored2" + AnchorChanges { + target: myRect; + anchors.left: undefined + anchors.right: undefined + anchors.top: topGuideline2.top + anchors.bottom: bottomGuideline2.bottom + } + }] + + transitions: Transition { + AnchorAnimation { } + } + + MouseArea { + width: 50; height: 50 + anchors.right: parent.right + anchors.bottom: parent.bottom + onClicked: { + container.state = ""; + } + } + + state: "reanchored" +} -- cgit v0.12 From 0b0358732cafc34d4b6794200752ac9cb99de569 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Tue, 15 Feb 2011 16:22:46 +1000 Subject: Righ-to-left support for GridView and ListView GridView and ListView can now be laid out right-to-left. The behaviour should be identical and mirrored to the oridinary behaviour. Change-Id: I8e55c5f88358042caa5201712ef239cd67628172 Task-number: QTBUG-15877 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativegridview.cpp | 535 ++++++++++++++++----- .../graphicsitems/qdeclarativegridview_p.h | 12 +- .../graphicsitems/qdeclarativelistview.cpp | 385 +++++++++++---- .../graphicsitems/qdeclarativelistview_p.h | 11 +- .../data/gridview-enforcerange.qml | 2 + .../qdeclarativegridview/data/gridview1.qml | 3 +- .../tst_qdeclarativegridview.cpp | 324 +++++++++++++ .../tst_qdeclarativelistview.cpp | 42 ++ 8 files changed, 1102 insertions(+), 212 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 7e7889c..39fa8e8 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -68,19 +68,60 @@ public: } ~FxGridItem() {} - qreal rowPos() const { return (view->flow() == QDeclarativeGridView::LeftToRight ? item->y() : item->x()); } - qreal colPos() const { return (view->flow() == QDeclarativeGridView::LeftToRight ? item->x() : item->y()); } + qreal rowPos() const { + qreal rowPos = 0; + if (view->flow() == QDeclarativeGridView::LeftToRight) { + rowPos = item->y(); + } else { + if (view->layoutDirection() == Qt::LeftToRight) + rowPos = item->x(); + else + rowPos = -view->cellWidth()-item->x(); + } + return rowPos; + } + qreal colPos() const { + qreal colPos = 0; + if (view->flow() == QDeclarativeGridView::LeftToRight) { + if (view->layoutDirection() == Qt::LeftToRight) { + colPos = item->x(); + } else { + int colSize = view->cellWidth(); + int columns = view->width()/colSize; + colPos = colSize * (columns-1) - item->x(); + } + } else { + colPos = item->y(); + } + + return colPos; + } + qreal endRowPos() const { - return view->flow() == QDeclarativeGridView::LeftToRight - ? item->y() + view->cellHeight() - 1 - : item->x() + view->cellWidth() - 1; + if (view->flow() == QDeclarativeGridView::LeftToRight) { + return item->y() + view->cellHeight() - 1; + } else { + if (view->layoutDirection() == Qt::LeftToRight) + return item->x() + view->cellWidth() - 1; + else + return -item->x() - 1; + } } void setPosition(qreal col, qreal row) { - if (view->flow() == QDeclarativeGridView::LeftToRight) { - item->setPos(QPointF(col, row)); + if (view->layoutDirection() == Qt::LeftToRight) { + if (view->flow() == QDeclarativeGridView::LeftToRight) + item->setPos(QPointF(col, row)); + else + item->setPos(QPointF(row, col)); } else { - item->setPos(QPointF(row, col)); + if (view->flow() == QDeclarativeGridView::LeftToRight) { + int columns = view->width()/view->cellWidth(); + item->setPos(QPointF((view->cellWidth() * (columns-1) - col), row)); + } else { + item->setPos(QPointF(-view->cellWidth()-row, col)); + } } + } bool contains(int x, int y) const { return (x >= item->x() && x < item->x() + view->cellWidth() && @@ -101,10 +142,12 @@ class QDeclarativeGridViewPrivate : public QDeclarativeFlickablePrivate public: QDeclarativeGridViewPrivate() - : currentItem(0), flow(QDeclarativeGridView::LeftToRight) + : currentItem(0), layoutDirection(Qt::LeftToRight), flow(QDeclarativeGridView::LeftToRight) , visibleIndex(0) , currentIndex(-1) , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1), itemCount(0) - , highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange) + , highlightRangeStart(0), highlightRangeEnd(0) + , highlightRangeStartValid(false), highlightRangeEndValid(false) + , highlightRange(QDeclarativeGridView::NoHighlightRange) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) , highlightMoveDuration(150) @@ -144,35 +187,54 @@ public: return 0; } + bool isRightToLeftTopToBottom() const { + return flow == QDeclarativeGridView::TopToBottom && layoutDirection == Qt::RightToLeft; + } + qreal position() const { Q_Q(const QDeclarativeGridView); return flow == QDeclarativeGridView::LeftToRight ? q->contentY() : q->contentX(); } void setPosition(qreal pos) { Q_Q(QDeclarativeGridView); - if (flow == QDeclarativeGridView::LeftToRight) + if (flow == QDeclarativeGridView::LeftToRight) { q->QDeclarativeFlickable::setContentY(pos); - else - q->QDeclarativeFlickable::setContentX(pos); + q->QDeclarativeFlickable::setContentX(0); + } else { + if (layoutDirection == Qt::LeftToRight) + q->QDeclarativeFlickable::setContentX(pos); + else + q->QDeclarativeFlickable::setContentX(-pos-size()); + q->QDeclarativeFlickable::setContentY(0); + } } int size() const { Q_Q(const QDeclarativeGridView); return flow == QDeclarativeGridView::LeftToRight ? q->height() : q->width(); } - qreal startPosition() const { + qreal originPosition() const { qreal pos = 0; if (!visibleItems.isEmpty()) pos = visibleItems.first()->rowPos() - visibleIndex / columns * rowSize(); return pos; } - qreal endPosition() const { + qreal lastPosition() const { qreal pos = 0; if (model && model->count()) pos = rowPosAt(model->count() - 1) + rowSize(); return pos; } + qreal startPosition() const { + return isRightToLeftTopToBottom() ? -lastPosition()+1 : originPosition(); + } + + qreal endPosition() const { + return isRightToLeftTopToBottom() ? -originPosition()+1 : lastPosition(); + + } + bool isValid() const { return model && model->count() && model->isValid(); } @@ -227,7 +289,7 @@ public: } FxGridItem *firstVisibleItem() const { - const qreal pos = position(); + const qreal pos = isRightToLeftTopToBottom() ? -position()-size() : position(); for (int i = 0; i < visibleItems.count(); ++i) { FxGridItem *item = visibleItems.at(i); if (item->index != -1 && item->endRowPos() > pos) @@ -237,15 +299,12 @@ public: } int lastVisibleIndex() const { - int lastIndex = -1; - for (int i = visibleItems.count()-1; i >= 0; --i) { - FxGridItem *gridItem = visibleItems.at(i); - if (gridItem->index != -1) { - lastIndex = gridItem->index; - break; - } + for (int i = 0; i < visibleItems.count(); ++i) { + FxGridItem *item = visibleItems.at(i); + if (item->index != -1) + return item->index; } - return lastIndex; + return -1; } // Map a model index to visibleItems list index. @@ -271,8 +330,15 @@ public: pos += rowSize()/2; snapPos = visibleItems.first()->rowPos() - visibleIndex / columns * rowSize(); snapPos = pos - fmodf(pos - snapPos, qreal(rowSize())); - qreal maxExtent = flow == QDeclarativeGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent(); - qreal minExtent = flow == QDeclarativeGridView::LeftToRight ? -q->minYExtent() : -q->minXExtent(); + qreal maxExtent; + qreal minExtent; + if (isRightToLeftTopToBottom()) { + maxExtent = q->minXExtent(); + minExtent = q->maxXExtent(); + } else { + maxExtent = flow == QDeclarativeGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent(); + minExtent = flow == QDeclarativeGridView::LeftToRight ? -q->minYExtent() : -q->minXExtent(); + } if (snapPos > maxExtent) snapPos = maxExtent; if (snapPos < minExtent) @@ -363,6 +429,7 @@ public: QList visibleItems; QHash unrequestedItems; FxGridItem *currentItem; + Qt::LayoutDirection layoutDirection; QDeclarativeGridView::Flow flow; int visibleIndex; int currentIndex; @@ -373,6 +440,8 @@ public: int itemCount; qreal highlightRangeStart; qreal highlightRangeEnd; + bool highlightRangeStartValid; + bool highlightRangeEndValid; QDeclarativeGridView::HighlightRangeMode highlightRange; QDeclarativeComponent *highlightComponent; FxGridItem *highlight; @@ -554,7 +623,7 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) if (!lazyRelease || !changed || deferredRelease) { // avoid destroying items in the same frame that we create while (visibleItems.count() > 1 && (item = visibleItems.first()) - && item->endRowPos() < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { + && item->rowPos()+rowSize()-1 < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { if (item->attached->delayRemove()) break; // qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endRowPos(); @@ -596,12 +665,14 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) void QDeclarativeGridViewPrivate::updateGrid() { Q_Q(QDeclarativeGridView); + columns = (int)qMax((flow == QDeclarativeGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.)); if (isValid()) { if (flow == QDeclarativeGridView::LeftToRight) q->setContentHeight(endPosition() - startPosition()); else - q->setContentWidth(endPosition() - startPosition()); + q->setContentWidth(lastPosition() - originPosition()); + setPosition(0); } } @@ -626,7 +697,7 @@ void QDeclarativeGridViewPrivate::layout() qreal rowPos = visibleItems.first()->rowPos(); qreal colPos = visibleItems.first()->colPos(); int col = visibleIndex % columns; - if (colPos != col * colSize()) { + if (colPos != col * colSize() || isRightToLeftTopToBottom()) { colPos = col * colSize(); visibleItems.first()->setPosition(colPos, rowPos); } @@ -669,10 +740,14 @@ void QDeclarativeGridViewPrivate::updateUnrequestedPositions() { QHash::const_iterator it; for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) { + QDeclarativeItem *item = it.key(); if (flow == QDeclarativeGridView::LeftToRight) { - it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); + item->setPos(QPointF(colPosAt(*it), rowPosAt(*it))); } else { - it.key()->setPos(QPointF(rowPosAt(*it), colPosAt(*it))); + if (isRightToLeftTopToBottom()) + item->setPos(QPointF(-rowPosAt(*it)-item->width(), colPosAt(*it))); + else + item->setPos(QPointF(rowPosAt(*it), (columns-1)*colSize()-colPosAt(*it))); } } } @@ -837,23 +912,30 @@ void QDeclarativeGridViewPrivate::updateFooter() } } if (footer) { + qreal colOffset = 0; + qreal rowOffset; + if (isRightToLeftTopToBottom()) { + rowOffset = footer->item->width()-cellWidth; + } else { + rowOffset = 0; + if (layoutDirection == Qt::RightToLeft) + colOffset = footer->item->width()-cellWidth; + } if (visibleItems.count()) { - qreal endPos = endPosition(); + qreal endPos = lastPosition(); if (lastVisibleIndex() == model->count()-1) { - footer->setPosition(0, endPos); + footer->setPosition(colOffset, endPos + rowOffset); } else { - qreal visiblePos = position() + q->height(); - if (endPos <= visiblePos || footer->endRowPos() < endPos) - footer->setPosition(0, endPos); + qreal visiblePos = isRightToLeftTopToBottom() ? -position() : position() + size(); + if (endPos <= visiblePos || footer->endRowPos() < endPos + rowOffset) + footer->setPosition(colOffset, endPos + rowOffset); } } else { qreal endPos = 0; if (header) { - endPos += flow == QDeclarativeGridView::LeftToRight - ? header->item->height() - : header->item->width(); + endPos += flow == QDeclarativeGridView::LeftToRight ? header->item->height() : header->item->width(); } - footer->setPosition(0, endPos); + footer->setPosition(colOffset, endPos); } } } @@ -883,16 +965,27 @@ void QDeclarativeGridViewPrivate::updateHeader() } } if (header) { + qreal colOffset = 0; + qreal rowOffset; + if (isRightToLeftTopToBottom()) { + rowOffset = -cellWidth; + } else { + rowOffset = -headerSize(); + if (layoutDirection == Qt::RightToLeft) + colOffset = header->item->width()-cellWidth; + } if (visibleItems.count()) { - qreal startPos = startPosition(); + qreal startPos = originPosition(); if (visibleIndex == 0) { - header->setPosition(0, startPos - headerSize()); + header->setPosition(colOffset, startPos + rowOffset); } else { - if (position() <= startPos || header->rowPos() > startPos - headerSize()) - header->setPosition(0, startPos - headerSize()); + qreal tempPos = isRightToLeftTopToBottom() ? -position()-size() : position(); + qreal headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos(); + if (tempPos <= startPos || headerPos > startPos + rowOffset) + header->setPosition(colOffset, startPos + rowOffset); } } else { - header->setPosition(0, 0); + header->setPosition(colOffset, 0); } } } @@ -915,21 +1008,44 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; + qreal highlightStart; + qreal highlightEnd; + qreal viewPos; + if (isRightToLeftTopToBottom()) { + // Handle Right-To-Left exceptions + viewPos = -position()-size(); + highlightStart = highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart; + highlightEnd = highlightRangeEndValid ? size()-highlightRangeStart : highlightRangeEnd; + } else { + viewPos = position(); + highlightStart = highlightRangeStart; + highlightEnd = highlightRangeEnd; + } + if (snapMode != QDeclarativeGridView::NoSnap) { - FxGridItem *topItem = snapItemAt(position()+highlightRangeStart); - FxGridItem *bottomItem = snapItemAt(position()+highlightRangeEnd); + qreal tempPosition = isRightToLeftTopToBottom() ? -position()-size() : position(); + FxGridItem *topItem = snapItemAt(tempPosition+highlightStart); + FxGridItem *bottomItem = snapItemAt(tempPosition+highlightEnd); qreal pos; if (topItem && bottomItem && haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange) { - qreal topPos = qMin(topItem->rowPos() - highlightRangeStart, -maxExtent); - qreal bottomPos = qMax(bottomItem->rowPos() - highlightRangeEnd, -minExtent); + qreal topPos = qMin(topItem->rowPos() - highlightStart, -maxExtent); + qreal bottomPos = qMax(bottomItem->rowPos() - highlightEnd, -minExtent); pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos; } else if (topItem) { - if (topItem->index == 0 && header && position()+highlightRangeStart < header->rowPos()+headerSize()/2) - pos = header->rowPos() - highlightRangeStart; - else - pos = qMax(qMin(topItem->rowPos() - highlightRangeStart, -maxExtent), -minExtent); + qreal headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos(); + if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2) { + pos = isRightToLeftTopToBottom() ? - headerPos + highlightStart - size() : headerPos - highlightStart; + } else { + if (isRightToLeftTopToBottom()) + pos = qMax(qMin(-topItem->rowPos() + highlightStart - size(), -maxExtent), -minExtent); + else + pos = qMax(qMin(topItem->rowPos() - highlightStart, -maxExtent), -minExtent); + } } else if (bottomItem) { - pos = qMax(qMin(bottomItem->rowPos() - highlightRangeStart, -maxExtent), -minExtent); + if (isRightToLeftTopToBottom()) + pos = qMax(qMin(-bottomItem->rowPos() + highlightStart - size(), -maxExtent), -minExtent); + else + pos = qMax(qMin(bottomItem->rowPos() - highlightStart, -maxExtent), -minExtent); } else { QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent); fixupDuration = oldDuration; @@ -938,12 +1054,15 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m if (currentItem && haveHighlightRange && highlightRange == QDeclarativeGridView::StrictlyEnforceRange) { updateHighlight(); qreal currPos = currentItem->rowPos(); - if (pos < currPos + rowSize() - highlightRangeEnd) - pos = currPos + rowSize() - highlightRangeEnd; - if (pos > currPos - highlightRangeStart) - pos = currPos - highlightRangeStart; + if (isRightToLeftTopToBottom()) + pos = -pos-size(); // Transform Pos if required + if (pos < currPos + rowSize() - highlightEnd) + pos = currPos + rowSize() - highlightEnd; + if (pos > currPos - highlightStart) + pos = currPos - highlightStart; + if (isRightToLeftTopToBottom()) + pos = -pos-size(); // Untransform } - qreal dist = qAbs(data.move + pos); if (dist > 0) { timeline.reset(data.move); @@ -957,12 +1076,12 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m if (currentItem) { updateHighlight(); qreal pos = currentItem->rowPos(); - qreal viewPos = position(); - if (viewPos < pos + rowSize() - highlightRangeEnd) - viewPos = pos + rowSize() - highlightRangeEnd; - if (viewPos > pos - highlightRangeStart) - viewPos = pos - highlightRangeStart; - + if (viewPos < pos + rowSize() - highlightEnd) + viewPos = pos + rowSize() - highlightEnd; + if (viewPos > pos - highlightStart) + viewPos = pos - highlightStart; + if (isRightToLeftTopToBottom()) + viewPos = -viewPos-size(); timeline.reset(data.move); if (viewPos != position()) { if (fixupDuration) @@ -989,12 +1108,14 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m return; } qreal maxDistance = 0; - // -ve velocity means list is moving up + qreal dataValue = isRightToLeftTopToBottom() ? -data.move.value()+size() : data.move.value(); + // -ve velocity means list is moving up/left if (velocity > 0) { if (data.move.value() < minExtent) { if (snapMode == QDeclarativeGridView::SnapOneRow) { - if (FxGridItem *item = firstVisibleItem()) - maxDistance = qAbs(item->rowPos() + data.move.value()); + if (FxGridItem *item = firstVisibleItem()) { + maxDistance = qAbs(item->rowPos() + dataValue); + } } else { maxDistance = qAbs(minExtent - data.move.value()); } @@ -1004,8 +1125,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } else { if (data.move.value() > maxExtent) { if (snapMode == QDeclarativeGridView::SnapOneRow) { - qreal pos = snapPosAt(-data.move.value()) + rowSize(); - maxDistance = qAbs(pos + data.move.value()); + qreal pos = snapPosAt(-dataValue) + (isRightToLeftTopToBottom() ? 0 : rowSize()); + maxDistance = qAbs(pos + dataValue); } else { maxDistance = qAbs(maxExtent - data.move.value()); } @@ -1013,7 +1134,10 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (snapMode == QDeclarativeGridView::NoSnap && highlightRange != QDeclarativeGridView::StrictlyEnforceRange) data.flickTarget = maxExtent; } + bool overShoot = boundsBehavior == QDeclarativeFlickable::DragAndOvershootBounds; + qreal highlightStart = isRightToLeftTopToBottom() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart; + if (maxDistance > 0 || overShoot) { // This mode requires the grid to stop exactly on a row boundary. qreal v = velocity; @@ -1032,7 +1156,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m dist = qMin(dist, maxDistance); if (v > 0) dist = -dist; - data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart; + qreal distTemp = isRightToLeftTopToBottom() ? -dist : dist; + data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart; + data.flickTarget = isRightToLeftTopToBottom() ? -data.flickTarget+size() : data.flickTarget; qreal adjDist = -data.flickTarget + data.move.value(); if (qAbs(adjDist) > qAbs(dist)) { // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration @@ -1224,6 +1350,13 @@ QVariant QDeclarativeGridView::model() const return d->modelVariant; } +// For internal use +int QDeclarativeGridView::modelCount() const +{ + Q_D(const QDeclarativeGridView); + return d->model->count(); +} + void QDeclarativeGridView::setModel(const QVariant &model) { Q_D(QDeclarativeGridView); @@ -1549,6 +1682,7 @@ qreal QDeclarativeGridView::preferredHighlightBegin() const void QDeclarativeGridView::setPreferredHighlightBegin(qreal start) { Q_D(QDeclarativeGridView); + d->highlightRangeStartValid = true; if (d->highlightRangeStart == start) return; d->highlightRangeStart = start; @@ -1556,6 +1690,16 @@ void QDeclarativeGridView::setPreferredHighlightBegin(qreal start) emit preferredHighlightBeginChanged(); } +void QDeclarativeGridView::resetPreferredHighlightBegin() +{ + Q_D(QDeclarativeGridView); + d->highlightRangeStartValid = false; + if (d->highlightRangeStart == 0) + return; + d->highlightRangeStart = 0; + emit preferredHighlightBeginChanged(); +} + qreal QDeclarativeGridView::preferredHighlightEnd() const { Q_D(const QDeclarativeGridView); @@ -1565,6 +1709,7 @@ qreal QDeclarativeGridView::preferredHighlightEnd() const void QDeclarativeGridView::setPreferredHighlightEnd(qreal end) { Q_D(QDeclarativeGridView); + d->highlightRangeEndValid = true; if (d->highlightRangeEnd == end) return; d->highlightRangeEnd = end; @@ -1572,6 +1717,16 @@ void QDeclarativeGridView::setPreferredHighlightEnd(qreal end) emit preferredHighlightEndChanged(); } +void QDeclarativeGridView::resetPreferredHighlightEnd() +{ + Q_D(QDeclarativeGridView); + d->highlightRangeEndValid = false; + if (d->highlightRangeEnd == 0) + return; + d->highlightRangeEnd = 0; + emit preferredHighlightEndChanged(); +} + QDeclarativeGridView::HighlightRangeMode QDeclarativeGridView::highlightRangeMode() const { Q_D(const QDeclarativeGridView); @@ -1588,6 +1743,43 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) emit highlightRangeModeChanged(); } +/*! + \qmlproperty enumeration GridView::layoutDirection + This property holds the layout direction of the grid. + + Possible values: + + \list + \o Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is + dependent on the \l GridView::flow property. + \o Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent + on the \l GridView:flow property. + \endlist + + \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if + GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply + indicates that the flow is horizontal. + +*/ + +Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const +{ + Q_D(const QDeclarativeGridView); + return d->layoutDirection; +} + +void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + Q_D(QDeclarativeGridView); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; + d->clear(); + d->updateGrid(); + refill(); + d->updateCurrent(d->currentIndex); + emit layoutDirectionChanged(); + } +} /*! \qmlproperty enumeration GridView::flow @@ -1890,11 +2082,23 @@ void QDeclarativeGridView::viewportMoved() if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) { // reposition highlight qreal pos = d->highlight->rowPos(); - qreal viewPos = d->position(); - if (pos > viewPos + d->highlightRangeEnd - d->rowSize()) - pos = viewPos + d->highlightRangeEnd - d->rowSize(); - if (pos < viewPos + d->highlightRangeStart) - pos = viewPos + d->highlightRangeStart; + qreal viewPos; + qreal highlightStart; + qreal highlightEnd; + if (d->isRightToLeftTopToBottom()) { + highlightStart = d->highlightRangeStartValid ? d->size()-d->highlightRangeEnd : d->highlightRangeStart; + highlightEnd = d->highlightRangeEndValid ? d->size()-d->highlightRangeStart : d->highlightRangeEnd; + viewPos = -d->position()-d->size(); + } else { + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + viewPos = d->position(); + } + if (pos > viewPos + highlightEnd - d->rowSize()) + pos = viewPos + highlightEnd - d->rowSize(); + if (pos < viewPos + highlightStart) + pos = viewPos + highlightStart; + d->highlight->setPosition(d->highlight->colPos(), qRound(pos)); // update current index @@ -1956,11 +2160,27 @@ qreal QDeclarativeGridView::minXExtent() const if (d->flow == QDeclarativeGridView::LeftToRight) return QDeclarativeFlickable::minXExtent(); qreal extent = -d->startPosition(); - if (d->header && d->visibleItems.count()) - extent += d->header->item->width(); + qreal highlightStart; + qreal highlightEnd; + qreal endPositionFirstItem; + if (d->isRightToLeftTopToBottom()) { + endPositionFirstItem = d->rowPosAt(d->model->count()-1); + highlightStart = d->highlightRangeStartValid + ? d->highlightRangeStart - (d->lastPosition()-endPositionFirstItem) + : d->size() - (d->lastPosition()-endPositionFirstItem); + highlightEnd = d->highlightRangeEndValid ? d->highlightRangeEnd : d->size(); + if (d->footer && d->visibleItems.count()) + extent += d->footer->item->width(); + } else { + endPositionFirstItem = d->rowPosAt(0)+d->rowSize(); + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + if (d->header && d->visibleItems.count()) + extent += d->header->item->width(); + } if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { - extent += d->highlightRangeStart; - extent = qMax(extent, -(d->rowPosAt(0) + d->rowSize() - d->highlightRangeEnd)); + extent += highlightStart; + extent = qMax(extent, -(endPositionFirstItem - highlightEnd)); } return extent; } @@ -1973,15 +2193,36 @@ qreal QDeclarativeGridView::maxXExtent() const qreal extent; if (!d->model || !d->model->count()) { extent = 0; - } if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { - extent = -(d->rowPosAt(d->model->count()-1) - d->highlightRangeStart); - if (d->highlightRangeEnd != d->highlightRangeStart) - extent = qMin(extent, -(d->endPosition() - d->highlightRangeEnd + 1)); + } + qreal highlightStart; + qreal highlightEnd; + qreal lastItemPosition; + if (d->isRightToLeftTopToBottom()){ + highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size(); + highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size(); + lastItemPosition = d->endPosition(); + } else { + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + lastItemPosition = d->rowPosAt(d->model->count()-1); + } + if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { + extent = -(lastItemPosition - highlightStart); + if (highlightEnd != highlightStart) + extent = d->isRightToLeftTopToBottom() + ? qMax(extent, -(d->endPosition() - highlightEnd + 1)) + : qMin(extent, -(d->endPosition() - highlightEnd + 1)); } else { extent = -(d->endPosition() - width()); } - if (d->footer) - extent -= d->footer->item->width(); + if (d->isRightToLeftTopToBottom()) { + if (d->header) + extent -= d->header->item->width(); + } else { + if (d->footer) + extent -= d->footer->item->width(); + } + const qreal minX = minXExtent(); if (extent > minX) extent = minX; @@ -2094,15 +2335,30 @@ void QDeclarativeGridView::moveCurrentIndexLeft() const int count = d->model ? d->model->count() : 0; if (!count) return; - if (d->flow == QDeclarativeGridView::LeftToRight) { - if (currentIndex() > 0 || d->wrap) { - int index = currentIndex() - 1; - setCurrentIndex((index >= 0 && index < count) ? index : count-1); + + if (d->layoutDirection == Qt::LeftToRight) { + if (d->flow == QDeclarativeGridView::LeftToRight) { + if (currentIndex() > 0 || d->wrap) { + int index = currentIndex() - 1; + setCurrentIndex((index >= 0 && index < count) ? index : count-1); + } + } else { + if (currentIndex() >= d->columns || d->wrap) { + int index = currentIndex() - d->columns; + setCurrentIndex((index >= 0 && index < count) ? index : count-1); + } } } else { - if (currentIndex() >= d->columns || d->wrap) { - int index = currentIndex() - d->columns; - setCurrentIndex((index >= 0 && index < count) ? index : count-1); + if (d->flow == QDeclarativeGridView::LeftToRight) { + if (currentIndex() < count - 1 || d->wrap) { + int index = currentIndex() + 1; + setCurrentIndex((index >= 0 && index < count) ? index : 0); + } + } else { + if (currentIndex() < count - d->columns || d->wrap) { + int index = currentIndex() + d->columns; + setCurrentIndex((index >= 0 && index < count) ? index : 0); + } } } } @@ -2122,15 +2378,30 @@ void QDeclarativeGridView::moveCurrentIndexRight() const int count = d->model ? d->model->count() : 0; if (!count) return; - if (d->flow == QDeclarativeGridView::LeftToRight) { - if (currentIndex() < count - 1 || d->wrap) { - int index = currentIndex() + 1; - setCurrentIndex((index >= 0 && index < count) ? index : 0); + + if (d->layoutDirection == Qt::LeftToRight) { + if (d->flow == QDeclarativeGridView::LeftToRight) { + if (currentIndex() < count - 1 || d->wrap) { + int index = currentIndex() + 1; + setCurrentIndex((index >= 0 && index < count) ? index : 0); + } + } else { + if (currentIndex() < count - d->columns || d->wrap) { + int index = currentIndex()+d->columns; + setCurrentIndex((index >= 0 && index < count) ? index : 0); + } } } else { - if (currentIndex() < count - d->columns || d->wrap) { - int index = currentIndex()+d->columns; - setCurrentIndex((index >= 0 && index < count) ? index : 0); + if (d->flow == QDeclarativeGridView::LeftToRight) { + if (currentIndex() > 0 || d->wrap) { + int index = currentIndex() - 1; + setCurrentIndex((index >= 0 && index < count) ? index : count-1); + } + } else { + if (currentIndex() >= d->columns || d->wrap) { + int index = currentIndex() - d->columns; + setCurrentIndex((index >= 0 && index < count) ? index : count-1); + } } } } @@ -2147,16 +2418,24 @@ void QDeclarativeGridViewPrivate::positionViewAtIndex(int index, int mode) if (layoutScheduled) layout(); - qreal pos = position(); + qreal pos = isRightToLeftTopToBottom() ? -position() - size() : position(); FxGridItem *item = visibleItem(idx); - qreal maxExtent = flow == QDeclarativeGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent(); + qreal maxExtent; + if (flow == QDeclarativeGridView::LeftToRight) + maxExtent = -q->maxYExtent(); + else + maxExtent = isRightToLeftTopToBottom() ? q->minXExtent()-size() : -q->maxXExtent(); + if (!item) { int itemPos = rowPosAt(idx); // save the currently visible items in case any of them end up visible again QList oldVisible = visibleItems; visibleItems.clear(); visibleIndex = idx - idx % columns; - maxExtent = flow == QDeclarativeGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent(); + if (flow == QDeclarativeGridView::LeftToRight) + maxExtent = -q->maxYExtent(); + else + maxExtent = isRightToLeftTopToBottom() ? q->minXExtent()-size() : -q->maxXExtent(); setPosition(qMin(qreal(itemPos), maxExtent)); // now release the reference to all the old visible items. for (int i = 0; i < oldVisible.count(); ++i) @@ -2197,8 +2476,13 @@ void QDeclarativeGridViewPrivate::positionViewAtIndex(int index, int mode) if (itemPos < pos) pos = itemPos; } + pos = qMin(pos, maxExtent); - qreal minExtent = flow == QDeclarativeGridView::LeftToRight ? -q->minYExtent() : -q->minXExtent(); + qreal minExtent; + if (flow == QDeclarativeGridView::LeftToRight) + minExtent = -q->minYExtent(); + else + minExtent = isRightToLeftTopToBottom() ? q->maxXExtent()-size() : -q->minXExtent(); pos = qMax(pos, minExtent); moveReason = QDeclarativeGridViewPrivate::Other; q->cancelFlick(); @@ -2337,32 +2621,43 @@ void QDeclarativeGridView::trackedPositionChanged() return; if (d->moveReason == QDeclarativeGridViewPrivate::SetIndex) { const qreal trackedPos = d->trackedItem->rowPos(); - const qreal viewPos = d->position(); + qreal viewPos; + qreal highlightStart; + qreal highlightEnd; + if (d->isRightToLeftTopToBottom()) { + viewPos = -d->position()-d->size(); + highlightStart = d->highlightRangeStartValid ? d->size()-d->highlightRangeEnd : d->highlightRangeStart; + highlightEnd = d->highlightRangeEndValid ? d->size()-d->highlightRangeStart : d->highlightRangeEnd; + } else { + viewPos = d->position(); + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + } qreal pos = viewPos; if (d->haveHighlightRange) { if (d->highlightRange == StrictlyEnforceRange) { - if (trackedPos > pos + d->highlightRangeEnd - d->rowSize()) - pos = trackedPos - d->highlightRangeEnd + d->rowSize(); - if (trackedPos < pos + d->highlightRangeStart) - pos = trackedPos - d->highlightRangeStart; + if (trackedPos > pos + highlightEnd - d->rowSize()) + pos = trackedPos - highlightEnd + d->rowSize(); + if (trackedPos < pos + highlightStart) + pos = trackedPos - highlightStart; } else { - if (trackedPos < d->startPosition() + d->highlightRangeStart) { + if (trackedPos < d->startPosition() + highlightStart) { pos = d->startPosition(); - } else if (d->trackedItem->endRowPos() > d->endPosition() - d->size() + d->highlightRangeEnd) { + } else if (d->trackedItem->endRowPos() > d->endPosition() - d->size() + highlightEnd) { pos = d->endPosition() - d->size() + 1; if (pos < d->startPosition()) pos = d->startPosition(); } else { - if (trackedPos < viewPos + d->highlightRangeStart) { - pos = trackedPos - d->highlightRangeStart; - } else if (trackedPos > viewPos + d->highlightRangeEnd - d->rowSize()) { - pos = trackedPos - d->highlightRangeEnd + d->rowSize(); + if (trackedPos < viewPos + highlightStart) { + pos = trackedPos - highlightStart; + } else if (trackedPos > viewPos + highlightEnd - d->rowSize()) { + pos = trackedPos - highlightEnd + d->rowSize(); } } } } else { if (trackedPos < viewPos && d->currentItem->rowPos() < viewPos) { - pos = d->currentItem->rowPos() < trackedPos ? trackedPos : d->currentItem->rowPos(); + pos = qMax(trackedPos, d->currentItem->rowPos()); } else if (d->trackedItem->endRowPos() >= viewPos + d->size() && d->currentItem->endRowPos() >= viewPos + d->size()) { if (d->trackedItem->endRowPos() <= d->currentItem->endRowPos()) { @@ -2430,7 +2725,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) modelIndex = d->visibleIndex; } - int to = d->buffer+d->position()+d->size()-1; + qreal tempPos = d->isRightToLeftTopToBottom() ? -d->position()-d->size() : d->position(); + int to = d->buffer+tempPos+d->size()-1; int colPos = 0; int rowPos = 0; if (d->visibleItems.count()) { @@ -2756,7 +3052,10 @@ void QDeclarativeGridView::animStopped() void QDeclarativeGridView::refill() { Q_D(QDeclarativeGridView); - d->refill(d->position(), d->position()+d->size()-1); + if (d->isRightToLeftTopToBottom()) + d->refill(-d->position()-d->size()+1, -d->position()); + else + d->refill(d->position(), d->position()+d->size()-1); } diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 248b9ef..fc9e6b4 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -69,11 +69,12 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) - Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) - Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) + Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged RESET resetPreferredHighlightBegin) + Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd) Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) //Versioning support? Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) @@ -95,6 +96,7 @@ public: ~QDeclarativeGridView(); QVariant model() const; + int modelCount() const; void setModel(const QVariant &); QDeclarativeComponent *delegate() const; @@ -122,9 +124,14 @@ public: qreal preferredHighlightBegin() const; void setPreferredHighlightBegin(qreal); + void resetPreferredHighlightBegin(); qreal preferredHighlightEnd() const; void setPreferredHighlightEnd(qreal); + void resetPreferredHighlightEnd(); + + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection(Qt::LayoutDirection); enum Flow { LeftToRight, TopToBottom }; Flow flow() const; @@ -184,6 +191,7 @@ Q_SIGNALS: void modelChanged(); void delegateChanged(); void flowChanged(); + void layoutDirectionChanged(); void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index a60a4aa..6749657 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -100,13 +100,20 @@ public: } ~FxListItem() {} qreal position() const { - if (section) - return (view->orientation() == QDeclarativeListView::Vertical ? section->y() : section->x()); - else - return (view->orientation() == QDeclarativeListView::Vertical ? item->y() : item->x()); + if (section) { + if (view->orientation() == QDeclarativeListView::Vertical) + return section->y(); + else + return (view->layoutDirection() == Qt::RightToLeft ? -section->width()-section->x() : section->x()); + } else { + return itemPosition(); + } } qreal itemPosition() const { - return (view->orientation() == QDeclarativeListView::Vertical ? item->y() : item->x()); + if (view->orientation() == QDeclarativeListView::Vertical) + return item->y(); + else + return (view->layoutDirection() == Qt::RightToLeft ? -item->width()-item->x() : item->x()); } qreal size() const { if (section) @@ -123,9 +130,13 @@ public: return 0.0; } qreal endPosition() const { - return (view->orientation() == QDeclarativeListView::Vertical - ? item->y() + (item->height() >= 1.0 ? item->height() : 1) - : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1; + if (view->orientation() == QDeclarativeListView::Vertical) { + return item->y() + (item->height() >= 1.0 ? item->height() : 1) - 1; + } else { + return (view->layoutDirection() == Qt::RightToLeft + ? -item->width()-item->x() + (item->width() >= 1.0 ? item->width() : 1) + : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1; + } } void setPosition(qreal pos) { if (view->orientation() == QDeclarativeListView::Vertical) { @@ -135,11 +146,19 @@ public: } item->setY(pos); } else { - if (section) { - section->setX(pos); - pos += section->width(); + if (view->layoutDirection() == Qt::RightToLeft) { + if (section) { + section->setX(-section->width()-pos); + pos += section->width(); + } + item->setX(-item->width()-pos); + } else { + if (section) { + section->setX(pos); + pos += section->width(); + } + item->setX(pos); } - item->setX(pos); } } void setSize(qreal size) { @@ -168,10 +187,11 @@ class QDeclarativeListViewPrivate : public QDeclarativeFlickablePrivate public: QDeclarativeListViewPrivate() - : currentItem(0), orient(QDeclarativeListView::Vertical) + : currentItem(0), orient(QDeclarativeListView::Vertical), layoutDirection(Qt::LeftToRight) , visiblePos(0), visibleIndex(0) , averageSize(100.0), currentIndex(-1), requestedIndex(-1) , itemCount(0), highlightRangeStart(0), highlightRangeEnd(0) + , highlightRangeStartValid(false), highlightRangeEndValid(false) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) , sectionCriteria(0), spacing(0.0) @@ -204,7 +224,7 @@ public: } FxListItem *firstVisibleItem() const { - const qreal pos = position(); + const qreal pos = isRightToLeft() ? -position()-size() : position(); for (int i = 0; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems.at(i); if (item->index != -1 && item->endPosition() > pos) @@ -214,7 +234,7 @@ public: } FxListItem *nextVisibleItem() const { - const qreal pos = position(); + const qreal pos = isRightToLeft() ? -position()-size() : position(); bool foundFirst = false; for (int i = 0; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems.at(i); @@ -228,23 +248,32 @@ public: return 0; } + bool isRightToLeft() const { + return (layoutDirection == Qt::RightToLeft && orient == QDeclarativeListView::Horizontal); + } + qreal position() const { Q_Q(const QDeclarativeListView); return orient == QDeclarativeListView::Vertical ? q->contentY() : q->contentX(); } + void setPosition(qreal pos) { Q_Q(QDeclarativeListView); - if (orient == QDeclarativeListView::Vertical) + if (orient == QDeclarativeListView::Vertical) { q->QDeclarativeFlickable::setContentY(pos); - else - q->QDeclarativeFlickable::setContentX(pos); + } else { + if (layoutDirection == Qt::RightToLeft) + q->QDeclarativeFlickable::setContentX(-pos-size()); + else + q->QDeclarativeFlickable::setContentX(pos); + } } qreal size() const { Q_Q(const QDeclarativeListView); return orient == QDeclarativeListView::Vertical ? q->height() : q->width(); } - qreal startPosition() const { + qreal originPosition() const { qreal pos = 0; if (!visibleItems.isEmpty()) { pos = (*visibleItems.constBegin())->position(); @@ -254,7 +283,7 @@ public: return pos; } - qreal endPosition() const { + qreal lastPosition() const { qreal pos = 0; if (!visibleItems.isEmpty()) { int invisibleCount = visibleItems.count() - visibleIndex; @@ -271,6 +300,14 @@ public: return pos; } + qreal startPosition() const { + return isRightToLeft() ? -lastPosition()-1 : originPosition(); + } + + qreal endPosition() const { + return isRightToLeft() ? -originPosition()-1 : lastPosition(); + } + qreal positionAt(int modelIndex) const { if (FxListItem *item = visibleItem(modelIndex)) return item->position(); @@ -348,7 +385,7 @@ public: } else if (pos > endPos) return endPos + qRound((pos - endPos) / averageSize) * averageSize; } - return qRound((pos - startPosition()) / averageSize) * averageSize + startPosition(); + return qRound((pos - originPosition()) / averageSize) * averageSize + originPosition(); } FxListItem *snapItemAt(qreal pos) { @@ -464,6 +501,7 @@ public: QHash unrequestedItems; FxListItem *currentItem; QDeclarativeListView::Orientation orient; + Qt::LayoutDirection layoutDirection; qreal visiblePos; int visibleIndex; qreal averageSize; @@ -472,6 +510,8 @@ public: int itemCount; qreal highlightRangeStart; qreal highlightRangeEnd; + bool highlightRangeStartValid; + bool highlightRangeEndValid; QDeclarativeComponent *highlightComponent; FxListItem *highlight; FxListItem *trackedItem; @@ -649,7 +689,6 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer) if (visibleItems.at(i)->index != -1) modelIndex = visibleItems.at(i)->index + 1; } - bool changed = false; FxListItem *item = 0; qreal pos = itemEnd + 1; @@ -795,8 +834,12 @@ void QDeclarativeListViewPrivate::updateUnrequestedPositions() if (item->y() + item->height() > pos && item->y() < pos + q->height()) item->setY(positionAt(*it)); } else { - if (item->x() + item->width() > pos && item->x() < pos + q->width()) - item->setX(positionAt(*it)); + if (item->x() + item->width() > pos && item->x() < pos + q->width()) { + if (isRightToLeft()) + item->setX(-positionAt(*it)-item->width()); + else + item->setX(positionAt(*it)); + } } } } @@ -887,7 +930,9 @@ void QDeclarativeListViewPrivate::updateHighlight() createHighlight(); if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) { // auto-update highlight - highlightPosAnimator->to = currentItem->itemPosition(); + highlightPosAnimator->to = isRightToLeft() + ? -currentItem->itemPosition()-currentItem->itemSize() + : currentItem->itemPosition(); highlightSizeAnimator->to = currentItem->itemSize(); if (orient == QDeclarativeListView::Vertical) { if (highlight->item->width() == 0) @@ -1104,7 +1149,7 @@ void QDeclarativeListViewPrivate::updateFooter() } if (footer) { if (visibleItems.count()) { - qreal endPos = endPosition() + 1; + qreal endPos = lastPosition() + 1; if (lastVisibleIndex() == model->count()-1) { footer->setPosition(endPos); } else { @@ -1144,7 +1189,7 @@ void QDeclarativeListViewPrivate::updateHeader() } if (header) { if (visibleItems.count()) { - qreal startPos = startPosition(); + qreal startPos = originPosition(); if (visibleIndex == 0) { header->setPosition(startPos - header->size()); } else { @@ -1180,14 +1225,30 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; - if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) { + qreal highlightStart; + qreal highlightEnd; + qreal viewPos; + if (isRightToLeft()) { + // Handle Right-To-Left exceptions + viewPos = -position()-size(); + highlightStart = highlightRangeStartValid ? size() - highlightRangeEnd : highlightRangeStart; + highlightEnd = highlightRangeEndValid ? size() - highlightRangeStart : highlightRangeEnd; + } else { + viewPos = position(); + highlightStart = highlightRangeStart; + highlightEnd = highlightRangeEnd; + } + + if (currentItem && haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange + && moveReason != QDeclarativeListViewPrivate::SetIndex) { updateHighlight(); qreal pos = currentItem->itemPosition(); - qreal viewPos = position(); - if (viewPos < pos + currentItem->itemSize() - highlightRangeEnd) - viewPos = pos + currentItem->itemSize() - highlightRangeEnd; - if (viewPos > pos - highlightRangeStart) - viewPos = pos - highlightRangeStart; + if (viewPos < pos + currentItem->itemSize() - highlightEnd) + viewPos = pos + currentItem->itemSize() - highlightEnd; + if (viewPos > pos - highlightStart) + viewPos = pos - highlightStart; + if (isRightToLeft()) + viewPos = -viewPos-size(); timeline.reset(data.move); if (viewPos != position()) { @@ -1197,17 +1258,26 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m timeline.set(data.move, -viewPos); } vTime = timeline.time(); - } else if (snapMode != QDeclarativeListView::NoSnap) { - FxListItem *topItem = snapItemAt(position()+highlightRangeStart); - FxListItem *bottomItem = snapItemAt(position()+highlightRangeEnd); + } else if (snapMode != QDeclarativeListView::NoSnap && moveReason != QDeclarativeListViewPrivate::SetIndex) { + qreal tempPosition = isRightToLeft() ? -position()-size() : position(); + FxListItem *topItem = snapItemAt(tempPosition+highlightStart); + FxListItem *bottomItem = snapItemAt(tempPosition+highlightEnd); qreal pos; - if (topItem) { - if (topItem->index == 0 && header && position()+highlightRangeStart < header->position()+header->size()/2) - pos = header->position() - highlightRangeStart; + bool isInBounds = -position() > maxExtent && -position() < minExtent; + if (topItem && isInBounds) { + if (topItem->index == 0 && header && tempPosition+highlightStart < header->position()+header->size()/2) { + pos = isRightToLeft() ? - header->position() + highlightStart - size() : header->position() - highlightStart; + } else { + if (isRightToLeft()) + pos = qMax(qMin(-topItem->position() + highlightStart - size(), -maxExtent), -minExtent); + else + pos = qMax(qMin(topItem->position() - highlightStart, -maxExtent), -minExtent); + } + } else if (bottomItem && isInBounds) { + if (isRightToLeft()) + pos = qMax(qMin(-bottomItem->position() + highlightStart - size(), -maxExtent), -minExtent); else - pos = qMax(qMin(topItem->position() - highlightRangeStart, -maxExtent), -minExtent); - } else if (bottomItem) { - pos = qMax(qMin(bottomItem->position() - highlightRangeStart, -maxExtent), -minExtent); + pos = qMax(qMin(bottomItem->position() - highlightStart, -maxExtent), -minExtent); } else { QDeclarativeFlickablePrivate::fixup(data, minExtent, maxExtent); fixupDuration = oldDuration; @@ -1241,12 +1311,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m return; } qreal maxDistance = 0; + qreal dataValue = isRightToLeft() ? -data.move.value()+size() : data.move.value(); // -ve velocity means list is moving up/left if (velocity > 0) { if (data.move.value() < minExtent) { if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = firstVisibleItem()) - maxDistance = qAbs(item->position() + data.move.value()); + if (FxListItem *item = isRightToLeft() ? nextVisibleItem() : firstVisibleItem()) { + maxDistance = qAbs(item->position() + dataValue); +// qDebug() << "maxDist" << maxDistance << item->position() << dataValue; + } } else { maxDistance = qAbs(minExtent - data.move.value()); } @@ -1256,8 +1329,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } else { if (data.move.value() > maxExtent) { if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = nextVisibleItem()) - maxDistance = qAbs(item->position() + data.move.value()); + if (FxListItem *item = isRightToLeft() ? firstVisibleItem() : nextVisibleItem()) { + maxDistance = qAbs(item->position() + dataValue); +// qDebug() << "maxDist2" << maxDistance << item->position() << dataValue; + } } else { maxDistance = qAbs(maxExtent - data.move.value()); } @@ -1265,7 +1340,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (snapMode == QDeclarativeListView::NoSnap && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = maxExtent; } + bool overShoot = boundsBehavior == QDeclarativeFlickable::DragAndOvershootBounds; + qreal highlightStart = isRightToLeft() && highlightRangeStartValid ? size()-highlightRangeEnd : highlightRangeStart; + if (maxDistance > 0 || overShoot) { // These modes require the list to stop exactly on an item boundary. // The initial flick will estimate the boundary to stop on. @@ -1290,7 +1368,9 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (v > 0) dist = -dist; if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { - data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart; + qreal distTemp = isRightToLeft() ? -dist : dist; + data.flickTarget = -snapPosAt(-(dataValue - highlightStart) + distTemp) + highlightStart; + data.flickTarget = isRightToLeft() ? -data.flickTarget+size() : data.flickTarget; if (overShoot) { if (data.flickTarget >= minExtent) { overshootDist = overShootDistance(v, vSize); @@ -1323,6 +1403,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m data.flickTarget -= overshootDist; } } + timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); @@ -1342,8 +1423,11 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } else { // reevaluate the target boundary. qreal newtarget = data.flickTarget; - if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange) - newtarget = -snapPosAt(-(data.flickTarget - highlightRangeStart)) + highlightRangeStart; + if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange) { + qreal tempFlickTarget = isRightToLeft() ? -data.flickTarget+size() : data.flickTarget; + newtarget = -snapPosAt(-(tempFlickTarget - highlightStart)) + highlightStart; + newtarget = isRightToLeft() ? -newtarget+size() : newtarget; + } if (velocity < 0 && newtarget <= maxExtent) newtarget = maxExtent - overshootDist; else if (velocity > 0 && newtarget >= minExtent) @@ -1361,6 +1445,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m fixup(data, minExtent, maxExtent); return; } + timeline.reset(data.move); timeline.accelDistance(data.move, v, -dist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); @@ -1859,6 +1944,7 @@ qreal QDeclarativeListView::preferredHighlightBegin() const void QDeclarativeListView::setPreferredHighlightBegin(qreal start) { Q_D(QDeclarativeListView); + d->highlightRangeStartValid = true; if (d->highlightRangeStart == start) return; d->highlightRangeStart = start; @@ -1866,6 +1952,16 @@ void QDeclarativeListView::setPreferredHighlightBegin(qreal start) emit preferredHighlightBeginChanged(); } +void QDeclarativeListView::resetPreferredHighlightBegin() +{ + Q_D(QDeclarativeListView); + d->highlightRangeStartValid = false; + if (d->highlightRangeStart == 0) + return; + d->highlightRangeStart = 0; + emit preferredHighlightBeginChanged(); +} + qreal QDeclarativeListView::preferredHighlightEnd() const { Q_D(const QDeclarativeListView); @@ -1875,6 +1971,7 @@ qreal QDeclarativeListView::preferredHighlightEnd() const void QDeclarativeListView::setPreferredHighlightEnd(qreal end) { Q_D(QDeclarativeListView); + d->highlightRangeEndValid = true; if (d->highlightRangeEnd == end) return; d->highlightRangeEnd = end; @@ -1882,6 +1979,16 @@ void QDeclarativeListView::setPreferredHighlightEnd(qreal end) emit preferredHighlightEndChanged(); } +void QDeclarativeListView::resetPreferredHighlightEnd() +{ + Q_D(QDeclarativeListView); + d->highlightRangeEndValid = false; + if (d->highlightRangeEnd == 0) + return; + d->highlightRangeEnd = 0; + emit preferredHighlightEndChanged(); +} + QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMode() const { Q_D(const QDeclarativeListView); @@ -1968,6 +2075,25 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie } } +Qt::LayoutDirection QDeclarativeListView::layoutDirection() const +{ + Q_D(const QDeclarativeListView); + return d->layoutDirection; +} + +void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + Q_D(QDeclarativeListView); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; + d->clear(); + d->setPosition(0); + refill(); + emit layoutDirectionChanged(); + d->updateCurrent(d->currentIndex); + } +} + /*! \qmlproperty bool ListView::keyNavigationWraps This property holds whether the list wraps key navigation. @@ -2339,11 +2465,23 @@ void QDeclarativeListView::viewportMoved() if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) { // reposition highlight qreal pos = d->highlight->position(); - qreal viewPos = d->position(); - if (pos > viewPos + d->highlightRangeEnd - d->highlight->size()) - pos = viewPos + d->highlightRangeEnd - d->highlight->size(); - if (pos < viewPos + d->highlightRangeStart) - pos = viewPos + d->highlightRangeStart; + qreal viewPos; + qreal highlightStart; + qreal highlightEnd; + if (d->isRightToLeft()) { + // Handle Right-To-Left exceptions + viewPos = -d->position()-d->size(); + highlightStart = d->highlightRangeStartValid ? d->size()-d->highlightRangeEnd : d->highlightRangeStart; + highlightEnd = d->highlightRangeEndValid ? d->size()-d->highlightRangeStart : d->highlightRangeEnd; + } else { + viewPos = d->position(); + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + } + if (pos > viewPos + highlightEnd - d->highlight->size()) + pos = viewPos + highlightEnd - d->highlight->size(); + if (pos < viewPos + highlightStart) + pos = viewPos + highlightStart; d->highlightPosAnimator->stop(); d->highlight->setPosition(qRound(pos)); @@ -2381,13 +2519,15 @@ void QDeclarativeListView::viewportMoved() if ((minX - d->hData.move.value() < width()/2 || d->hData.flickTarget - d->hData.move.value() < width()/2) && minX != d->hData.flickTarget) d->flickX(-d->hData.smoothVelocity.value()); - d->bufferMode = QDeclarativeListViewPrivate::BufferBefore; + d->bufferMode = d->isRightToLeft() + ? QDeclarativeListViewPrivate::BufferAfter : QDeclarativeListViewPrivate::BufferBefore; } else if (d->hData.velocity < 0) { const qreal maxX = maxXExtent(); if ((d->hData.move.value() - maxX < width()/2 || d->hData.move.value() - d->hData.flickTarget < width()/2) && maxX != d->hData.flickTarget) d->flickX(-d->hData.smoothVelocity.value()); - d->bufferMode = QDeclarativeListViewPrivate::BufferAfter; + d->bufferMode = d->isRightToLeft() + ? QDeclarativeListViewPrivate::BufferBefore : QDeclarativeListViewPrivate::BufferAfter; } } d->inFlickCorrection = false; @@ -2450,11 +2590,28 @@ qreal QDeclarativeListView::minXExtent() const return QDeclarativeFlickable::minXExtent(); if (d->minExtentDirty) { d->minExtent = -d->startPosition(); - if (d->header) - d->minExtent += d->header->size(); + + qreal highlightStart; + qreal highlightEnd; + qreal endPositionFirstItem; + if (d->isRightToLeft()) { + endPositionFirstItem = d->positionAt(d->model->count()-1); + highlightStart = d->highlightRangeStartValid + ? d->highlightRangeStart - (d->lastPosition()-endPositionFirstItem) + : d->size() - (d->lastPosition()-endPositionFirstItem); + highlightEnd = d->highlightRangeEndValid ? d->highlightRangeEnd : d->size(); + if (d->footer) + d->minExtent += d->footer->size(); + } else { + endPositionFirstItem = d->endPositionAt(0); + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + if (d->header) + d->minExtent += d->header->size(); + } if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { - d->minExtent += d->highlightRangeStart; - d->minExtent = qMax(d->minExtent, -(d->endPositionAt(0) - d->highlightRangeEnd + 1)); + d->minExtent += highlightStart; + d->minExtent = qMax(d->minExtent, -(endPositionFirstItem - highlightEnd + 1)); } d->minExtentDirty = false; } @@ -2468,23 +2625,42 @@ qreal QDeclarativeListView::maxXExtent() const if (d->orient == QDeclarativeListView::Vertical) return width(); if (d->maxExtentDirty) { + qreal highlightStart; + qreal highlightEnd; + qreal lastItemPosition; + if (d->isRightToLeft()) { + highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size(); + highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size(); + lastItemPosition = d->endPosition(); + } else { + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + lastItemPosition = d->positionAt(d->model->count()-1); + } if (!d->model || !d->model->count()) { d->maxExtent = 0; } else if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { - d->maxExtent = -(d->positionAt(d->model->count()-1) - d->highlightRangeStart); - if (d->highlightRangeEnd != d->highlightRangeStart) - d->maxExtent = qMin(d->maxExtent, -(d->endPosition() - d->highlightRangeEnd + 1)); + d->maxExtent = -(lastItemPosition - highlightStart); + if (highlightEnd != highlightStart) { + d->maxExtent = d->isRightToLeft() + ? qMax(d->maxExtent, -(d->endPosition() - highlightEnd + 1)) + : qMin(d->maxExtent, -(d->endPosition() - highlightEnd + 1)); + } } else { d->maxExtent = -(d->endPosition() - width() + 1); } - if (d->footer) - d->maxExtent -= d->footer->size(); + if (d->isRightToLeft()) { + if (d->header) + d->maxExtent -= d->header->size(); + } else { + if (d->footer) + d->maxExtent -= d->footer->size(); + } qreal minX = minXExtent(); if (d->maxExtent > minX) d->maxExtent = minX; d->maxExtentDirty = false; } - return d->maxExtent; } @@ -2496,7 +2672,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) return; if (d->model && d->model->count() && d->interactive) { - if ((d->orient == QDeclarativeListView::Horizontal && event->key() == Qt::Key_Left) + if ((d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::LeftToRight && event->key() == Qt::Key_Left) + || (d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::RightToLeft && event->key() == Qt::Key_Right) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) { decrementCurrentIndex(); @@ -2506,7 +2683,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) event->accept(); return; } - } else if ((d->orient == QDeclarativeListView::Horizontal && event->key() == Qt::Key_Right) + } else if ((d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::LeftToRight && event->key() == Qt::Key_Right) + || (d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::RightToLeft && event->key() == Qt::Key_Left) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) { incrementCurrentIndex(); @@ -2583,9 +2761,14 @@ void QDeclarativeListViewPrivate::positionViewAtIndex(int index, int mode) if (layoutScheduled) layout(); - qreal pos = position(); + qreal pos = isRightToLeft() ? -position() - size() : position(); FxListItem *item = visibleItem(idx); - qreal maxExtent = orient == QDeclarativeListView::Vertical ? -q->maxYExtent() : -q->maxXExtent(); + qreal maxExtent; + if (orient == QDeclarativeListView::Vertical) + maxExtent = -q->maxYExtent(); + else + maxExtent = isRightToLeft() ? q->minXExtent()-size(): -q->maxXExtent(); + if (!item) { int itemPos = positionAt(idx); // save the currently visible items in case any of them end up visible again @@ -2628,7 +2811,12 @@ void QDeclarativeListViewPrivate::positionViewAtIndex(int index, int mode) pos = itemPos; } pos = qMin(pos, maxExtent); - qreal minExtent = orient == QDeclarativeListView::Vertical ? -q->minYExtent() : -q->minXExtent(); + qreal minExtent; + if (orient == QDeclarativeListView::Vertical) { + minExtent = -q->minYExtent(); + } else { + minExtent = isRightToLeft() ? q->maxXExtent()-size(): -q->minXExtent(); + } pos = qMax(pos, minExtent); moveReason = QDeclarativeListViewPrivate::Other; q->cancelFlick(); @@ -2783,7 +2971,10 @@ void QDeclarativeListView::updateSections() void QDeclarativeListView::refill() { Q_D(QDeclarativeListView); - d->refill(d->position(), d->position()+d->size()-1); + if (layoutDirection() == Qt::RightToLeft && orientation() == QDeclarativeListView::Horizontal) + d->refill(-d->position()-d->size()+1, -d->position()); + else + d->refill(d->position(), d->position()+d->size()-1); } void QDeclarativeListView::trackedPositionChanged() @@ -2798,26 +2989,37 @@ void QDeclarativeListView::trackedPositionChanged() trackedPos -= d->currentItem->sectionSize(); trackedSize += d->currentItem->sectionSize(); } - const qreal viewPos = d->position(); + qreal viewPos; + qreal highlightStart; + qreal highlightEnd; + if (d->isRightToLeft()) { + viewPos = -d->position()-d->size(); + highlightStart = d->highlightRangeStartValid ? d->size()-d->highlightRangeEnd : d->highlightRangeStart; + highlightEnd = d->highlightRangeEndValid ? d->size()-d->highlightRangeStart : d->highlightRangeEnd; + } else { + viewPos = d->position(); + highlightStart = d->highlightRangeStart; + highlightEnd = d->highlightRangeEnd; + } qreal pos = viewPos; if (d->haveHighlightRange) { if (d->highlightRange == StrictlyEnforceRange) { - if (trackedPos > pos + d->highlightRangeEnd - d->trackedItem->size()) - pos = trackedPos - d->highlightRangeEnd + d->trackedItem->size(); - if (trackedPos < pos + d->highlightRangeStart) - pos = trackedPos - d->highlightRangeStart; + if (trackedPos > pos + highlightEnd - d->trackedItem->size()) + pos = trackedPos - highlightEnd + d->trackedItem->size(); + if (trackedPos < pos + highlightStart) + pos = trackedPos - highlightStart; } else { - if (trackedPos < d->startPosition() + d->highlightRangeStart) { + if (trackedPos < d->startPosition() + highlightStart) { pos = d->startPosition(); - } else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + d->highlightRangeEnd) { + } else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + highlightEnd) { pos = d->endPosition() - d->size() + 1; if (pos < d->startPosition()) pos = d->startPosition(); } else { - if (trackedPos < viewPos + d->highlightRangeStart) { - pos = trackedPos - d->highlightRangeStart; - } else if (trackedPos > viewPos + d->highlightRangeEnd - trackedSize) { - pos = trackedPos - d->highlightRangeEnd + trackedSize; + if (trackedPos < viewPos + highlightStart) { + pos = trackedPos - highlightStart; + } else if (trackedPos > viewPos + highlightEnd - trackedSize) { + pos = trackedPos - highlightEnd + trackedSize; } } } @@ -2854,6 +3056,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) d->updateUnrequestedIndexes(); d->moveReason = QDeclarativeListViewPrivate::Other; + qreal tempPos = d->isRightToLeft() ? -d->position()-d->size() : d->position(); int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0; if (index < 0) { int i = d->visibleItems.count() - 1; @@ -2863,7 +3066,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) // there are no visible items except items marked for removal index = d->visibleItems.count(); } else if (d->visibleItems.at(i)->index + 1 == modelIndex - && d->visibleItems.at(i)->endPosition() < d->buffer+d->position()+d->size()-1) { + && d->visibleItems.at(i)->endPosition() < d->buffer+tempPos+d->size()-1) { // Special case of appending an item to the model. index = d->visibleItems.count(); } else { @@ -2908,7 +3111,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) // Insert items before the visible item. int insertionIdx = index; int i = 0; - int from = d->position() - d->buffer; + int from = tempPos - d->buffer; for (i = count-1; i >= 0 && pos > from; --i) { if (!addedVisible) { d->scheduleLayout(); @@ -2938,7 +3141,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) } } else { int i = 0; - int to = d->buffer+d->position()+d->size()-1; + int to = d->buffer+tempPos+d->size()-1; for (i = 0; i < count && pos <= to; ++i) { if (!addedVisible) { d->scheduleLayout(); @@ -3233,10 +3436,14 @@ void QDeclarativeListView::createdItem(int index, QDeclarativeItem *item) if (d->requestedIndex != index) { item->setParentItem(contentItem()); d->unrequestedItems.insert(item, index); - if (d->orient == QDeclarativeListView::Vertical) + if (d->orient == QDeclarativeListView::Vertical) { item->setY(d->positionAt(index)); - else - item->setX(d->positionAt(index)); + } else { + if (d->isRightToLeft()) + item->setX(-d->positionAt(index)-item->width()); + else + item->setX(d->positionAt(index)); + } } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 10fbf10..6b72240 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -107,12 +107,13 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) Q_PROPERTY(int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged) - Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) - Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) + Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged RESET resetPreferredHighlightBegin) + Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged RESET resetPreferredHighlightEnd) Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) @@ -158,9 +159,11 @@ public: qreal preferredHighlightBegin() const; void setPreferredHighlightBegin(qreal); + void resetPreferredHighlightBegin(); qreal preferredHighlightEnd() const; void setPreferredHighlightEnd(qreal); + void resetPreferredHighlightEnd(); qreal spacing() const; void setSpacing(qreal spacing); @@ -169,6 +172,9 @@ public: Orientation orientation() const; void setOrientation(Orientation); + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection(Qt::LayoutDirection); + bool isWrapEnabled() const; void setWrapEnabled(bool); @@ -220,6 +226,7 @@ Q_SIGNALS: void countChanged(); void spacingChanged(); void orientationChanged(); + void layoutDirectionChanged(); void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml index 5719f43..164103d 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml @@ -48,6 +48,8 @@ Rectangle { model: testModel delegate: myDelegate highlight: myHighlight + flow: (testTopToBottom == true) ? GridView.TopToBottom : GridView.LeftToRight + layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight preferredHighlightBegin: 100 preferredHighlightEnd: 100 highlightRangeMode: "StrictlyEnforceRange" diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index e4e699c..1f5943d 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -55,7 +55,8 @@ Rectangle { height: 320 cellWidth: 80 cellHeight: 60 - flow: (testTopToBottom == false) ? "LeftToRight" : "TopToBottom" + flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom + layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight model: testModel delegate: myDelegate header: root.showHeader ? headerFooter : null diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 79189a7..188fd6e 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -78,9 +78,11 @@ private slots: void componentChanges(); void modelChanges(); void positionViewAtIndex(); + void positionViewAtIndex_rightToLeft(); void snapping(); void resetModel(); void enforceRange(); + void enforceRange_rightToLeft(); void QTBUG_8456(); void manualHighlight(); void footer(); @@ -203,6 +205,7 @@ void tst_QDeclarativeGridView::items() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -251,6 +254,7 @@ void tst_QDeclarativeGridView::changed() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -284,6 +288,7 @@ void tst_QDeclarativeGridView::inserted() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -360,6 +365,7 @@ void tst_QDeclarativeGridView::removed() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -503,6 +509,7 @@ void tst_QDeclarativeGridView::moved() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -726,6 +733,58 @@ void tst_QDeclarativeGridView::currentIndex() QVERIFY(!gridview->highlightItem()); QVERIFY(!gridview->currentItem()); + gridview->setHighlightFollowsCurrentItem(true); + + gridview->setFlow(QDeclarativeGridView::LeftToRight); + gridview->setLayoutDirection(Qt::RightToLeft); + + qApp->setActiveWindow(canvas); +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(canvas); +#endif + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); + qApp->processEvents(); + + gridview->setCurrentIndex(35); + + QTest::keyClick(canvas, Qt::Key_Right); + QCOMPARE(gridview->currentIndex(), 34); + + QTest::keyClick(canvas, Qt::Key_Down); + QCOMPARE(gridview->currentIndex(), 37); + + QTest::keyClick(canvas, Qt::Key_Up); + QCOMPARE(gridview->currentIndex(), 34); + + QTest::keyClick(canvas, Qt::Key_Left); + QCOMPARE(gridview->currentIndex(), 35); + + + // turn off auto highlight + gridview->setHighlightFollowsCurrentItem(false); + QVERIFY(gridview->highlightFollowsCurrentItem() == false); + QVERIFY(gridview->highlightItem()); + hlPosX = gridview->highlightItem()->x(); + hlPosY = gridview->highlightItem()->y(); + + gridview->setCurrentIndex(5); + QTRY_COMPARE(gridview->highlightItem()->x(), hlPosX); + QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY); + + // insert item before currentIndex + gridview->setCurrentIndex(28); + model.insertItem(0, "Foo", "1111"); + QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); + + // check removing highlight by setting currentIndex to -1; + gridview->setCurrentIndex(-1); + + QCOMPARE(gridview->currentIndex(), -1); + QVERIFY(!gridview->highlightItem()); + QVERIFY(!gridview->currentItem()); + delete canvas; } @@ -774,6 +833,7 @@ void tst_QDeclarativeGridView::changeFlow() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -819,6 +879,44 @@ void tst_QDeclarativeGridView::changeFlow() QTRY_COMPARE(number->text(), model.number(i)); } + ctxt->setContextProperty("testRightToLeft", QVariant(true)); + + // Confirm items positioned correctly and indexes correct + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80 - item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + QDeclarativeText *name = findItem(contentItem, "textName", i); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem(contentItem, "textNumber", i); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); + } + gridview->setContentX(100); + QTRY_COMPARE(gridview->contentX(), 100.); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + QTRY_COMPARE(gridview->contentX(), 0.); + + // Confirm items positioned correctly and indexes correct + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(240 - (i%3+1)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); + QDeclarativeText *name = findItem(contentItem, "textName", i); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem(contentItem, "textNumber", i); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); + } + delete canvas; } @@ -879,6 +977,7 @@ void tst_QDeclarativeGridView::propertyChanges() QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged())); QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged())); + QSignalSpy layoutSpy(gridView, SIGNAL(layoutDirectionChanged())); QSignalSpy flowSpy(gridView, SIGNAL(flowChanged())); QTRY_COMPARE(gridView->isWrapEnabled(), true); @@ -905,6 +1004,38 @@ void tst_QDeclarativeGridView::propertyChanges() QTRY_COMPARE(cacheBufferSpy.count(),1); QTRY_COMPARE(flowSpy.count(),1); + gridView->setFlow(QDeclarativeGridView::LeftToRight); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); + + gridView->setWrapEnabled(true); + gridView->setCacheBuffer(5); + gridView->setLayoutDirection(Qt::RightToLeft); + + QTRY_COMPARE(gridView->isWrapEnabled(), true); + QTRY_COMPARE(gridView->cacheBuffer(), 5); + QTRY_COMPARE(gridView->layoutDirection(), Qt::RightToLeft); + + QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); + QTRY_COMPARE(cacheBufferSpy.count(),2); + QTRY_COMPARE(layoutSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),2); + + gridView->setWrapEnabled(true); + gridView->setCacheBuffer(5); + gridView->setLayoutDirection(Qt::RightToLeft); + + QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); + QTRY_COMPARE(cacheBufferSpy.count(),2); + QTRY_COMPARE(layoutSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),2); + + gridView->setFlow(QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(flowSpy.count(),3); + + gridView->setFlow(QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(flowSpy.count(),3); + delete canvas; } @@ -992,6 +1123,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); @@ -1213,6 +1345,138 @@ void tst_QDeclarativeGridView::snapping() delete canvas; } +void tst_QDeclarativeGridView::positionViewAtIndex_rightToLeft() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(true)); + ctxt->setContextProperty("testRightToLeft", QVariant(true)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + } + + // Position on a currently visible item + gridview->positionViewAtIndex(6, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->contentX(), -320.); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + } + + // Position on an item beyond the visible items + gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->contentX(), -560.); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + } + + // Position on an item that would leave empty space if positioned at the top + gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->contentX(), -639.); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + } + + // Position at the beginning again + gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->contentX(), -240.); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal(-(i/5)*80-item->width())); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); + } + + // Position at End + gridview->positionViewAtIndex(30, QDeclarativeGridView::End); + QTRY_COMPARE(gridview->contentX(), -560.); + + // Position in Center + gridview->positionViewAtIndex(15, QDeclarativeGridView::Center); + QTRY_COMPARE(gridview->contentX(), -400.); + + // Ensure at least partially visible + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), -400.); + + gridview->setContentX(-555.); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), -555.); + + gridview->setContentX(-239); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), -320.); + + gridview->setContentX(-239); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), -400.); + + gridview->setContentX(-640); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), -560.); + + // Ensure completely visible + gridview->setContentX(-400); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); + QTRY_COMPARE(gridview->contentX(), -400.); + + gridview->setContentX(-315); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Contain); + QTRY_COMPARE(gridview->contentX(), -320.); + + gridview->setContentX(-640); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); + QTRY_COMPARE(gridview->contentX(), -560.); + + delete canvas; +} + void tst_QDeclarativeGridView::resetModel() { QDeclarativeView *canvas = createView(); @@ -1264,6 +1528,8 @@ void tst_QDeclarativeGridView::enforceRange() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); qApp->processEvents(); @@ -1307,6 +1573,63 @@ void tst_QDeclarativeGridView::enforceRange() delete canvas; } +void tst_QDeclarativeGridView::enforceRange_rightToLeft() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(true)); + ctxt->setContextProperty("testTopToBottom", QVariant(true)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0); + QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0); + QTRY_COMPARE(gridview->highlightRangeMode(), QDeclarativeGridView::StrictlyEnforceRange); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // view should be positioned at the top of the range. + QDeclarativeItem *item = findItem(contentItem, "wrapper", 0); + QTRY_VERIFY(item); + QTRY_COMPARE(gridview->contentX(), -100.); + QTRY_COMPARE(gridview->contentY(), 0.0); + + QDeclarativeText *name = findItem(contentItem, "textName", 0); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); + QDeclarativeText *number = findItem(contentItem, "textNumber", 0); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); + + // Check currentIndex is updated when contentItem moves + gridview->setContentX(-200); + QTRY_COMPARE(gridview->currentIndex(), 3); + + gridview->setCurrentIndex(7); + QTRY_COMPARE(gridview->contentX(), -300.); + QTRY_COMPARE(gridview->contentY(), 0.0); + + TestModel model2; + for (int i = 0; i < 5; i++) + model2.addItem("Item" + QString::number(i), ""); + + ctxt->setContextProperty("testModel", &model2); + QCOMPARE(gridview->count(), 5); + + delete canvas; +} + void tst_QDeclarativeGridView::QTBUG_8456() { QDeclarativeView *canvas = createView(); @@ -1475,6 +1798,7 @@ void tst_QDeclarativeGridView::indexAt() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index f358625..26219fe 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -115,6 +115,7 @@ private slots: void onRemove_data(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); + void rightToLeft(); private: template void items(); @@ -2299,6 +2300,47 @@ void tst_QDeclarativeListView::testQtQuick11Attributes_data() << ""; } +void tst_QDeclarativeListView::rightToLeft() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "view"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeVisualItemModel *model = canvas->rootObject()->findChild("itemModel"); + QTRY_VERIFY(model != 0); + + QTRY_VERIFY(model->count() == 3); + QTRY_COMPARE(listview->currentIndex(), 0); + + QDeclarativeItem *item = findItem(contentItem, "item1"); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), -100.0); + QCOMPARE(item->height(), listview->height()); + + QDeclarativeText *text = findItem(contentItem, "text1"); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 0")); + + listview->setCurrentIndex(2); + + item = findItem(contentItem, "item3"); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), -600.0); + + text = findItem(contentItem, "text3"); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 2")); + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From b5076fb392894e71b44b4762d0567354ef1c8a9e Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Wed, 16 Feb 2011 14:58:28 +1000 Subject: Add a "note well" to QVectorXD re float precision. Several bug-reports ask for clarifications/warnings in the doc for this class, since it stores in float, but has a qreal interface (as per qt convention). Change-Id: I32ffcde3733866942134e881567eef367a5620f5 Task-number: QTBUG-8216 Reviewed-by: Rhys Weatherley --- src/gui/math3d/qvector2d.cpp | 5 +++++ src/gui/math3d/qvector3d.cpp | 5 +++++ src/gui/math3d/qvector4d.cpp | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index 7f5a937..1fccfc9 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -60,6 +60,11 @@ QT_BEGIN_NAMESPACE The QVector2D class can also be used to represent vertices in 2D space. We therefore do not need to provide a separate vertex class. + \bold{Note:} By design values in the QVector2D instance are stored as \c float. + This means that on platforms where the \c qreal arguments to QVector2D + functions are represented by \c double values, it is possible to + lose precision. + \sa QVector3D, QVector4D, QQuaternion */ diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 2414b5f..7bf0400 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -63,6 +63,11 @@ QT_BEGIN_NAMESPACE The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class. + \bold{Note:} By design values in the QVector3D instance are stored as \c float. + This means that on platforms where the \c qreal arguments to QVector3D + functions are represented by \c double values, it is possible to + lose precision. + \sa QVector2D, QVector4D, QQuaternion */ diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index 74dedc4..23befc0 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -59,6 +59,11 @@ QT_BEGIN_NAMESPACE The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class. + \bold{Note:} By design values in the QVector4D instance are stored as \c float. + This means that on platforms where the \c qreal arguments to QVector4D + functions are represented by \c double values, it is possible to + lose precision. + \sa QQuaternion, QVector2D, QVector3D */ -- cgit v0.12 From 4e75cb56f37ac2ff22fbc562c85daeb8599753a9 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Wed, 16 Feb 2011 11:48:02 +1000 Subject: GridView and ListView bug fixes ListView and GridView check before accessing an empty model. Fixed issue with undefined header. Current index initialised properly when dynamically creating ListModel items with javascript. Change-Id: I121c0626db6eb7ccaab689dfc750e0d03773d90f Task-number: QTBUG-15877 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativegridview.cpp | 57 +++++++++++----------- .../graphicsitems/qdeclarativelistview.cpp | 16 +++--- .../tst_qdeclarativegridview.cpp | 2 + .../tst_qdeclarativelistview.cpp | 2 +- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 39fa8e8..2eeadf4 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -73,22 +73,22 @@ public: if (view->flow() == QDeclarativeGridView::LeftToRight) { rowPos = item->y(); } else { - if (view->layoutDirection() == Qt::LeftToRight) - rowPos = item->x(); - else + if (view->layoutDirection() == Qt::RightToLeft) rowPos = -view->cellWidth()-item->x(); + else + rowPos = item->x(); } return rowPos; } qreal colPos() const { qreal colPos = 0; if (view->flow() == QDeclarativeGridView::LeftToRight) { - if (view->layoutDirection() == Qt::LeftToRight) { - colPos = item->x(); - } else { + if (view->layoutDirection() == Qt::RightToLeft) { int colSize = view->cellWidth(); int columns = view->width()/colSize; colPos = colSize * (columns-1) - item->x(); + } else { + colPos = item->x(); } } else { colPos = item->y(); @@ -101,25 +101,25 @@ public: if (view->flow() == QDeclarativeGridView::LeftToRight) { return item->y() + view->cellHeight() - 1; } else { - if (view->layoutDirection() == Qt::LeftToRight) - return item->x() + view->cellWidth() - 1; - else + if (view->layoutDirection() == Qt::RightToLeft) return -item->x() - 1; + else + return item->x() + view->cellWidth() - 1; } } void setPosition(qreal col, qreal row) { - if (view->layoutDirection() == Qt::LeftToRight) { - if (view->flow() == QDeclarativeGridView::LeftToRight) - item->setPos(QPointF(col, row)); - else - item->setPos(QPointF(row, col)); - } else { + if (view->layoutDirection() == Qt::RightToLeft) { if (view->flow() == QDeclarativeGridView::LeftToRight) { int columns = view->width()/view->cellWidth(); item->setPos(QPointF((view->cellWidth() * (columns-1) - col), row)); } else { item->setPos(QPointF(-view->cellWidth()-row, col)); } + } else { + if (view->flow() == QDeclarativeGridView::LeftToRight) + item->setPos(QPointF(col, row)); + else + item->setPos(QPointF(row, col)); } } @@ -697,7 +697,7 @@ void QDeclarativeGridViewPrivate::layout() qreal rowPos = visibleItems.first()->rowPos(); qreal colPos = visibleItems.first()->colPos(); int col = visibleIndex % columns; - if (colPos != col * colSize() || isRightToLeftTopToBottom()) { + if (colPos != col * colSize()) { colPos = col * colSize(); visibleItems.first()->setPosition(colPos, rowPos); } @@ -747,7 +747,7 @@ void QDeclarativeGridViewPrivate::updateUnrequestedPositions() if (isRightToLeftTopToBottom()) item->setPos(QPointF(-rowPosAt(*it)-item->width(), colPosAt(*it))); else - item->setPos(QPointF(rowPosAt(*it), (columns-1)*colSize()-colPosAt(*it))); + item->setPos(QPointF(rowPosAt(*it), colPosAt(*it))); } } } @@ -1032,7 +1032,9 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m qreal bottomPos = qMax(bottomItem->rowPos() - highlightEnd, -minExtent); pos = qAbs(data.move + topPos) < qAbs(data.move + bottomPos) ? topPos : bottomPos; } else if (topItem) { - qreal headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos(); + qreal headerPos = 0; + if (header) + headerPos = isRightToLeftTopToBottom() ? header->rowPos() + cellWidth - headerSize() : header->rowPos(); if (topItem->index == 0 && header && tempPosition+highlightStart < headerPos+headerSize()/2) { pos = isRightToLeftTopToBottom() ? - headerPos + highlightStart - size() : headerPos - highlightStart; } else { @@ -2191,9 +2193,6 @@ qreal QDeclarativeGridView::maxXExtent() const if (d->flow == QDeclarativeGridView::LeftToRight) return QDeclarativeFlickable::maxXExtent(); qreal extent; - if (!d->model || !d->model->count()) { - extent = 0; - } qreal highlightStart; qreal highlightEnd; qreal lastItemPosition; @@ -2204,9 +2203,12 @@ qreal QDeclarativeGridView::maxXExtent() const } else { highlightStart = d->highlightRangeStart; highlightEnd = d->highlightRangeEnd; - lastItemPosition = d->rowPosAt(d->model->count()-1); + if (d->model && d->model->count()) + lastItemPosition = d->rowPosAt(d->model->count()-1); } - if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { + if (!d->model || !d->model->count()) { + extent = 0; + } else if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { extent = -(lastItemPosition - highlightStart); if (highlightEnd != highlightStart) extent = d->isRightToLeftTopToBottom() @@ -2725,7 +2727,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) modelIndex = d->visibleIndex; } - qreal tempPos = d->isRightToLeftTopToBottom() ? -d->position()-d->size() : d->position(); + qreal tempPos = d->isRightToLeftTopToBottom() ? -d->position()-d->size()+d->width()+1 : d->position(); int to = d->buffer+tempPos+d->size()-1; int colPos = 0; int rowPos = 0; @@ -2744,10 +2746,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) } } } else if (d->itemCount == 0 && d->header) { - if (d->flow == QDeclarativeGridView::LeftToRight) - rowPos = d->headerSize(); - else - colPos = d->headerSize(); + rowPos = d->headerSize(); } // Update the indexes of the following visible items. @@ -2804,6 +2803,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) d->updateCurrent(0); } emit currentIndexChanged(); + } else if (d->itemCount == 0 && d->currentIndex == -1) { + setCurrentIndex(0); } // everything is in order now - emit add() signal diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 6749657..486cec8 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -329,6 +329,7 @@ public: else idx = visibleItems.at(idx)->index; int count = modelIndex - idx - 1; + return (*(--visibleItems.constEnd()))->endPosition() + spacing + count * (averageSize + spacing) + 1; } } @@ -1316,10 +1317,8 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (velocity > 0) { if (data.move.value() < minExtent) { if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = isRightToLeft() ? nextVisibleItem() : firstVisibleItem()) { + if (FxListItem *item = isRightToLeft() ? nextVisibleItem() : firstVisibleItem()) maxDistance = qAbs(item->position() + dataValue); -// qDebug() << "maxDist" << maxDistance << item->position() << dataValue; - } } else { maxDistance = qAbs(minExtent - data.move.value()); } @@ -1329,10 +1328,8 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } else { if (data.move.value() > maxExtent) { if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = isRightToLeft() ? firstVisibleItem() : nextVisibleItem()) { + if (FxListItem *item = isRightToLeft() ? firstVisibleItem() : nextVisibleItem()) maxDistance = qAbs(item->position() + dataValue); -// qDebug() << "maxDist2" << maxDistance << item->position() << dataValue; - } } else { maxDistance = qAbs(maxExtent - data.move.value()); } @@ -2595,7 +2592,8 @@ qreal QDeclarativeListView::minXExtent() const qreal highlightEnd; qreal endPositionFirstItem; if (d->isRightToLeft()) { - endPositionFirstItem = d->positionAt(d->model->count()-1); + if (d->model && d->model->count()) + endPositionFirstItem = d->positionAt(d->model->count()-1); highlightStart = d->highlightRangeStartValid ? d->highlightRangeStart - (d->lastPosition()-endPositionFirstItem) : d->size() - (d->lastPosition()-endPositionFirstItem); @@ -2635,7 +2633,8 @@ qreal QDeclarativeListView::maxXExtent() const } else { highlightStart = d->highlightRangeStart; highlightEnd = d->highlightRangeEnd; - lastItemPosition = d->positionAt(d->model->count()-1); + if (d->model && d->model->count()) + lastItemPosition = d->positionAt(d->model->count()-1); } if (!d->model || !d->model->count()) { d->maxExtent = 0; @@ -3058,6 +3057,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) qreal tempPos = d->isRightToLeft() ? -d->position()-d->size() : d->position(); int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0; + if (index < 0) { int i = d->visibleItems.count() - 1; while (i > 0 && d->visibleItems.at(i)->index == -1) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 188fd6e..4fcaed6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -1317,6 +1317,7 @@ void tst_QDeclarativeGridView::snapping() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); + ctxt->setContextProperty("testRightToLeft", QVariant(false)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); qApp->processEvents(); @@ -1343,6 +1344,7 @@ void tst_QDeclarativeGridView::snapping() QCOMPARE(gridview->contentY(), 120.); delete canvas; + } void tst_QDeclarativeGridView::positionViewAtIndex_rightToLeft() diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 26219fe..02c8dad 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -2332,7 +2332,7 @@ void tst_QDeclarativeListView::rightToLeft() item = findItem(contentItem, "item3"); QTRY_VERIFY(item); - QTRY_COMPARE(item->x(), -600.0); + QTRY_COMPARE(item->x(), -540.0); text = findItem(contentItem, "text3"); QTRY_VERIFY(text); -- cgit v0.12 From 13ea38369b7f095e6af96c98bed7a3bb9bf795d5 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Thu, 17 Feb 2011 16:36:08 +1000 Subject: Adding file required for ListView Autotest The file was missed out in the previous commit. Change-Id: Ic8d055e9797b5da2ba1cb548984efc8c7e205751 Task-number: QTBUG-16010 Reviewed-by: Trust Me --- .../qdeclarativelistview/data/rightToLeft.qml | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml diff --git a/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml new file mode 100644 index 0000000..e31d923 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml @@ -0,0 +1,42 @@ +// This example demonstrates placing items in a view using +// a VisualItemModel + +import QtQuick 1.0 + +Rectangle { + color: "lightgray" + width: 240 + height: 320 + + VisualItemModel { + id: itemModel + objectName: "itemModel" + Rectangle { + objectName: "item1" + height: view.height; width: 100; color: "#FFFEF0" + Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item2" + height: view.height; width: 200; color: "#F0FFF7" + Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item3" + height: view.height; width: 240; color: "#F4F0FF" + Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + + ListView { + id: view + objectName: "view" + anchors.fill: parent + anchors.bottomMargin: 30 + model: itemModel + highlightRangeMode: "StrictlyEnforceRange" + orientation: ListView.Horizontal + flickDeceleration: 2000 + layoutDirection: Qt.RightToLeft + } +} -- cgit v0.12 From 5727255ce985862ac9970f3fb2db96735700b92f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 17 Feb 2011 11:55:58 +0100 Subject: Cocoa: processEvents does not always send posted events The event dispatcher for the cocoa port relies on the event loop source to fire for sending posted events. But when dispatching events manually (not using exec mode) this does not always trigger. This patch (discussed with brad) makes sure we always call sendPostedEvents for this case --- src/gui/kernel/qeventdispatcher_mac.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 15410ad..b4f3805 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -586,13 +586,14 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) // application, we should not run or stop NSApplication; This will be // done from the application itself. And if processEvents is called // manually (rather than from a QEventLoop), we cannot enter a tight - // loop and block this call, but instead we need to return after one flush: + // loop and block this call, but instead we need to return after one flush. + // Finally, if we are to exclude user input events, we cannot call [NSApp run] + // as we then loose control over which events gets dispatched: const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning]; const bool canExec_Qt = (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) && !(flags & QEventLoop::ExcludeUserInputEvents); - if (canExec_Qt && canExec_3rdParty) { // We can use exec-mode, meaning that we can stay in a tight loop until // interrupted. This is mostly an optimization, but it allow us to use @@ -648,6 +649,11 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) } } while (!d->interrupt && event != nil); + // Be sure to flush the Qt posted events when not using mode + // (exec mode will always do this call from the event loop source): + if (!d->interrupt) + QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); + // Since the window that holds modality might have changed while processing // events, we we need to interrupt when we return back the previous process // event recursion to ensure that we spin the correct modal session. -- cgit v0.12 From 8f74a64f3f2f5a6273c5e7de1591585a97dff82d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 18 Feb 2011 09:20:06 +0100 Subject: Cocoa: implement eventdispatcher flag excludeUserInputEvents When executing modal windows, the event dispatcher would not respect the QEventLoop::ExcludeUserInputEvents. This patch implements this support. The way it now works is that we fetch events manually from NSApplication and do the dispatching ourselves in those cases. From earlier research, this patch has shown to be a bit unreliable in some cases, and might have some sideeffects. Hence the reason we avoid it if we can. But it still feels better that we try to follow the flag in those few application that wants to do this. --- src/gui/kernel/qeventdispatcher_mac.mm | 60 ++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index b4f3805..677a736 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -561,6 +561,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) wakeUp(); emit awake(); + bool excludeUserEvents = flags & QEventLoop::ExcludeUserInputEvents; bool retVal = false; forever { if (d->interrupt) @@ -571,7 +572,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) NSEvent* event = 0; // First, send all previously excluded input events, if any: - if (!(flags & QEventLoop::ExcludeUserInputEvents)) { + if (!excludeUserEvents) { while (!d->queuedUserInputEvents.isEmpty()) { event = static_cast(d->queuedUserInputEvents.takeFirst()); if (!filterEvent(event)) { @@ -590,9 +591,8 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) // Finally, if we are to exclude user input events, we cannot call [NSApp run] // as we then loose control over which events gets dispatched: const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning]; - const bool canExec_Qt = - (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) - && !(flags & QEventLoop::ExcludeUserInputEvents); + const bool canExec_Qt = !excludeUserEvents && + (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ; if (canExec_Qt && canExec_3rdParty) { // We can use exec-mode, meaning that we can stay in a tight loop until @@ -620,22 +620,46 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) // Instead we will process all current pending events and return. d->ensureNSAppInitialized(); if (NSModalSession session = d->currentModalSession()) { - if (flags & QEventLoop::WaitForMoreEvents) - qt_mac_waitForMoreModalSessionEvents(); - NSInteger status = [NSApp runModalSession:session]; - if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { - // INVARIANT: Someone called [NSApp stopModal:] from outside the event - // dispatcher (e.g to stop a native dialog). But that call wrongly stopped - // 'session' as well. As a result, we need to restart all internal sessions: - d->temporarilyStopAllModalSessions(); - } - retVal = true; - } else do { - event = [NSApp nextEventMatchingMask:NSAnyEventMask + // INVARIANT: a modal window is executing. + if (!excludeUserEvents) { + // Since we can dispatch all kinds of events, we choose + // to use cocoa's native way of running modal sessions: + if (flags & QEventLoop::WaitForMoreEvents) + qt_mac_waitForMoreModalSessionEvents(); + NSInteger status = [NSApp runModalSession:session]; + if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + // INVARIANT: Someone called [NSApp stopModal:] from outside the event + // dispatcher (e.g to stop a native dialog). But that call wrongly stopped + // 'session' as well. As a result, we need to restart all internal sessions: + d->temporarilyStopAllModalSessions(); + } + retVal = true; + } else do { + // Dispatch all non-user events (but que non-user events up for later). In + // this case, we need more control over which events gets dispatched, and + // cannot use [NSApp runModalSession:session]: + event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil - inMode:NSDefaultRunLoopMode + inMode:NSModalPanelRunLoopMode dequeue: YES]; + if (event) { + if (IsMouseOrKeyEvent(event)) { + [event retain]; + d->queuedUserInputEvents.append(event); + continue; + } + if (!filterEvent(event) && qt_mac_send_event(flags, event, 0)) + retVal = true; + } + } while (!d->interrupt && event != nil); + } else do { + // INVARIANT: No modal window is executing. + event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue: YES]; + if (event) { if (flags & QEventLoop::ExcludeUserInputEvents) { if (IsMouseOrKeyEvent(event)) { @@ -649,7 +673,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) } } while (!d->interrupt && event != nil); - // Be sure to flush the Qt posted events when not using mode + // Be sure to flush the Qt posted events when not using exec mode // (exec mode will always do this call from the event loop source): if (!d->interrupt) QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); -- cgit v0.12 From 45f8d9f78c8357c087a71346e0815c23997d67b4 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 18 Feb 2011 09:35:29 +0100 Subject: Cocoa: use mouse location from event This is offcourse important, and the bug was revealed when calling qApp->processEvents(QEventLoop:excludeUserInputEvents), as this call would que up mouse events and dispatch them later on. And offcourse, the mouse would have changed position at that point. --- src/gui/kernel/qcursor_mac.mm | 2 +- src/gui/kernel/qt_cocoa_helpers_mac.mm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm index 0d57b85..0afa3ee 100644 --- a/src/gui/kernel/qcursor_mac.mm +++ b/src/gui/kernel/qcursor_mac.mm @@ -215,7 +215,7 @@ void qt_mac_update_cursor() widgetUnderMouse = qt_button_down; } else { QPoint localPoint; - QPoint globalPoint = QCursor::pos(); + QPoint globalPoint; qt_mac_getTargetForMouseEvent(0, QEvent::None, localPoint, globalPoint, 0, &widgetUnderMouse); } qt_mac_updateCursorWithWidgetUnderMouse(widgetUnderMouse); diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index c8132e8..af8692d 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1048,7 +1048,6 @@ QWidget *qt_mac_getTargetForKeyEvent(QWidget *widgetThatReceivedEvent) // events QWidget *qt_mac_getTargetForMouseEvent( // You can call this function without providing an event. - // If so, set returnGlobalPoint before the call. NSEvent *event, QEvent::Type eventType, QPoint &returnLocalPoint, @@ -1057,7 +1056,8 @@ QWidget *qt_mac_getTargetForMouseEvent( QWidget **returnWidgetUnderMouse) { Q_UNUSED(event); - returnGlobalPoint = flipPoint([NSEvent mouseLocation]).toPoint(); + NSPoint nsglobalpoint = event ? [[event window] convertBaseToScreen:[event locationInWindow]] : [NSEvent mouseLocation]; + returnGlobalPoint = flipPoint(nsglobalpoint).toPoint(); QWidget *mouseGrabber = QWidget::mouseGrabber(); bool buttonDownNotBlockedByModal = qt_button_down && !QApplicationPrivate::isBlockedByModal(qt_button_down); QWidget *popup = QApplication::activePopupWidget(); -- cgit v0.12 From 73ae8a593b96ead99dabb854b20a687aa849b71b Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 21 Feb 2011 10:25:57 +0100 Subject: Mac: add support for closing dialogs using Cmd-D This is how dialogs work natively on Mac; you can choose the "Don't Save" button by using the shortcut "Cmd-D" Rev-By: jbache --- src/gui/widgets/qdialogbuttonbox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 5f17a2b..6fe87b6 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -562,6 +562,14 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut } else { qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added"); } + +#ifdef Q_WS_MAC + // Since mnemonics is off by default on Mac, we add a Cmd-D + // shortcut here to e.g. make the "Don't Save" button work nativly: + if (sbutton == QDialogButtonBox::Discard) + button->setShortcut(QKeySequence(QLatin1String("Ctrl+D"))); +#endif + return button; } -- cgit v0.12 From 72928bb61d5aceac1d15ee11736941c16b83df59 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 25 Feb 2011 14:38:48 +0100 Subject: Doc: inform better about how you can tweak Qt apps on Mac Just some update on the Mac platform documentation --- doc/src/platforms/platform-notes.qdoc | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index aac6bb0..246f721 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -602,6 +602,69 @@ problem, it probably is a good idea to turn off precompiled headers. Also, consider filing a bug report with Apple so that they can improve support for this feature. + + \section2 Attributes + The following lists a set of useful attributes that can be used to tweak applications + on Mac: + + Qt::AA_MacPluginApplication, Qt::AA_DontUseNativeMenuBar, Qt::AA_MacDontSwapCtrlAndMeta + Qt::WA_MacNoClickThrough, Qt::WA_MacOpaqueSizeGrip, Qt::WA_MacShowFocusRect, + Qt::WA_MacNormalSize, Qt::WA_MacSmallSize, Qt::WA_MacMiniSize, Qt::WA_MacVariableSize, + Qt::WA_MacBrushedMetal, Qt::WA_MacAlwaysShowToolWindow, Qt::WA_MacFrameworkScaled, + Qt::WA_MacNoShadow, Qt::Sheet, Qt::Drawer, Qt::MacWindowToolBarButtonHint, + QMainWindow::unifiedTitleAndToolBarOnMac + + \section2 Mixing Qt with native code + Two classes are awailable for either adding native Cocoa views/controls + inside a Qt application, or the opposite, embedding Qt into a native + Cocoa application: + + QMacCocoaViewContainer, QMacNativeWidget + + \section3 Using native Cocoa panels + Launching native Cocoa panels from within a Qt application can sometimes + be problematic. The reason is that Qt's event dispatcher is more flexible + than what Cocoa offers, and lets the user spin the event dispatcher (and + running QEventLoop::exec) without having to think about whether or not modal + dialogs are showing on screen (which is a difference to Cocoa). Therefore + we need to do special bookkeeping in Qt to handle this correctly, which + unfortunately make mixing in native panels hard. The best way at the moment + to do this, is to follow the pattern below, where we post the call to the + function with native code rather than calling it directly. Then we now that + Qt has cleanly updated any pending event loop recursions before the native + panel is shown: + + \code + #include + + class NativeProxyObject : public QObject + { + Q_OBJECT + public slots: + void execNativeDialogLater() + { + QMetaObject::invokeMethod(this, "execNativeDialogNow", Qt::QueuedConnection); + } + + void execNativeDialogNow() + { + NSRunAlertPanel(@"A Native dialog", @"", @"OK", @"", @""); + } + + }; + + #include "main.moc" + + int main(int argc, char **argv){ + QApplication app(argc, argv); + NativeProxyObject proxy; + QPushButton button("Show native dialog"); + QObject::connect(&button, SIGNAL(clicked()), &proxy, SLOT(execNativeDialogLater())); + button.show(); + return app.exec(); + } + + \endcode */ /*! -- cgit v0.12 From f82f128451ef78e968c85944af10e0e54dbb73c5 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 25 Feb 2011 14:52:39 +0100 Subject: Merge request: 1111 Rev-By: jbache --- src/gui/styles/qmacstyle_mac.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index ac05789..64722c7 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4621,6 +4621,13 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex tdi.attributes &= ~kThemeTrackShowThumb; if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy)) tdi.enableState = kThemeTrackNothingToScroll; + } else { + if (!(slider->subControls & SC_SliderHandle)) + tdi.attributes &= ~kThemeTrackShowThumb; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if (!(slider->subControls & SC_SliderGroove)) + tdi.attributes |= kThemeTrackHideTrack; +#endif } HIThemeDrawTrack(&tdi, tracking ? 0 : &macRect, cg, -- cgit v0.12 From 2c7cab4172f1acc86fd49345a2847417e162f2c3 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 24 Feb 2011 12:33:11 +1000 Subject: Add LayoutMirroring attached property for mirroring QML layouts Task-number: QTBUG-17280 Reviewed-by: Martin Jones Change-Id: I34a623b49ce0fd5c05ae7a7ea5d0437c107b8a9b --- doc/src/snippets/declarative/layoutmirroring.qml | 64 ++++++++ .../layoutdirection/layoutdirection.qml | 22 ++- .../graphicsitems/qdeclarativeanchors.cpp | 40 ++--- .../graphicsitems/qdeclarativeanchors_p.h | 10 +- .../graphicsitems/qdeclarativeanchors_p_p.h | 4 +- .../graphicsitems/qdeclarativegridview.cpp | 69 +++++--- .../graphicsitems/qdeclarativegridview_p.h | 7 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 154 +++++++++++++++++- src/declarative/graphicsitems/qdeclarativeitem_p.h | 53 +++++- .../graphicsitems/qdeclarativeitemsmodule.cpp | 1 + .../graphicsitems/qdeclarativelistview.cpp | 90 ++++++++--- .../graphicsitems/qdeclarativelistview_p.h | 7 +- .../graphicsitems/qdeclarativepositioners.cpp | 114 +++++++++---- .../graphicsitems/qdeclarativepositioners_p.h | 15 +- .../graphicsitems/qdeclarativepositioners_p_p.h | 30 +++- .../tst_qdeclarativeanchors.cpp | 12 +- .../data/gridview-enforcerange.qml | 2 +- .../qdeclarativegridview/data/gridview1.qml | 2 +- .../qdeclarativegridview/data/mirroring.qml | 43 +++++ .../tst_qdeclarativegridview.cpp | 65 ++++++++ .../qdeclarativeitem/data/layoutmirroring.qml | 54 +++++++ .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 180 +++++++++++++++++---- .../qdeclarativelistview/data/rightToLeft.qml | 8 +- .../tst_qdeclarativelistview.cpp | 69 +++++++- .../data/grid-righttoleft.qml | 41 ----- .../qdeclarativepositioners/data/gridtest.qml | 6 +- .../qdeclarativepositioners/data/horizontal.qml | 1 - .../tst_qdeclarativepositioners.cpp | 78 ++++++++- .../qdeclarativestates/tst_qdeclarativestates.cpp | 2 +- 29 files changed, 1027 insertions(+), 216 deletions(-) create mode 100644 doc/src/snippets/declarative/layoutmirroring.qml create mode 100644 tests/auto/declarative/qdeclarativegridview/data/mirroring.qml create mode 100644 tests/auto/declarative/qdeclarativeitem/data/layoutmirroring.qml delete mode 100644 tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml diff --git a/doc/src/snippets/declarative/layoutmirroring.qml b/doc/src/snippets/declarative/layoutmirroring.qml new file mode 100644 index 0000000..23eecd6 --- /dev/null +++ b/doc/src/snippets/declarative/layoutmirroring.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import QtQuick 1.1 + +Rectangle { + LayoutMirroring.enabled: true + LayoutMirroring.childrenInherit: true + width: 240; height: 50 + Row { + anchors { left: parent.left; margins: 5 } + y: 5; spacing: 5 + Repeater { + model: 5 + Rectangle { + color: "red" + opacity: (5-index) / 5 + width: 40; height: 40 + Text { + text: index+1 + anchors.centerIn: parent + } + } + } + } +} +//![0] diff --git a/examples/declarative/positioners/layoutdirection/layoutdirection.qml b/examples/declarative/positioners/layoutdirection/layoutdirection.qml index 3e23b15..080010e 100644 --- a/examples/declarative/positioners/layoutdirection/layoutdirection.qml +++ b/examples/declarative/positioners/layoutdirection/layoutdirection.qml @@ -41,10 +41,13 @@ import QtQuick 1.1 Rectangle { + property bool mirror + property int direction: Qt.application.layoutDirection + LayoutMirroring.enabled: mirror + LayoutMirroring.childrenInherit: true width: column.width + 100 height: column.height + 100 - property int direction: Qt.application.layoutDirection Column { id: column @@ -133,6 +136,23 @@ Rectangle { anchors.fill: parent } } + Rectangle { + height: 50; width: parent.width + color: mouseArea2.pressed ? "black" : "gray" + Text { + text: mirror ? "Mirrored" : "Normal" + color: "white" + font.pixelSize: 16 + anchors.centerIn: parent + } + MouseArea { + id: mouseArea2 + onClicked: { + mirror = !mirror; + } + anchors.fill: parent + } + } } Component { diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index a2d6261..5ff6d2c 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -175,13 +175,14 @@ QDeclarativeAnchors::~QDeclarativeAnchors() void QDeclarativeAnchorsPrivate::fillChanged() { + Q_Q(QDeclarativeAnchors); if (!fill || !isItemComplete()) return; if (updatingFill < 2) { ++updatingFill; - qreal horizontalMargin = isMirrored() ? rightMargin : leftMargin; + qreal horizontalMargin = q->mirrored() ? rightMargin : leftMargin; if (fill == item->parentItem()) { //child-parent setItemPos(QPointF(horizontalMargin, topMargin)); @@ -201,13 +202,14 @@ void QDeclarativeAnchorsPrivate::fillChanged() void QDeclarativeAnchorsPrivate::centerInChanged() { + Q_Q(QDeclarativeAnchors); if (!centerIn || fill || !isItemComplete()) return; if (updatingCenterIn < 2) { ++updatingCenterIn; - qreal effectiveHCenterOffset = isMirrored() ? -hCenterOffset : hCenterOffset; + qreal effectiveHCenterOffset = q->mirrored() ? -hCenterOffset : hCenterOffset; if (centerIn == item->parentItem()) { QPointF p(hcenter(item->parentItem()) - hcenter(item) + effectiveHCenterOffset, vcenter(item->parentItem()) - vcenter(item) + vCenterOffset); @@ -315,6 +317,13 @@ void QDeclarativeAnchors::componentComplete() d->componentComplete = true; } +bool QDeclarativeAnchors::mirrored() +{ + Q_D(QDeclarativeAnchors); + QGraphicsItemPrivate * itemPrivate = QGraphicsItemPrivate::get(d->item); + return itemPrivate->isDeclarativeItem ? static_cast(itemPrivate)->effectiveLayoutMirror : false; +} + void QDeclarativeAnchorsPrivate::setItemHeight(qreal v) { updatingMe = true; @@ -502,11 +511,6 @@ bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1 return invalid; } -bool QDeclarativeAnchorsPrivate::isMirrored() const -{ - return layoutDirection == Qt::RightToLeft; -} - void QDeclarativeAnchorsPrivate::updateVerticalAnchors() { if (fill || centerIn || !isItemComplete()) @@ -591,6 +595,7 @@ inline QDeclarativeAnchorLine::AnchorLine reverseAnchorLine(QDeclarativeAnchorLi void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() { + Q_Q(QDeclarativeAnchors); if (fill || centerIn || !isItemComplete()) return; @@ -599,7 +604,7 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() qreal effectiveRightMargin, effectiveLeftMargin, effectiveHorizontalCenterOffset; QDeclarativeAnchorLine effectiveLeft, effectiveRight, effectiveHorizontalCenter; QDeclarativeAnchors::Anchor effectiveLeftAnchor, effectiveRightAnchor; - if (isMirrored()) { + if (q->mirrored()) { effectiveLeftAnchor = QDeclarativeAnchors::RightAnchor; effectiveRightAnchor = QDeclarativeAnchors::LeftAnchor; effectiveLeft.item = right.item; @@ -1086,25 +1091,6 @@ QDeclarativeAnchors::Anchors QDeclarativeAnchors::usedAnchors() const return d->usedAnchors; } - -Qt::LayoutDirection QDeclarativeAnchors::layoutDirection() const -{ - Q_D(const QDeclarativeAnchors); - return d->layoutDirection; -} - -void QDeclarativeAnchors::setLayoutDirection(Qt::LayoutDirection layoutDirection) -{ - Q_D(QDeclarativeAnchors); - if (d->layoutDirection != layoutDirection) { - d->layoutDirection = layoutDirection; - d->fillChanged(); - d->centerInChanged(); - d->updateHorizontalAnchors(); - emit layoutDirectionChanged(); - } -} - bool QDeclarativeAnchorsPrivate::checkHValid() const { if (usedAnchors & QDeclarativeAnchors::LeftAnchor && diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index 90a3508..388d6b9 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -79,7 +79,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1) public: QDeclarativeAnchors(QObject *parent=0); @@ -161,12 +161,11 @@ public: Anchors usedAnchors() const; - Qt::LayoutDirection layoutDirection() const; - void setLayoutDirection (Qt::LayoutDirection); - void classBegin(); void componentComplete(); + bool mirrored(); + Q_SIGNALS: void leftChanged(); void rightChanged(); @@ -185,10 +184,11 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); void baselineOffsetChanged(); - Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void mirroredChanged(); private: friend class QDeclarativeItem; + friend class QDeclarativeItemPrivate; friend class QDeclarativeGraphicsWidget; Q_DISABLE_COPY(QDeclarativeAnchors) Q_DECLARE_PRIVATE(QDeclarativeAnchors) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h index ec96582..d8d2f15 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h @@ -94,7 +94,7 @@ public: : componentComplete(true), updatingMe(false), updatingHorizontalAnchor(0), updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0), - margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), layoutDirection(Qt::LeftToRight) + margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0) { } @@ -161,8 +161,6 @@ public: qreal vCenterOffset; qreal hCenterOffset; qreal baselineOffset; - - Qt::LayoutDirection layoutDirection; }; QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 2eeadf4..f6810ed 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -73,7 +73,7 @@ public: if (view->flow() == QDeclarativeGridView::LeftToRight) { rowPos = item->y(); } else { - if (view->layoutDirection() == Qt::RightToLeft) + if (view->effectiveLayoutDirection() == Qt::RightToLeft) rowPos = -view->cellWidth()-item->x(); else rowPos = item->x(); @@ -83,7 +83,7 @@ public: qreal colPos() const { qreal colPos = 0; if (view->flow() == QDeclarativeGridView::LeftToRight) { - if (view->layoutDirection() == Qt::RightToLeft) { + if (view->effectiveLayoutDirection() == Qt::RightToLeft) { int colSize = view->cellWidth(); int columns = view->width()/colSize; colPos = colSize * (columns-1) - item->x(); @@ -101,14 +101,14 @@ public: if (view->flow() == QDeclarativeGridView::LeftToRight) { return item->y() + view->cellHeight() - 1; } else { - if (view->layoutDirection() == Qt::RightToLeft) + if (view->effectiveLayoutDirection() == Qt::RightToLeft) return -item->x() - 1; else return item->x() + view->cellWidth() - 1; } } void setPosition(qreal col, qreal row) { - if (view->layoutDirection() == Qt::RightToLeft) { + if (view->effectiveLayoutDirection() == Qt::RightToLeft) { if (view->flow() == QDeclarativeGridView::LeftToRight) { int columns = view->width()/view->cellWidth(); item->setPos(QPointF((view->cellWidth() * (columns-1) - col), row)); @@ -188,7 +188,24 @@ public: } bool isRightToLeftTopToBottom() const { - return flow == QDeclarativeGridView::TopToBottom && layoutDirection == Qt::RightToLeft; + Q_Q(const QDeclarativeGridView); + return flow == QDeclarativeGridView::TopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft; + } + + void regenerate() { + Q_Q(QDeclarativeGridView); + if (q->isComponentComplete()) { + clear(); + updateGrid(); + q->refill(); + updateCurrent(currentIndex); + } + } + + void mirrorChange() { + Q_Q(QDeclarativeGridView); + regenerate(); + emit q->effectiveLayoutDirectionChanged(); } qreal position() const { @@ -201,7 +218,7 @@ public: q->QDeclarativeFlickable::setContentY(pos); q->QDeclarativeFlickable::setContentX(0); } else { - if (layoutDirection == Qt::LeftToRight) + if (q->effectiveLayoutDirection() == Qt::LeftToRight) q->QDeclarativeFlickable::setContentX(pos); else q->QDeclarativeFlickable::setContentX(-pos-size()); @@ -918,7 +935,7 @@ void QDeclarativeGridViewPrivate::updateFooter() rowOffset = footer->item->width()-cellWidth; } else { rowOffset = 0; - if (layoutDirection == Qt::RightToLeft) + if (q->effectiveLayoutDirection() == Qt::RightToLeft) colOffset = footer->item->width()-cellWidth; } if (visibleItems.count()) { @@ -971,7 +988,7 @@ void QDeclarativeGridViewPrivate::updateHeader() rowOffset = -cellWidth; } else { rowOffset = -headerSize(); - if (layoutDirection == Qt::RightToLeft) + if (q->effectiveLayoutDirection() == Qt::RightToLeft) colOffset = header->item->width()-cellWidth; } if (visibleItems.count()) { @@ -1761,7 +1778,6 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply indicates that the flow is horizontal. - */ Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const @@ -1775,15 +1791,33 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio Q_D(QDeclarativeGridView); if (d->layoutDirection != layoutDirection) { d->layoutDirection = layoutDirection; - d->clear(); - d->updateGrid(); - refill(); - d->updateCurrent(d->currentIndex); + d->regenerate(); emit layoutDirectionChanged(); + emit effectiveLayoutDirectionChanged(); } } /*! + \qmlproperty enumeration GridView::effectiveLayoutDirection + This property holds the effective layout direction of the grid. + + When using the attached property \l {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + the visual layout direction of the grid will be mirrored. However, the + property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged. + + \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring} +*/ + +Qt::LayoutDirection QDeclarativeGridView::effectiveLayoutDirection() const +{ + Q_D(const QDeclarativeGridView); + if (d->effectiveLayoutMirror) + return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft; + else + return d->layoutDirection; +} + +/*! \qmlproperty enumeration GridView::flow This property holds the flow of the grid. @@ -1814,10 +1848,7 @@ void QDeclarativeGridView::setFlow(Flow flow) } setContentX(0); setContentY(0); - d->clear(); - d->updateGrid(); - refill(); - d->updateCurrent(d->currentIndex); + d->regenerate(); emit flowChanged(); } } @@ -2338,7 +2369,7 @@ void QDeclarativeGridView::moveCurrentIndexLeft() if (!count) return; - if (d->layoutDirection == Qt::LeftToRight) { + if (effectiveLayoutDirection() == Qt::LeftToRight) { if (d->flow == QDeclarativeGridView::LeftToRight) { if (currentIndex() > 0 || d->wrap) { int index = currentIndex() - 1; @@ -2381,7 +2412,7 @@ void QDeclarativeGridView::moveCurrentIndexRight() if (!count) return; - if (d->layoutDirection == Qt::LeftToRight) { + if (effectiveLayoutDirection() == Qt::LeftToRight) { if (d->flow == QDeclarativeGridView::LeftToRight) { if (currentIndex() < count - 1 || d->wrap) { int index = currentIndex() + 1; diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index fc9e6b4..ad0c609 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -74,7 +74,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) //Versioning support? + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) @@ -132,6 +133,7 @@ public: Qt::LayoutDirection layoutDirection() const; void setLayoutDirection(Qt::LayoutDirection); + Qt::LayoutDirection effectiveLayoutDirection() const; enum Flow { LeftToRight, TopToBottom }; Flow flow() const; @@ -191,7 +193,8 @@ Q_SIGNALS: void modelChanged(); void delegateChanged(); void flowChanged(); - void layoutDirectionChanged(); + Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void effectiveLayoutDirectionChanged(); void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index ac5d55c..d16025d 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "private/qdeclarativeitem_p.h" #include "qdeclarativeitem.h" #include "private/qdeclarativeevents_p_p.h" #include #include +#include #include #include @@ -731,6 +731,152 @@ void QDeclarativeKeyNavigationAttached::setFocusNavigation(QDeclarativeItem *cur } /*! + \qmlclass LayoutMirroring QDeclarativeLayoutMirroringAttached + \since QtQuick 1.1 + \ingroup qml-utility-elements + \brief The LayoutMirroring is used for mirroring the Qt Quick application layouts. + + LayoutMirroring \l enabled property can be used to horizontally mirror \l {anchor-layout}{Item anchors}, + \l{Using QML Positioner and Repeater Items}{Positioner} elements and QML views like \l {GridView}{GridView} + and horizontal \l {ListView}{ListView}. Mirroring is a visual change, left anchors will become + right anchors and left-to-right positioner will instead position child items from right to left. + By default setting the \l enabled property to true only affects the item in question. You can set property + LayoutDirection \l childrenInherit to true if you want the item children also inherit the mirror setting. + If no attached property has been defined, mirroring is disabled. + + The following example shows mirroring in action. When \l enabled is set to true, left anchor + becomes right, and \l {Row}{Row} starts positioning items in a reverse order: + + \snippet doc/src/snippets/declarative/layoutmirroring.qml 0 + + Layout mirroring is useful when you need to support both left-to-right and right-to-left + layout versions of your application that target different language areas. Inheritance saves + you from having to mirror the layouts manually for each layout item in your application. Keep + in mind however that the mirroring does not affect the positioning done by modifying Item's x + co-ordinate directly, so even with the mirroring enabled you will often need to do some layout + fixes to support the other reading direction. Also, there are cases where you need to disable + mirroring of individual child items, either because mirroring is not the wanted behavior or + because the item already implements mirroring in some custom way. +*/ + +/*! + \qmlproperty bool LayoutMirroring::enabled + + Setting this property to true mirrors item's layout horizontally, whether the layout is done + using \l {anchor-layout}{anchors}, \l{Using QML Positioner and Repeater Items}{Positioners} + or as a QML view \l {GridView}{GridView} or \l {ListView}{ListView}. +*/ + +/*! + \qmlproperty bool LayoutMirroring::childrenInherit + + This property can be set to true if you want the item children + to inherit the item's mirror setting. +*/ + +QDeclarativeLayoutMirroringAttached::QDeclarativeLayoutMirroringAttached(QObject *parent) : QObject(parent), itemPrivate(0) +{ + if (QDeclarativeItem *item = qobject_cast(parent)) { + itemPrivate = QDeclarativeItemPrivate::get(item); + itemPrivate->attachedLayoutDirection = this; + } else + qmlInfo(parent) << tr("LayoutDirection attached property only works with Items"); +} + +QDeclarativeLayoutMirroringAttached * QDeclarativeLayoutMirroringAttached::qmlAttachedProperties(QObject *object) +{ + return new QDeclarativeLayoutMirroringAttached(object); +} + +bool QDeclarativeLayoutMirroringAttached::enabled() const +{ + return itemPrivate ? itemPrivate->effectiveLayoutMirror : false; +} + +void QDeclarativeLayoutMirroringAttached::setEnabled(bool enabled) +{ + if (!itemPrivate) + return; + + itemPrivate->isMirrorImplicit = false; + if (enabled != itemPrivate->effectiveLayoutMirror) { + itemPrivate->setLayoutMirror(enabled); + if (itemPrivate->inheritMirrorFromItem) + itemPrivate->resolveLayoutMirror(); + } +} + +void QDeclarativeLayoutMirroringAttached::resetEnabled() +{ + if (itemPrivate && !itemPrivate->isMirrorImplicit) { + itemPrivate->isMirrorImplicit = true; + itemPrivate->resolveLayoutMirror(); + } +} + +bool QDeclarativeLayoutMirroringAttached::childrenInherit() const +{ + return itemPrivate ? itemPrivate->inheritMirrorFromItem : false; +} + +void QDeclarativeLayoutMirroringAttached::setChildrenInherit(bool childrenInherit) { + if (itemPrivate && childrenInherit != itemPrivate->inheritMirrorFromItem) { + itemPrivate->inheritMirrorFromItem = childrenInherit; + itemPrivate->resolveLayoutMirror(); + childrenInheritChanged(); + } +} + +void QDeclarativeItemPrivate::resolveLayoutMirror() +{ + Q_Q(QDeclarativeItem); + if (QDeclarativeItem *parentItem = q->parentItem()) { + QDeclarativeItemPrivate *parentPrivate = QDeclarativeItemPrivate::get(parentItem); + setImplicitLayoutMirror(parentPrivate->inheritedLayoutMirror, parentPrivate->inheritMirrorFromParent); + } else { + setImplicitLayoutMirror(isMirrorImplicit ? false : effectiveLayoutMirror, inheritMirrorFromItem); + } +} + +void QDeclarativeItemPrivate::setImplicitLayoutMirror(bool mirror, bool inherit) +{ + inherit = inherit || inheritMirrorFromItem; + if (!isMirrorImplicit && inheritMirrorFromItem) + mirror = effectiveLayoutMirror; + if (mirror == inheritedLayoutMirror && inherit == inheritMirrorFromParent) + return; + + inheritMirrorFromParent = inherit; + inheritedLayoutMirror = inheritMirrorFromParent ? mirror : false; + + if (isMirrorImplicit) + setLayoutMirror(inherit ? inheritedLayoutMirror : false); + for (int i = 0; i < children.count(); ++i) { + if (QDeclarativeItem *child = qobject_cast(children.at(i))) { + QDeclarativeItemPrivate *childPrivate = QDeclarativeItemPrivate::get(child); + childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent); + } + } +} + +void QDeclarativeItemPrivate::setLayoutMirror(bool mirror) +{ + if (mirror != effectiveLayoutMirror) { + effectiveLayoutMirror = mirror; + if (_anchors) { + _anchors->d_func()->fillChanged(); + _anchors->d_func()->centerInChanged(); + _anchors->d_func()->updateHorizontalAnchors(); + emit _anchors->mirroredChanged(); + } + mirrorChange(); + if (attachedLayoutDirection) { + emit attachedLayoutDirection->enabledChanged(); + } + } +} + +/*! \qmlclass Keys QDeclarativeKeysAttached \ingroup qml-basic-interaction-elements \since 4.7 @@ -1389,6 +1535,11 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec \endqml See the \l {Keys}{Keys} attached property for detailed documentation. + + \section1 Layout Mirroring + + Item layouts can be mirrored using \l {LayoutMirroring}{LayoutMirroring} attached property. + */ /*! @@ -2782,6 +2933,7 @@ QVariant QDeclarativeItem::itemChange(GraphicsItemChange change, Q_D(QDeclarativeItem); switch (change) { case ItemParentHasChanged: + d->resolveLayoutMirror(); emit parentChanged(parentItem()); d->parentNotifier.notify(); break; diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 4303c0a..b204d7f 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -77,6 +77,7 @@ QT_BEGIN_NAMESPACE class QNetworkReply; class QDeclarativeItemKeyFilter; +class QDeclarativeLayoutMirroringAttached; //### merge into private? class QDeclarativeContents : public QObject, public QDeclarativeItemChangeListener @@ -125,8 +126,10 @@ public: _stateGroup(0), origin(QDeclarativeItem::Center), widthValid(false), heightValid(false), componentComplete(true), keepMouse(false), - smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0), - mWidth(0), mHeight(0), mImplicitWidth(0), mImplicitHeight(0), hadSubFocusItem(false) + smooth(false), transformOriginDirty(true), doneEventPreHandler(false), + inheritedLayoutMirror(false), effectiveLayoutMirror(false), isMirrorImplicit(true), + inheritMirrorFromParent(false), inheritMirrorFromItem(false), keyHandler(0), + mWidth(0), mHeight(0), mImplicitWidth(0), mImplicitHeight(0), attachedLayoutDirection(0), hadSubFocusItem(false) { QGraphicsItemPrivate::acceptedMouseButtons = 0; isDeclarativeItem = 1; @@ -134,7 +137,6 @@ public: QGraphicsItem::ItemHasNoContents | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemNegativeZStacksBehindParent); - } void init(QDeclarativeItem *parent) @@ -146,6 +148,11 @@ public: } baselineOffset.invalidate(); mouseSetsFocus = false; + resolveLayoutMirror(); + } + + bool isMirrored() const { + return effectiveLayoutMirror; } // Private Properties @@ -162,6 +169,10 @@ public: virtual void implicitWidthChanged(); virtual void implicitHeightChanged(); + void resolveLayoutMirror(); + void setImplicitLayoutMirror(bool mirror, bool inherit); + void setLayoutMirror(bool mirror); + QDeclarativeListProperty data(); QDeclarativeListProperty resources(); @@ -272,6 +283,11 @@ public: bool smooth:1; bool transformOriginDirty : 1; bool doneEventPreHandler : 1; + bool inheritedLayoutMirror:1; + bool effectiveLayoutMirror:1; + bool isMirrorImplicit:1; + bool inheritMirrorFromParent:1; + bool inheritMirrorFromItem:1; QDeclarativeItemKeyFilter *keyHandler; @@ -280,6 +296,8 @@ public: qreal mImplicitWidth; qreal mImplicitHeight; + QDeclarativeLayoutMirroringAttached* attachedLayoutDirection; + bool hadSubFocusItem; QPointF computeTransformOrigin() const; @@ -326,6 +344,8 @@ public: virtual void focusChanged(bool); + virtual void mirrorChange() {}; + static qint64 consistentTime; static void setConsistentTime(qint64 t); static void start(QElapsedTimer &); @@ -423,6 +443,31 @@ private: void setFocusNavigation(QDeclarativeItem *currentItem, const char *dir); }; +class QDeclarativeLayoutMirroringAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled RESET resetEnabled NOTIFY enabledChanged) + Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged) + +public: + explicit QDeclarativeLayoutMirroringAttached(QObject *parent = 0); + + bool enabled() const; + void setEnabled(bool); + void resetEnabled(); + + bool childrenInherit() const; + void setChildrenInherit(bool); + + static QDeclarativeLayoutMirroringAttached *qmlAttachedProperties(QObject *); +Q_SIGNALS: + void enabledChanged(); + void childrenInheritChanged(); +private: + friend class QDeclarativeItemPrivate; + QDeclarativeItemPrivate *itemPrivate; +}; + class QDeclarativeKeysAttachedPrivate : public QObjectPrivate { public: @@ -572,5 +617,7 @@ QML_DECLARE_TYPE(QDeclarativeKeysAttached) QML_DECLARE_TYPEINFO(QDeclarativeKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QDeclarativeKeyNavigationAttached) QML_DECLARE_TYPEINFO(QDeclarativeKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(QDeclarativeLayoutMirroringAttached) +QML_DECLARE_TYPEINFO(QDeclarativeLayoutMirroringAttached, QML_HAS_ATTACHED_PROPERTIES) #endif // QDECLARATIVEITEM_P_H diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 3c8f64e..c4a9030 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -198,6 +198,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterRevision("QtQuick",1,1); qmlRegisterRevision("QtQuick",1,0); qmlRegisterRevision("QtQuick",1,1); + qmlRegisterUncreatableType("QtQuick",1,1,"LayoutMirroring", QDeclarativeLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); #ifndef QT_NO_IMPORT_QT47_QML #ifdef QT_NO_MOVIE diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 486cec8..879b99b 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -104,16 +104,17 @@ public: if (view->orientation() == QDeclarativeListView::Vertical) return section->y(); else - return (view->layoutDirection() == Qt::RightToLeft ? -section->width()-section->x() : section->x()); + return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -section->width()-section->x() : section->x()); } else { return itemPosition(); } } + qreal itemPosition() const { if (view->orientation() == QDeclarativeListView::Vertical) return item->y(); else - return (view->layoutDirection() == Qt::RightToLeft ? -item->width()-item->x() : item->x()); + return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -item->width()-item->x() : item->x()); } qreal size() const { if (section) @@ -133,7 +134,7 @@ public: if (view->orientation() == QDeclarativeListView::Vertical) { return item->y() + (item->height() >= 1.0 ? item->height() : 1) - 1; } else { - return (view->layoutDirection() == Qt::RightToLeft + return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -item->width()-item->x() + (item->width() >= 1.0 ? item->width() : 1) : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1; } @@ -146,7 +147,7 @@ public: } item->setY(pos); } else { - if (view->layoutDirection() == Qt::RightToLeft) { + if (view->effectiveLayoutDirection() == Qt::RightToLeft) { if (section) { section->setX(-section->width()-pos); pos += section->width(); @@ -248,8 +249,25 @@ public: return 0; } + void regenerate() { + Q_Q(QDeclarativeListView); + if (q->isComponentComplete()) { + clear(); + setPosition(0); + q->refill(); + updateCurrent(currentIndex); + } + } + + void mirrorChange() { + Q_Q(QDeclarativeListView); + regenerate(); + emit q->effectiveLayoutDirectionChanged(); + } + bool isRightToLeft() const { - return (layoutDirection == Qt::RightToLeft && orient == QDeclarativeListView::Horizontal); + Q_Q(const QDeclarativeListView); + return orient == QDeclarativeListView::Horizontal && q->effectiveLayoutDirection() == Qt::RightToLeft; } qreal position() const { @@ -262,7 +280,7 @@ public: if (orient == QDeclarativeListView::Vertical) { q->QDeclarativeFlickable::setContentY(pos); } else { - if (layoutDirection == Qt::RightToLeft) + if (isRightToLeft()) q->QDeclarativeFlickable::setContentX(-pos-size()); else q->QDeclarativeFlickable::setContentX(pos); @@ -2064,14 +2082,25 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie setContentHeight(-1); setFlickableDirection(HorizontalFlick); } - d->clear(); - d->setPosition(0); - refill(); + d->regenerate(); emit orientationChanged(); - d->updateCurrent(d->currentIndex); } } +/*! + \qmlproperty enumeration ListView::layoutDirection + This property holds the layout direction of the horizontal list. + + Possible values: + + \list + \o Qt.LeftToRight (default) - Items will be laid out from left to right. + \o Qt.RightToLeft - Items will be laid out from right to let. + \endlist + + \sa ListView::effectiveLayoutDirection +*/ + Qt::LayoutDirection QDeclarativeListView::layoutDirection() const { Q_D(const QDeclarativeListView); @@ -2083,15 +2112,33 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio Q_D(QDeclarativeListView); if (d->layoutDirection != layoutDirection) { d->layoutDirection = layoutDirection; - d->clear(); - d->setPosition(0); - refill(); + d->regenerate(); emit layoutDirectionChanged(); - d->updateCurrent(d->currentIndex); + emit effectiveLayoutDirectionChanged(); } } /*! + \qmlproperty enumeration ListView::effectiveLayoutDirection + This property holds the effective layout direction of the horizontal list. + + When using the attached property \l {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + the visual layout direction of the horizontal list will be mirrored. However, the + property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged. + + \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring} +*/ + +Qt::LayoutDirection QDeclarativeListView::effectiveLayoutDirection() const +{ + Q_D(const QDeclarativeListView); + if (d->effectiveLayoutMirror) + return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft; + else + return d->layoutDirection; +} + +/*! \qmlproperty bool ListView::keyNavigationWraps This property holds whether the list wraps key navigation. @@ -2671,8 +2718,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) return; if (d->model && d->model->count() && d->interactive) { - if ((d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::LeftToRight && event->key() == Qt::Key_Left) - || (d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::RightToLeft && event->key() == Qt::Key_Right) + if ((!d->isRightToLeft() && event->key() == Qt::Key_Left) + || (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Right) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) { decrementCurrentIndex(); @@ -2682,8 +2729,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) event->accept(); return; } - } else if ((d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::LeftToRight && event->key() == Qt::Key_Right) - || (d->orient == QDeclarativeListView::Horizontal && d->layoutDirection == Qt::RightToLeft && event->key() == Qt::Key_Left) + } else if ((!d->isRightToLeft() && event->key() == Qt::Key_Right) + || (d->orient == QDeclarativeListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Left) || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) { incrementCurrentIndex(); @@ -2970,7 +3017,7 @@ void QDeclarativeListView::updateSections() void QDeclarativeListView::refill() { Q_D(QDeclarativeListView); - if (layoutDirection() == Qt::RightToLeft && orientation() == QDeclarativeListView::Horizontal) + if (d->isRightToLeft()) d->refill(-d->position()-d->size()+1, -d->position()); else d->refill(d->position(), d->position()+d->size()-1); @@ -3416,11 +3463,8 @@ void QDeclarativeListView::itemsChanged(int, int) void QDeclarativeListView::modelReset() { Q_D(QDeclarativeListView); - d->clear(); - d->setPosition(0); - refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; - d->updateCurrent(d->currentIndex); + d->regenerate(); if (d->highlight && d->currentItem) { if (d->autoHighlight) d->highlight->setPosition(d->currentItem->position()); diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 6b72240..30171f8 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -113,7 +113,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) @@ -174,6 +175,7 @@ public: Qt::LayoutDirection layoutDirection() const; void setLayoutDirection(Qt::LayoutDirection); + Qt::LayoutDirection effectiveLayoutDirection() const; bool isWrapEnabled() const; void setWrapEnabled(bool); @@ -226,7 +228,8 @@ Q_SIGNALS: void countChanged(); void spacingChanged(); void orientationChanged(); - void layoutDirectionChanged(); + Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void effectiveLayoutDirectionChanged(); void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4560d32..f57f501 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -574,7 +574,7 @@ void QDeclarativeColumn::reportConflictingAnchors() \sa Grid::spacing */ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) -: QDeclarativeBasePositioner(Horizontal, parent), m_layoutDirection(Qt::LeftToRight) +: QDeclarativeBasePositioner(Horizontal, parent) { } @@ -595,20 +595,39 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) */ Qt::LayoutDirection QDeclarativeRow::layoutDirection() const { - return m_layoutDirection; + return QDeclarativeBasePositionerPrivate::getLayoutDirection(this); } void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) { - if (m_layoutDirection != layoutDirection) { - m_layoutDirection = layoutDirection; + QDeclarativeBasePositionerPrivate *d = static_cast(QDeclarativeBasePositionerPrivate::get(this)); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); + emit effectiveLayoutDirectionChanged(); } } +/*! + \qmlproperty enumeration Row::effectiveLayoutDirection + This property holds the effective layout direction of the row positioner. + + When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + the visual layout direction of the row positioner will be mirrored. However, the + property \l {Row::layoutDirection}{layoutDirection} will remain unchanged. + + \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring} +*/ + +Qt::LayoutDirection QDeclarativeRow::effectiveLayoutDirection() const +{ + return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); +} + void QDeclarativeRow::doPositioning(QSizeF *contentSize) { + QDeclarativeBasePositionerPrivate *d = static_cast(QDeclarativeBasePositionerPrivate::get(this)); int hoffset = 0; QList hoffsets; @@ -617,7 +636,7 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) if (!child.item || !child.isVisible) continue; - if(m_layoutDirection == Qt::LeftToRight){ + if(d->isLeftToRight()){ if(child.item->x() != hoffset) positionX(hoffset, child); }else{ @@ -632,7 +651,7 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) contentSize->setWidth(hoffset - spacing()); - if(m_layoutDirection == Qt::LeftToRight) + if(d->isLeftToRight()) return; //Right to Left layout @@ -786,7 +805,7 @@ void QDeclarativeRow::reportConflictingAnchors() \sa rows, columns */ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : - QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight), m_layoutDirection(Qt::LeftToRight) + QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight) { } @@ -860,11 +879,11 @@ void QDeclarativeGrid::setFlow(Flow flow) Possible values are: \list - \o Qt.LeftToRight (default) - Items are positioned beginning - from the top, left anchor. The flow direction is dependent - on the \l Grid::flow property. - \o Qt.RightToLeft - Items are positioned beginning from the - top, right anchor. The flow direction is dependent on the + \o Qt.LeftToRight (default) - Items are positioned from the top to bottom, + and left to right. The flow direction is dependent on the + \l Grid::flow property. + \o Qt.RightToLeft - Items are positioned from the top to bottom, + and right to left. The flow direction is dependent on the \l Grid::flow property. \endlist @@ -872,21 +891,39 @@ void QDeclarativeGrid::setFlow(Flow flow) */ Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const { - return m_layoutDirection; + return QDeclarativeBasePositionerPrivate::getLayoutDirection(this); } void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) { - if (m_layoutDirection != layoutDirection) { - m_layoutDirection = layoutDirection; + QDeclarativeBasePositionerPrivate *d = static_cast(QDeclarativeBasePositionerPrivate::get(this)); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); + emit effectiveLayoutDirectionChanged(); } } -void QDeclarativeGrid::doPositioning(QSizeF *contentSize) +/*! + \qmlproperty enumeration Grid::effectiveLayoutDirection + This property holds the effective layout direction of the grid positioner. + + When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + the visual layout direction of the grid positioner will be mirrored. However, the + property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged. + + \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring} +*/ + +Qt::LayoutDirection QDeclarativeGrid::effectiveLayoutDirection() const { + return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); +} +void QDeclarativeGrid::doPositioning(QSizeF *contentSize) +{ + QDeclarativeBasePositionerPrivate *d = static_cast(QDeclarativeBasePositionerPrivate::get(this)); int c = m_columns; int r = m_rows; //Is allocating the extra QPODVector too much overhead? @@ -976,7 +1013,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) end = widthSum; int xoffset=0; - if(m_layoutDirection == Qt::RightToLeft) + if(!d->isLeftToRight()) xoffset=end; int yoffset=0; int curRow =0; @@ -984,7 +1021,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) for (int i = 0; i < visibleItems.count(); ++i) { const PositionedItem &child = visibleItems.at(i); int childXOffset = xoffset; - if(m_layoutDirection == Qt::RightToLeft) + if(!d->isLeftToRight()) childXOffset -= QGraphicsItemPrivate::get(child.item)->width(); if((child.item->x()!=childXOffset)||(child.item->y()!=yoffset)){ positionX(childXOffset, child); @@ -992,7 +1029,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) } if (m_flow == LeftToRight) { - if(m_layoutDirection == Qt::LeftToRight) + if(d->isLeftToRight()) xoffset+=maxColWidth[curCol]+spacing(); else xoffset-=maxColWidth[curCol]+spacing(); @@ -1000,7 +1037,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) curCol%=c; if (!curCol){ yoffset+=maxRowHeight[curRow]+spacing(); - if(m_layoutDirection == Qt::LeftToRight) + if(d->isLeftToRight()) xoffset=0; else xoffset=end; @@ -1013,7 +1050,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) curRow++; curRow%=r; if (!curRow){ - if(m_layoutDirection == Qt::LeftToRight) + if(d->isLeftToRight()) xoffset+=maxColWidth[curCol]+spacing(); else xoffset-=maxColWidth[curCol]+spacing(); @@ -1148,12 +1185,10 @@ class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate public: QDeclarativeFlowPrivate() - : QDeclarativeBasePositionerPrivate(), flow(QDeclarativeFlow::LeftToRight), - layoutDirection(Qt::LeftToRight) + : QDeclarativeBasePositionerPrivate(), flow(QDeclarativeFlow::LeftToRight) {} QDeclarativeFlow::Flow flow; - Qt::LayoutDirection layoutDirection; }; QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent) @@ -1202,11 +1237,11 @@ void QDeclarativeFlow::setFlow(Flow flow) Possible values are: \list - \o Qt.LeftToRight (default) - Items are positioned beginning - from the top, left anchor. The flow direction is dependent - on the \l Flow::flow property. - \o Qt.RightToLeft - Items are positioned beginning from the - top, right anchor. The flow direction is dependent on the + \o Qt.LeftToRight (default) - Items are positioned from the top to bottom, + and left to right. The flow direction is dependent on the + \l Flow::flow property. + \o Qt.RightToLeft - Items are positioned from the top to bottom, + and right to left. The flow direction is dependent on the \l Flow::flow property. \endlist @@ -1226,9 +1261,26 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); + emit effectiveLayoutDirectionChanged(); } } +/*! + \qmlproperty enumeration Flow::effectiveLayoutDirection + This property holds the effective layout direction of the flow positioner. + + When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + the visual layout direction of the grid positioner will be mirrored. However, the + property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged. + + \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring} +*/ + +Qt::LayoutDirection QDeclarativeFlow::effectiveLayoutDirection() const +{ + return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); +} + void QDeclarativeFlow::doPositioning(QSizeF *contentSize) { Q_D(QDeclarativeFlow); @@ -1258,7 +1310,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) } } - if(d->layoutDirection == Qt::LeftToRight){ + if(d->isLeftToRight()){ if(child.item->x() != hoffset) positionX(hoffset, child); }else{ @@ -1281,7 +1333,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) } } - if(d->layoutDirection == Qt::LeftToRight) + if(d->isLeftToRight()) return; int end; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 55d8fa1..214c04f 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -130,20 +130,22 @@ class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeRow(QDeclarativeItem *parent=0); Qt::LayoutDirection layoutDirection() const; void setLayoutDirection (Qt::LayoutDirection); + Qt::LayoutDirection effectiveLayoutDirection() const; Q_SIGNALS: Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); virtual void reportConflictingAnchors(); private: - Qt::LayoutDirection m_layoutDirection; Q_DISABLE_COPY(QDeclarativeRow) }; @@ -154,7 +156,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - + Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -171,12 +173,14 @@ public: Qt::LayoutDirection layoutDirection() const; void setLayoutDirection (Qt::LayoutDirection); + Qt::LayoutDirection effectiveLayoutDirection() const; Q_SIGNALS: void rowsChanged(); void columnsChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -186,7 +190,6 @@ private: int m_rows; int m_columns; Flow m_flow; - Qt::LayoutDirection m_layoutDirection; Q_DISABLE_COPY(QDeclarativeGrid) }; @@ -194,8 +197,9 @@ class QDeclarativeFlowPrivate; class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner { Q_OBJECT - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) + Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeFlow(QDeclarativeItem *parent=0); @@ -206,10 +210,11 @@ public: Qt::LayoutDirection layoutDirection() const; void setLayoutDirection (Qt::LayoutDirection); - + Qt::LayoutDirection effectiveLayoutDirection() const; Q_SIGNALS: void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); + Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h index df105c6..e80129d 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h @@ -75,7 +75,7 @@ public: QDeclarativeBasePositionerPrivate() : spacing(0), type(QDeclarativeBasePositioner::None) , moveTransition(0), addTransition(0), queuedPositioning(false) - , doingPositioning(false), anchorConflict(false) + , doingPositioning(false), anchorConflict(false), layoutDirection(Qt::LeftToRight) { } @@ -100,6 +100,9 @@ public: bool doingPositioning : 1; bool anchorConflict : 1; + Qt::LayoutDirection layoutDirection; + + void schedulePositioning() { Q_Q(QDeclarativeBasePositioner); @@ -109,6 +112,18 @@ public: } } + void mirrorChange() { + Q_Q(QDeclarativeBasePositioner); + if (type != QDeclarativeBasePositioner::Vertical) + q->prePositioning(); + } + bool isLeftToRight() const { + if (type == QDeclarativeBasePositioner::Vertical) + return true; + else + return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight; + } + virtual void itemSiblingOrderChanged(QDeclarativeItem* other) { Q_UNUSED(other); @@ -139,6 +154,19 @@ public: Q_Q(QDeclarativeBasePositioner); q->positionedItems.removeOne(QDeclarativeBasePositioner::PositionedItem(item)); } + + static Qt::LayoutDirection getLayoutDirection(const QDeclarativeBasePositioner *positioner) + { + return positioner->d_func()->layoutDirection; + } + + static Qt::LayoutDirection getEffectiveLayoutDirection(const QDeclarativeBasePositioner *positioner) + { + if (positioner->d_func()->effectiveLayoutMirror) + return positioner->d_func()->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft; + else + return positioner->d_func()->layoutDirection; + } }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 79e233b..0442350 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -279,7 +279,7 @@ qreal offsetParentRTL(QDeclarativeItem *rootItem, const char * itemString) { void mirrorAnchors(QDeclarativeItem *item) { QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); - itemPrivate->anchors()->setLayoutDirection(Qt::RightToLeft); + itemPrivate->setLayoutMirror(true); } void tst_qdeclarativeanchors::basicAnchorsRTL() @@ -290,9 +290,19 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() qApp->processEvents(); QDeclarativeItem* rootItem = qobject_cast(view->rootObject()); + foreach(QObject *child, rootItem->children()) { + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + QCOMPARE(mirrored, false); + } + foreach(QObject *child, rootItem->children()) mirrorAnchors(qobject_cast(child)); + foreach(QObject *child, rootItem->children()) { + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + QCOMPARE(mirrored, true); + } + //sibling horizontal QCOMPARE(childItem(rootItem, "rect1")->x(), offsetMasterRTL(rootItem, "rect1")-26.0); QCOMPARE(childItem(rootItem, "rect2")->x(), offsetMasterRTL(rootItem, "rect2")-122.0); diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml index 164103d..69eaa47 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import QtQuick 1.1 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index 1f5943d..caa28d6 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -1,4 +1,4 @@ -import QtQuick 1.0 +import QtQuick 1.1 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativegridview/data/mirroring.qml b/tests/auto/declarative/qdeclarativegridview/data/mirroring.qml new file mode 100644 index 0000000..54de16b --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/mirroring.qml @@ -0,0 +1,43 @@ +// This example demonstrates how item positioning +// changes in right-to-left layout direction + +import QtQuick 1.1 + +Rectangle { + color: "lightgray" + width: 340 + height: 370 + + VisualItemModel { + id: itemModel + objectName: "itemModel" + Rectangle { + objectName: "item1" + height: 110; width: 120; color: "#FFFEF0" + Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item2" + height: 130; width: 150; color: "#F0FFF7" + Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item3" + height: 170; width: 190; color: "#F4F0FF" + Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + + GridView { + id: view + objectName: "view" + cellWidth: 190 + cellHeight: 170 + anchors.fill: parent + anchors.bottomMargin: 30 + model: itemModel + highlightRangeMode: "StrictlyEnforceRange" + flow: GridView.TopToBottom + flickDeceleration: 2000 + } +} diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 4fcaed6..5ced02b 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,7 @@ private slots: void modelChanges(); void positionViewAtIndex(); void positionViewAtIndex_rightToLeft(); + void mirroring(); void snapping(); void resetModel(); void enforceRange(); @@ -1347,6 +1349,67 @@ void tst_QDeclarativeGridView::snapping() } +void tst_QDeclarativeGridView::mirroring() +{ + QDeclarativeView *canvasA = createView(); + canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml")); + QDeclarativeGridView *gridviewA = findItem(canvasA->rootObject(), "view"); + QTRY_VERIFY(gridviewA != 0); + + QDeclarativeView *canvasB = createView(); + canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml")); + QDeclarativeGridView *gridviewB = findItem(canvasB->rootObject(), "view"); + QTRY_VERIFY(gridviewA != 0); + qApp->processEvents(); + + QList objectNames; + objectNames << "item1" << "item2"; // << "item3" + + gridviewA->setProperty("layoutDirection", Qt::LeftToRight); + gridviewB->setProperty("layoutDirection", Qt::RightToLeft); + QCOMPARE(gridviewA->layoutDirection(), gridviewA->effectiveLayoutDirection()); + + // LTR != RTL + foreach(const QString objectName, objectNames) + QVERIFY(findItem(gridviewA, objectName)->x() != findItem(gridviewB, objectName)->x()); + + gridviewA->setProperty("layoutDirection", Qt::LeftToRight); + gridviewB->setProperty("layoutDirection", Qt::LeftToRight); + + // LTR == LTR + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(gridviewA, objectName)->x(), findItem(gridviewB, objectName)->x()); + + QVERIFY(gridviewB->layoutDirection() == gridviewB->effectiveLayoutDirection()); + QDeclarativeItemPrivate::get(gridviewB)->setLayoutMirror(true); + QVERIFY(gridviewB->layoutDirection() != gridviewB->effectiveLayoutDirection()); + + // LTR != LTR+mirror + foreach(const QString objectName, objectNames) + QVERIFY(findItem(gridviewA, objectName)->x() != findItem(gridviewB, objectName)->x()); + + gridviewA->setProperty("layoutDirection", Qt::RightToLeft); + + // RTL == LTR+mirror + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(gridviewA, objectName)->x(), findItem(gridviewB, objectName)->x()); + + gridviewB->setProperty("layoutDirection", Qt::RightToLeft); + + // RTL != RTL+mirror + foreach(const QString objectName, objectNames) + QVERIFY(findItem(gridviewA, objectName)->x() != findItem(gridviewB, objectName)->x()); + + gridviewA->setProperty("layoutDirection", Qt::LeftToRight); + + // LTR == RTL+mirror + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(gridviewA, objectName)->x(), findItem(gridviewB, objectName)->x()); + + delete canvasA; + delete canvasB; +} + void tst_QDeclarativeGridView::positionViewAtIndex_rightToLeft() { QDeclarativeView *canvas = createView(); @@ -1535,6 +1598,7 @@ void tst_QDeclarativeGridView::enforceRange() canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); qApp->processEvents(); + QVERIFY(canvas->rootObject() != 0); QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); QTRY_VERIFY(gridview != 0); @@ -1590,6 +1654,7 @@ void tst_QDeclarativeGridView::enforceRange_rightToLeft() canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); qApp->processEvents(); + QVERIFY(canvas->rootObject() != 0); QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); QTRY_VERIFY(gridview != 0); diff --git a/tests/auto/declarative/qdeclarativeitem/data/layoutmirroring.qml b/tests/auto/declarative/qdeclarativeitem/data/layoutmirroring.qml new file mode 100644 index 0000000..866b615 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/layoutmirroring.qml @@ -0,0 +1,54 @@ +import QtQuick 1.1 + +Item { + property bool childrenInherit: true + Item { + objectName: "mirrored1" + LayoutMirroring.enabled: true + LayoutMirroring.childrenInherit: parent.childrenInherit + Item { + Item { + objectName: "notMirrored1" + LayoutMirroring.enabled: false + Item { + objectName: "inheritedMirror1" + } + } + Item { + objectName: "inheritedMirror2" + } + } + } + Item { + objectName: "mirrored2" + LayoutMirroring.enabled: true + LayoutMirroring.childrenInherit: false + Item { + objectName: "notMirrored2" + } + } + Item { + LayoutMirroring.enabled: true + LayoutMirroring.childrenInherit: true + Loader { + id: loader + } + } + states: State { + name: "newContent" + PropertyChanges { + target: loader + sourceComponent: component + } + } + Component { + id: component + Item { + objectName: "notMirrored3" + LayoutMirroring.enabled: false + Item { + objectName: "inheritedMirror3" + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 137522d..f83207c 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -66,6 +66,8 @@ private slots: void keysProcessingOrder(); void keyNavigation(); void keyNavigation_skipNotVisible(); + void layoutMirroring(); + void layoutMirroringIllegalParent(); void smooth(); void clip(); void mapCoordinates(); @@ -87,13 +89,33 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); void qtbug_16871(); - private: - template - T *findItem(QGraphicsObject *parent, const QString &objectName); QDeclarativeEngine engine; }; +template +T *findItem(QGraphicsObject *parent, const QString &objectName) +{ + if (!parent) + return 0; + + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + return static_cast(item); + item = findItem(item, objectName); + if (item) + return static_cast(item); + } + + return 0; +} + class KeysTestObject : public QObject { Q_OBJECT @@ -380,6 +402,132 @@ void tst_QDeclarativeItem::keysProcessingOrder() delete testObject; } +QDeclarativeItemPrivate *childPrivate(QGraphicsObject *rootItem, const char * itemString) +{ + QDeclarativeItem *item = findItem(rootItem, QString(QLatin1String(itemString))); + QDeclarativeItemPrivate* itemPrivate = QDeclarativeItemPrivate::get(item); + return itemPrivate; +} + +QVariant childProperty(QGraphicsObject *rootItem, const char * itemString, const char * property) +{ + QDeclarativeItem *item = findItem(rootItem, QString(QLatin1String(itemString))); + return item->property(property); +} + +bool anchorsMirrored(QGraphicsObject *rootItem, const char * itemString) +{ + QDeclarativeItem *item = findItem(rootItem, QString(QLatin1String(itemString))); + QDeclarativeItemPrivate* itemPrivate = QDeclarativeItemPrivate::get(item); + return itemPrivate->anchors()->mirrored(); +} + +void tst_QDeclarativeItem::layoutMirroring() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/layoutmirroring.qml")); + canvas->show(); + + QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); + QVERIFY(rootItem); + QDeclarativeItemPrivate *rootPrivate = QDeclarativeItemPrivate::get(rootItem); + QVERIFY(rootPrivate); + + QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "mirrored2")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "notMirrored2")->effectiveLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, true); + + QCOMPARE(anchorsMirrored(rootItem, "mirrored1"), true); + QCOMPARE(anchorsMirrored(rootItem, "mirrored2"), true); + QCOMPARE(anchorsMirrored(rootItem, "notMirrored1"), false); + QCOMPARE(anchorsMirrored(rootItem, "notMirrored2"), false); + QCOMPARE(anchorsMirrored(rootItem, "inheritedMirror1"), true); + QCOMPARE(anchorsMirrored(rootItem, "inheritedMirror2"), true); + + QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritedLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritedLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true); + + QCOMPARE(childPrivate(rootItem, "mirrored1")->isMirrorImplicit, false); + QCOMPARE(childPrivate(rootItem, "mirrored2")->isMirrorImplicit, false); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->isMirrorImplicit, false); + QCOMPARE(childPrivate(rootItem, "notMirrored2")->isMirrorImplicit, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->isMirrorImplicit, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->isMirrorImplicit, true); + + QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritMirrorFromParent, true); + QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritMirrorFromParent, false); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritMirrorFromParent, true); + QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritMirrorFromParent, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritMirrorFromParent, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritMirrorFromParent, true); + + QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritMirrorFromItem, true); + QCOMPARE(childPrivate(rootItem, "mirrored2")->inheritMirrorFromItem, false); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritMirrorFromItem, false); + QCOMPARE(childPrivate(rootItem, "notMirrored2")->inheritMirrorFromItem, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritMirrorFromItem, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritMirrorFromItem, false); + + // load dynamic content using Loader that needs to inherit mirroring + rootItem->setProperty("state", "newContent"); + QCOMPARE(childPrivate(rootItem, "notMirrored3")->effectiveLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->effectiveLayoutMirror, true); + + QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->inheritedLayoutMirror, true); + + QCOMPARE(childPrivate(rootItem, "notMirrored3")->isMirrorImplicit, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->isMirrorImplicit, true); + + QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromParent, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror3")->inheritMirrorFromParent, true); + + QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromItem, false); + QCOMPARE(childPrivate(rootItem, "notMirrored3")->inheritMirrorFromItem, false); + + // disable inheritance + rootItem->setProperty("childrenInherit", false); + + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false); + + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, false); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, false); + + // re-enable inheritance + rootItem->setProperty("childrenInherit", true); + + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "mirrored1")->effectiveLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->effectiveLayoutMirror, false); + + QCOMPARE(childPrivate(rootItem, "inheritedMirror1")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true); + QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true); +} + +void tst_QDeclarativeItem::layoutMirroringIllegalParent() +{ + QDeclarativeComponent component(&engine); + component.setData("import QtQuick 1.1; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile("")); + QTest::ignoreMessage(QtWarningMsg, "file::1:21: QML QtObject: LayoutDirection attached property only works with Items"); + QObject *object = component.create(); + QVERIFY(object != 0); +} + void tst_QDeclarativeItem::keyNavigation() { QDeclarativeView *canvas = new QDeclarativeView(0); @@ -1003,32 +1151,6 @@ void tst_QDeclarativeItem::qtbug_16871() delete o; } - -template -T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) -{ - if (!parent) - return 0; - - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->QGraphicsObject::children().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QDeclarativeItem *item = qobject_cast(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) - return static_cast(item); - item = findItem(item, objectName); - if (item) - return static_cast(item); - } - - return 0; -} - - - QTEST_MAIN(tst_QDeclarativeItem) #include "tst_qdeclarativeitem.moc" diff --git a/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml index e31d923..1e92bb3 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/rightToLeft.qml @@ -1,11 +1,11 @@ -// This example demonstrates placing items in a view using -// a VisualItemModel +// This example demonstrates how item positioning +// changes in right-to-left layout direction -import QtQuick 1.0 +import QtQuick 1.1 Rectangle { color: "lightgray" - width: 240 + width: 640 height: 320 VisualItemModel { diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 02c8dad..bba86c3 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,7 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); void rightToLeft(); + void test_mirroring(); private: template void items(); @@ -1697,8 +1699,6 @@ void tst_QDeclarativeListView::manualHighlight() QDeclarativeView *canvas = new QDeclarativeView(0); canvas->setFixedSize(240,320); - QDeclarativeContext *ctxt = canvas->rootContext(); - QString filename(SRCDIR "/data/manual-highlight.qml"); canvas->setSource(QUrl::fromLocalFile(filename)); @@ -1829,8 +1829,6 @@ void tst_QDeclarativeListView::header() TestModel model; - QDeclarativeContext *ctxt = canvas->rootContext(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header1.qml")); qApp->processEvents(); @@ -2303,10 +2301,10 @@ void tst_QDeclarativeListView::testQtQuick11Attributes_data() void tst_QDeclarativeListView::rightToLeft() { QDeclarativeView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); qApp->processEvents(); + QVERIFY(canvas->rootObject() != 0); QDeclarativeListView *listview = findItem(canvas->rootObject(), "view"); QTRY_VERIFY(listview != 0); @@ -2341,6 +2339,67 @@ void tst_QDeclarativeListView::rightToLeft() delete canvas; } +void tst_QDeclarativeListView::test_mirroring() +{ + QDeclarativeView *canvasA = createView(); + canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + QDeclarativeListView *listviewA = findItem(canvasA->rootObject(), "view"); + QTRY_VERIFY(listviewA != 0); + + QDeclarativeView *canvasB = createView(); + canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + QDeclarativeListView *listviewB = findItem(canvasB->rootObject(), "view"); + QTRY_VERIFY(listviewA != 0); + qApp->processEvents(); + + QList objectNames; + objectNames << "item1" << "item2"; // << "item3" + + listviewA->setProperty("layoutDirection", Qt::LeftToRight); + listviewB->setProperty("layoutDirection", Qt::RightToLeft); + QCOMPARE(listviewA->layoutDirection(), listviewA->effectiveLayoutDirection()); + + // LTR != RTL + foreach(const QString objectName, objectNames) + QVERIFY(findItem(listviewA, objectName)->x() != findItem(listviewB, objectName)->x()); + + listviewA->setProperty("layoutDirection", Qt::LeftToRight); + listviewB->setProperty("layoutDirection", Qt::LeftToRight); + + // LTR == LTR + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(listviewA, objectName)->x(), findItem(listviewB, objectName)->x()); + + QVERIFY(listviewB->layoutDirection() == listviewB->effectiveLayoutDirection()); + QDeclarativeItemPrivate::get(listviewB)->setLayoutMirror(true); + QVERIFY(listviewB->layoutDirection() != listviewB->effectiveLayoutDirection()); + + // LTR != LTR+mirror + foreach(const QString objectName, objectNames) + QVERIFY(findItem(listviewA, objectName)->x() != findItem(listviewB, objectName)->x()); + + listviewA->setProperty("layoutDirection", Qt::RightToLeft); + + // RTL == LTR+mirror + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(listviewA, objectName)->x(), findItem(listviewB, objectName)->x()); + + listviewB->setProperty("layoutDirection", Qt::RightToLeft); + + // RTL != RTL+mirror + foreach(const QString objectName, objectNames) + QVERIFY(findItem(listviewA, objectName)->x() != findItem(listviewB, objectName)->x()); + + listviewA->setProperty("layoutDirection", Qt::LeftToRight); + + // LTR == RTL+mirror + foreach(const QString objectName, objectNames) + QCOMPARE(findItem(listviewA, objectName)->x(), findItem(listviewB, objectName)->x()); + + delete canvasA; + delete canvasB; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml deleted file mode 100644 index 0ec1f37..0000000 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml +++ /dev/null @@ -1,41 +0,0 @@ -import QtQuick 1.1 - -Item { - width: 640 - height: 480 - Grid { - objectName: "grid" - columns: 3 - layoutDirection: Qt.RightToLeft - Rectangle { - objectName: "one" - color: "red" - width: 50 - height: 50 - } - Rectangle { - objectName: "two" - color: "green" - width: 20 - height: 50 - } - Rectangle { - objectName: "three" - color: "blue" - width: 50 - height: 20 - } - Rectangle { - objectName: "four" - color: "cyan" - width: 50 - height: 50 - } - Rectangle { - objectName: "five" - color: "magenta" - width: 10 - height: 10 - } - } -} diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml index f3b17dd..929b726 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml @@ -1,9 +1,11 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 640 height: 480 + property bool testRightToLeft: false Grid { + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight objectName: "grid" columns: 3 Rectangle { @@ -21,7 +23,7 @@ Item { Rectangle { objectName: "three" color: "blue" - width: 50 + width: 30 height: 20 } Rectangle { diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml index e1a9652..d35c02d 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml @@ -4,7 +4,6 @@ Item { width: 640 height: 480 property bool testRightToLeft: false - Row { objectName: "row" layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 40e533d..92ab722 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include "../../../shared/util.h" @@ -87,6 +88,7 @@ private slots: void test_flow_implicit_resize(); void test_conflictinganchors(); void test_vertical_qgraphicswidget(); + void test_mirroring(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); private: @@ -452,7 +454,7 @@ void tst_QDeclarativePositioners::test_grid() QDeclarativeGrid *grid = canvas->rootObject()->findChild("grid"); QCOMPARE(grid->flow(), QDeclarativeGrid::LeftToRight); - QCOMPARE(grid->width(), 120.0); + QCOMPARE(grid->width(), 100.0); QCOMPARE(grid->height(), 100.0); delete canvas; @@ -494,7 +496,9 @@ void tst_QDeclarativePositioners::test_grid_topToBottom() void tst_QDeclarativePositioners::test_grid_rightToLeft() { - QDeclarativeView *canvas = createView(SRCDIR "/data/grid-righttoleft.qml"); + QDeclarativeView *canvas = createView(SRCDIR "/data/gridtest.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -507,20 +511,20 @@ void tst_QDeclarativePositioners::test_grid_rightToLeft() QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); QVERIFY(five != 0); - QCOMPARE(one->x(), 70.0); + QCOMPARE(one->x(), 50.0); QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 50.0); + QCOMPARE(two->x(), 30.0); QCOMPARE(two->y(), 0.0); QCOMPARE(three->x(), 0.0); QCOMPARE(three->y(), 0.0); - QCOMPARE(four->x(), 70.0); + QCOMPARE(four->x(), 50.0); QCOMPARE(four->y(), 50.0); - QCOMPARE(five->x(), 60.0); + QCOMPARE(five->x(), 40.0); QCOMPARE(five->y(), 50.0); QDeclarativeGrid *grid = canvas->rootObject()->findChild("grid"); QCOMPARE(grid->layoutDirection(), Qt::RightToLeft); - QCOMPARE(grid->width(), 120.0); + QCOMPARE(grid->width(), 100.0); QCOMPARE(grid->height(), 100.0); delete canvas; @@ -1198,6 +1202,66 @@ void tst_QDeclarativePositioners::test_vertical_qgraphicswidget() delete canvas; } +void tst_QDeclarativePositioners::test_mirroring() +{ + QList qmlFiles; + qmlFiles << "horizontal.qml" << "gridtest.qml" << "flowtest.qml"; + QList objectNames; + objectNames << "one" << "two" << "three" << "four" << "five"; + + foreach(const QString qmlFile, qmlFiles) { + QDeclarativeView *canvasA = createView(QString(SRCDIR) + "/data/" + qmlFile); + QDeclarativeItem *rootA = qobject_cast(canvasA->rootObject()); + + QDeclarativeView *canvasB = createView(QString(SRCDIR) + "/data/" + qmlFile); + QDeclarativeItem *rootB = qobject_cast(canvasB->rootObject()); + + rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft + + // LTR != RTL + foreach(const QString objectName, objectNames) { + // horizontal.qml only has three items + if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) + break; + QDeclarativeItem *itemA = rootA->findChild(objectName); + QDeclarativeItem *itemB = rootB->findChild(objectName); + QVERIFY(itemA->x() != itemB->x()); + } + + QDeclarativeItemPrivate* rootPrivateB = QDeclarativeItemPrivate::get(rootB); + + rootPrivateB->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true + rootPrivateB->isMirrorImplicit = false; + rootPrivateB->inheritMirrorFromItem = true; // LayoutMirroring.childrenInherit: true + rootPrivateB->resolveLayoutMirror(); + + // RTL == mirror + foreach(const QString objectName, objectNames) { + // horizontal.qml only has three items + if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) + break; + QDeclarativeItem *itemA = rootA->findChild(objectName); + QDeclarativeItem *itemB = rootB->findChild(objectName); + QCOMPARE(itemA->x(), itemB->x()); + } + + rootA->setProperty("testRightToLeft", false); // layoutDirection: Qt.LeftToRight + rootB->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft + + // LTR == RTL + mirror + foreach(const QString objectName, objectNames) { + // horizontal.qml only has three items + if (qmlFile == QString("horizontal.qml") && objectName == QString("four")) + break; + QDeclarativeItem *itemA = rootA->findChild(objectName); + QDeclarativeItem *itemB = rootB->findChild(objectName); + QCOMPARE(itemA->x(), itemB->x()); + } + delete canvasA; + delete canvasB; + } +} + void tst_QDeclarativePositioners::testQtQuick11Attributes() { QFETCH(QString, code); diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 2220b6d..20e2640 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -818,7 +818,7 @@ void tst_qdeclarativestates::anchorChanges5() void mirrorAnchors(QDeclarativeItem *item) { QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); - itemPrivate->anchors()->setLayoutDirection(Qt::RightToLeft); + itemPrivate->setLayoutMirror(true); } qreal offsetRTL(QDeclarativeItem *anchorItem, QDeclarativeItem *item) { -- cgit v0.12 From d5c72c6fb75357061c5f9e0d0d2efdaff9140741 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 1 Mar 2011 12:57:14 +1000 Subject: Reverse KeyNavigation left and right properties when the layout mirroring is enabled Task-number: QTBUG-15882 Reviewed-by: Martin Jones Change-Id: I4c9f0b48e089b30ced5e7fefa5d6e97b3155f3b2 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 32 +++++++++---- .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 54 ++++++++++++++++++++++ 2 files changed, 76 insertions(+), 10 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index d16025d..867a16d 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -615,19 +615,28 @@ void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event, bool post) return; } + bool mirror = false; switch(event->key()) { - case Qt::Key_Left: - if (d->left) { - setFocusNavigation(d->left, "left"); + case Qt::Key_Left: { + if (QDeclarativeItem *parentItem = qobject_cast(parent())) + mirror = QDeclarativeItemPrivate::get(parentItem)->effectiveLayoutMirror; + QDeclarativeItem* leftItem = mirror ? d->right : d->left; + if (leftItem) { + setFocusNavigation(leftItem, mirror ? "right" : "left"); event->accept(); } break; - case Qt::Key_Right: - if (d->right) { - setFocusNavigation(d->right, "right"); + } + case Qt::Key_Right: { + if (QDeclarativeItem *parentItem = qobject_cast(parent())) + mirror = QDeclarativeItemPrivate::get(parentItem)->effectiveLayoutMirror; + QDeclarativeItem* rightItem = mirror ? d->left : d->right; + if (rightItem) { + setFocusNavigation(rightItem, mirror ? "left" : "right"); event->accept(); } break; + } case Qt::Key_Up: if (d->up) { setFocusNavigation(d->up, "up"); @@ -669,16 +678,19 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) return; } + bool mirror = false; switch(event->key()) { case Qt::Key_Left: - if (d->left) { + if (QDeclarativeItem *parentItem = qobject_cast(parent())) + mirror = QDeclarativeItemPrivate::get(parentItem)->effectiveLayoutMirror; + if (mirror ? d->right : d->left) event->accept(); - } break; case Qt::Key_Right: - if (d->right) { + if (QDeclarativeItem *parentItem = qobject_cast(parent())) + mirror = QDeclarativeItemPrivate::get(parentItem)->effectiveLayoutMirror; + if (mirror ? d->left : d->right) event->accept(); - } break; case Qt::Key_Up: if (d->up) { diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index f83207c..2d14e66 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -65,6 +65,7 @@ private slots: void keys(); void keysProcessingOrder(); void keyNavigation(); + void keyNavigation_RightToLeft(); void keyNavigation_skipNotVisible(); void layoutMirroring(); void layoutMirroringIllegalParent(); @@ -608,6 +609,59 @@ void tst_QDeclarativeItem::keyNavigation() delete canvas; } +void tst_QDeclarativeItem::keyNavigation_RightToLeft() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml")); + canvas->show(); + qApp->processEvents(); + + QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); + QVERIFY(rootItem); + QDeclarativeItemPrivate* rootItemPrivate = QDeclarativeItemPrivate::get(rootItem); + + rootItemPrivate->effectiveLayoutMirror = true; // LayoutMirroring.mirror: true + rootItemPrivate->isMirrorImplicit = false; + rootItemPrivate->inheritMirrorFromItem = true; // LayoutMirroring.inherit: true + rootItemPrivate->resolveLayoutMirror(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QDeclarativeItem *item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + QVariant result; + QVERIFY(QMetaObject::invokeMethod(canvas->rootObject(), "verify", + Q_RETURN_ARG(QVariant, result))); + QVERIFY(result.toBool()); + + // right + QKeyEvent key(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item2"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // left + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + delete canvas; +} + void tst_QDeclarativeItem::keyNavigation_skipNotVisible() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 88253db8a7d7910e1393b1948fb3747117538c92 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 1 Mar 2011 12:51:27 +1000 Subject: Make sure horizontal QML editor text aligment always returns the actual alignment Also, implicit empty text alignment now follows the Application's default layout direction traditionally set by the locale. Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: I88340513d489290bafd393072786a19731097b77 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 67 +++++++++++++------- src/declarative/graphicsitems/qdeclarativetext_p.h | 3 +- .../graphicsitems/qdeclarativetext_p_p.h | 2 + .../graphicsitems/qdeclarativetextedit.cpp | 52 ++++++++++++++- .../graphicsitems/qdeclarativetextedit_p.h | 3 +- .../graphicsitems/qdeclarativetextedit_p_p.h | 7 ++- .../graphicsitems/qdeclarativetextinput.cpp | 73 +++++++++++++++++----- .../graphicsitems/qdeclarativetextinput_p.h | 3 +- .../graphicsitems/qdeclarativetextinput_p_p.h | 24 +++---- .../qdeclarativetext/tst_qdeclarativetext.cpp | 34 ++++++++-- .../tst_qdeclarativetextedit.cpp | 37 +++++++++-- .../tst_qdeclarativetextinput.cpp | 37 ++++++++++- 12 files changed, 274 insertions(+), 68 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 4c6c34f..af7e4a1 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -97,17 +97,18 @@ DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE); QString QDeclarativeTextPrivate::elideChar = QString(0x2026); QDeclarativeTextPrivate::QDeclarativeTextPrivate() -: color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), +: color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineHeight(1), - lineHeightMode(QDeclarativeText::ProportionalHeight), - lineCount(1), truncated(false), maximumLineCount(INT_MAX), + lineHeightMode(QDeclarativeText::ProportionalHeight), lineCount(1), truncated(false), maximumLineCount(INT_MAX), maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false), - cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), naturalWidth(0), doc(0) + cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), hAlignImplicit(true), naturalWidth(0), doc(0) { cacheAllTextAsImage = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; + if (QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeText::AlignRight; } QTextDocumentWithImageResources::QTextDocumentWithImageResources(QDeclarativeText *parent) @@ -211,6 +212,21 @@ qreal QDeclarativeTextPrivate::implicitWidth() const return mImplicitWidth; } +void QDeclarativeTextPrivate::determineHorizontalAlignment() +{ + Q_Q(QDeclarativeText); + if (hAlignImplicit && q->isComponentComplete()) { + // if no explicit alignment has been set, follow the natural layout direction of the text + QDeclarativeText::HAlignment previousAlign = hAlign; + if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeText::AlignRight; + else + hAlign = text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft; + if (previousAlign != hAlign) + emit q->horizontalAlignmentChanged(hAlign); + } +} + void QDeclarativeTextPrivate::updateLayout() { Q_Q(QDeclarativeText); @@ -367,17 +383,6 @@ QSize QDeclarativeTextPrivate::setupTextLayout() textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); layout.setTextOption(textOption); - QDeclarativeText::HAlignment hAlignment = hAlign; - if(text.isRightToLeft()) { - if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { - hAlignment = QDeclarativeText::AlignRight; - } else if (hAlign == QDeclarativeText::AlignRight) { - hAlignment = QDeclarativeText::AlignLeft; - } else { - hAlignment = hAlign; - } - } - bool elideText = false; bool truncate = false; @@ -423,10 +428,10 @@ QSize QDeclarativeTextPrivate::setupTextLayout() // Need to correct for alignment line.setLineWidth(lineWidth-elideWidth); int x = line.naturalTextWidth(); - if (hAlignment == QDeclarativeText::AlignRight) { + if (hAlign == QDeclarativeText::AlignRight) { x = q->width()-elideWidth; - } else if (hAlignment == QDeclarativeText::AlignHCenter) { - x = (q->width()+line.naturalTextWidth()-elideWidth)/2; + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (q->width()+line.naturalTextWidth() - elideWidth)/2; } elidePos = QPointF(x, y + fm.ascent()); elideText = true; @@ -472,13 +477,13 @@ QSize QDeclarativeTextPrivate::setupTextLayout() height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; if (!cacheAllTextAsImage) { - if ((hAlignment == QDeclarativeText::AlignLeft) || (hAlignment == QDeclarativeText::AlignJustify)) { + if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { x = 0; - } else if (hAlignment == QDeclarativeText::AlignRight) { + } else if (hAlign == QDeclarativeText::AlignRight) { x = layoutWidth - line.naturalTextWidth(); if (elideText && i == layout.lineCount()-1) x -= elideWidth; // Correct for when eliding multilines - } else if (hAlignment == QDeclarativeText::AlignHCenter) { + } else if (hAlign == QDeclarativeText::AlignHCenter) { x = (layoutWidth - line.naturalTextWidth()) / 2; if (elideText && i == layout.lineCount()-1) x -= elideWidth/2; // Correct for when eliding multilines @@ -946,6 +951,7 @@ void QDeclarativeText::setText(const QString &n) } d->text = n; + d->determineHorizontalAlignment(); d->updateLayout(); emit textChanged(d->text); @@ -1064,7 +1070,9 @@ void QDeclarativeText::setStyleColor(const QColor &color) \qmlproperty enumeration Text::verticalAlignment Sets the horizontal and vertical alignment of the text within the Text items - width and height. By default, the text is top-left aligned. + width and height. By default, the text is vertically aligned to the top. Horizontal + alignment follows the natural alignment of the text, for example text that is read + from left to right will be aligned to the left. The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight, \c Text.AlignHCenter and \c Text.AlignJustify. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom @@ -1084,6 +1092,7 @@ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const void QDeclarativeText::setHAlign(HAlignment align) { Q_D(QDeclarativeText); + d->hAlignImplicit = false; if (d->hAlign == align) return; @@ -1096,6 +1105,19 @@ void QDeclarativeText::setHAlign(HAlignment align) emit horizontalAlignmentChanged(align); } +void QDeclarativeText::resetHAlign() +{ + Q_D(QDeclarativeText); + d->hAlignImplicit = true; + QDeclarativeText::HAlignment oldAlignment = d->hAlign; + d->determineHorizontalAlignment(); + if (oldAlignment != d->hAlign) { + prepareGeometryChange(); + d->updateLayout(); + emit horizontalAlignmentChanged(d->hAlign); + } +} + QDeclarativeText::VAlignment QDeclarativeText::vAlign() const { Q_D(const QDeclarativeText); @@ -1556,6 +1578,7 @@ void QDeclarativeText::componentComplete() QDeclarativeItem::componentComplete(); if (d->updateOnComponentComplete) { d->updateOnComponentComplete = false; + d->determineHorizontalAlignment(); if (d->richText) { d->ensureDoc(); d->doc->setText(d->text); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index b8835d1..92c2eab 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -69,7 +69,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -133,6 +133,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); + void resetHAlign(); VAlignment vAlign() const; void setVAlign(VAlignment align); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 36ae123..6886d91 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -76,6 +76,7 @@ public: void updateSize(); void updateLayout(); + void determineHorizontalAlignment(); QString text; QFont font; @@ -110,6 +111,7 @@ public: bool cacheAllTextAsImage:1; bool internalWidthUpdate:1; bool requireImplicitWidth:1; + bool hAlignImplicit:1; QSize layedOutTextSize; QSize paintedSize; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 87a49bd..35716d0 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -249,6 +249,7 @@ void QDeclarativeTextEdit::setText(const QString &text) Q_D(QDeclarativeTextEdit); if (QDeclarativeTextEdit::text() == text) return; + d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text)); if (d->richText) { #ifndef QT_NO_TEXTHTMLPARSER @@ -457,7 +458,9 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \qmlproperty enumeration TextEdit::verticalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit item's - width and height. By default, the text is top-left aligned. + width and height. By default, the text alignment follows the natural alignment + of the text, for example text that is read from left to right will be aligned to + the left. Valid values for \c horizontalAlignment are: \list @@ -483,6 +486,7 @@ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const void QDeclarativeTextEdit::setHAlign(QDeclarativeTextEdit::HAlignment alignment) { Q_D(QDeclarativeTextEdit); + d->hAlignImplicit = false; if (alignment == d->hAlign) return; d->hAlign = alignment; @@ -491,6 +495,19 @@ void QDeclarativeTextEdit::setHAlign(QDeclarativeTextEdit::HAlignment alignment) emit horizontalAlignmentChanged(d->hAlign); } +void QDeclarativeTextEdit::resetHAlign() +{ + Q_D(QDeclarativeTextEdit); + d->hAlignImplicit = true; + QDeclarativeTextEdit::HAlignment oldAlignment = d->hAlign; + d->determineHorizontalAlignment(); + if (oldAlignment != d->hAlign) { + d->updateDefaultTextOption(); + updateSize(); + + } +} + QDeclarativeTextEdit::VAlignment QDeclarativeTextEdit::vAlign() const { Q_D(const QDeclarativeTextEdit); @@ -948,6 +965,8 @@ void QDeclarativeTextEdit::componentComplete() Q_D(QDeclarativeTextEdit); QDeclarativePaintedItem::componentComplete(); if (d->dirty) { + d->determineHorizontalAlignment(); + d->updateDefaultTextOption(); updateSize(); d->dirty = false; } @@ -1438,6 +1457,9 @@ void QDeclarativeTextEditPrivate::init() document->setDocumentMargin(textMargin); document->setUndoRedoEnabled(false); // flush undo buffer. document->setUndoRedoEnabled(true); + + if (QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeTextEdit::AlignRight; updateDefaultTextOption(); } @@ -1445,6 +1467,9 @@ void QDeclarativeTextEdit::q_textChanged() { Q_D(QDeclarativeTextEdit); d->text = text(); + d->rightToLeftText = d->text.isRightToLeft(); + d->determineHorizontalAlignment(); + d->updateDefaultTextOption(); updateSize(); updateTotalLines(); updateMicroFocus(); @@ -1461,6 +1486,21 @@ void QDeclarativeTextEdit::moveCursorDelegate() d->cursor->setY(cursorRect.y()); } +void QDeclarativeTextEditPrivate::determineHorizontalAlignment() +{ + Q_Q(QDeclarativeTextEdit); + if (hAlignImplicit && q->isComponentComplete()) { + // if no explicit alignment has been set, follow the natural layout direction of the text + QDeclarativeTextEdit::HAlignment previousAlign = hAlign; + if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeTextEdit::AlignRight; + else + hAlign = rightToLeftText ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft; + if (previousAlign != hAlign) + emit q->horizontalAlignmentChanged(hAlign); + } +} + void QDeclarativeTextEditPrivate::updateSelection() { Q_Q(QDeclarativeTextEdit); @@ -1611,7 +1651,15 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() { QTextOption opt = document->defaultTextOption(); int oldAlignment = opt.alignment(); - opt.setAlignment((Qt::Alignment)(int)(hAlign | vAlign)); + + QDeclarativeTextEdit::HAlignment horizontalAlignment = hAlign; + if (rightToLeftText) { + if (hAlign == QDeclarativeTextEdit::AlignLeft) + horizontalAlignment = QDeclarativeTextEdit::AlignRight; + else if (hAlign == QDeclarativeTextEdit::AlignRight) + horizontalAlignment = QDeclarativeTextEdit::AlignLeft; + } + opt.setAlignment((Qt::Alignment)(int)(horizontalAlignment | vAlign)); QTextOption::WrapMode oldWrapMode = opt.wrapMode(); opt.setWrapMode(QTextOption::WrapMode(wrapMode)); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 7785a7a..c7dc2f6 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -72,7 +72,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor NOTIFY selectionColorChanged) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -152,6 +152,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); + void resetHAlign(); VAlignment vAlign() const; void setVAlign(VAlignment align); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 111cc02..f4a6c0e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -71,8 +71,8 @@ public: : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false), - textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), - format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap), + hAlignImplicit(true), rightToLeftText(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), + cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap), mouseSelectionMode(QDeclarativeTextEdit::SelectCharacters), selectByMouse(false), canPaste(false), yoff(0) { @@ -88,6 +88,7 @@ public: void updateDefaultTextOption(); void relayoutDocument(); void updateSelection(); + void determineHorizontalAlignment(); qreal implicitWidth() const; void focusChanged(bool); @@ -112,6 +113,8 @@ public: bool clickCausedFocus : 1; bool persistentSelection : 1; bool requireImplicitWidth:1; + bool hAlignImplicit:1; + bool rightToLeftText:1; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index e7c2ac7..adc2860 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -327,7 +327,9 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) \qmlproperty enumeration TextInput::horizontalAlignment Sets the horizontal alignment of the text within the TextInput item's - width and height. By default, the text is left aligned. + width and height. By default, the text alignment follows the natural alignment + of the text, for example text that is read from left to right will be aligned to + the left. TextInput does not have vertical alignment, as the natural height is exactly the height of the single line of text. If you set the height @@ -347,7 +349,8 @@ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const void QDeclarativeTextInput::setHAlign(HAlignment align) { Q_D(QDeclarativeTextInput); - if(align == d->hAlign) + d->hAlignImplicit = false; + if(align == d->hAlign || align > QDeclarativeTextInput::AlignHCenter) // justify not supported return; d->hAlign = align; updateRect(); @@ -355,6 +358,19 @@ void QDeclarativeTextInput::setHAlign(HAlignment align) emit horizontalAlignmentChanged(d->hAlign); } +void QDeclarativeTextInput::resetHAlign() +{ + Q_D(QDeclarativeTextInput); + d->hAlignImplicit = true; + QDeclarativeTextInput::HAlignment oldAlignment = d->hAlign; + d->determineHorizontalAlignment(); + if (oldAlignment != d->hAlign) { + updateRect(); + d->updateHorizontalScroll(); + emit horizontalAlignmentChanged(d->hAlign); + } +} + /*! \qmlproperty bool TextInput::readOnly @@ -961,16 +977,21 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) keyPressPreHandler(ev); if (ev->isAccepted()) return; - if (((ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier) // Don't allow MacOSX up/down support, and we don't allow a completer. - || (((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) - || (d->control->cursor() == d->control->text().length() - && ev->key() == Qt::Key_Right)) - && (d->lastSelectionStart == d->lastSelectionEnd))) - { - //ignore when moving off the end - //unless there is a selection, because then moving will do something (deselect) + + // Don't allow MacOSX up/down support, and we don't allow a completer. + bool ignore = (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier; + if (!ignore && (d->lastSelectionStart == d->lastSelectionEnd) && (ev->key() == Qt::Key_Right || ev->key() == Qt::Key_Left)) { + // Ignore when moving off the end unless there is a selection, + // because then moving will do something (deselect). + int cursorPosition = d->control->cursor(); + if (cursorPosition == 0) + ignore = ev->key() == (d->control->text().mid(cursorPosition,1).isRightToLeft() ? Qt::Key_Right : Qt::Key_Left); + if (cursorPosition == d->control->text().length()) + ignore = ev->key() == (d->control->text().mid(cursorPosition-1,1).isRightToLeft() ? Qt::Key_Left : Qt::Key_Right); + } + if (ignore) { ev->ignore(); - }else{ + } else { d->control->processKeyEvent(ev); } if (!ev->isAccepted()) @@ -1129,11 +1150,11 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() int cix = qRound(control->cursorToX(control->cursor() + preeditLength)); QRect br(q->boundingRect().toRect()); int widthUsed = calculateTextWidth(); - Qt::Alignment va = QStyle::visualAlignment(control->layoutDirection(), QFlag(Qt::Alignment(hAlign))); + if (autoScroll) { if (widthUsed <= br.width()) { // text fits in br; use hscroll for alignment - switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { + switch (hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { case Qt::AlignRight: hscroll = widthUsed - br.width() - 1; break; @@ -1165,11 +1186,11 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() hscroll = cix; } } else { - switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { - case Qt::AlignRight: + switch (hAlign) { + case QDeclarativeTextInput::AlignRight: hscroll = q->width() - widthUsed; break; - case Qt::AlignHCenter: + case QDeclarativeTextInput::AlignHCenter: hscroll = (q->width() - widthUsed) / 2; break; default: @@ -1180,6 +1201,22 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() } } +void QDeclarativeTextInputPrivate::determineHorizontalAlignment() +{ + Q_Q(QDeclarativeTextInput); + if (hAlignImplicit) { + QString text = control->text(); + // if no explicit alignment has been set, follow the natural layout direction of the text + QDeclarativeTextInput::HAlignment previousAlign = hAlign; + if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeTextInput::AlignRight; + else + hAlign = text.isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft; + if (previousAlign != hAlign) + emit q->horizontalAlignmentChanged(hAlign); + } +} + void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r) { Q_D(QDeclarativeTextInput); @@ -1671,6 +1708,9 @@ void QDeclarativeTextInputPrivate::init() QPalette p = control->palette(); selectedTextColor = p.color(QPalette::HighlightedText); selectionColor = p.color(QPalette::Highlight); + + if (QApplication::layoutDirection() == Qt::RightToLeft) + hAlign = QDeclarativeTextInput::AlignRight; } void QDeclarativeTextInput::cursorPosChanged() @@ -1719,6 +1759,7 @@ void QDeclarativeTextInput::q_textChanged() Q_D(QDeclarativeTextInput); updateSize(); d->updateHorizontalScroll(); + d->determineHorizontalAlignment(); updateMicroFocus(); emit textChanged(); emit displayTextChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index e1e66a9..a3e8d29 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -70,7 +70,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor NOTIFY selectionColorChanged) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) - Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) @@ -146,6 +146,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); + void resetHAlign(); bool isReadOnly() const; void setReadOnly(bool); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index f7446b4..321d124 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -74,9 +74,9 @@ public: color((QRgb)0), style(QDeclarativeText::Normal), styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft), mouseSelectionMode(QDeclarativeTextInput::SelectCharacters), - hscroll(0), oldScroll(0), focused(false), focusOnPress(true), + hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true), showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false), - autoScroll(true), selectByMouse(false), canPaste(false) + autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true) { #ifdef Q_OS_SYMBIAN if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { @@ -103,6 +103,7 @@ public: void startCreatingCursor(); void focusChanged(bool hasFocus); void updateHorizontalScroll(); + void determineHorizontalAlignment(); int calculateTextWidth(); QLineControl* control; @@ -124,17 +125,18 @@ public: int lastSelectionEnd; int oldHeight; int oldWidth; - bool oldValidity; int hscroll; int oldScroll; - bool focused; - bool focusOnPress; - bool showInputPanelOnFocus; - bool clickCausedFocus; - bool cursorVisible; - bool autoScroll; - bool selectByMouse; - bool canPaste; + bool oldValidity:1; + bool focused:1; + bool focusOnPress:1; + bool showInputPanelOnFocus:1; + bool clickCausedFocus:1; + bool cursorVisible:1; + bool autoScroll:1; + bool selectByMouse:1; + bool canPaste:1; + bool hAlignImplicit:1; static inline QDeclarativeTextInputPrivate *get(QDeclarativeTextInput *t) { return t->d_func(); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 05546cb..33c8b89 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -517,18 +517,44 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QDeclarativeTextPrivate *textPrivate = QDeclarativeTextPrivate::get(text); QVERIFY(textPrivate != 0); + // implicit alignment should follow the reading direction of RTL text + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); - // "Right" aligned + // explicitly left aligned + text->setHAlign(QDeclarativeText::AlignLeft); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + + // explicitly right aligned text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); - // Center aligned + // explicitly center aligned text->setHAlign(QDeclarativeText::AlignHCenter); QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter); QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); - QVERIFY(textPrivate->layout.lineAt(0).x() + textPrivate->layout.lineAt(0).width() > canvas->width()/2); + + // reseted alignment should go back to following the text reading direction + text->resetHAlign(); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); + + // English text should be implicitly left aligned + text->setText("Hello world!"); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + + // empty text should implicitly follow the layout direction + QApplication::setLayoutDirection(Qt::RightToLeft); + text->setText(""); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + text->setHAlign(QDeclarativeText::AlignLeft); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + + // set layout direction back to LTR to avoid affecting other autotests + QApplication::setLayoutDirection(Qt::LeftToRight); delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 87c2c60..eb02936 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -438,20 +438,47 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit != 0); canvas->show(); + // implicit alignment should follow the reading direction of RTL text + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); - // "Right" align + // explicitly left aligned + textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + + // explicitly right aligned textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); - QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); - // Center align - // Note that position 0 is on the right-hand side + // explicitly center aligned textEdit->setHAlign(QDeclarativeTextEdit::AlignHCenter); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignHCenter); - QVERIFY(textEdit->positionToRectangle(0).x() - textEdit->width() < canvas->width()/2); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + // reseted alignment should go back to following the text reading direction + textEdit->resetHAlign(); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + + // English text should be implicitly left aligned + textEdit->setText("Hello world!"); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + + // empty text should implicitly follow the layout direction + QApplication::setLayoutDirection(Qt::RightToLeft); + textEdit->setText(""); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + + // set layout direction back to LTR to avoid affecting other autotests + QApplication::setLayoutDirection(Qt::LeftToRight); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 7753f11..45f2cf7 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -914,17 +914,48 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QVERIFY(textInputPrivate != 0); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); - // "Right" Align - textInput->setHAlign(QDeclarativeTextInput::AlignRight); + // implicit alignment should follow the reading direction of RTL text QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + + // explicitly left aligned + textInput->setHAlign(QDeclarativeTextInput::AlignLeft); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); - // Center Align + // explicitly right aligned + textInput->setHAlign(QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + + // explicitly center aligned textInput->setHAlign(QDeclarativeTextInput::AlignHCenter); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignHCenter); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); QVERIFY(-textInputPrivate->hscroll + textInputPrivate->width() > canvas->width()/2); + // reseted alignment should go back to following the text reading direction + textInput->resetHAlign(); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + + // English text should be implicitly left aligned + textInput->setText("Hello world!"); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + + // empty text should implicitly follow the layout direction + QApplication::setLayoutDirection(Qt::RightToLeft); + textInput->setText(""); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + textInput->setHAlign(QDeclarativeTextInput::AlignLeft); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + + // set layout direction back to LTR to avoid affecting other autotests + QApplication::setLayoutDirection(Qt::LeftToRight); + delete canvas; } -- cgit v0.12 From 6aaf7b3c93687b857ff7cac0f2ad2ee510b2813b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 3 Mar 2011 14:43:42 +1000 Subject: Add a way to query the reading direction of QML editor text Task-number: QTBUG-17490 Reviewed-by: Martin Jones Change-Id: I3dd3854f820860d32e822605ed547150d5f17eb2 --- .../graphicsitems/qdeclarativetextedit.cpp | 17 +++++++ .../graphicsitems/qdeclarativetextedit_p.h | 1 + .../graphicsitems/qdeclarativetextinput.cpp | 17 +++++++ .../graphicsitems/qdeclarativetextinput_p.h | 1 + .../tst_qdeclarativetextedit.cpp | 59 ++++++++++++++++++++++ .../tst_qdeclarativetextinput.cpp | 59 ++++++++++++++++++++++ 6 files changed, 154 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 3c2684c..5e1459c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1235,6 +1235,23 @@ void QDeclarativeTextEdit::select(int start, int end) updateSelectionMarkers(); } +/*! + \qmlmethod void TextEdit::isRightToLeft(int start, int end) + + Returns true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. +*/ +bool QDeclarativeTextEdit::isRightToLeft(int start, int end) +{ + Q_D(QDeclarativeTextEdit); + if (start > end) { + qmlInfo(this) << "isRightToLeft(start, end) called with the end property being smaller than the start."; + return false; + } else { + return d->text.mid(start, end - start).isRightToLeft(); + } +} + #ifndef QT_NO_CLIPBOARD /*! \qmlmethod TextEdit::cut() diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index a8d9fe2..471b201 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -253,6 +253,7 @@ public Q_SLOTS: void selectWord(); void select(int start, int end); Q_REVISION(1) void deselect(); + Q_REVISION(1) bool isRightToLeft(int start, int end); #ifndef QT_NO_CLIPBOARD void cut(); void copy(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index cb7f739..09404ce 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1370,6 +1370,23 @@ void QDeclarativeTextInput::selectAll() d->control->setSelection(0, d->control->text().length()); } +/*! + \qmlmethod void TextInput::isRightToLeft(int start, int end) + + Returns true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. +*/ +bool QDeclarativeTextInput::isRightToLeft(int start, int end) +{ + Q_D(QDeclarativeTextInput); + if (start > end) { + qmlInfo(this) << "isRightToLeft(start, end) called with the end property being smaller than the start."; + return false; + } else { + return d->control->text().mid(start, end - start).isRightToLeft(); + } +} + #ifndef QT_NO_CLIPBOARD /*! \qmlmethod TextInput::cut() diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index c057f1f..ce5f267 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -262,6 +262,7 @@ public Q_SLOTS: void selectWord(); void select(int start, int end); Q_REVISION(1) void deselect(); + Q_REVISION(1) bool isRightToLeft(int start, int end); #ifndef QT_NO_CLIPBOARD void cut(); void copy(); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index c5e2a11..6d5750f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -110,6 +110,8 @@ private slots: void persistentSelection(); void focusOnPress(); void selection(); + void isRightToLeft_data(); + void isRightToLeft(); void moveCursorSelection_data(); void moveCursorSelection(); void moveCursorSelectionSequence_data(); @@ -787,6 +789,63 @@ void tst_qdeclarativetextedit::selection() QVERIFY(textEditObject->selectedText().isNull()); } +void tst_qdeclarativetextedit::isRightToLeft_data() +{ + QTest::addColumn("text"); + QTest::addColumn("emptyString"); + QTest::addColumn("firstCharacter"); + QTest::addColumn("lastCharacter"); + QTest::addColumn("middleCharacter"); + QTest::addColumn("startString"); + QTest::addColumn("midString"); + QTest::addColumn("endString"); + + const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; + QTest::newRow("Empty") << "" << false << false << false << false << false << false << false; + QTest::newRow("Neutral") << "23244242" << false << false << false << false << false << false << false; + QTest::newRow("LTR") << "Hello world" << false << false << false << false << false << false << false; + QTest::newRow("RTL") << QString::fromUtf16(arabic_str, 11) << false << true << true << true << true << true << true; + QTest::newRow("Bidi RTL + LTR + RTL") << QString::fromUtf16(arabic_str, 11) + QString("Hello world") + QString::fromUtf16(arabic_str, 11) << false << true << true << false << true << true << true; + QTest::newRow("Bidi LTR + RTL + LTR") << QString("Hello world") + QString::fromUtf16(arabic_str, 11) + QString("Hello world") << false << false << false << true << false << false << false; +} + +void tst_qdeclarativetextedit::isRightToLeft() +{ + QFETCH(QString, text); + QFETCH(bool, emptyString); + QFETCH(bool, firstCharacter); + QFETCH(bool, lastCharacter); + QFETCH(bool, middleCharacter); + QFETCH(bool, startString); + QFETCH(bool, midString); + QFETCH(bool, endString); + + QDeclarativeTextEdit textEdit; + textEdit.setText(text); + + // first test that the right string is delivered to the QString::isRightToLeft() + QCOMPARE(textEdit.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft()); + if (text.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, ": QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); + QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft()); + + // then test that the feature actually works + QCOMPARE(textEdit.isRightToLeft(0,0), emptyString); + QCOMPARE(textEdit.isRightToLeft(0,1), firstCharacter); + QCOMPARE(textEdit.isRightToLeft(text.count()-2, text.count()-1), lastCharacter); + QCOMPARE(textEdit.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter); + QCOMPARE(textEdit.isRightToLeft(0,text.count()/4), startString); + QCOMPARE(textEdit.isRightToLeft(text.count()/4,3*text.count()/4), midString); + if (text.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, ": QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); + QCOMPARE(textEdit.isRightToLeft(3*text.count()/4,text.count()-1), endString); +} + void tst_qdeclarativetextedit::moveCursorSelection_data() { QTest::addColumn("testStr"); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 65be327..585479c 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -89,6 +89,8 @@ private slots: void font(); void color(); void selection(); + void isRightToLeft_data(); + void isRightToLeft(); void moveCursorSelection_data(); void moveCursorSelection(); void moveCursorSelectionSequence_data(); @@ -435,6 +437,63 @@ void tst_qdeclarativetextinput::selection() delete textinputObject; } +void tst_qdeclarativetextinput::isRightToLeft_data() +{ + QTest::addColumn("text"); + QTest::addColumn("emptyString"); + QTest::addColumn("firstCharacter"); + QTest::addColumn("lastCharacter"); + QTest::addColumn("middleCharacter"); + QTest::addColumn("startString"); + QTest::addColumn("midString"); + QTest::addColumn("endString"); + + const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; + QTest::newRow("Empty") << "" << false << false << false << false << false << false << false; + QTest::newRow("Neutral") << "23244242" << false << false << false << false << false << false << false; + QTest::newRow("LTR") << "Hello world" << false << false << false << false << false << false << false; + QTest::newRow("RTL") << QString::fromUtf16(arabic_str, 11) << false << true << true << true << true << true << true; + QTest::newRow("Bidi RTL + LTR + RTL") << QString::fromUtf16(arabic_str, 11) + QString("Hello world") + QString::fromUtf16(arabic_str, 11) << false << true << true << false << true << true << true; + QTest::newRow("Bidi LTR + RTL + LTR") << QString("Hello world") + QString::fromUtf16(arabic_str, 11) + QString("Hello world") << false << false << false << true << false << false << false; +} + +void tst_qdeclarativetextinput::isRightToLeft() +{ + QFETCH(QString, text); + QFETCH(bool, emptyString); + QFETCH(bool, firstCharacter); + QFETCH(bool, lastCharacter); + QFETCH(bool, middleCharacter); + QFETCH(bool, startString); + QFETCH(bool, midString); + QFETCH(bool, endString); + + QDeclarativeTextInput textInput; + textInput.setText(text); + + // first test that the right string is delivered to the QString::isRightToLeft() + QCOMPARE(textInput.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), text.mid(text.count()-2, text.count()-1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), text.mid(text.count()/2, text.count()/2 + 1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(0,text.count()/4), text.mid(0,text.count()/4).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), text.mid(text.count()/4,3*text.count()/4).isRightToLeft()); + if (text.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, ": QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); + QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), text.mid(3*text.count()/4,text.count()-1).isRightToLeft()); + + // then test that the feature actually works + QCOMPARE(textInput.isRightToLeft(0,0), emptyString); + QCOMPARE(textInput.isRightToLeft(0,1), firstCharacter); + QCOMPARE(textInput.isRightToLeft(text.count()-2, text.count()-1), lastCharacter); + QCOMPARE(textInput.isRightToLeft(text.count()/2, text.count()/2 + 1), middleCharacter); + QCOMPARE(textInput.isRightToLeft(0,text.count()/4), startString); + QCOMPARE(textInput.isRightToLeft(text.count()/4,3*text.count()/4), midString); + if (text.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, ": QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); + QCOMPARE(textInput.isRightToLeft(3*text.count()/4,text.count()-1), endString); +} + void tst_qdeclarativetextinput::moveCursorSelection_data() { QTest::addColumn("testStr"); -- cgit v0.12 From 9f674617daf03026d78f8ce18328cbe6c31b689d Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 4 Mar 2011 13:26:12 +1000 Subject: Remove text alignment of empty QML editors following the layout direction Task-number: QTBUG-15880 Reviewed-by: Martin Jones Removed implicit text alignment of empty text in QML editor following the application's default layout direction. Change was originally made few days ago in the commit 88253db8a7d7910e1393b1948fb3747117538c92. Aligning empty and neutral text to the right for RTL locales requires much more comprehensive changes to the Qt's internal text classes than initially thought. Change-Id: I93a26df259b87dff47d57423949270656746c9a7 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 5 +---- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 5 +---- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 5 +---- .../declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 10 +++------- .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 12 ++++-------- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 12 ++++-------- 6 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 66a2355..3988f7f 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -218,10 +218,7 @@ void QDeclarativeTextPrivate::determineHorizontalAlignment() if (hAlignImplicit && q->isComponentComplete()) { // if no explicit alignment has been set, follow the natural layout direction of the text QDeclarativeText::HAlignment previousAlign = hAlign; - if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeText::AlignRight; - else - hAlign = text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft; + hAlign = text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft; if (previousAlign != hAlign) emit q->horizontalAlignmentChanged(hAlign); } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 5e1459c..78729aa 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1547,10 +1547,7 @@ void QDeclarativeTextEditPrivate::determineHorizontalAlignment() if (hAlignImplicit && q->isComponentComplete()) { // if no explicit alignment has been set, follow the natural layout direction of the text QDeclarativeTextEdit::HAlignment previousAlign = hAlign; - if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeTextEdit::AlignRight; - else - hAlign = rightToLeftText ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft; + hAlign = rightToLeftText ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft; if (previousAlign != hAlign) emit q->horizontalAlignmentChanged(hAlign); } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index d9d9335..670a6ea 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1283,10 +1283,7 @@ void QDeclarativeTextInputPrivate::determineHorizontalAlignment() QString text = control->text(); // if no explicit alignment has been set, follow the natural layout direction of the text QDeclarativeTextInput::HAlignment previousAlign = hAlign; - if (text.isEmpty() && QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeTextInput::AlignRight; - else - hAlign = text.isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft; + hAlign = text.isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft; if (previousAlign != hAlign) emit q->horizontalAlignmentChanged(hAlign); } diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 6c9998e..2aeb425 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -547,15 +547,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); - // empty text should implicitly follow the layout direction - QApplication::setLayoutDirection(Qt::RightToLeft); + // empty text is also implicitly left aligned text->setText(""); - QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - text->setHAlign(QDeclarativeText::AlignLeft); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); - - // set layout direction back to LTR to avoid affecting other autotests - QApplication::setLayoutDirection(Qt::LeftToRight); + text->setHAlign(QDeclarativeText::AlignRight); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 6d5750f..ff52167 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -474,17 +474,13 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); - // empty text should implicitly follow the layout direction - QApplication::setLayoutDirection(Qt::RightToLeft); + // empty text is also implicitly left aligned textEdit->setText(""); - QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); - QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); - textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); - - // set layout direction back to LTR to avoid affecting other autotests - QApplication::setLayoutDirection(Qt::LeftToRight); + textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 72e8b11..666bbc8 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1078,17 +1078,13 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); - // empty text should implicitly follow the layout direction - QApplication::setLayoutDirection(Qt::RightToLeft); + // empty text is also implicitly left aligned textInput->setText(""); - QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); - QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); - textInput->setHAlign(QDeclarativeTextInput::AlignLeft); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); - - // set layout direction back to LTR to avoid affecting other autotests - QApplication::setLayoutDirection(Qt::LeftToRight); + textInput->setHAlign(QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); delete canvas; } -- cgit v0.12 From 7cdd849b50f0314d0eb227e1d0c92627f2be555b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 4 Mar 2011 14:33:30 +1000 Subject: Fix RTL multiline Text drawing We handled horizontal alignment ourselves, but this neglected some RTL layouting issues (e.g. trailing spaces). Allow QTextLayout to do the aligning for us. Also fix eliding of multiline text for RTL language - in this case the eliding should be to the left. Change-Id: I487137b123ae66c1f5fc358a8d8a013049d05818 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativetext.cpp | 75 ++++++---------------- .../qdeclarativetext/tst_qdeclarativetext.cpp | 12 ++-- 2 files changed, 26 insertions(+), 61 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 3988f7f..890e481 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -364,19 +364,16 @@ QSize QDeclarativeTextPrivate::setupTextLayout() Q_Q(QDeclarativeText); layout.setCacheEnabled(true); - qreal height = 0; qreal widthUsed = 0; qreal lineWidth = 0; - int visibleTextLength = 0; int visibleCount = 0; //set manual width - if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) + if (q->widthValid()) lineWidth = q->width(); QTextOption textOption = layout.textOption(); - if (hAlign == QDeclarativeText::AlignJustify) - textOption.setAlignment(Qt::Alignment(hAlign)); + textOption.setAlignment(Qt::Alignment(hAlign)); textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); layout.setTextOption(textOption); @@ -384,7 +381,6 @@ QSize QDeclarativeTextPrivate::setupTextLayout() bool truncate = false; QFontMetrics fm(layout.font()); - qreal elideWidth = fm.width(elideChar); elidePos = QPointF(); if (requireImplicitWidth && q->widthValid()) { @@ -407,36 +403,35 @@ QSize QDeclarativeTextPrivate::setupTextLayout() layout.beginLayout(); if (!lineWidth) lineWidth = INT_MAX; - int y = 0; int linesLeft = maximumLineCount; + int visibleTextLength = 0; while (linesLeft > 0) { QTextLine line = layout.createLine(); if (!line.isValid()) break; visibleCount++; - line.setLineWidth(lineWidth); + if (lineWidth) + line.setLineWidth(lineWidth); visibleTextLength += line.textLength(); if (--linesLeft == 0) { if (visibleTextLength < text.length()) { truncate = true; if (elideMode==QDeclarativeText::ElideRight && q->widthValid()) { + qreal elideWidth = fm.width(elideChar); // Need to correct for alignment line.setLineWidth(lineWidth-elideWidth); - int x = line.naturalTextWidth(); - if (hAlign == QDeclarativeText::AlignRight) { - x = q->width()-elideWidth; - } else if (hAlign == QDeclarativeText::AlignHCenter) { - x = (q->width()+line.naturalTextWidth() - elideWidth)/2; + if (layout.text().mid(line.textStart(), line.textLength()).isRightToLeft()) { + line.setPosition(QPointF(line.position().x() + elideWidth, line.position().y())); + elidePos.setX(line.naturalTextRect().left() - elideWidth); + } else { + elidePos.setX(line.naturalTextRect().right()); } - elidePos = QPointF(x, y + fm.ascent()); elideText = true; } } } - - y += line.height(); } layout.endLayout(); @@ -458,36 +453,20 @@ QSize QDeclarativeTextPrivate::setupTextLayout() layout.endLayout(); } + qreal height = 0; for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); + // calc width + widthUsed = qMax(widthUsed, line.naturalTextRect().right()); + // set line spacing + line.setPosition(QPointF(line.position().x(), height)); + if (elideText && i == layout.lineCount()-1) + elidePos.setY(height + fm.ascent()); + height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; } - qreal layoutWidth = q->widthValid() ? q->width() : widthUsed; if (!q->widthValid()) - naturalWidth = layoutWidth; - - qreal x = 0; - for (int i = 0; i < layout.lineCount(); ++i) { - QTextLine line = layout.lineAt(i); - line.setPosition(QPointF(0, height)); - height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; - - if (!cacheAllTextAsImage) { - if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { - x = 0; - } else if (hAlign == QDeclarativeText::AlignRight) { - x = layoutWidth - line.naturalTextWidth(); - if (elideText && i == layout.lineCount()-1) - x -= elideWidth; // Correct for when eliding multilines - } else if (hAlign == QDeclarativeText::AlignHCenter) { - x = (layoutWidth - line.naturalTextWidth()) / 2; - if (elideText && i == layout.lineCount()-1) - x -= elideWidth/2; // Correct for when eliding multilines - } - line.setPosition(QPointF(x, line.y())); - } - } + naturalWidth = widthUsed; //Update the number of visible lines if (lineCount != visibleCount) { @@ -506,20 +485,6 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) { //do layout QSize size = layedOutTextSize; - - qreal x = 0; - for (int i = 0; i < layout.lineCount(); ++i) { - QTextLine line = layout.lineAt(i); - if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { - x = 0; - } else if (hAlign == QDeclarativeText::AlignRight) { - x = size.width() - line.naturalTextWidth(); - } else if (hAlign == QDeclarativeText::AlignHCenter) { - x = (size.width() - line.naturalTextWidth()) / 2; - } - line.setPosition(QPointF(x, line.y())); - } - //paint text QPixmap img(size); if (!size.isEmpty()) { diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 2aeb425..f27fc07 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -520,32 +520,32 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() // implicit alignment should follow the reading direction of RTL text QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); // explicitly left aligned text->setHAlign(QDeclarativeText::AlignLeft); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); - QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); // explicitly right aligned text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); // explicitly center aligned text->setHAlign(QDeclarativeText::AlignHCenter); QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter); - QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); // reseted alignment should go back to following the text reading direction text->resetHAlign(); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); // English text should be implicitly left aligned text->setText("Hello world!"); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); - QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); // empty text is also implicitly left aligned text->setText(""); -- cgit v0.12 From 86a0b3749a336181c241dd239c863f4ddbbd4ad2 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 4 Mar 2011 16:50:02 +1000 Subject: Removal of text alignment layout direction dependency was missing couple of changes Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: I1ea87b05c483e5c9339fc47cf719c22d001ef52b --- src/declarative/graphicsitems/qdeclarativetext.cpp | 2 -- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 3 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 3 --- 3 files changed, 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 890e481..e66a83e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -107,8 +107,6 @@ QDeclarativeTextPrivate::QDeclarativeTextPrivate() cacheAllTextAsImage = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; - if (QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeText::AlignRight; } QTextDocumentWithImageResources::QTextDocumentWithImageResources(QDeclarativeText *parent) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 78729aa..e4cd66c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1512,9 +1512,6 @@ void QDeclarativeTextEditPrivate::init() document->setDocumentMargin(textMargin); document->setUndoRedoEnabled(false); // flush undo buffer. document->setUndoRedoEnabled(true); - - if (QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeTextEdit::AlignRight; updateDefaultTextOption(); } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 670a6ea..0c021db 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1827,9 +1827,6 @@ void QDeclarativeTextInputPrivate::init() QPalette p = control->palette(); selectedTextColor = p.color(QPalette::HighlightedText); selectionColor = p.color(QPalette::Highlight); - - if (QApplication::layoutDirection() == Qt::RightToLeft) - hAlign = QDeclarativeTextInput::AlignRight; } void QDeclarativeTextInput::cursorPosChanged() -- cgit v0.12 From 7872985cc2eb21ae9283aa8e6779f490b500dff0 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 3 Mar 2011 11:06:13 +1000 Subject: Update QtDeclarative def files Symbols introduced in Qt Quick 1.1 layout mirroring support. Task-number: QTBUG-17280 Reviewed-by: Martin Jones --- src/s60installs/bwins/QtDeclarativeu.def | 5 +++++ src/s60installs/eabi/QtDeclarativeu.def | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 8b23b63..5490f0d 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1888,4 +1888,9 @@ EXPORTS ??1QDeclarativeRefCount@@UAE@XZ @ 1887 NONAME ; QDeclarativeRefCount::~QDeclarativeRefCount(void) ?addref@QDeclarativeRefCount@@QAEXXZ @ 1888 NONAME ; void QDeclarativeRefCount::addref(void) ?release@QDeclarativeRefCount@@QAEXXZ @ 1889 NONAME ; void QDeclarativeRefCount::release(void) + ?resolveLayoutMirror@QDeclarativeItemPrivate@@QAEXXZ @ 1890 NONAME ; void QDeclarativeItemPrivate::resolveLayoutMirror(void) + ?mirrorChange@QDeclarativeItemPrivate@@UAEXXZ @ 1891 NONAME ; void QDeclarativeItemPrivate::mirrorChange(void) + ?setLayoutMirror@QDeclarativeItemPrivate@@QAEX_N@Z @ 1892 NONAME ; void QDeclarativeItemPrivate::setLayoutMirror(bool) + ?setImplicitLayoutMirror@QDeclarativeItemPrivate@@QAEX_N0@Z @ 1893 NONAME ; void QDeclarativeItemPrivate::setImplicitLayoutMirror(bool, bool) + ?isMirrored@QDeclarativeItemPrivate@@QBE_NXZ @ 1894 NONAME ; bool QDeclarativeItemPrivate::isMirrored(void) const diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 130e2d5..2849068 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1930,4 +1930,7 @@ EXPORTS _ZN20QDeclarativeRefCountD2Ev @ 1929 NONAME _ZTI20QDeclarativeRefCount @ 1930 NONAME _ZTV20QDeclarativeRefCount @ 1931 NONAME + _ZN23QDeclarativeItemPrivate15setLayoutMirrorEb @ 1932 NONAME + _ZN23QDeclarativeItemPrivate19resolveLayoutMirrorEv @ 1933 NONAME + _ZN23QDeclarativeItemPrivate23setImplicitLayoutMirrorEbb @ 1934 NONAME -- cgit v0.12 From 27e4302b7f45f22180693d26747f419177c81e27 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 7 Mar 2011 13:10:08 +1000 Subject: Reverse horizontal alignment of QML editors when the layout mirroring is enabled Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: Ie9cebd7bc6d40f5f555bfd83ddc3a24a55c6cb4d --- src/declarative/graphicsitems/qdeclarativetext.cpp | 95 ++++++++++++++------- src/declarative/graphicsitems/qdeclarativetext_p.h | 3 + .../graphicsitems/qdeclarativetext_p_p.h | 4 +- .../graphicsitems/qdeclarativetextedit.cpp | 98 ++++++++++++++++------ .../graphicsitems/qdeclarativetextedit_p.h | 3 + .../graphicsitems/qdeclarativetextedit_p_p.h | 4 +- .../graphicsitems/qdeclarativetextinput.cpp | 96 +++++++++++++++------ .../graphicsitems/qdeclarativetextinput_p.h | 4 +- .../graphicsitems/qdeclarativetextinput_p_p.h | 4 +- .../qdeclarativetext/tst_qdeclarativetext.cpp | 29 +++++++ .../tst_qdeclarativetextedit.cpp | 24 ++++++ .../tst_qdeclarativetextinput.cpp | 30 +++++++ 12 files changed, 309 insertions(+), 85 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index e66a83e..4a931fd 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -210,18 +210,6 @@ qreal QDeclarativeTextPrivate::implicitWidth() const return mImplicitWidth; } -void QDeclarativeTextPrivate::determineHorizontalAlignment() -{ - Q_Q(QDeclarativeText); - if (hAlignImplicit && q->isComponentComplete()) { - // if no explicit alignment has been set, follow the natural layout direction of the text - QDeclarativeText::HAlignment previousAlign = hAlign; - hAlign = text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft; - if (previousAlign != hAlign) - emit q->horizontalAlignmentChanged(hAlign); - } -} - void QDeclarativeTextPrivate::updateLayout() { Q_Q(QDeclarativeText); @@ -305,7 +293,7 @@ void QDeclarativeTextPrivate::updateSize() ensureDoc(); doc->setDefaultFont(font); QTextOption option; - option.setAlignment((Qt::Alignment)int(hAlign | vAlign)); + option.setAlignment((Qt::Alignment)int(q->effectiveHAlign() | vAlign)); option.setWrapMode(QTextOption::WrapMode(wrapMode)); doc->setDefaultTextOption(option); if (requireImplicitWidth && q->widthValid()) { @@ -371,7 +359,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout() lineWidth = q->width(); QTextOption textOption = layout.textOption(); - textOption.setAlignment(Qt::Alignment(hAlign)); + textOption.setAlignment(Qt::Alignment(q->effectiveHAlign())); textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); layout.setTextOption(textOption); @@ -1049,6 +1037,7 @@ void QDeclarativeText::setStyleColor(const QColor &color) /*! \qmlproperty enumeration Text::horizontalAlignment \qmlproperty enumeration Text::verticalAlignment + \qmlproperty enumeration Text::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is vertically aligned to the top. Horizontal @@ -1063,6 +1052,11 @@ void QDeclarativeText::setStyleColor(const QColor &color) all alignments are equivalent. If you want the text to be, say, centered in its parent, then you will need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to that of the parent. + + When using the attached property LayoutMirroring::enabled to mirror application + layouts, the horizontal alignment of text will also be mirrored. However, the property + \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment + of Text, use the read-only property \c effectiveHorizontalAlignment. */ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const { @@ -1073,29 +1067,72 @@ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const void QDeclarativeText::setHAlign(HAlignment align) { Q_D(QDeclarativeText); + bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror; d->hAlignImplicit = false; - if (d->hAlign == align) - return; - - if (isComponentComplete()) - prepareGeometryChange(); - - d->hAlign = align; - d->updateLayout(); - - emit horizontalAlignmentChanged(align); + if (d->setHAlign(align, forceAlign) && isComponentComplete()) + d->updateLayout(); } void QDeclarativeText::resetHAlign() { Q_D(QDeclarativeText); d->hAlignImplicit = true; - QDeclarativeText::HAlignment oldAlignment = d->hAlign; - d->determineHorizontalAlignment(); - if (oldAlignment != d->hAlign) { - prepareGeometryChange(); + if (d->determineHorizontalAlignment() && isComponentComplete()) d->updateLayout(); - emit horizontalAlignmentChanged(d->hAlign); +} + +QDeclarativeText::HAlignment QDeclarativeText::effectiveHAlign() const +{ + Q_D(const QDeclarativeText); + QDeclarativeText::HAlignment effectiveAlignment = d->hAlign; + if (!d->hAlignImplicit && d->effectiveLayoutMirror) { + switch (d->hAlign) { + case QDeclarativeText::AlignLeft: + effectiveAlignment = QDeclarativeText::AlignRight; + break; + case QDeclarativeText::AlignRight: + effectiveAlignment = QDeclarativeText::AlignLeft; + break; + default: + break; + } + } + return effectiveAlignment; +} + +bool QDeclarativeTextPrivate::setHAlign(QDeclarativeText::HAlignment alignment, bool forceAlign) +{ + Q_Q(QDeclarativeText); + if (hAlign != alignment || forceAlign) { + QDeclarativeText::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); + hAlign = alignment; + + emit q->horizontalAlignmentChanged(hAlign); + if (oldEffectiveHAlign != q->effectiveHAlign()) + emit q->effectiveHorizontalAlignmentChanged(); + return true; + } + return false; +} + +bool QDeclarativeTextPrivate::determineHorizontalAlignment() +{ + Q_Q(QDeclarativeText); + if (hAlignImplicit && q->isComponentComplete()) { + // if no explicit alignment has been set, follow the natural layout direction of the text + return setHAlign(text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft); + } + return false; +} + +void QDeclarativeTextPrivate::mirrorChange() +{ + Q_Q(QDeclarativeText); + if (q->isComponentComplete()) { + if (!hAlignImplicit && (hAlign == QDeclarativeText::AlignRight || hAlign == QDeclarativeText::AlignLeft)) { + updateLayout(); + emit q->effectiveHorizontalAlignmentChanged(); + } } } diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index 92c2eab..a1153c2 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -70,6 +70,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) + Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -134,6 +135,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); void resetHAlign(); + HAlignment effectiveHAlign() const; VAlignment vAlign() const; void setVAlign(VAlignment align); @@ -189,6 +191,7 @@ Q_SIGNALS: void paintedSizeChanged(); Q_REVISION(1) void lineHeightChanged(qreal lineHeight); Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode); + Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 6886d91..0864c8f 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -76,7 +76,9 @@ public: void updateSize(); void updateLayout(); - void determineHorizontalAlignment(); + bool determineHorizontalAlignment(); + bool setHAlign(QDeclarativeText::HAlignment, bool forceAlign = false); + void mirrorChange(); QString text; QFont font; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index e4cd66c..7a75ece 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -458,6 +458,7 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextEdit::horizontalAlignment \qmlproperty enumeration TextEdit::verticalAlignment + \qmlproperty enumeration TextEdit::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit item's width and height. By default, the text alignment follows the natural alignment @@ -476,8 +477,13 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \list \o TextEdit.AlignTop (default) \o TextEdit.AlignBottom - \c TextEdit.AlignVCenter + \o TextEdit.AlignVCenter \endlist + + When using the attached property LayoutMirroring::enabled to mirror application + layouts, the horizontal alignment of text will also be mirrored. However, the property + \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment + of TextEdit, use the read-only property \c effectiveHorizontalAlignment. */ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const { @@ -485,28 +491,79 @@ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const return d->hAlign; } -void QDeclarativeTextEdit::setHAlign(QDeclarativeTextEdit::HAlignment alignment) +void QDeclarativeTextEdit::setHAlign(HAlignment align) { Q_D(QDeclarativeTextEdit); + bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror; d->hAlignImplicit = false; - if (alignment == d->hAlign) - return; - d->hAlign = alignment; - d->updateDefaultTextOption(); - updateSize(); - emit horizontalAlignmentChanged(d->hAlign); + if (d->setHAlign(align, forceAlign) && isComponentComplete()) { + d->updateDefaultTextOption(); + updateSize(); + } } void QDeclarativeTextEdit::resetHAlign() { Q_D(QDeclarativeTextEdit); d->hAlignImplicit = true; - QDeclarativeTextEdit::HAlignment oldAlignment = d->hAlign; - d->determineHorizontalAlignment(); - if (oldAlignment != d->hAlign) { + if (d->determineHorizontalAlignment() && isComponentComplete()) { d->updateDefaultTextOption(); updateSize(); + } +} +QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::effectiveHAlign() const +{ + Q_D(const QDeclarativeTextEdit); + QDeclarativeTextEdit::HAlignment effectiveAlignment = d->hAlign; + if (!d->hAlignImplicit && d->effectiveLayoutMirror) { + switch (d->hAlign) { + case QDeclarativeTextEdit::AlignLeft: + effectiveAlignment = QDeclarativeTextEdit::AlignRight; + break; + case QDeclarativeTextEdit::AlignRight: + effectiveAlignment = QDeclarativeTextEdit::AlignLeft; + break; + default: + break; + } + } + return effectiveAlignment; +} + +bool QDeclarativeTextEditPrivate::setHAlign(QDeclarativeTextEdit::HAlignment alignment, bool forceAlign) +{ + Q_Q(QDeclarativeTextEdit); + if (hAlign != alignment || forceAlign) { + QDeclarativeTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); + hAlign = alignment; + emit q->horizontalAlignmentChanged(alignment); + if (oldEffectiveHAlign != q->effectiveHAlign()) + emit q->effectiveHorizontalAlignmentChanged(); + return true; + } + return false; +} + +bool QDeclarativeTextEditPrivate::determineHorizontalAlignment() +{ + Q_Q(QDeclarativeTextEdit); + if (hAlignImplicit && q->isComponentComplete()) { + // if no explicit alignment has been set, follow the natural layout direction of the text + return setHAlign(text.isRightToLeft() ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); + } + return false; +} + +void QDeclarativeTextEditPrivate::mirrorChange() +{ + Q_Q(QDeclarativeTextEdit); + if (q->isComponentComplete()) { + if (!hAlignImplicit && (hAlign == QDeclarativeTextEdit::AlignRight || hAlign == QDeclarativeTextEdit::AlignLeft)) { + updateDefaultTextOption(); + q->updateSize(); + emit q->effectiveHorizontalAlignmentChanged(); + } } } @@ -1538,18 +1595,6 @@ void QDeclarativeTextEdit::moveCursorDelegate() d->cursor->setY(cursorRect.y()); } -void QDeclarativeTextEditPrivate::determineHorizontalAlignment() -{ - Q_Q(QDeclarativeTextEdit); - if (hAlignImplicit && q->isComponentComplete()) { - // if no explicit alignment has been set, follow the natural layout direction of the text - QDeclarativeTextEdit::HAlignment previousAlign = hAlign; - hAlign = rightToLeftText ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft; - if (previousAlign != hAlign) - emit q->horizontalAlignmentChanged(hAlign); - } -} - void QDeclarativeTextEditPrivate::updateSelection() { Q_Q(QDeclarativeTextEdit); @@ -1698,14 +1743,15 @@ void QDeclarativeTextEdit::updateTotalLines() void QDeclarativeTextEditPrivate::updateDefaultTextOption() { + Q_Q(QDeclarativeTextEdit); QTextOption opt = document->defaultTextOption(); int oldAlignment = opt.alignment(); - QDeclarativeTextEdit::HAlignment horizontalAlignment = hAlign; + QDeclarativeTextEdit::HAlignment horizontalAlignment = q->effectiveHAlign(); if (rightToLeftText) { - if (hAlign == QDeclarativeTextEdit::AlignLeft) + if (horizontalAlignment == QDeclarativeTextEdit::AlignLeft) horizontalAlignment = QDeclarativeTextEdit::AlignRight; - else if (hAlign == QDeclarativeTextEdit::AlignRight) + else if (horizontalAlignment == QDeclarativeTextEdit::AlignRight) horizontalAlignment = QDeclarativeTextEdit::AlignLeft; } opt.setAlignment((Qt::Alignment)(int)(horizontalAlignment | vAlign)); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 471b201..25ca1e7 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -73,6 +73,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) + Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -154,6 +155,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); void resetHAlign(); + HAlignment effectiveHAlign() const; VAlignment vAlign() const; void setVAlign(VAlignment align); @@ -247,6 +249,7 @@ Q_SIGNALS: Q_REVISION(1) void linkActivated(const QString &link); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); + Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index f4a6c0e..36e1b51 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -88,7 +88,9 @@ public: void updateDefaultTextOption(); void relayoutDocument(); void updateSelection(); - void determineHorizontalAlignment(); + bool determineHorizontalAlignment(); + bool setHAlign(QDeclarativeTextEdit::HAlignment, bool forceAlign = false); + void mirrorChange(); qreal implicitWidth() const; void focusChanged(bool); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 0c021db..0deffe9 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -326,6 +326,7 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextInput::horizontalAlignment + \qmlproperty enumeration TextInput::effectiveHorizontalAlignment Sets the horizontal alignment of the text within the TextInput item's width and height. By default, the text alignment follows the natural alignment @@ -340,6 +341,11 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and \c TextInput.AlignHCenter. + + When using the attached property LayoutMirroring::enabled to mirror application + layouts, the horizontal alignment of text will also be mirrored. However, the property + \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment + of TextInput, use the read-only property \c effectiveHorizontalAlignment. */ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const { @@ -350,25 +356,75 @@ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const void QDeclarativeTextInput::setHAlign(HAlignment align) { Q_D(QDeclarativeTextInput); + bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror; d->hAlignImplicit = false; - if(align == d->hAlign || align > QDeclarativeTextInput::AlignHCenter) // justify not supported - return; - d->hAlign = align; - updateRect(); - d->updateHorizontalScroll(); - emit horizontalAlignmentChanged(d->hAlign); + if (d->setHAlign(align, forceAlign) && isComponentComplete()) { + updateRect(); + d->updateHorizontalScroll(); + } } void QDeclarativeTextInput::resetHAlign() { Q_D(QDeclarativeTextInput); d->hAlignImplicit = true; - QDeclarativeTextInput::HAlignment oldAlignment = d->hAlign; - d->determineHorizontalAlignment(); - if (oldAlignment != d->hAlign) { + if (d->determineHorizontalAlignment() && isComponentComplete()) { updateRect(); d->updateHorizontalScroll(); - emit horizontalAlignmentChanged(d->hAlign); + } +} + +QDeclarativeTextInput::HAlignment QDeclarativeTextInput::effectiveHAlign() const +{ + Q_D(const QDeclarativeTextInput); + QDeclarativeTextInput::HAlignment effectiveAlignment = d->hAlign; + if (!d->hAlignImplicit && d->effectiveLayoutMirror) { + switch (d->hAlign) { + case QDeclarativeTextInput::AlignLeft: + effectiveAlignment = QDeclarativeTextInput::AlignRight; + break; + case QDeclarativeTextInput::AlignRight: + effectiveAlignment = QDeclarativeTextInput::AlignLeft; + break; + default: + break; + } + } + return effectiveAlignment; +} + +bool QDeclarativeTextInputPrivate::setHAlign(QDeclarativeTextInput::HAlignment alignment, bool forceAlign) +{ + Q_Q(QDeclarativeTextInput); + if ((hAlign != alignment || forceAlign) && alignment <= QDeclarativeTextInput::AlignHCenter) { // justify not supported + QDeclarativeTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); + hAlign = alignment; + return true; + emit q->horizontalAlignmentChanged(alignment); + if (oldEffectiveHAlign != q->effectiveHAlign()) + emit q->effectiveHorizontalAlignmentChanged(); + } + return false; +} + +bool QDeclarativeTextInputPrivate::determineHorizontalAlignment() +{ + if (hAlignImplicit) { + // if no explicit alignment has been set, follow the natural layout direction of the text + return setHAlign(control->text().isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft); + } + return false; +} + +void QDeclarativeTextInputPrivate::mirrorChange() +{ + Q_Q(QDeclarativeTextInput); + if (q->isComponentComplete()) { + if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) { + q->updateRect(); + updateHorizontalScroll(); + emit q->effectiveHorizontalAlignmentChanged(); + } } } @@ -1226,10 +1282,11 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() QRect br(q->boundingRect().toRect()); int widthUsed = calculateTextWidth(); + QDeclarativeTextInput::HAlignment effectiveHAlign = q->effectiveHAlign(); if (autoScroll) { if (widthUsed <= br.width()) { // text fits in br; use hscroll for alignment - switch (hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { + switch (effectiveHAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { case Qt::AlignRight: hscroll = widthUsed - br.width() - 1; break; @@ -1261,7 +1318,7 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() hscroll = cix; } } else { - switch (hAlign) { + switch (effectiveHAlign) { case QDeclarativeTextInput::AlignRight: hscroll = q->width() - widthUsed; break; @@ -1276,19 +1333,6 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() } } -void QDeclarativeTextInputPrivate::determineHorizontalAlignment() -{ - Q_Q(QDeclarativeTextInput); - if (hAlignImplicit) { - QString text = control->text(); - // if no explicit alignment has been set, follow the natural layout direction of the text - QDeclarativeTextInput::HAlignment previousAlign = hAlign; - hAlign = text.isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft; - if (previousAlign != hAlign) - emit q->horizontalAlignmentChanged(hAlign); - } -} - void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r) { Q_D(QDeclarativeTextInput); @@ -1874,8 +1918,8 @@ void QDeclarativeTextInput::q_textChanged() { Q_D(QDeclarativeTextInput); updateSize(); - d->updateHorizontalScroll(); d->determineHorizontalAlignment(); + d->updateHorizontalScroll(); updateMicroFocus(); emit textChanged(); emit displayTextChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index ce5f267..8c873b3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - + Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) @@ -154,6 +154,7 @@ public: HAlignment hAlign() const; void setHAlign(HAlignment align); void resetHAlign(); + HAlignment effectiveHAlign() const; bool isReadOnly() const; void setReadOnly(bool); @@ -242,6 +243,7 @@ Q_SIGNALS: Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); + Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: virtual void geometryChanged(const QRectF &newGeometry, diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 60eeb76..fd4da2e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -103,7 +103,9 @@ public: void startCreatingCursor(); void focusChanged(bool hasFocus); void updateHorizontalScroll(); - void determineHorizontalAlignment(); + bool determineHorizontalAlignment(); + bool setHAlign(QDeclarativeTextInput::HAlignment, bool forceAlign = false); + void mirrorChange(); int calculateTextWidth(); bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index f27fc07..261dc51 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -520,28 +520,57 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() // implicit alignment should follow the reading direction of RTL text QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); // explicitly left aligned text->setHAlign(QDeclarativeText::AlignLeft); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); // explicitly right aligned text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); // explicitly center aligned text->setHAlign(QDeclarativeText::AlignHCenter); QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().right() > canvas->width()/2); // reseted alignment should go back to following the text reading direction text->resetHAlign(); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); + // mirror the text item + QDeclarativeItemPrivate::get(text)->setLayoutMirror(true); + + // mirrored implicit alignment should continue to follow the reading direction of the text + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), QDeclarativeText::AlignRight); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); + + // mirrored explicitly right aligned behaves as left aligned + text->setHAlign(QDeclarativeText::AlignRight); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), QDeclarativeText::AlignLeft); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); + + // mirrored explicitly left aligned behaves as right aligned + text->setHAlign(QDeclarativeText::AlignLeft); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QCOMPARE(text->effectiveHAlign(), QDeclarativeText::AlignRight); + QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); + + // disable mirroring + QDeclarativeItemPrivate::get(text)->setLayoutMirror(false); + text->resetHAlign(); + // English text should be implicitly left aligned text->setText("Hello world!"); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index ff52167..973128d 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -469,6 +469,30 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + // mirror the text item + QDeclarativeItemPrivate::get(textEdit)->setLayoutMirror(true); + + // mirrored implicit alignment should continue to follow the reading direction of the text + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->effectiveHAlign(), QDeclarativeTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + + // mirrored explicitly right aligned behaves as left aligned + textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->effectiveHAlign(), QDeclarativeTextEdit::AlignLeft); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + + // mirrored explicitly left aligned behaves as right aligned + textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->effectiveHAlign(), QDeclarativeTextEdit::AlignRight); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + + // disable mirroring + QDeclarativeItemPrivate::get(textEdit)->setLayoutMirror(false); + textEdit->resetHAlign(); + // English text should be implicitly left aligned textEdit->setText("Hello world!"); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 666bbc8..bcae3fc 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1050,20 +1050,24 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() // implicit alignment should follow the reading direction of RTL text QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); // explicitly left aligned textInput->setHAlign(QDeclarativeTextInput::AlignLeft); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); // explicitly right aligned textInput->setHAlign(QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); // explicitly center aligned textInput->setHAlign(QDeclarativeTextInput::AlignHCenter); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignHCenter); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); QVERIFY(-textInputPrivate->hscroll + textInputPrivate->width() > canvas->width()/2); @@ -1071,8 +1075,34 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() // reseted alignment should go back to following the text reading direction textInput->resetHAlign(); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + // mirror the text item + QDeclarativeItemPrivate::get(textInput)->setLayoutMirror(true); + + // mirrored implicit alignment should continue to follow the reading direction of the text + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + + // explicitly right aligned behaves as left aligned + textInput->setHAlign(QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); + QCOMPARE(textInput->effectiveHAlign(), QDeclarativeTextInput::AlignLeft); + QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + + // mirrored explicitly left aligned behaves as right aligned + textInput->setHAlign(QDeclarativeTextInput::AlignLeft); + QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); + QCOMPARE(textInput->effectiveHAlign(), QDeclarativeTextInput::AlignRight); + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); + + // disable mirroring + QDeclarativeItemPrivate::get(textInput)->setLayoutMirror(false); + QCOMPARE(textInput->effectiveHAlign(), textInput->hAlign()); + textInput->resetHAlign(); + // English text should be implicitly left aligned textInput->setText("Hello world!"); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); -- cgit v0.12 From cc6408ccd5453d1bed9f98b9caa14861cea5742b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 7 Mar 2011 15:02:01 +1000 Subject: Fix documentation talking about old property LayoutMirror::mirror Task-number: QTBUG-11042 Reviewed-by: Bea Lam Change-Id: I3f842b7672ee57dadbd1ed9216249c36aa527d6a --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativepositioners.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index e3ec7e2..5c2f781 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1804,7 +1804,7 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio \qmlproperty enumeration GridView::effectiveLayoutDirection This property holds the effective layout direction of the grid. - When using the attached property \l {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, the visual layout direction of the grid will be mirrored. However, the property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 0a54c92..f9f1a48 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2146,7 +2146,7 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio \qmlproperty enumeration ListView::effectiveLayoutDirection This property holds the effective layout direction of the horizontal list. - When using the attached property \l {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, the visual layout direction of the horizontal list will be mirrored. However, the property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged. diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index c2d0aed..84dcec6 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -619,7 +619,7 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) \qmlproperty enumeration Row::effectiveLayoutDirection This property holds the effective layout direction of the row positioner. - When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, the visual layout direction of the row positioner will be mirrored. However, the property \l {Row::layoutDirection}{layoutDirection} will remain unchanged. @@ -917,7 +917,7 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) \qmlproperty enumeration Grid::effectiveLayoutDirection This property holds the effective layout direction of the grid positioner. - When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, the visual layout direction of the grid positioner will be mirrored. However, the property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged. @@ -1279,7 +1279,7 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) \qmlproperty enumeration Flow::effectiveLayoutDirection This property holds the effective layout direction of the flow positioner. - When using the attached property {LayoutMirroring::mirror}{LayoutMirroring::mirror} for locale layouts, + When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, the visual layout direction of the grid positioner will be mirrored. However, the property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged. -- cgit v0.12 From cee7a42f5bf6473cecafc2bf98e9b383cb3edede Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 7 Mar 2011 14:45:24 +0200 Subject: VGImage readback support in QPixmap on OpenVG. Enable readback of pixel data for pixmaps that are constructed directly from a VGImage. These do not have any backing data in main memory (i.e. 'source' is null), however certain operations, like toImage(), fill(), or painting into the pixmap do not work without it. With this patch the data is read back via vgGetImageSubData when needed. Task-number: QT-4669 Reviewed-by: Jani Hautakangas --- src/openvg/qpixmapdata_vg.cpp | 42 +++++++++++---- src/openvg/qpixmapdata_vg_p.h | 9 +++- src/openvg/qvg_symbian.cpp | 2 +- tests/auto/qpixmap/qpixmap.pro | 1 + tests/auto/qpixmap/tst_qpixmap.cpp | 106 +++++++++++++++++++++++++++++++++++++ 5 files changed, 148 insertions(+), 12 deletions(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index c5da115..47de5ab 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -105,6 +105,8 @@ void QVGPixmapData::destroyImageAndContext() if (vgImage != VG_INVALID_HANDLE) { // We need to have a context current to destroy the image. #if !defined(QT_NO_EGL) + if (!context) + context = qt_vg_create_context(0, QInternal::Pixmap); if (context->isCurrent()) { destroyImages(); } else { @@ -243,10 +245,7 @@ void QVGPixmapData::fill(const QColor &color) { if (!isValid()) return; - - if (source.isNull()) - source = QVolatileImage(w, h, sourceFormat()); - + forceToImage(); if (source.depth() == 1) { // Pick the best approximate color in the image's colortable. int gray = qGray(color.rgba()); @@ -258,13 +257,11 @@ void QVGPixmapData::fill(const QColor &color) } else { source.fill(PREMUL(color.rgba())); } - - // Re-upload the image to VG the next time toVGImage() is called. - recreate = true; } bool QVGPixmapData::hasAlphaChannel() const { + ensureReadback(true); if (!source.isNull()) return source.hasAlphaChannel(); else @@ -273,6 +270,8 @@ bool QVGPixmapData::hasAlphaChannel() const void QVGPixmapData::setAlphaChannel(const QPixmap &alphaChannel) { + if (!isValid()) + return; forceToImage(); source.setAlphaChannel(alphaChannel); } @@ -281,12 +280,11 @@ QImage QVGPixmapData::toImage() const { if (!isValid()) return QImage(); - + ensureReadback(true); if (source.isNull()) { source = QVolatileImage(w, h, sourceFormat()); recreate = true; } - return source.toImage(); } @@ -476,18 +474,42 @@ int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } } -// Force the pixmap data to be backed by some valid data. +// Ensures that the pixmap is backed by some valid data and forces the data to +// be re-uploaded to the VGImage when toVGImage() is called next time. void QVGPixmapData::forceToImage() { if (!isValid()) return; + ensureReadback(false); + if (source.isNull()) source = QVolatileImage(w, h, sourceFormat()); recreate = true; } +void QVGPixmapData::ensureReadback(bool readOnly) const +{ + if (vgImage != VG_INVALID_HANDLE && source.isNull()) { + source = QVolatileImage(w, h, sourceFormat()); + source.beginDataAccess(); + vgGetImageSubData(vgImage, source.bits(), source.bytesPerLine(), + qt_vg_image_to_vg_format(source.format()), + 0, 0, w, h); + source.endDataAccess(); + if (readOnly) { + recreate = false; + } else { + // Once we did a readback, the original VGImage must be destroyed + // because it may be shared (e.g. created via SgImage) and a subsequent + // upload of the image data may produce unexpected results. + const_cast(this)->destroyImages(); + recreate = true; + } + } +} + QImage::Format QVGPixmapData::sourceFormat() const { return QImage::Format_ARGB32_Premultiplied; diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index c4fd47f..80ff1cb 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -55,7 +55,7 @@ #include #include -#include +#include "qvg_p.h" #if defined(Q_OS_SYMBIAN) class RSGImage; @@ -126,6 +126,13 @@ public: // VGImage objects to reuse storage. virtual void reclaimImages(); + // If vgImage is valid but source is null, copies pixel data from GPU back + // into main memory and destroys vgImage. For a normal pixmap this function + // does nothing, however if the pixmap was created directly from a VGImage + // (e.g. via SgImage on Symbian) then by doing the readback this ensures + // that QImage-based functions can operate too. + virtual void ensureReadback(bool readOnly) const; + QSize size() const { return QSize(w, h); } #if defined(Q_OS_SYMBIAN) diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index 22cbb3c..c6521fd 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -127,7 +127,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) } is_null = (w <= 0 || h <= 0); - source = QVolatileImage(); // vgGetImageSubData() some day? + source = QVolatileImage(); // readback will be done later, only when needed recreate = false; prevSize = QSize(w, h); updateSerial(); diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro index ff8258f..e6a8257 100644 --- a/tests/auto/qpixmap/qpixmap.pro +++ b/tests/auto/qpixmap/qpixmap.pro @@ -25,6 +25,7 @@ wince*: { LIBS += -lfbscli.dll -lbitgdi.dll -lgdi.dll contains(QT_CONFIG, openvg) { LIBS += $$QMAKE_LIBS_OPENVG + QT *= openvg } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 62a6eb4..bd9c26f 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -68,6 +68,10 @@ #include #include #include +#if !defined(QT_NO_OPENVG) +#include +#include +#endif #endif #ifdef Q_WS_X11 @@ -185,6 +189,10 @@ private slots: void toImageDeepCopy(); void loadAsBitmapOrPixmap(); + +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) + void vgImageReadBack(); +#endif }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1767,6 +1775,104 @@ void tst_QPixmap::toImageDeepCopy() QVERIFY(first != second); } +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) +Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap); +class FriendlyVGPixmapData : public QVGPixmapData +{ +public: + FriendlyVGPixmapData(PixelType type) : QVGPixmapData(type) { } + bool sourceIsNull() { return source.isNull(); } + friend QPixmap pixmapFromVGImage(VGImage image); +}; +QPixmap pixmapFromVGImage(VGImage image) +{ + if (image != VG_INVALID_HANDLE) { + int w = vgGetParameteri(image, VG_IMAGE_WIDTH); + int h = vgGetParameteri(image, VG_IMAGE_HEIGHT); + FriendlyVGPixmapData *pd = new FriendlyVGPixmapData(QPixmapData::PixmapType); + pd->resize(w, h); + pd->vgImage = image; + pd->recreate = false; + pd->prevSize = QSize(pd->w, pd->h); + return QPixmap(pd); + } + return QPixmap(); +} +class Content : public QWidget +{ +public: + void paintEvent(QPaintEvent *) { + QPainter painter(this); + QColor testPixel(qRgb(200, 150, 100)); + if (pm.isNull()) { // first phase: create a VGImage + painter.beginNativePainting(); + vgimage = vgCreateImage(VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); + QImage img(20, 10, QImage::Format_ARGB32_Premultiplied); + img.fill(qRgb(0, 0, 0)); + QPainter p(&img); + p.fillRect(0, 0, img.width(), img.height(), testPixel); + p.end(); + vgImageSubData(vgimage, img.bits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height()); + // Now the area 0,0 20x10 (in OpenVG coords) is filled with some color. + painter.endNativePainting(); + } else { // second phase: check if readback works + painter.drawPixmap(0, 0, pm); + // Drawing should not cause readback, this is important for performance; + noreadback_ok = static_cast(pm.pixmapData())->sourceIsNull(); + // However toImage() requires readback. + QImage img = pm.toImage(); + readback_ok = img.width() == pm.width(); + readback_ok &= img.height() == pm.height(); + readback_ok &= !static_cast(pm.pixmapData())->sourceIsNull(); + uint pix = img.pixel(1, 1); + content_ok = qRed(pix) == testPixel.red(); + content_ok &= qGreen(pix) == testPixel.green(); + content_ok &= qBlue(pix) == testPixel.blue(); + pix = img.pixel(img.width() - 1, img.height() - 1); + content_ok &= qRed(pix) == 0; + content_ok &= qGreen(pix) == 0; + content_ok &= qBlue(pix) == 0; + } + } + int w; + int h; + VGImage vgimage; + QPixmap pm; + bool noreadback_ok; + bool readback_ok; + bool content_ok; +}; +void tst_QPixmap::vgImageReadBack() +{ + QPixmap tmp(10, 20); + if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { + Content c; + c.w = 50; + c.h = 60; + c.vgimage = VG_INVALID_HANDLE; + c.noreadback_ok = c.readback_ok = c.content_ok = false; + c.showFullScreen(); + QTest::qWaitForWindowShown(&c); + QVERIFY(c.vgimage != VG_INVALID_HANDLE); + QPixmap pm = pixmapFromVGImage(c.vgimage); + QVERIFY(!pm.isNull()); + QCOMPARE(pm.width(), c.w); + QCOMPARE(pm.height(), c.h); + QVERIFY(qPixmapToVGImage(pm) == c.vgimage); + QVERIFY(static_cast(pm.pixmapData())->sourceIsNull()); + c.pm = pm; + // Make sure the second phase in paintEvent is executed too. + c.hide(); + c.showFullScreen(); + QTest::qWaitForWindowShown(&c); + QVERIFY(c.noreadback_ok); + QVERIFY(c.readback_ok); + QVERIFY(c.content_ok); + } else { + QSKIP("Not using openvg graphicssystem", SkipSingle); + } +} +#endif // Symbian & OpenVG QTEST_MAIN(tst_QPixmap) #include "tst_qpixmap.moc" -- cgit v0.12 From 3aad7f4fbdf57efa822c044233cf5b0f580b9ccb Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 7 Mar 2011 14:57:15 +0200 Subject: Updated def files with new QVGPixmapData function. Reviewed-by: TRUSTME --- src/s60installs/bwins/QtOpenVGu.def | 1 + src/s60installs/eabi/QtOpenVGu.def | 1 + 2 files changed, 2 insertions(+) diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index 4767d93..0bc44e9 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -179,4 +179,5 @@ EXPORTS ?updateSerial@QVGPixmapData@@IAEXXZ @ 178 NONAME ; void QVGPixmapData::updateSerial(void) ?copy@QVGPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 179 NONAME ; void QVGPixmapData::copy(class QPixmapData const *, class QRect const &) ?idealFormat@QVGPixmapData@@IBE?AW4Format@QImage@@PAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 180 NONAME ; enum QImage::Format QVGPixmapData::idealFormat(class QImage *, class QFlags) const + ?ensureReadback@QVGPixmapData@@UBEX_N@Z @ 181 NONAME ; void QVGPixmapData::ensureReadback(bool) const diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index 40aac8a..4c01550 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -209,4 +209,5 @@ EXPORTS _ZN13QVGPixmapData12updateSerialEv @ 208 NONAME _ZN13QVGPixmapData4copyEPK11QPixmapDataRK5QRect @ 209 NONAME _ZNK13QVGPixmapData11idealFormatEP6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 210 NONAME + _ZNK13QVGPixmapData14ensureReadbackEb @ 211 NONAME -- cgit v0.12 From 1224e6c3f7bbf361f0be2ff5116b5745cb98fb76 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 7 Mar 2011 16:22:23 +0200 Subject: Avoid compiler warnings in openvg on win32. Reviewed-by: TRUSTME --- src/openvg/qpaintengine_vg_p.h | 2 +- src/openvg/qwindowsurface_vgegl.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 85583cc..1e9103b 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QFixedPoint; +struct QFixedPoint; class QVGPaintEnginePrivate; class QPixmapData; class QVGEGLWindowSurfacePrivate; diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index ca80886..866453f 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -768,6 +768,11 @@ bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int context->lazyDoneCurrent(); return true; } +#else + Q_UNUSED(widget); + Q_UNUSED(area); + Q_UNUSED(dx); + Q_UNUSED(dy); #endif return false; } -- cgit v0.12 From 02cde1e6d991d10acd96492d5c5757cf6717ec98 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 7 Mar 2011 15:32:07 +1000 Subject: PinchArea example produced incorrect scaling. The maths was dodgy - producing far greater scaling than that provided by PinchArea. Change-Id: I4a1ee1b0d65eed623ec9ee92c22c9740116430c5 Task-number: QTBUG-17828 Reviewed-by: Michael Brasser --- .../declarative/touchinteraction/pincharea/flickresize.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml index a2f81ff..9439ace 100644 --- a/examples/declarative/touchinteraction/pincharea/flickresize.qml +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -54,14 +54,21 @@ Rectangle { PinchArea { width: Math.max(flick.contentWidth, flick.width) height: Math.max(flick.contentHeight, flick.height) + + property real initialWidth + property real initialHeight + onPinchStarted: { + initialWidth = flick.contentWidth + initialHeight = flick.contentHeight + } + onPinchUpdated: { // adjust content pos due to drag flick.contentX += pinch.previousCenter.x - pinch.center.x flick.contentY += pinch.previousCenter.y - pinch.center.y // resize content - var scale = 1.0 + pinch.scale - pinch.previousScale - flick.resizeContent(flick.contentWidth * scale, flick.contentHeight * scale, pinch.center) + flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center) } onPinchFinished: { -- cgit v0.12 From 38a3d51593bb5591c7c4f6d51d7d9fa203b4d56e Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 7 Mar 2011 17:25:44 +1000 Subject: Include dynamic parenting use cases in layout mirroring autotests Task-number: QTBUG-17280 Reviewed-by: Martin Jones Change-Id: Ibbbd2da44d5826b6e499b731eda66b2016bade85 --- src/declarative/graphicsitems/qdeclarativeitem_p.h | 3 +- .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 33 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index b204d7f..dae581c 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -145,10 +145,11 @@ public: if (parent) { QDeclarative_setParent_noEvent(q, parent); q->setParentItem(parent); + QDeclarativeItemPrivate *parentPrivate = QDeclarativeItemPrivate::get(parent); + setImplicitLayoutMirror(parentPrivate->inheritedLayoutMirror, parentPrivate->inheritMirrorFromParent); } baselineOffset.invalidate(); mouseSetsFocus = false; - resolveLayoutMirror(); } bool isMirrored() const { diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 2d14e66..52c9a72 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -518,6 +518,39 @@ void tst_QDeclarativeItem::layoutMirroring() QCOMPARE(childPrivate(rootItem, "inheritedMirror2")->inheritedLayoutMirror, true); QCOMPARE(childPrivate(rootItem, "mirrored1")->inheritedLayoutMirror, true); QCOMPARE(childPrivate(rootItem, "notMirrored1")->inheritedLayoutMirror, true); + + // + // dynamic parenting + // + QDeclarativeItem *parentItem1 = new QDeclarativeItem(); + QDeclarativeItemPrivate::get(parentItem1)->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true + QDeclarativeItemPrivate::get(parentItem1)->isMirrorImplicit = false; + QDeclarativeItemPrivate::get(parentItem1)->inheritMirrorFromItem = true; // LayoutMirroring.childrenInherit: true + QDeclarativeItemPrivate::get(parentItem1)->resolveLayoutMirror(); + + // inherit in constructor + QDeclarativeItem *childItem1 = new QDeclarativeItem(parentItem1); + QCOMPARE(QDeclarativeItemPrivate::get(childItem1)->effectiveLayoutMirror, true); + QCOMPARE(QDeclarativeItemPrivate::get(childItem1)->inheritMirrorFromParent, true); + + // inherit through a parent change + QDeclarativeItem *childItem2 = new QDeclarativeItem(); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->effectiveLayoutMirror, false); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->inheritMirrorFromParent, false); + childItem2->setParentItem(parentItem1); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->effectiveLayoutMirror, true); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->inheritMirrorFromParent, true); + + // stop inherting through a parent change + QDeclarativeItem *parentItem2 = new QDeclarativeItem(); + QDeclarativeItemPrivate::get(parentItem2)->effectiveLayoutMirror = true; // LayoutMirroring.enabled: true + QDeclarativeItemPrivate::get(parentItem2)->resolveLayoutMirror(); + childItem2->setParentItem(parentItem2); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->effectiveLayoutMirror, false); + QCOMPARE(QDeclarativeItemPrivate::get(childItem2)->inheritMirrorFromParent, false); + + delete parentItem1; + delete parentItem2; } void tst_QDeclarativeItem::layoutMirroringIllegalParent() -- cgit v0.12 From a8f7a5067e4c3d1e7ef87a7067e026e62eab5c17 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 8 Mar 2011 08:39:59 +0200 Subject: Support partial input mode By default Symbian devices use fullscreen editing mode. However, in the latest AVKON releases a partial virtual keyboard is supported. Support the non-fullscreen editing mode from QCoeFepInputContext. The non-fullscreen editing mode is only supported for Symbian^3 and only for graphicsview-based solutions (QGraphicsView, QGraphicsWebView, QDeclarativeView, ...). When native side indicates that the keyboard opens, the graphicsview is possibly translated so that the text cursor position is ensured to be visible. When keyboard closes, the translation is removed. If the graphicsview contains vertical scrollbar, the whole view is resized to the area above the keyboard, since translating it, would move the upper part of the scrollbar out of screen area. There is a new exported private API to control when partial vkb is used. Task-number: QTBUG-16572 Reviewed-by: axis Reviewed-by: Mrudul Pendharkar Reviewed-by: Laszlo Agocs --- src/gui/inputmethod/qcoefepinputcontext_p.h | 11 + src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 280 +++++++++++++++++++++++- src/gui/kernel/qapplication_s60.cpp | 56 +++++ src/gui/kernel/qt_s60_p.h | 5 + src/s60installs/bwins/QtGuiu.def | 1 + src/s60installs/eabi/QtGuiu.def | 1 + 6 files changed, 345 insertions(+), 9 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 8c8ffd4..de3577f 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -93,6 +93,9 @@ public: TCoeInputCapabilities inputCapabilities(); + void resetSplitViewWidget(bool keepInputWidget = false); + void ensureFocusWidgetVisible(QWidget *widget); + protected: void timerEvent(QTimerEvent *timerEvent); @@ -104,9 +107,11 @@ private: void queueInputCapabilitiesChanged(); bool needsInputPanel(); void commitTemporaryPreeditString(); + bool isWidgetVisible(QWidget *widget, int offset = 0); private Q_SLOTS: void ensureInputCapabilitiesChanged(); + void translateInputWidget(); // From MCoeFepAwareTextEditor public: @@ -155,9 +160,15 @@ private: QBasicTimer m_tempPreeditStringTimeout; bool m_hasTempPreeditString; + int m_splitViewResizeBy; + Qt::WindowStates m_splitViewPreviousWindowStates; + QRectF m_transformation; + friend class tst_QInputContext; }; +Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable); + QT_END_NAMESPACE #endif // QT_NO_IM diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 1bef64d..cd4e2fd 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include @@ -67,8 +69,16 @@ // that support text selection. #define QT_EAknEditorFlagSelectionVisible 0x100000 +// EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards. +#define QT_EAknEditorFlagEnablePartialScreen 0x200000 + QT_BEGIN_NAMESPACE +Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) +{ + S60->partial_keyboard = enable; +} + QCoeFepInputContext::QCoeFepInputContext(QObject *parent) : QInputContext(parent), m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new @@ -80,13 +90,19 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_inlinePosition(0), m_formatRetriever(0), m_pointerHandler(0), - m_hasTempPreeditString(false) + m_hasTempPreeditString(false), + m_splitViewResizeBy(0), + m_splitViewPreviousWindowStates(Qt::WindowNoState) { m_fepState->SetObjectProvider(this); - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) - m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible); - else - m_fepState->SetFlags(EAknEditorFlagDefault); + int defaultFlags = EAknEditorFlagDefault; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { + if (S60->partial_keyboard) { + defaultFlags |= QT_EAknEditorFlagEnablePartialScreen; + } + defaultFlags |= QT_EAknEditorFlagSelectionVisible; + } + m_fepState->SetFlags(defaultFlags); m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorTextCase ); @@ -210,6 +226,21 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) return false; switch (event->type()) { + case QEvent::MouseButtonPress: + // Alphanumeric keypad doesn't like it when we click and text is still getting displayed + // It ignores the mouse event, so we need to commit and send a selection event (which will get triggered + // after the commit) + if (!m_preeditString.isEmpty()) { + commitCurrentString(false); + + int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); + + QList selectAttributes; + selectAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, pos, 0, QVariant()); + QInputMethodEvent selectEvent(QLatin1String(""), selectAttributes); + sendEvent(selectEvent); + } + break; case QEvent::KeyPress: commitTemporaryPreeditString(); // fall through intended @@ -299,6 +330,26 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE // This should also happen for commands. reset(); + // We need to translate the window content when window becomes available. Changing the window while it is + // not yet ready with OpenVg graphicssystem results in operations silently failing. + + if (event->windowServerEvent() && event->windowServerEvent()->Type() == EEventWindowVisibilityChanged) { + if (S60->splitViewLastWidget) { + QGraphicsView *gv = qobject_cast(S60->splitViewLastWidget); + const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); + TUint visibleFlags = event->windowServerEvent()->VisibilityChanged()->iFlags; + if (!alwaysResize) { + if (visibleFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { + if (!isWidgetVisible(S60->splitViewLastWidget)) { + ensureFocusWidgetVisible(S60->splitViewLastWidget); + } + } else if (visibleFlags & TWsVisibilityChangedEvent::ENotVisible) { + resetSplitViewWidget(true); + } + } + } + } + return false; } @@ -343,6 +394,174 @@ TCoeInputCapabilities QCoeFepInputContext::inputCapabilities() return TCoeInputCapabilities(m_textCapabilities, this, 0); } +void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) +{ + QGraphicsView *gv = qobject_cast(S60->splitViewLastWidget); + + if (!gv) { + return; + } + + QSymbianControl *symControl = static_cast(S60->splitViewLastWidget->effectiveWinId()); + symControl->CancelLongTapTimer(); + + const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); + QWidget *windowToMove = gv ? gv : symControl->widget(); + if (!S60->splitViewLastWidget->isWindow()) + windowToMove = S60->splitViewLastWidget->window(); + + bool userResize = S60->splitViewLastWidget->testAttribute(Qt::WA_Resized); + bool userMove = windowToMove->testAttribute(Qt::WA_Moved); + + if (gv) + windowToMove->setUpdatesEnabled(false); + + if (gv && !alwaysResize) { + disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + if (gv && gv->scene()) { + QGraphicsItem *rootItem; + foreach (QGraphicsItem *item, gv->scene()->items()) { + if (!item->parentItem()) { + rootItem = item; + break; + } + } + if (rootItem) + rootItem->resetTransform(); + } + } + + // Resizing might have led to widget losing its original windowstate. + // Restore previous window state. + + if (m_splitViewPreviousWindowStates != windowToMove->windowState()) + windowToMove->setWindowState(m_splitViewPreviousWindowStates); + + if (m_splitViewResizeBy) + S60->splitViewLastWidget->updateGeometry(); + if (gv) + windowToMove->setUpdatesEnabled(true); + + S60->splitViewLastWidget->setAttribute(Qt::WA_Resized, userResize); //not a user resize + windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move + + m_splitViewResizeBy = 0; + if (!keepInputWidget) { + m_splitViewPreviousWindowStates = Qt::WindowNoState; + S60->splitViewLastWidget = 0; + } +} + +// Checks if a given widget is visible in the splitview rect. The offset +// parameter can be used to validate if moving widget upwards or downwards +// by the offset would make a difference for the visibility. + +bool QCoeFepInputContext::isWidgetVisible(QWidget *widget, int offset) +{ + bool visible = false; + if (widget) { + QRect splitViewRect = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); + QWidget *window = QApplication::activeWindow(); + QGraphicsView *gv = qobject_cast(widget); + if (gv && window) { + if (QGraphicsScene *scene = gv->scene()) { + if (QGraphicsItem *focusItem = scene->focusItem()) { + QPoint cursorPos = window->mapToGlobal(focusItem->cursor().pos()); + cursorPos.setY(cursorPos.y() + offset); + if (splitViewRect.contains(cursorPos)) { + visible = true; + } + } + } + } + } + return visible; +} + +// Ensure that the input widget is visible in the splitview rect. + +void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) +{ + // Native side opening and closing its virtual keyboard when it changes the keyboard layout, + // has an adverse impact on long tap timer. Cancel the timer when splitview opens to avoid this. + QSymbianControl *symControl = static_cast(widget->effectiveWinId()); + symControl->CancelLongTapTimer(); + + // Graphicsviews that have vertical scrollbars should always be resized to the splitview area. + // Graphicsviews without scrollbars should be translated. + + QGraphicsView *gv = qobject_cast(widget); + if (!gv) + return; + + const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); + const bool moveWithinVisibleArea = (S60->splitViewLastWidget != 0); + + QWidget *windowToMove = gv ? gv : symControl->widget(); + if (!windowToMove->isWindow()) + windowToMove = windowToMove->window(); + if (!windowToMove) { + return; + } + + // When opening the keyboard (not moving within the splitview area), save the original + // window state. In some cases, ensuring input widget visibility might lead to window + // states getting changed. + + if (!moveWithinVisibleArea) { + S60->splitViewLastWidget = widget; + m_splitViewPreviousWindowStates = windowToMove->windowState(); + } + + int windowTop = widget->window()->pos().y(); + + const bool userResize = widget->testAttribute(Qt::WA_Resized); + const bool userMove = windowToMove->testAttribute(Qt::WA_Moved); + + QRect splitViewRect = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); + + if (gv) { + + // When resizing a window widget, it will lose its maximized window state. + // Native applications hide statuspane in splitview state, so lets move to + // fullscreen mode. This makes available area slightly bigger, which helps usability + // and greatly reduces event passing in orientation switch cases, + // as the statuspane size is not changing. + + if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { + widget->setWindowState( + (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); + } + + if (alwaysResize) { + windowToMove->setUpdatesEnabled(false); + if (!moveWithinVisibleArea) + m_splitViewResizeBy = widget->height(); + + windowTop = widget->geometry().top(); + widget->resize(widget->width(), splitViewRect.height() - windowTop); + + if (gv && gv->scene()) { + const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); + gv->ensureVisible(microFocusRect); + } + windowToMove->setUpdatesEnabled(true); + } else { + if (!moveWithinVisibleArea) { + // Check if the widget contains cursorPositionChanged signal and connect to it. + const char *signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())).constData(); + int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal + 1); + if (index != -1) + connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); + } + translateInputWidget(); + } + } + + widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize + windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move +} + static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat, bool validStyleColor) { QTextCharFormat qFormat; @@ -474,10 +693,12 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetPermittedCases(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); - if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) - flags = QT_EAknEditorFlagSelectionVisible; - else - flags = 0; + flags = 0; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) { + if (S60->partial_keyboard) + flags |= QT_EAknEditorFlagEnablePartialScreen; + flags |= QT_EAknEditorFlagSelectionVisible; + } if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) { flags |= EAknEditorFlagFixedCase; @@ -604,6 +825,47 @@ void QCoeFepInputContext::ensureInputCapabilitiesChanged() m_pendingInputCapabilitiesChanged = false; } +void QCoeFepInputContext::translateInputWidget() +{ + QGraphicsView *gv = qobject_cast(S60->splitViewLastWidget); + QRect splitViewRect = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); + + QRectF cursor = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); + QPolygon cursorP = gv->mapFromScene(cursor); + QRectF vkbRect = QRectF(splitViewRect.bottomLeft(), qApp->desktop()->rect().bottomRight()); + if (cursor.isEmpty() || vkbRect.isEmpty()) + return; + + // Fetch root item (i.e. graphicsitem with no parent) + QGraphicsItem *rootItem; + foreach (QGraphicsItem *item, gv->scene()->items()) { + if (!item->parentItem()) { + rootItem = item; + break; + } + } + if (!rootItem) + return; + + m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF(); + + // Do nothing if the cursor is visible in the splitview area. + if (splitViewRect.contains(cursorP.boundingRect())) + return; + + // New Y position should be ideally at the center of the splitview area. + // If that would expose unpainted canvas, limit the tranformation to the visible scene bottom. + + const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height(); + qreal dy = -(qMin(maxY, (cursor.bottom() - vkbRect.top() / 2))); + + // Do not allow transform above screen top. + if (m_transformation.height() + dy > 0) + return; + + rootItem->setTransform(QTransform::fromTranslate(0, dy), true); +} + void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* /*aCustomDraw*/, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fb0c6b8..02560b3 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -96,6 +96,10 @@ QT_BEGIN_NAMESPACE // Goom Events through Window Server static const int KGoomMemoryLowEvent = 0x10282DBF; static const int KGoomMemoryGoodEvent = 0x20026790; +// Split view open/close events from AVKON +static const int KSplitViewOpenEvent = 0x2001E2C0; +static const int KSplitViewCloseEvent = 0x2001E2C1; + #if defined(QT_DEBUG) static bool appNoGrab = false; // Grabbing enabled @@ -1224,6 +1228,11 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) if (m_ignoreFocusChanged || (qwidget->windowType() & Qt::WindowType_Mask) == Qt::Desktop) return; +#ifdef Q_WS_S60 + if (S60->splitViewLastWidget) + return; +#endif + // Popups never get focused, but still receive the FocusChanged when they are hidden. if (QApplicationPrivate::popupWidgets != 0 || (qwidget->windowType() & Qt::Popup) == Qt::Popup) @@ -1302,9 +1311,56 @@ void QSymbianControl::handleClientAreaChange() } } +bool QSymbianControl::isSplitViewWidget(QWidget *widget) { + bool returnValue = true; + //Ignore events sent to non-active windows, not visible widgets and not parents of input widget. + if (!qwidget->isActiveWindow() + || !qwidget->isVisible() + || !qwidget->isAncestorOf(widget)) { + + returnValue = false; + } + return returnValue; +} + void QSymbianControl::HandleResourceChange(int resourceType) { switch (resourceType) { + case KSplitViewCloseEvent: //intentional fall-through + case KSplitViewOpenEvent: { +#if !defined(QT_NO_IM) && defined(Q_WS_S60) + + //Fetch widget getting the text input + QWidget *widget = QWidget::keyboardGrabber(); + if (!widget) { + if (QApplicationPrivate::popupWidgets) { + widget = QApplication::activePopupWidget()->focusWidget(); + if (!widget) { + widget = QApplication::activePopupWidget(); + } + } else { + widget = QApplicationPrivate::focus_widget; + if (!widget) { + widget = qwidget; + } + } + } + if (widget) { + QCoeFepInputContext *ic = qobject_cast(widget->inputContext()); + if (!ic) { + ic = qobject_cast(qApp->inputContext()); + } + if (ic && isSplitViewWidget(widget)) { + if (resourceType == KSplitViewCloseEvent) { + ic->resetSplitViewWidget(); + } else { + ic->ensureFocusWidgetVisible(widget); + } + } + } +#endif // !defined(QT_NO_IM) && defined(Q_WS_S60) + } + break; case KInternalStatusPaneChange: handleClientAreaChange(); if (IsFocused() && IsVisible()) { diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 40697bf..1e9967f 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -142,7 +142,10 @@ public: int avkonComponentsSupportTransparency : 1; int menuBeingConstructed : 1; int orientationSet : 1; + int partial_keyboard : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type + QPointer splitViewLastWidget; + static CEikButtonGroupContainer *cba; enum ScanCodeState { @@ -252,6 +255,7 @@ private: #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); #endif + bool isSplitViewWidget(QWidget *widget); public: void handleClientAreaChange(); @@ -297,6 +301,7 @@ inline QS60Data::QS60Data() avkonComponentsSupportTransparency(0), menuBeingConstructed(0), orientationSet(0), + partial_keyboard(0), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 0650a6a..26a0761 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12980,4 +12980,5 @@ EXPORTS ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 39f1459..29db74e 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12181,4 +12181,5 @@ EXPORTS _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _Z32qt_s60_setPartialScreenInputModeb @ 12149 NONAME -- cgit v0.12 From 54de06c6f3bd7ef74a10bfab9bff5416078edd6f Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 8 Mar 2011 14:33:29 +1000 Subject: Base empty QML editor horizontal alignment on QApplication::keyboardInputDirection() Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: I240d53c8572fd3d1222b555e93812a3ee38e2558 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 5 ++++- .../declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 ++++-- .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 11 ++++++++--- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 11 ++++++++--- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 4a931fd..f0d0221 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1120,7 +1120,8 @@ bool QDeclarativeTextPrivate::determineHorizontalAlignment() Q_Q(QDeclarativeText); if (hAlignImplicit && q->isComponentComplete()) { // if no explicit alignment has been set, follow the natural layout direction of the text - return setHAlign(text.isRightToLeft() ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft); + bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); + return setHAlign(isRightToLeft ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft); } return false; } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 75a22d1..d1d2351 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -550,7 +550,8 @@ bool QDeclarativeTextEditPrivate::determineHorizontalAlignment() Q_Q(QDeclarativeTextEdit); if (hAlignImplicit && q->isComponentComplete()) { // if no explicit alignment has been set, follow the natural layout direction of the text - return setHAlign(text.isRightToLeft() ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); + bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); + return setHAlign(isRightToLeft ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); } return false; } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 6305eaa..850c212 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -411,7 +411,9 @@ bool QDeclarativeTextInputPrivate::determineHorizontalAlignment() { if (hAlignImplicit) { // if no explicit alignment has been set, follow the natural layout direction of the text - return setHAlign(control->text().isRightToLeft() ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft); + QString text = control->text(); + bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); + return setHAlign(isRightToLeft ? QDeclarativeTextInput::AlignRight : QDeclarativeTextInput::AlignLeft); } return false; } @@ -1872,6 +1874,7 @@ void QDeclarativeTextInputPrivate::init() QPalette p = control->palette(); selectedTextColor = p.color(QPalette::HighlightedText); selectionColor = p.color(QPalette::Highlight); + determineHorizontalAlignment(); } void QDeclarativeTextInput::cursorPosChanged() diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 261dc51..c854f86 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -576,9 +576,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); - // empty text is also implicitly left aligned + // empty text with implicit alignment follows the system locale-based + // keyboard input direction from QApplication::keyboardInputDirection text->setText(""); - QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QCOMPARE(text->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight); text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 7a0ca12..4d94dae 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -500,10 +500,15 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); - // empty text is also implicitly left aligned + // empty text with implicit alignment follows the system locale-based + // keyboard input direction from QApplication::keyboardInputDirection textEdit->setText(""); - QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); - QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + QCOMPARE(textEdit->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeTextEdit::AlignLeft : QDeclarativeTextEdit::AlignRight); + if (QApplication::keyboardInputDirection() == Qt::LeftToRight) + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + else + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 5c8b59c..caada13 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1110,10 +1110,15 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); - // empty text is also implicitly left aligned + // empty text with implicit alignment follows the system locale-based + // keyboard input direction from QApplication::keyboardInputDirection textInput->setText(""); - QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); - QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + QCOMPARE(textInput->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeTextInput::AlignLeft : QDeclarativeTextInput::AlignRight); + if (QApplication::keyboardInputDirection() == Qt::LeftToRight) + QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); + else + QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); textInput->setHAlign(QDeclarativeTextInput::AlignRight); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); -- cgit v0.12 From 0b2983f9339f1003159f3a746491928f74b593ba Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 8 Mar 2011 15:30:36 +1000 Subject: Fix TextInput key navigation for RTL text Task-number: QTBUG-15882 Reviewed-by: Martin Jones Change-Id: I77c02de3bcd1a1d05dfcdd71327da45182050071 --- .../graphicsitems/qdeclarativetextinput.cpp | 4 +-- .../tst_qdeclarativetextinput.cpp | 40 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 850c212..6c26fd3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1068,9 +1068,9 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) // because then moving will do something (deselect). int cursorPosition = d->control->cursor(); if (cursorPosition == 0) - ignore = ev->key() == (d->control->text().mid(cursorPosition,1).isRightToLeft() ? Qt::Key_Right : Qt::Key_Left); + ignore = ev->key() == (d->control->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right); if (cursorPosition == d->control->text().length()) - ignore = ev->key() == (d->control->text().mid(cursorPosition-1,1).isRightToLeft() ? Qt::Key_Left : Qt::Key_Right); + ignore = ev->key() == (d->control->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left); } if (ignore) { ev->ignore(); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index caada13..fc19c94 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -115,6 +115,7 @@ private slots: void cursorVisible(); void cursorRectangle(); void navigation(); + void navigation_RTL(); void copyAndPaste(); void canPasteEmpty(); void canPaste(); @@ -1435,6 +1436,45 @@ void tst_qdeclarativetextinput::navigation() delete canvas; } +void tst_qdeclarativetextinput::navigation_RTL() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *input = qobject_cast(qvariant_cast(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; + input->setText(QString::fromUtf16(arabic_str, 11)); + + input->setCursorPosition(0); + QTRY_VERIFY(input->hasActiveFocus() == true); + + // move off + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasActiveFocus() == false); + + // move back + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasActiveFocus() == true); + + input->setCursorPosition(input->text().length()); + QVERIFY(input->hasActiveFocus() == true); + + // move off + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasActiveFocus() == false); + + // move back + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasActiveFocus() == true); + + delete canvas; +} + void tst_qdeclarativetextinput::copyAndPaste() { #ifndef QT_NO_CLIPBOARD -- cgit v0.12 From f47f01fd34d08f6152c9053c0d6928fc359aa0f9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 8 Mar 2011 14:55:56 +1000 Subject: Use the text layout bounds calculated by QLayout. We used to calculate the size and position of the cache image ourselves. Rather use the line positions and bounding rect calculated by QLayout. Change-Id: I601688ab7e310b0015a1994adf52b108f39504d8 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativetext.cpp | 73 +++++++++------------- .../graphicsitems/qdeclarativetext_p_p.h | 4 +- .../qdeclarativetext/tst_qdeclarativetext.cpp | 6 +- 3 files changed, 34 insertions(+), 49 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index f0d0221..6bcd2fa 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -282,11 +282,11 @@ void QDeclarativeTextPrivate::updateSize() //setup instance of QTextLayout for all cases other than richtext if (!richText) { - size = setupTextLayout(); - if (layedOutTextSize != size) { + QRect textRect = setupTextLayout(); + if (layedOutTextRect.size() != textRect.size()) q->prepareGeometryChange(); - layedOutTextSize = size; - } + layedOutTextRect = textRect; + size = textRect.size(); dy -= size.height(); } else { singleline = false; // richtext can't elide or be optimized for single-line case @@ -306,9 +306,9 @@ void QDeclarativeTextPrivate::updateSize() doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) dy -= (int)doc->size().height(); QSize dsize = doc->size().toSize(); - if (dsize != layedOutTextSize) { + if (dsize != layedOutTextRect.size()) { q->prepareGeometryChange(); - layedOutTextSize = dsize; + layedOutTextRect = QRect(QPoint(0,0), dsize); } size = QSize(int(doc->idealWidth()),dsize.height()); } @@ -343,14 +343,13 @@ void QDeclarativeTextPrivate::updateSize() Returns the size of the final text. This can be used to position the text vertically (the text is already absolutely positioned horizontally). */ -QSize QDeclarativeTextPrivate::setupTextLayout() +QRect QDeclarativeTextPrivate::setupTextLayout() { // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); Q_Q(QDeclarativeText); layout.setCacheEnabled(true); - qreal widthUsed = 0; qreal lineWidth = 0; int visibleCount = 0; @@ -378,11 +377,12 @@ QSize QDeclarativeTextPrivate::setupTextLayout() break; } layout.endLayout(); - naturalWidth = 0; + QRectF br; for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); - naturalWidth = qMax(naturalWidth, line.naturalTextWidth()); + br = br.united(line.naturalTextRect()); } + naturalWidth = br.width(); } if (maximumLineCountValid) { @@ -440,19 +440,21 @@ QSize QDeclarativeTextPrivate::setupTextLayout() } qreal height = 0; + QRectF br; for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); - // calc width - widthUsed = qMax(widthUsed, line.naturalTextRect().right()); // set line spacing line.setPosition(QPointF(line.position().x(), height)); - if (elideText && i == layout.lineCount()-1) + if (elideText && i == layout.lineCount()-1) { elidePos.setY(height + fm.ascent()); + br = br.united(QRectF(elidePos, QSizeF(fm.width(elideChar), fm.ascent()))); + } + br = br.united(line.naturalTextRect()); height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; } if (!q->widthValid()) - naturalWidth = widthUsed; + naturalWidth = br.width(); //Update the number of visible lines if (lineCount != visibleCount) { @@ -460,7 +462,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout() emit q->lineCountChanged(); } - return QSize(qCeil(widthUsed), qCeil(height)); + return QRect(qRound(br.x()), qRound(br.y()), qCeil(br.width()), qCeil(br.height())); } /*! @@ -470,7 +472,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout() QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) { //do layout - QSize size = layedOutTextSize; + QSize size = layedOutTextRect.size(); //paint text QPixmap img(size); if (!size.isEmpty()) { @@ -483,7 +485,7 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) #ifdef Q_WS_MAC qt_applefontsmoothing_enabled = oldSmooth; #endif - drawTextLayout(&p, QPointF(0,0), drawStyle); + drawTextLayout(&p, QPointF(-layedOutTextRect.x(),0), drawStyle); } return img; } @@ -501,7 +503,7 @@ void QDeclarativeTextPrivate::drawTextLayout(QPainter *painter, const QPointF &p painter->setFont(font); layout.draw(painter, pos); if (!elidePos.isNull()) - painter->drawText(elidePos, elideChar); + painter->drawText(pos + elidePos, elideChar); } /*! @@ -1388,44 +1390,25 @@ QRectF QDeclarativeText::boundingRect() const { Q_D(const QDeclarativeText); - int w = width(); - int h = height(); - - int x = 0; - int y = 0; - - QSize size = d->layedOutTextSize; + QRect rect = d->layedOutTextRect; if (d->style != Normal) - size += QSize(2,2); + rect.adjust(-1, 0, 1, 2); // Could include font max left/right bearings to either side of rectangle. - switch (d->hAlign) { - case AlignLeft: - case AlignJustify: - x = 0; - break; - case AlignRight: - x = w - size.width(); - break; - case AlignHCenter: - x = (w - size.width()) / 2; - break; - } - + int h = height(); switch (d->vAlign) { case AlignTop: - y = 0; break; case AlignBottom: - y = h - size.height(); + rect.setY(h - rect.height()); break; case AlignVCenter: - y = (h - size.height()) / 2; + rect.setY((h - rect.height()) / 2); break; } - return QRectF(x,y,size.width(),size.height()); + return QRectF(rect); } /*! \internal */ @@ -1571,8 +1554,8 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid } else { QRectF bounds = boundingRect(); - bool needClip = clip() && (d->layedOutTextSize.width() > width() || - d->layedOutTextSize.height() > height()); + bool needClip = clip() && (d->layedOutTextRect.width() > width() || + d->layedOutTextRect.height() > height()); if (needClip) { p->save(); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 0864c8f..2e154a0 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -115,7 +115,7 @@ public: bool requireImplicitWidth:1; bool hAlignImplicit:1; - QSize layedOutTextSize; + QRect layedOutTextRect; QSize paintedSize; qreal naturalWidth; virtual qreal implicitWidth() const; @@ -123,7 +123,7 @@ public: QPixmap textDocumentImage(bool drawStyle); QTextDocumentWithImageResources *doc; - QSize setupTextLayout(); + QRect setupTextLayout(); QPixmap textLayoutImage(bool drawStyle); void drawTextLayout(QPainter *p, const QPointF &pos, bool drawStyle); QDeclarativeTextLayout layout; diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index c854f86..9c12a90 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1156,12 +1156,14 @@ void tst_qdeclarativetext::lineHeight() QVERIFY(myText->lineHeightMode() == QDeclarativeText::ProportionalHeight); qreal h = myText->height(); + int lc = myText->lineCount(); + qreal lh = myText->height() / lc; myText->setLineHeight(1.5); - QVERIFY(myText->height() == h * 1.5); + QVERIFY(qAbs(myText->height() - (((lc-1) * lh * 1.5) + lh)) < 1.0); myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(20); - QCOMPARE(myText->height(), myText->lineCount() * 20.0); + QCOMPARE(myText->height(), ((lc-1) * 20.0) + lh); myText->setText("Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."); myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); -- cgit v0.12 From cb7ce0b2cb0f47e7ef51e7c7f034dda39cc410ad Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 8 Mar 2011 16:50:15 +0200 Subject: Correcting incorrect ordinal introduced by the split view changes. Reviewed-by: TRUSTME --- src/s60installs/eabi/QtGuiu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 29db74e..b6a24ab 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12181,5 +12181,5 @@ EXPORTS _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME - _Z32qt_s60_setPartialScreenInputModeb @ 12149 NONAME + _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME -- cgit v0.12 From a870c5e10fe83b6b8df254ec760ac50020738aaa Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 8 Mar 2011 16:59:31 +0200 Subject: Added native image handle provider support in pixmaps on openvg. QNativeImageHandleProvider is a thin interface consisting of get() and release() functions. Pixmaps constructed with such a provider will call these functions to acquire and release a native handle, e.g. a CFbsBitmap or RSgImage pointer in case of Symbian. The behavior is largely similar to constructing pixmaps via fromSymbianCFbsBitmap or fromSymbianRSgImage, with the exception of pixmap hibernation: release() (and subsequently get()) is guaranteed to be called also in case of hibernation, allowing more fine-grained tracking of the usage and lifetime of image data. Task-number: QT-4632 Reviewed-by: Jani Hautakangas --- src/gui/image/image.pri | 3 +- src/gui/image/qpixmapdata_p.h | 3 +- src/openvg/qpixmapdata_vg.cpp | 37 +++- src/openvg/qpixmapdata_vg_p.h | 11 + src/openvg/qvg_symbian.cpp | 45 ++++ src/s60installs/bwins/QtOpenVGu.def | 3 + src/s60installs/eabi/QtOpenVGu.def | 3 + .../nativeimagehandleprovider.pro | 6 + .../tst_nativeimagehandleprovider.cpp | 237 +++++++++++++++++++++ tests/auto/other.pro | 3 +- 10 files changed, 345 insertions(+), 6 deletions(-) create mode 100644 tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro create mode 100644 tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index d99b1c6..00dccbe 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -30,7 +30,8 @@ HEADERS += \ image/qpixmapfilter_p.h \ image/qimagepixmapcleanuphooks_p.h \ image/qvolatileimage_p.h \ - image/qvolatileimagedata_p.h + image/qvolatileimagedata_p.h \ + image/qnativeimagehandleprovider_p.h SOURCES += \ image/qbitmap.cpp \ diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index aa24a0e..0d0d417 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -72,7 +72,8 @@ public: enum NativeType { FbsBitmap, SgImage, - VolatileImage + VolatileImage, + NativeImageHandleProvider }; #endif enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 47de5ab..3f67c79 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -50,6 +50,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -66,6 +67,10 @@ QVGPixmapData::QVGPixmapData(PixelType type) inImagePool = false; inLRU = false; failedToAlloc = false; +#if defined(Q_OS_SYMBIAN) + nativeImageHandleProvider = 0; + nativeImageHandle = 0; +#endif #if !defined(QT_NO_EGL) context = 0; qt_vg_register_pixmap(this); @@ -98,6 +103,10 @@ void QVGPixmapData::destroyImages() vgImage = VG_INVALID_HANDLE; vgImageOpacity = VG_INVALID_HANDLE; inImagePool = false; + +#if defined(Q_OS_SYMBIAN) + releaseNativeImageHandle(); +#endif } void QVGPixmapData::destroyImageAndContext() @@ -120,6 +129,10 @@ void QVGPixmapData::destroyImageAndContext() #else destroyImages(); #endif + } else { +#if defined(Q_OS_SYMBIAN) + releaseNativeImageHandle(); +#endif } #if !defined(QT_NO_EGL) if (context) { @@ -343,6 +356,12 @@ VGImage QVGPixmapData::toVGImage() else if (recreate) cachedOpacity = -1.0f; // Force opacity image to be refreshed later. +#if defined(Q_OS_SYMBIAN) + if (recreate && nativeImageHandleProvider && !nativeImageHandle) { + createFromNativeImageHandleProvider(); + } +#endif + if (vgImage == VG_INVALID_HANDLE) { vgImage = QVGImagePool::instance()->createImageForPixmap (qt_vg_image_to_vg_format(source.format()), w, h, VG_IMAGE_QUALITY_FASTER, this); @@ -427,9 +446,16 @@ void QVGPixmapData::detachImageFromPool() void QVGPixmapData::hibernate() { - // If the image was imported (e.g, from an SgImage under Symbian), - // then we cannot copy it back to main memory for storage. - if (vgImage != VG_INVALID_HANDLE && source.isNull()) + // If the image was imported (e.g, from an SgImage under Symbian), then + // skip the hibernation, there is no sense in copying it back to main + // memory because the data is most likely shared between several processes. + bool skipHibernate = (vgImage != VG_INVALID_HANDLE && source.isNull()); +#if defined(Q_OS_SYMBIAN) + // However we have to proceed normally if the image was retrieved via + // a handle provider. + skipHibernate &= !nativeImageHandleProvider; +#endif + if (skipHibernate) return; forceToImage(); @@ -505,6 +531,11 @@ void QVGPixmapData::ensureReadback(bool readOnly) const // because it may be shared (e.g. created via SgImage) and a subsequent // upload of the image data may produce unexpected results. const_cast(this)->destroyImages(); +#if defined(Q_OS_SYMBIAN) + // There is now an own copy of the data so drop the handle provider, + // otherwise toVGImage() would request the handle again, which is wrong. + nativeImageHandleProvider = 0; +#endif recreate = true; } } diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index 80ff1cb..15ff889 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -76,6 +76,8 @@ void qt_vg_unregister_pixmap(QVGPixmapData *pd); void qt_vg_hibernate_pixmaps(QVGSharedContext *context); #endif +class QNativeImageHandleProvider; + class Q_OPENVG_EXPORT QVGPixmapData : public QPixmapData { public: @@ -138,6 +140,9 @@ public: #if defined(Q_OS_SYMBIAN) void* toNativeType(NativeType type); void fromNativeType(void* pixmap, NativeType type); + bool initFromNativeImageHandle(void *handle, const QString &type); + void createFromNativeImageHandleProvider(); + void releaseNativeImageHandle(); #endif protected: @@ -177,6 +182,12 @@ protected: mutable QEglContext *context; #endif +#if defined(Q_OS_SYMBIAN) + mutable QNativeImageHandleProvider *nativeImageHandleProvider; + void *nativeImageHandle; + QString nativeImageType; +#endif + void forceToImage(); QImage::Format sourceFormat() const; QImage::Format idealFormat(QImage *image, Qt::ImageConversionFlags flags) const; diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index c6521fd..5eb64bd 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -41,6 +41,7 @@ #include "qpixmapdata_vg_p.h" #include "qvgfontglyphcache_p.h" +#include #include #include @@ -111,6 +112,44 @@ void QVGPixmapData::cleanup() source = QVolatileImage(); } +bool QVGPixmapData::initFromNativeImageHandle(void *handle, const QString &type) +{ + if (type == QLatin1String("RSgImage")) { + fromNativeType(handle, QPixmapData::SgImage); + return true; + } else if (type == QLatin1String("CFbsBitmap")) { + fromNativeType(handle, QPixmapData::FbsBitmap); + return true; + } + return false; +} + +void QVGPixmapData::createFromNativeImageHandleProvider() +{ + void *handle = 0; + QString type; + nativeImageHandleProvider->get(&handle, &type); + if (handle) { + if (initFromNativeImageHandle(handle, type)) { + nativeImageHandle = handle; + nativeImageType = type; + } else { + qWarning("QVGPixmapData: Unknown native image type '%s'", qPrintable(type)); + } + } else { + qWarning("QVGPixmapData: Native handle is null"); + } +} + +void QVGPixmapData::releaseNativeImageHandle() +{ + if (nativeImageHandleProvider && nativeImageHandle) { + nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); + nativeImageHandle = 0; + nativeImageType = QString(); + } +} + void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) { if (type == QPixmapData::SgImage && pixmap) { @@ -149,6 +188,11 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) source = *img; source.ensureFormat(idealFormat(&source.imageRef(), Qt::AutoColor)); recreate = true; + } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { + destroyImages(); + nativeImageHandleProvider = static_cast(pixmap); + // Cannot defer the retrieval, we need at least the size right away. + createFromNativeImageHandleProvider(); } } @@ -216,6 +260,7 @@ void* QVGPixmapData::toNativeType(NativeType type) return reinterpret_cast(sgImage.take()); #endif } else if (type == QPixmapData::FbsBitmap && isValid()) { + ensureReadback(true); if (source.isNull()) { source = QVolatileImage(w, h, sourceFormat()); } diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index 0bc44e9..18f576b 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -180,4 +180,7 @@ EXPORTS ?copy@QVGPixmapData@@UAEXPBVQPixmapData@@ABVQRect@@@Z @ 179 NONAME ; void QVGPixmapData::copy(class QPixmapData const *, class QRect const &) ?idealFormat@QVGPixmapData@@IBE?AW4Format@QImage@@PAV3@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 180 NONAME ; enum QImage::Format QVGPixmapData::idealFormat(class QImage *, class QFlags) const ?ensureReadback@QVGPixmapData@@UBEX_N@Z @ 181 NONAME ; void QVGPixmapData::ensureReadback(bool) const + ?initFromNativeImageHandle@QVGPixmapData@@QAE_NPAXABVQString@@@Z @ 182 NONAME ; bool QVGPixmapData::initFromNativeImageHandle(void *, class QString const &) + ?createFromNativeImageHandleProvider@QVGPixmapData@@QAEXXZ @ 183 NONAME ; void QVGPixmapData::createFromNativeImageHandleProvider(void) + ?releaseNativeImageHandle@QVGPixmapData@@QAEXXZ @ 184 NONAME ; void QVGPixmapData::releaseNativeImageHandle(void) diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index 4c01550..25c53b8 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -210,4 +210,7 @@ EXPORTS _ZN13QVGPixmapData4copyEPK11QPixmapDataRK5QRect @ 209 NONAME _ZNK13QVGPixmapData11idealFormatEP6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 210 NONAME _ZNK13QVGPixmapData14ensureReadbackEb @ 211 NONAME + _ZN13QVGPixmapData24releaseNativeImageHandleEv @ 212 NONAME + _ZN13QVGPixmapData25initFromNativeImageHandleEPvRK7QString @ 213 NONAME + _ZN13QVGPixmapData35createFromNativeImageHandleProviderEv @ 214 NONAME diff --git a/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro b/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro new file mode 100644 index 0000000..fb8ecb0 --- /dev/null +++ b/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +SOURCES += tst_nativeimagehandleprovider.cpp +symbian { + LIBS += -lfbscli -lbitgdi + contains(QT_CONFIG, openvg): QT *= openvg +} diff --git a/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp b/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp new file mode 100644 index 0000000..5aaf055 --- /dev/null +++ b/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include +#include +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) +#include +#include +#include +#endif + +QPixmap pixmapFromNativeImageHandleProvider(QNativeImageHandleProvider *source) +{ +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) + if (!source) + return QPixmap(); + QScopedPointer pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); + pd->fromNativeType(source, QPixmapData::NativeImageHandleProvider); + return QPixmap(pd.take()); +#else + Q_UNUSED(source); + return QPixmap(); +#endif +} + +class DummyProvider : public QNativeImageHandleProvider +{ +public: + void get(void **handle, QString *type); + void release(void *handle, const QString &type); +}; + +void DummyProvider::get(void **handle, QString *type) +{ + *handle = (void *) 0x12345678; + *type = "some dummy type"; +} + +void DummyProvider::release(void *handle, const QString &type) +{ + Q_UNUSED(handle); + Q_UNUSED(type); +} + +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) +class BitmapProvider : public QNativeImageHandleProvider +{ +public: + BitmapProvider() : bmp(0), refCount(0), w(50), h(60) { } + void get(void **handle, QString *type); + void release(void *handle, const QString &type); + + CFbsBitmap *bmp; + int refCount, w, h; + void *returnedHandle; + QString returnedType; +}; + +void BitmapProvider::get(void **handle, QString *type) +{ + // There may not be a release() if the get() fails so don't bother with + // refcounting in such cases. + if (bmp) + ++refCount; + returnedType = QLatin1String("CFbsBitmap"); + returnedHandle = bmp; + *handle = returnedHandle; + *type = returnedType; +} + +void BitmapProvider::release(void *handle, const QString &type) +{ + if (handle == returnedHandle && type == returnedType && returnedHandle) { + --refCount; + } +} +#endif // symbian & openvg + +class tst_NativeImageHandleProvider : public QObject +{ + Q_OBJECT + +public: + tst_NativeImageHandleProvider() { } + +private slots: + void create(); + void bitmap(); + void hibernate(); +}; + +void tst_NativeImageHandleProvider::create() +{ + QPixmap pm = pixmapFromNativeImageHandleProvider(0); + QVERIFY(pm.isNull()); + QPixmap tmp(10, 20); + if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { + // Verify that null pixmap is properly returned when get() provides bogus results. + DummyProvider prov; + pm = pixmapFromNativeImageHandleProvider(&prov); + QVERIFY(pm.isNull()); + pm = QPixmap(); + } else { + QSKIP("Not openvg, skipping non-trivial tests", SkipSingle); + } +} + +void tst_NativeImageHandleProvider::bitmap() +{ +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) + QPixmap tmp(10, 20); + if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { + BitmapProvider prov; + + // This should fail because of null ptr. + QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); + QVERIFY(pm.isNull()); + pm = QPixmap(); + QCOMPARE(prov.refCount, 0); + + prov.bmp = new CFbsBitmap; + QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); + CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(prov.bmp); + CBitmapContext *bitmapContext = 0; + QCOMPARE(bitmapDevice->CreateBitmapContext(bitmapContext), KErrNone); + TRgb symbianColor = TRgb(255, 200, 100); + bitmapContext->SetBrushColor(symbianColor); + bitmapContext->Clear(); + delete bitmapContext; + delete bitmapDevice; + + pm = pixmapFromNativeImageHandleProvider(&prov); + QVERIFY(!pm.isNull()); + QCOMPARE(pm.width(), prov.w); + QCOMPARE(pm.height(), prov.h); + QVERIFY(prov.refCount == 1); + QImage img = pm.toImage(); + QVERIFY(prov.refCount == 1); + QRgb pix = img.pixel(QPoint(1, 2)); + QCOMPARE(qRed(pix), symbianColor.Red()); + QCOMPARE(qGreen(pix), symbianColor.Green()); + QCOMPARE(qBlue(pix), symbianColor.Blue()); + + pm = QPixmap(); // should result in calling release + QCOMPARE(prov.refCount, 0); + delete prov.bmp; + } else { + QSKIP("Not openvg", SkipSingle); + } +#else + QSKIP("Not applicable", SkipSingle); +#endif +} + +void tst_NativeImageHandleProvider::hibernate() +{ +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) + QPixmap tmp(10, 20); + if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { + BitmapProvider prov; + prov.bmp = new CFbsBitmap; + QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); + + QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); + QCOMPARE(prov.refCount, 1); + + QVGPixmapData *vgpd = static_cast(pm.pixmapData()); + vgpd->hibernate(); + QCOMPARE(prov.refCount, 0); + + // Calling toVGImage() may cause some warnings as we don't have a gui initialized, + // but the only thing we care about here is get() being called. + vgpd->toVGImage(); + QCOMPARE(prov.refCount, 1); + + pm = QPixmap(); + QCOMPARE(prov.refCount, 0); + delete prov.bmp; + } else { + QSKIP("Not openvg", SkipSingle); + } +#else + QSKIP("Not applicable", SkipSingle); +#endif +} + +int main(int argc, char *argv[]) +{ + QApplication::setGraphicsSystem("openvg"); + QApplication app(argc, argv); + tst_NativeImageHandleProvider tc; + return QTest::qExec(&tc, argc, argv); +} + +#include "tst_nativeimagehandleprovider.moc" diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 3c8f856..40fa4a9 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -32,7 +32,8 @@ SUBDIRS=\ qvariant \ qwidget \ qworkspace \ - windowsmobile + windowsmobile \ + nativeimagehandleprovider contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac: { -- cgit v0.12 From ddeee0dc7d9c2bfd4ad4e2f71497f1135446051a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 8 Mar 2011 17:08:37 +0200 Subject: Added native image handle provider header. Task-number: QT-4632 Reviewed-by: Jani Hautakangas --- src/gui/image/qnativeimagehandleprovider_p.h | 69 ++++++++++++++++++++++ .../tst_nativeimagehandleprovider.cpp | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/gui/image/qnativeimagehandleprovider_p.h diff --git a/src/gui/image/qnativeimagehandleprovider_p.h b/src/gui/image/qnativeimagehandleprovider_p.h new file mode 100644 index 0000000..4e6ed38 --- /dev/null +++ b/src/gui/image/qnativeimagehandleprovider_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNATIVEIMAGEHANDLEPROVIDER_P_H +#define QNATIVEIMAGEHANDLEPROVIDER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE + +class QNativeImageHandleProvider +{ +public: + virtual void get(void **handle, QString *type) = 0; + virtual void release(void *handle, const QString &type) = 0; +}; + +QT_END_NAMESPACE + +#endif // QNATIVEIMAGEHANDLEPROVIDER_P_H diff --git a/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp b/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp index 5aaf055..3a315f2 100644 --- a/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp +++ b/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp @@ -163,7 +163,7 @@ void tst_NativeImageHandleProvider::bitmap() prov.bmp = new CFbsBitmap; QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(prov.bmp); - CBitmapContext *bitmapContext = 0; + CBitmapContext *bitmapContext = 0; QCOMPARE(bitmapDevice->CreateBitmapContext(bitmapContext), KErrNone); TRgb symbianColor = TRgb(255, 200, 100); bitmapContext->SetBrushColor(symbianColor); -- cgit v0.12 From 0d6ce63ea84b076efbebfae0f6f39f492d8d7bcf Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 9 Mar 2011 11:52:41 +1000 Subject: Revert to previous lineHeight behavior. f47f01fd34d08f6152c9053c0d6928fc359aa0f9 changed the height of the Text to not include the extra spacing at the end of the block. This is different to what QDextDocument does. Revert back to the old behavior. Change-Id: Ie43dea4dd5a0e9ba179f44c246fb834322db11e3 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativetext.cpp | 1 + tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 6bcd2fa..3b5be9e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -452,6 +452,7 @@ QRect QDeclarativeTextPrivate::setupTextLayout() br = br.united(line.naturalTextRect()); height += (lineHeightMode == QDeclarativeText::FixedHeight) ? lineHeight : line.height() * lineHeight; } + br.setHeight(height); if (!q->widthValid()) naturalWidth = br.width(); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 9c12a90..c854f86 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1156,14 +1156,12 @@ void tst_qdeclarativetext::lineHeight() QVERIFY(myText->lineHeightMode() == QDeclarativeText::ProportionalHeight); qreal h = myText->height(); - int lc = myText->lineCount(); - qreal lh = myText->height() / lc; myText->setLineHeight(1.5); - QVERIFY(qAbs(myText->height() - (((lc-1) * lh * 1.5) + lh)) < 1.0); + QVERIFY(myText->height() == h * 1.5); myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(20); - QCOMPARE(myText->height(), ((lc-1) * 20.0) + lh); + QCOMPARE(myText->height(), myText->lineCount() * 20.0); myText->setText("Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."); myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); -- cgit v0.12 From 4a0ce0775350cf2b10f44502dc86110684fc9fb5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 9 Mar 2011 16:56:05 +1000 Subject: The rotation reported by PinchArea should not be in the range -180..180 The rotation is the total rotation that has been applied since the gesture started. This should not be normalized to -180 to 180. If you contort your fingers such that you have rotated 420deg then that is what should be reported. Change-Id: I24ba3f105befc2b0d31f1933911a94a0152ffcb4 Task-number: QTBUG-17437 Reviewed-by: Bea Lam --- src/declarative/graphicsitems/qdeclarativepincharea.cpp | 17 ++++++++++------- .../graphicsitems/qdeclarativepincharea_p_p.h | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp index eae83f6..9bc3d8d 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -300,9 +300,8 @@ void QDeclarativePinchArea::updatePinch() d->stealMouse = false; setKeepMouseGrab(false); d->inPinch = false; - const qreal rotationAngle = d->pinchStartAngle - d->pinchLastAngle; QPointF pinchCenter = mapFromScene(d->sceneLastCenter); - QDeclarativePinchEvent pe(pinchCenter, d->pinchLastScale, d->pinchLastAngle, rotationAngle); + QDeclarativePinchEvent pe(pinchCenter, d->pinchLastScale, d->pinchLastAngle, d->pinchRotation); pe.setStartCenter(d->pinchStartCenter); pe.setPreviousCenter(pinchCenter); pe.setPreviousAngle(d->pinchLastAngle); @@ -349,6 +348,7 @@ void QDeclarativePinchArea::updatePinch() d->pinchStartAngle = angle; d->pinchLastScale = 1.0; d->pinchLastAngle = angle; + d->pinchRotation = 0.0; d->lastPoint1 = d->touchPoints.at(0).pos(); d->lastPoint2 = d->touchPoints.at(1).pos(); QDeclarativePinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0); @@ -380,11 +380,14 @@ void QDeclarativePinchArea::updatePinch() } } else if (d->pinchStartDist > 0) { qreal scale = dist / d->pinchStartDist; - qreal rotationAngle = d->pinchStartAngle - angle; - if (rotationAngle > 180) - rotationAngle -= 360; + qreal da = d->pinchLastAngle - angle; + if (da > 180) + da -= 360; + else if (da < -180) + da += 360; + d->pinchRotation += da; QPointF pinchCenter = mapFromScene(sceneCenter); - QDeclarativePinchEvent pe(pinchCenter, scale, angle, rotationAngle); + QDeclarativePinchEvent pe(pinchCenter, scale, angle, d->pinchRotation); pe.setStartCenter(d->pinchStartCenter); pe.setPreviousCenter(mapFromScene(d->sceneLastCenter)); pe.setPreviousAngle(d->pinchLastAngle); @@ -422,7 +425,7 @@ void QDeclarativePinchArea::updatePinch() } if (d->pinchStartRotation >= pinch()->minimumRotation() && d->pinchStartRotation <= pinch()->maximumRotation()) { - qreal r = rotationAngle + d->pinchStartRotation; + qreal r = d->pinchRotation + d->pinchStartRotation; r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation()); pinch()->target()->setRotation(r); } diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h index 5641e35..cd5cf2a 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h @@ -68,7 +68,9 @@ class QDeclarativePinchAreaPrivate : public QDeclarativeItemPrivate public: QDeclarativePinchAreaPrivate() : absorb(true), stealMouse(false), inPinch(false) - , pinchRejected(false), pinch(0), pinchStartDist(0) + , pinchRejected(false), pinch(0), pinchStartDist(0), pinchStartScale(1.0) + , pinchLastScale(1.0), pinchStartRotation(0.0), pinchStartAngle(0.0) + , pinchLastAngle(0.0), pinchRotation(0.0) { } @@ -97,6 +99,7 @@ public: qreal pinchStartRotation; qreal pinchStartAngle; qreal pinchLastAngle; + qreal pinchRotation; QPointF sceneStartCenter; QPointF pinchStartCenter; QPointF sceneLastCenter; -- cgit v0.12 From aeb330e3999ef3d7ae8d94b9330471f2a2a13554 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 8 Mar 2011 18:05:25 +1000 Subject: Fix horizontal alignment of QTextDocument-based RTL text Task-number: QTBUG-15880 Reviewed-by: Martin Jones Change-Id: If537d7c795dec46eedee62511e75bab862676ef1 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 45 +++++++++++++++------- .../graphicsitems/qdeclarativetext_p_p.h | 2 + .../graphicsitems/qdeclarativetextedit.cpp | 7 ++-- .../qdeclarativetext/tst_qdeclarativetext.cpp | 40 +++++++++++++++++-- .../tst_qdeclarativetextedit.cpp | 34 +++++++++++++++- .../tst_qdeclarativetextinput.cpp | 9 +++++ 6 files changed, 115 insertions(+), 22 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 3b5be9e..fdc1a71 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -102,7 +101,7 @@ QDeclarativeTextPrivate::QDeclarativeTextPrivate() format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineHeight(1), lineHeightMode(QDeclarativeText::ProportionalHeight), lineCount(1), truncated(false), maximumLineCount(INT_MAX), maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false), - cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), hAlignImplicit(true), naturalWidth(0), doc(0) + cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), hAlignImplicit(true), rightToLeftText(false), naturalWidth(0), doc(0) { cacheAllTextAsImage = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; @@ -292,8 +291,16 @@ void QDeclarativeTextPrivate::updateSize() singleline = false; // richtext can't elide or be optimized for single-line case ensureDoc(); doc->setDefaultFont(font); + + QDeclarativeText::HAlignment horizontalAlignment = q->effectiveHAlign(); + if (rightToLeftText) { + if (horizontalAlignment == QDeclarativeText::AlignLeft) + horizontalAlignment = QDeclarativeText::AlignRight; + else if (horizontalAlignment == QDeclarativeText::AlignRight) + horizontalAlignment = QDeclarativeText::AlignLeft; + } QTextOption option; - option.setAlignment((Qt::Alignment)int(q->effectiveHAlign() | vAlign)); + option.setAlignment((Qt::Alignment)int(horizontalAlignment | vAlign)); option.setWrapMode(QTextOption::WrapMode(wrapMode)); doc->setDefaultTextOption(option); if (requireImplicitWidth && q->widthValid()) { @@ -909,15 +916,18 @@ void QDeclarativeText::setText(const QString &n) return; d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(n)); - if (d->richText && isComponentComplete()) { - d->ensureDoc(); - d->doc->setText(n); - } - d->text = n; - d->determineHorizontalAlignment(); + if (isComponentComplete()) { + if (d->richText) { + d->ensureDoc(); + d->doc->setText(n); + d->rightToLeftText = d->doc->toPlainText().isRightToLeft(); + } else { + d->rightToLeftText = d->text.isRightToLeft(); + } + d->determineHorizontalAlignment(); + } d->updateLayout(); - emit textChanged(d->text); } @@ -1122,9 +1132,8 @@ bool QDeclarativeTextPrivate::determineHorizontalAlignment() { Q_Q(QDeclarativeText); if (hAlignImplicit && q->isComponentComplete()) { - // if no explicit alignment has been set, follow the natural layout direction of the text - bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); - return setHAlign(isRightToLeft ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft); + bool alignToRight = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : rightToLeftText; + return setHAlign(alignToRight ? QDeclarativeText::AlignRight : QDeclarativeText::AlignLeft); } return false; } @@ -1140,6 +1149,11 @@ void QDeclarativeTextPrivate::mirrorChange() } } +QTextDocument *QDeclarativeTextPrivate::textDocument() +{ + return doc; +} + QDeclarativeText::VAlignment QDeclarativeText::vAlign() const { Q_D(const QDeclarativeText); @@ -1585,11 +1599,14 @@ void QDeclarativeText::componentComplete() QDeclarativeItem::componentComplete(); if (d->updateOnComponentComplete) { d->updateOnComponentComplete = false; - d->determineHorizontalAlignment(); if (d->richText) { d->ensureDoc(); d->doc->setText(d->text); + d->rightToLeftText = d->doc->toPlainText().isRightToLeft(); + } else { + d->rightToLeftText = d->text.isRightToLeft(); } + d->determineHorizontalAlignment(); d->updateLayout(); } } diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 2e154a0..e3ab62a 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -79,6 +79,7 @@ public: bool determineHorizontalAlignment(); bool setHAlign(QDeclarativeText::HAlignment, bool forceAlign = false); void mirrorChange(); + QTextDocument *textDocument(); QString text; QFont font; @@ -114,6 +115,7 @@ public: bool internalWidthUpdate:1; bool requireImplicitWidth:1; bool hAlignImplicit:1; + bool rightToLeftText:1; QRect layedOutTextRect; QSize paintedSize; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index d1d2351..4006d54 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -549,9 +549,8 @@ bool QDeclarativeTextEditPrivate::determineHorizontalAlignment() { Q_Q(QDeclarativeTextEdit); if (hAlignImplicit && q->isComponentComplete()) { - // if no explicit alignment has been set, follow the natural layout direction of the text - bool isRightToLeft = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : text.isRightToLeft(); - return setHAlign(isRightToLeft ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); + bool alignToRight = text.isEmpty() ? QApplication::keyboardInputDirection() == Qt::RightToLeft : rightToLeftText; + return setHAlign(alignToRight ? QDeclarativeTextEdit::AlignRight : QDeclarativeTextEdit::AlignLeft); } return false; } @@ -1578,7 +1577,7 @@ void QDeclarativeTextEdit::q_textChanged() { Q_D(QDeclarativeTextEdit); d->text = text(); - d->rightToLeftText = d->text.isRightToLeft(); + d->rightToLeftText = d->document->begin().layout()->engine()->isRightToLeft(); d->determineHorizontalAlignment(); d->updateDefaultTextOption(); updateSize(); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index c854f86..b5dfba8 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -523,18 +523,44 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); - // explicitly left aligned + // explicitly left aligned text text->setHAlign(QDeclarativeText::AlignLeft); QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); - // explicitly right aligned + // explicitly right aligned text text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); QCOMPARE(text->effectiveHAlign(), text->hAlign()); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() > canvas->width()/2); + // change to rich text + QString textString = text->text(); + text->setText(QString("") + textString + QString("")); + text->setTextFormat(QDeclarativeText::RichText); + text->resetHAlign(); + + // implicitly aligned rich text should follow the reading direction of text + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); + QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignLeft); + + // explicitly left aligned rich text + text->setHAlign(QDeclarativeText::AlignLeft); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); + QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignRight); + + // explicitly right aligned rich text + text->setHAlign(QDeclarativeText::AlignRight); + QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); + QCOMPARE(text->effectiveHAlign(), text->hAlign()); + QVERIFY(textPrivate->textDocument()->defaultTextOption().alignment() & Qt::AlignLeft); + + text->setText(textString); + text->setTextFormat(QDeclarativeText::PlainText); + // explicitly center aligned text->setHAlign(QDeclarativeText::AlignHCenter); QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter); @@ -583,8 +609,16 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight); text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); - delete canvas; + + // alignment of Text with no text set to it + QString componentStr = "import QtQuick 1.0\nText {}"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast(textComponent.create()); + QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight); + delete textObject; } void tst_qdeclarativetext::verticalAlignment() diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index db36220..402c6cd 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -448,7 +448,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit != 0); canvas->show(); - // implicit alignment should follow the reading direction of RTL text + // implicit alignment should follow the reading direction of text QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); @@ -462,6 +462,29 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + QString textString = textEdit->text(); + textEdit->setText(QString("") + textString + QString("")); + textEdit->resetHAlign(); + + // implicitly aligned rich text should follow the reading direction of RTL text + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign()); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + + // explicitly left aligned rich text + textEdit->setHAlign(QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); + QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign()); + QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); + + // explicitly right aligned rich text + textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); + QCOMPARE(textEdit->effectiveHAlign(), textEdit->hAlign()); + QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); + + textEdit->setText(textString); + // explicitly center aligned textEdit->setHAlign(QDeclarativeTextEdit::AlignHCenter); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignHCenter); @@ -515,6 +538,15 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); delete canvas; + + // alignment of TextEdit with no text set to it + QString componentStr = "import QtQuick 1.0\nTextEdit {}"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create()); + QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeTextEdit::AlignLeft : QDeclarativeTextEdit::AlignRight); + delete textObject; } void tst_qdeclarativetextedit::vAlign() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index fc19c94..734f91f 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1125,6 +1125,15 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); delete canvas; + + // alignment of TextInput with no text set to it + QString componentStr = "import QtQuick 1.0\nTextInput {}"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextInput *textObject = qobject_cast(textComponent.create()); + QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? + QDeclarativeTextInput::AlignLeft : QDeclarativeTextInput::AlignRight); + delete textObject; } void tst_qdeclarativetextinput::positionAt() -- cgit v0.12 From c7e7856f710fe09b1fd715390e74578166c0f709 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 9 Mar 2011 17:48:12 +1000 Subject: Add missing header include missing from the previous commit Change-Id: I7993c13c7fe43027caaa28ef3866df5f0d21f5b9 --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 4006d54..babc020 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -48,6 +48,7 @@ #include +#include #include #include #include -- cgit v0.12 From f386c778d17347fb81d152eb61a7c40abe4eb0ae Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 8 Mar 2011 16:37:18 +0100 Subject: Fix line information for dynamic slots in .qml files Take whitespace before the opening bracket into account, e.g. save the newlines in function f()\n{} Task-number: QTBUG-18006 Done by Roberto Raggi --- src/declarative/qml/qdeclarativescriptparser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 996920a..b604706 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -776,7 +776,10 @@ bool ProcessAST::visit(AST::UiSourceElement *node) f = f->finish(); } - QString body = textAt(funDecl->lbraceToken, funDecl->rbraceToken); + AST::SourceLocation loc = funDecl->rparenToken; + loc.offset = loc.end(); + loc.startColumn += 1; + QString body = textAt(loc, funDecl->rbraceToken); slot.name = funDecl->name->asString().toUtf8(); slot.body = body; obj->dynamicSlots << slot; -- cgit v0.12 From e90cff53cdd7bf0bdfed1f2e8efb90539c6f33ba Mon Sep 17 00:00:00 2001 From: Timo Turunen Date: Wed, 9 Mar 2011 10:56:55 +0200 Subject: Bump Qt version to 4.7.3 Reviewed-by: Trust Me --- dist/changes-4.7.3 | 0 src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri | 4 ++-- src/corelib/global/qglobal.h | 4 ++-- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- tests/auto/mediaobject/dummy/dummy.pro | 2 +- tests/auto/selftests/expected_cmptest.txt | 2 +- tests/auto/selftests/expected_crashes_3.txt | 2 +- tests/auto/selftests/expected_longstring.txt | 2 +- tests/auto/selftests/expected_maxwarnings.txt | 2 +- tests/auto/selftests/expected_skip.txt | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 4 ++-- tools/qdoc3/doc/files/qt.qdocconf | 8 ++++---- tools/qdoc3/test/assistant.qdocconf | 4 ++-- tools/qdoc3/test/designer.qdocconf | 4 ++-- tools/qdoc3/test/linguist.qdocconf | 4 ++-- tools/qdoc3/test/qdeclarative.qdocconf | 8 ++++---- tools/qdoc3/test/qmake.qdocconf | 4 ++-- tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf | 8 ++++---- tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf | 8 ++++---- tools/qdoc3/test/qt-project.qdocconf | 10 +++++----- 21 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 dist/changes-4.7.3 diff --git a/dist/changes-4.7.3 b/dist/changes-4.7.3 new file mode 100644 index 0000000..e69de29 diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index b98617f..07754a7 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.2 +QT_WEBKIT_VERSION = 4.7.3 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 2 +QT_WEBKIT_PATCH_VERSION = 3 QT_CONFIG += webkit diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index fcee35d..da5db3a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.7.2" +#define QT_VERSION_STR "4.7.3" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040702 +#define QT_VERSION 0x040703 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 7cbffe0..3de5fdf 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.2 + VERSION=4.7.3 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index 75da3dc..babea56 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.2 + VERSION=4.7.3 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro index 88b864b..c81411c 100644 --- a/tests/auto/mediaobject/dummy/dummy.pro +++ b/tests/auto/mediaobject/dummy/dummy.pro @@ -1,7 +1,7 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.6.4 + VERSION=4.7.3 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index fccaca3..d70815d 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.7.2, Qt 4.7.2 +Config: Using QTest library 4.7.3, Qt 4.7.3 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index 2558f68..2aea62c 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.7.2, Qt 4.7.2 +Config: Using QTest library 4.7.3, Qt 4.7.3 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index c56244b..1fe012f 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.7.2, Qt 4.7.2 +Config: Using QTest library 4.7.3, Qt 4.7.3 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 7846435..cdd6ee8 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.7.2, Qt 4.7.2 +Config: Using QTest library 4.7.3, Qt 4.7.3 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index 5c9e497..490c140 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.7.2, Qt 4.7.2 +Config: Using QTest library 4.7.3, Qt 4.7.3 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 57abeae..575b1e5 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -10,7 +10,7 @@ description = "Qt Assistant" HTML.{postheader,address} = "" HTML.footer = "


\n" \ "\n" \ - "\n" \ + "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.7.2
Qt 4.7.3
" diff --git a/tools/qdoc3/doc/files/qt.qdocconf b/tools/qdoc3/doc/files/qt.qdocconf index 44cfbc1..9b16233 100644 --- a/tools/qdoc3/doc/files/qt.qdocconf +++ b/tools/qdoc3/doc/files/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.472 +qhp.Qt.namespace = com.trolltech.qt.473 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qt.filterAttributes = qt 4.7.3 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.3 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 0e9a2a8..74ab67b 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Assistant qhp.Assistant.file = assistant.qhp -qhp.Assistant.namespace = com.trolltech.assistant.472 +qhp.Assistant.namespace = com.trolltech.assistant.473 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Assistant.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Assistant.filterAttributes = qt 4.7.2 tools assistant +qhp.Assistant.filterAttributes = qt 4.7.3 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 637399b..42dbc20 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Designer qhp.Designer.file = designer.qhp -qhp.Designer.namespace = com.trolltech.designer.472 +qhp.Designer.namespace = com.trolltech.designer.473 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Designer.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Designer.filterAttributes = qt 4.7.2 tools designer +qhp.Designer.filterAttributes = qt 4.7.3 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 8ee298e..7c01023 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Linguist qhp.Linguist.file = linguist.qhp -qhp.Linguist.namespace = com.trolltech.linguist.472 +qhp.Linguist.namespace = com.trolltech.linguist.473 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Linguist.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Linguist.filterAttributes = qt 4.7.2 tools linguist +qhp.Linguist.filterAttributes = qt 4.7.3 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index e68a935..12c939c 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -21,7 +21,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qml qhp.Qml.file = qml.qhp -qhp.Qml.namespace = com.trolltech.qml.472 +qhp.Qml.namespace = com.trolltech.qml.473 qhp.Qml.virtualFolder = qdoc qhp.Qml.indexTitle = Qml Reference @@ -61,9 +61,9 @@ qhp.Qml.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Qml.filterAttributes = qt 4.7.2 qtrefdoc -qhp.Qml.customFilters.Qt.name = Qt 4.7.2 -qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qml.filterAttributes = qt 4.7.3 qtrefdoc +qhp.Qml.customFilters.Qt.name = Qt 4.7.3 +qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.3 qhp.Qml.subprojects = classes qhp.Qml.subprojects.classes.title = Elements qhp.Qml.subprojects.classes.indexTitle = Qml Elements diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index b5bc96c..b7d1299 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = qmake qhp.qmake.file = qmake.qhp -qhp.qmake.namespace = com.trolltech.qmake.472 +qhp.qmake.namespace = com.trolltech.qmake.473 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.qmake.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.qmake.filterAttributes = qt 4.7.2 tools qmake +qhp.qmake.filterAttributes = qt 4.7.3 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf index 24696d5..a4d0653 100644 --- a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.472 +qhp.Qt.namespace = com.trolltech.qt.473 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = Qt qhp.Qt.indexTitle = Qt qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qt.filterAttributes = qt 4.7.3 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.3 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index 7789bf7..818b5c5 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.472 +qhp.Qt.namespace = com.trolltech.qt.473 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = 教程 qhp.Qt.indexTitle = 教程 qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qt.filterAttributes = qt 4.7.3 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.3 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index 3ed7cff..2da0e90 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -6,7 +6,7 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -version = 4.7.2 +version = 4.7.3 sourceencoding = UTF-8 outputencoding = UTF-8 @@ -15,14 +15,14 @@ naturallanguage = en_US qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.472 +qhp.Qt.namespace = com.trolltech.qt.473 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = -qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.2 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 +qhp.Qt.filterAttributes = qt 4.7.3 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.3 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.3 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From 3d946b24834973816b4f472828c03bc07b10b3ac Mon Sep 17 00:00:00 2001 From: Guoqing Zhang Date: Wed, 9 Mar 2011 13:49:35 +0200 Subject: Adding quote around files in QMAKE_CLEAN to tackle wildcard issue Task-number: QTPROD-875 Reviewed-by: Miikka Heikkinen --- mkspecs/symbian-sbsv2/flm/qt/qmake_clean.flm | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_clean.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_clean.flm index fe35e6e..c9a88fc 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_clean.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_clean.flm @@ -13,6 +13,6 @@ SINGLETON:=$(call sanitise,QMAKE_CLEAN_SINGLETON_$(EXTENSION_ROOT)) ifeq ($($(SINGLETON)),) # Prevent duplicate targets from being created $(SINGLETON):=1 -$(eval $(call GenerateStandardCleanTarget,$(CLEAN_FILES),'')) +$(eval $(call GenerateStandardCleanTarget,$(wildcard $(patsubst "%",%,$(CLEAN_FILES))))) endif diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index f94a63f..0fdef86 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -727,7 +727,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QStringList absoluteCleanFiles; foreach (QString cleanFile, cleanFiles) { QFileInfo fi(cleanFile); - absoluteCleanFiles << fi.absoluteFilePath(); + QString fileName = QLatin1String("\""); + fileName.append(fi.absoluteFilePath()); + fileName.append(QLatin1String("\"")); + absoluteCleanFiles << fileName; } t << "START EXTENSION qt/qmake_clean" << endl; t << "OPTION CLEAN_FILES " << absoluteCleanFiles.join(" ") << endl; -- cgit v0.12 From 2b288ace6fb5747158609ac484268c29b30108e5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 9 Mar 2011 14:16:40 +0200 Subject: Multiple screen support for Symbian in QDeskopWidget. When using TV-out, the TV display can be used as an independent screen. By default the content shown there is a clone of the device screen, however from now on parenting a widget to QDesktopWidget::screen(1) and calling show() will turn off cloning and have the widget shown instead. screenCount() and the screenCountChanged signal can be used to detect the availability of the secondary display, just like on other platforms. Task-number: QT-830 Reviewed-by: Sami Merila Reviewed-by: Jani Hautakangas --- src/corelib/global/qglobal.h | 2 + src/gui/kernel/qapplication_s60.cpp | 38 ++++-- src/gui/kernel/qdesktopwidget_s60.cpp | 160 +++++++++++++++++++---- src/gui/kernel/qt_s60_p.h | 84 ++++++++++++ src/gui/kernel/qwidget.cpp | 6 + src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_s60.cpp | 32 ++++- tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp | 5 +- 8 files changed, 284 insertions(+), 44 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index fcee35d..9b3787e 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2454,6 +2454,8 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); # define Q_SYMBIAN_TRANSITION_EFFECTS #endif +#ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS +#define Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS #endif //Symbian does not support data imports from a DLL diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 02560b3..86d4fcf 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -405,6 +405,7 @@ QSymbianControl::QSymbianControl(QWidget *w) , m_longTapDetector(0) , m_ignoreFocusChanged(0) , m_symbianPopupIsOpen(0) + , m_inExternalScreenOverride(false) { } @@ -412,9 +413,11 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) { if (!desktop) { - if (isWindowOwning || !qwidget->parentWidget()) - CreateWindowL(S60->windowGroup()); - else + if (isWindowOwning || !qwidget->parentWidget() + || qwidget->parentWidget()->windowType() == Qt::Desktop) { + RWindowGroup &wg(S60->windowGroup(qwidget)); + CreateWindowL(wg); + } else { /** * TODO: in order to avoid creating windows for all ancestors of * this widget up to the root window, the parameter passed to @@ -424,6 +427,7 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) * is created for a widget between this one and the root window. */ CreateWindowL(qwidget->parentWidget()->winId()); + } // Necessary in order to be able to track the activation status of // the control's window @@ -456,7 +460,7 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop) windowPurpose = ETfxPurposeSplashScreenWindow; break; default: - windowPurpose = (isWindowOwning || !qwidget->parentWidget()) + windowPurpose = (isWindowOwning || !qwidget->parentWidget() || qwidget->parentWidget()->windowType() == Qt::Desktop) ? ETfxPurposeWindow : ETfxPurposeChildWindow; break; } @@ -987,14 +991,15 @@ TKeyResponse QSymbianControl::handleVirtualMouse(const TKeyEvent& keyEvent,TEven } } //clip to screen size (window server allows a sprite hotspot to be outside the screen) + int screenNumber = S60->screenNumberForWidget(qwidget); if (x < 0) x = 0; - else if (x >= S60->screenWidthInPixels) - x = S60->screenWidthInPixels - 1; + else if (x >= S60->screenWidthInPixelsForScreen[screenNumber]) + x = S60->screenWidthInPixelsForScreen[screenNumber] - 1; if (y < 0) y = 0; - else if (y >= S60->screenHeightInPixels) - y = S60->screenHeightInPixels - 1; + else if (y >= S60->screenHeightInPixelsForScreen[screenNumber]) + y = S60->screenHeightInPixelsForScreen[screenNumber] - 1; TPoint epos(x, y); TPoint cpos = epos - PositionRelativeToScreen(); fakeEvent.iPosition = cpos; @@ -1171,6 +1176,18 @@ void QSymbianControl::SizeChanged() QSize newSize(Size().iWidth, Size().iHeight); if (oldSize != newSize) { + const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; + const int screenNumber = S60->screenNumberForWidget(qwidget); + if (!m_inExternalScreenOverride && isFullscreen && screenNumber > 0) { + int screenWidth = S60->screenWidthInPixelsForScreen[screenNumber]; + int screenHeight = S60->screenHeightInPixelsForScreen[screenNumber]; + TSize screenSize(screenWidth, screenHeight); + if (screenWidth > 0 && screenHeight > 0 && screenSize != Size()) { + m_inExternalScreenOverride = true; + SetExtent(TPoint(0, 0), screenSize); + return; + } + } QRect cr = qwidget->geometry(); cr.setSize(newSize); qwidget->data->crect = cr; @@ -1193,6 +1210,8 @@ void QSymbianControl::SizeChanged() } } + m_inExternalScreenOverride = false; + // CCoeControl::SetExtent calls SizeChanged, but does not call // PositionChanged, so we call it here to ensure that the widget's // position is updated. @@ -2035,7 +2054,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent return 1; } break; - case EEventScreenDeviceChanged: + case EEventScreenDeviceChanged: // fallthrough + case EEventDisplayChanged: if (callSymbianEventFilters(symbianEvent)) return 1; if (S60) diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 3653ae2..9d48b64 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -44,36 +44,67 @@ #include "qwidget_p.h" #include "qt_s60_p.h" #include - -#include "hal.h" -#include "hal_data.h" +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) +#include +#endif QT_BEGIN_NAMESPACE -class QDesktopWidgetPrivate : public QWidgetPrivate +extern int qt_symbian_create_desktop_on_screen; + +class QSingleDesktopWidget : public QWidget +{ +public: + QSingleDesktopWidget(); + ~QSingleDesktopWidget(); +}; + +QSingleDesktopWidget::QSingleDesktopWidget() + : QWidget(0, Qt::Desktop) +{ +} + +QSingleDesktopWidget::~QSingleDesktopWidget() { + const QObjectList &childList = children(); + for (int i = childList.size(); i > 0 ;) { + --i; + childList.at(i)->setParent(0); + } +} +class QDesktopWidgetPrivate : public QWidgetPrivate +{ public: QDesktopWidgetPrivate(); ~QDesktopWidgetPrivate(); - static void init(QDesktopWidget *that); static void cleanup(); + static void init_sys(); static int screenCount; static int primaryScreen; static QVector *rects; static QVector *workrects; + static QVector *screens; static int refcount; + +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) + static MDisplayControl *displayControl; +#endif }; int QDesktopWidgetPrivate::screenCount = 1; int QDesktopWidgetPrivate::primaryScreen = 0; QVector *QDesktopWidgetPrivate::rects = 0; QVector *QDesktopWidgetPrivate::workrects = 0; +QVector *QDesktopWidgetPrivate::screens = 0; int QDesktopWidgetPrivate::refcount = 0; +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) +MDisplayControl *QDesktopWidgetPrivate::displayControl = 0; +#endif QDesktopWidgetPrivate::QDesktopWidgetPrivate() { @@ -88,25 +119,53 @@ QDesktopWidgetPrivate::~QDesktopWidgetPrivate() void QDesktopWidgetPrivate::init(QDesktopWidget *that) { - Q_UNUSED(that); -// int screenCount=0; - - // ### TODO: Implement proper multi-display support - QDesktopWidgetPrivate::screenCount = 1; -// if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) -// QDesktopWidgetPrivate::screenCount = screenCount; -// else -// QDesktopWidgetPrivate::screenCount = 0; + // Note that on S^3 devices the screen count retrieved via RWsSession + // will always be 2 but the width and height for screen number 1 will + // be 0 as long as TV-out is not connected. + // + // On the other hand a valid size for screen 1 will be reported even + // after the cable is disconnected. In order to overcome this, we use + // MDisplayControl::NumberOfResolutions() to check if the display is + // valid or not. + + screenCount = S60->screenCount(); + if (displayControl) { + if (displayControl->NumberOfResolutions() < 1) + screenCount = 1; + } + if (screenCount < 1) { + qWarning("No screen available"); + screenCount = 1; + } rects = new QVector(); workrects = new QVector(); - - rects->resize(QDesktopWidgetPrivate::screenCount); - workrects->resize(QDesktopWidgetPrivate::screenCount); - - (*rects)[0].setRect(0, 0, S60->screenWidthInPixels, S60->screenHeightInPixels); - QRect wr = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); - (*workrects)[0].setRect(wr.x(), wr.y(), wr.width(), wr.height()); + screens = new QVector(); + + rects->resize(screenCount); + workrects->resize(screenCount); + screens->resize(screenCount); + + for (int i = 0; i < screenCount; ++i) { + // All screens will share the same geometry as there is no true virtual desktop + // or pointer event support for multiple screens on Symbian. + QRect r(0, 0, + S60->screenWidthInPixelsForScreen[i], S60->screenHeightInPixelsForScreen[i]); + // Stop here if empty and ignore this screen. + if (r.isEmpty()) { + screenCount = i; + break; + } + (*rects)[i] = r; + QRect wr; + if (i == 0) + wr = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); + else + wr = rects->at(i); + (*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height()); + (*screens)[i] = 0; + } + (*screens)[0] = that; } void QDesktopWidgetPrivate::cleanup() @@ -115,6 +174,27 @@ void QDesktopWidgetPrivate::cleanup() rects = 0; delete workrects; workrects = 0; + if (screens) { + // First item is the QDesktopWidget so skip it. + for (int i = 1; i < screens->count(); ++i) + delete screens->at(i); + } + delete screens; + screens = 0; +} + +void QDesktopWidgetPrivate::init_sys() +{ +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) + CWsScreenDevice *dev = S60->screenDevice(1); + if (dev) { + displayControl = static_cast( + dev->GetInterface(MDisplayControl::ETypeId)); + if (displayControl) { + displayControl->EnableDisplayChangeEvents(ETrue); + } + } +#endif } @@ -122,6 +202,7 @@ QDesktopWidget::QDesktopWidget() : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) { setObjectName(QLatin1String("desktop")); + QDesktopWidgetPrivate::init_sys(); QDesktopWidgetPrivate::init(this); } @@ -131,7 +212,7 @@ QDesktopWidget::~QDesktopWidget() bool QDesktopWidget::isVirtualDesktop() const { - return true; + return false; } int QDesktopWidget::primaryScreen() const @@ -145,9 +226,23 @@ int QDesktopWidget::numScreens() const return QDesktopWidgetPrivate::screenCount; } -QWidget *QDesktopWidget::screen(int /* screen */) +static inline QWidget *newSingleDesktopWidget(int screen) { - return this; + qt_symbian_create_desktop_on_screen = screen; + QWidget *w = new QSingleDesktopWidget; + qt_symbian_create_desktop_on_screen = -1; + return w; +} + +QWidget *QDesktopWidget::screen(int screen) +{ + Q_D(QDesktopWidget); + if (screen < 0 || screen >= d->screenCount) + screen = d->primaryScreen; + if (!d->screens->at(screen) + || d->screens->at(screen)->windowType() != Qt::Desktop) + (*d->screens)[screen] = newSingleDesktopWidget(screen); + return (*d->screens)[screen]; } const QRect QDesktopWidget::availableGeometry(int screen) const @@ -168,14 +263,19 @@ const QRect QDesktopWidget::screenGeometry(int screen) const return d->rects->at(screen); } -int QDesktopWidget::screenNumber(const QWidget * /* widget */) const +int QDesktopWidget::screenNumber(const QWidget *widget) const { - return QDesktopWidgetPrivate::primaryScreen; + Q_D(const QDesktopWidget); + return widget + ? S60->screenNumberForWidget(widget) + : d->primaryScreen; } -int QDesktopWidget::screenNumber(const QPoint & /* point */) const +int QDesktopWidget::screenNumber(const QPoint &point) const { - return QDesktopWidgetPrivate::primaryScreen; + Q_UNUSED(point); + Q_D(const QDesktopWidget); + return d->primaryScreen; } void QDesktopWidget::resizeEvent(QResizeEvent *) @@ -203,6 +303,10 @@ void QDesktopWidget::resizeEvent(QResizeEvent *) if (oldrect != newrect) emit workAreaResized(j); } + + if (oldscreencount != d->screenCount) { + emit screenCountChanged(d->screenCount); + } } QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 1e9967f..3bb27c3 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -64,6 +64,7 @@ #include "qapplication.h" #include "qelapsedtimer.h" #include "QtCore/qthreadstorage.h" +#include "qwidget_p.h" #include #include #include @@ -84,6 +85,8 @@ QT_BEGIN_NAMESPACE // system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; +static const int qt_symbian_max_screens = 4; + //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) @@ -157,8 +160,14 @@ public: static inline void updateScreenSize(); inline RWsSession& wsSession(); + static inline int screenCount(); static inline RWindowGroup& windowGroup(); + static inline RWindowGroup& windowGroup(const QWidget *widget); + static inline RWindowGroup& windowGroup(int screenNumber); inline CWsScreenDevice* screenDevice(); + inline CWsScreenDevice* screenDevice(const QWidget *widget); + inline CWsScreenDevice* screenDevice(int screenNumber); + static inline int screenNumberForWidget(const QWidget *widget); static inline CCoeAppUi* appUi(); static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 @@ -175,6 +184,11 @@ public: #ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; #endif + + int screenWidthInPixelsForScreen[qt_symbian_max_screens]; + int screenHeightInPixelsForScreen[qt_symbian_max_screens]; + int screenWidthInTwipsForScreen[qt_symbian_max_screens]; + int screenHeightInTwipsForScreen[qt_symbian_max_screens]; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -274,6 +288,8 @@ private: // Fader object used to fade everything except this menu and the CBA. TAknPopupFader popupFader; #endif + + bool m_inExternalScreenOverride : 1; }; inline QS60Data::QS60Data() @@ -325,6 +341,17 @@ inline void QS60Data::updateScreenSize() S60->defaultDpiY = S60->screenHeightInPixels / inches; inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch; S60->defaultDpiX = S60->screenWidthInPixels / inches; + + int screens = S60->screenCount(); + for (int i = 0; i < screens; ++i) { + CWsScreenDevice *dev = S60->screenDevice(i); + mode = dev->CurrentScreenMode(); + dev->GetScreenModeSizeAndRotation(mode, params); + S60->screenWidthInPixelsForScreen[i] = params.iPixelSize.iWidth; + S60->screenHeightInPixelsForScreen[i] = params.iPixelSize.iHeight; + S60->screenWidthInTwipsForScreen[i] = params.iTwipsSize.iWidth; + S60->screenHeightInTwipsForScreen[i] = params.iTwipsSize.iHeight; + } } inline RWsSession& QS60Data::wsSession() @@ -335,11 +362,38 @@ inline RWsSession& QS60Data::wsSession() return tls.localData()->wsSession; } +inline int QS60Data::screenCount() +{ +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) + CCoeEnv *env = CCoeEnv::Static(); + if (env) { + return qMin(env->WsSession().NumberOfScreens(), qt_symbian_max_screens); + } +#endif + return 1; +} + inline RWindowGroup& QS60Data::windowGroup() { return CCoeEnv::Static()->RootWin(); } +inline RWindowGroup& QS60Data::windowGroup(const QWidget *widget) +{ + return windowGroup(screenNumberForWidget(widget)); +} + +inline RWindowGroup& QS60Data::windowGroup(int screenNumber) +{ +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) + RWindowGroup *wg = CCoeEnv::Static()->RootWin(screenNumber); + return wg ? *wg : windowGroup(); +#else + Q_UNUSED(screenNumber); + return windowGroup(); +#endif +} + inline CWsScreenDevice* QS60Data::screenDevice() { if(!tls.hasLocalData()) { @@ -348,6 +402,36 @@ inline CWsScreenDevice* QS60Data::screenDevice() return tls.localData()->screenDevice; } +inline CWsScreenDevice* QS60Data::screenDevice(const QWidget *widget) +{ + return screenDevice(screenNumberForWidget(widget)); +} + +inline CWsScreenDevice* QS60Data::screenDevice(int screenNumber) +{ +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) + CCoeEnv *env = CCoeEnv::Static(); + if (env) { + CWsScreenDevice *dev = env->ScreenDevice(screenNumber); + return dev ? dev : screenDevice(); + } else { + return screenDevice(); + } +#else + return screenDevice(); +#endif +} + +inline int QS60Data::screenNumberForWidget(const QWidget *widget) +{ + if (!widget) + return 0; + const QWidget *w = widget; + while (w->parentWidget()) + w = w->parentWidget(); + return qt_widget_private(const_cast(w))->symbianScreenNumber; +} + inline CCoeAppUi* QS60Data::appUi() { return CCoeEnv::Static()-> AppUi(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7065e85..1786e65 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -304,6 +304,8 @@ QWidgetPrivate::QWidgetPrivate(int version) , hasAlienChildren(0) , window_event(0) , qd_hd(0) +#elif defined(Q_OS_SYMBIAN) + , symbianScreenNumber(0) #endif { if (!qApp) { @@ -1284,6 +1286,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) // programmer specified desktop widget xinfo = desktopWidget->d_func()->xinfo; } +#elif defined(Q_OS_SYMBIAN) + if (desktopWidget) { + symbianScreenNumber = qt_widget_private(desktopWidget)->symbianScreenNumber; + } #else Q_UNUSED(desktopWidget); #endif diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 9f6ba6f..5235dc4 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -877,6 +877,7 @@ public: #elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN static QWidget *mouseGrabber; static QWidget *keyboardGrabber; + int symbianScreenNumber; // only valid for desktop widget and top-levels void s60UpdateIsOpaque(); void reparentChildren(); void registerTouchWindow(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index af9ae47..be212fb 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -84,6 +84,8 @@ QWidget *QWidgetPrivate::mouseGrabber = 0; QWidget *QWidgetPrivate::keyboardGrabber = 0; CEikButtonGroupContainer *QS60Data::cba = 0; +int qt_symbian_create_desktop_on_screen = -1; + static bool isEqual(const QList& a, const QList& b) { if ( a.count() != b.count()) @@ -349,12 +351,18 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de int sh = clientRect.Height(); if (desktop) { - TSize screenSize = S60->screenDevice()->SizeInPixels(); + symbianScreenNumber = qMax(qt_symbian_create_desktop_on_screen, 0); + TSize screenSize = S60->screenDevice(symbianScreenNumber)->SizeInPixels(); data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight); q->setAttribute(Qt::WA_DontShowOnScreen); } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){ int width = sw; int height = sh; + if (symbianScreenNumber > 0) { + TSize screenSize = S60->screenDevice(symbianScreenNumber)->SizeInPixels(); + width = screenSize.iWidth; + height = screenSize.iHeight; + } if (extra) { width = qMax(qMin(width, extra->maxw), extra->minw); height = qMax(qMin(height, extra->maxh), extra->minh); @@ -640,7 +648,7 @@ void QWidgetPrivate::raise_sys() // If toplevel widget, raise app to foreground if (q->isWindow()) - S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), 0); + S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup(q).Identifier(), 0); } } @@ -652,7 +660,7 @@ void QWidgetPrivate::lower_sys() if (q->internalWinId()) { // If toplevel widget, lower app to background if (q->isWindow()) - S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), -1); + S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup(q).Identifier(), -1); else q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1); } @@ -722,6 +730,11 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) { Q_Q(QWidget); + if (parent && parent->windowType() == Qt::Desktop) { + symbianScreenNumber = qt_widget_private(parent)->symbianScreenNumber; + parent = 0; + } + bool wasCreated = q->testAttribute(Qt::WA_WState_Created); if (q->isVisible() && q->parentWidget() && parent != q->parentWidget()) @@ -1037,7 +1050,7 @@ int QWidget::metric(PaintDeviceMetric m) const } else if (m == PdmHeight) { val = data->crect.height(); } else { - CWsScreenDevice *scr = S60->screenDevice(); + CWsScreenDevice *scr = S60->screenDevice(this); switch(m) { case PdmDpiX: case PdmPhysicalDpiX: @@ -1207,7 +1220,16 @@ void QWidget::setWindowState(Qt::WindowStates newstate) const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint; if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) { setAttribute(Qt::WA_OutsideWSRange, false); - window->SetExtentToWholeScreen(); + if (d->symbianScreenNumber > 0) { + int w = S60->screenWidthInPixelsForScreen[d->symbianScreenNumber]; + int h = S60->screenHeightInPixelsForScreen[d->symbianScreenNumber]; + if (w <= 0 || h <= 0) + window->SetExtentToWholeScreen(); + else + window->SetExtent(TPoint(0, 0), TSize(w, h)); + } else { + window->SetExtentToWholeScreen(); + } } else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) { setAttribute(Qt::WA_OutsideWSRange, false); TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this)); diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp index 0256b82..f66b849 100644 --- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp @@ -127,7 +127,7 @@ void tst_QDesktopWidget::screenNumberForQWidget() QWidget widget; widget.show(); - QApplication::processEvents(); + QTest::qWaitForWindowShown(&widget); QVERIFY(widget.isVisible()); int widgetScreen = desktop.screenNumber(&widget); @@ -142,7 +142,9 @@ void tst_QDesktopWidget::screenNumberForQPoint() QRect allScreens; for (int i = 0; i < desktopWidget->numScreens(); ++i) { QRect screenGeometry = desktopWidget->screenGeometry(i); +#if !defined(Q_OS_SYMBIAN) QCOMPARE(desktopWidget->screenNumber(screenGeometry.center()), i); +#endif allScreens |= screenGeometry; } @@ -180,7 +182,6 @@ void tst_QDesktopWidget::screenGeometry() total = desktopWidget->screenGeometry(i); available = desktopWidget->availableGeometry(i); } - QVERIFY(total.contains(r)); } QTEST_MAIN(tst_QDesktopWidget) -- cgit v0.12 From 5440d903532a37fdd69ae60e6579f82909996620 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 9 Mar 2011 14:26:16 +0200 Subject: Added missing ifdefs to allow compilation on older Symbian versions. Reviewed-by: TRUSTME --- src/gui/kernel/qapplication_s60.cpp | 2 ++ src/gui/kernel/qdesktopwidget_s60.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 86d4fcf..6e43c8b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2055,7 +2055,9 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent } break; case EEventScreenDeviceChanged: // fallthrough +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) case EEventDisplayChanged: +#endif if (callSymbianEventFilters(symbianEvent)) return 1; if (S60) diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 9d48b64..c3963f4 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -129,10 +129,12 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) // valid or not. screenCount = S60->screenCount(); +#if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS) if (displayControl) { if (displayControl->NumberOfResolutions() < 1) screenCount = 1; } +#endif if (screenCount < 1) { qWarning("No screen available"); screenCount = 1; @@ -147,7 +149,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) screens->resize(screenCount); for (int i = 0; i < screenCount; ++i) { - // All screens will share the same geometry as there is no true virtual desktop + // All screens will have a position of (0, 0) as there is no true virtual desktop // or pointer event support for multiple screens on Symbian. QRect r(0, 0, S60->screenWidthInPixelsForScreen[i], S60->screenHeightInPixelsForScreen[i]); -- cgit v0.12 From d4250d9e1d4ed23e0cf41e6ce35d9dda6323455c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 9 Mar 2011 13:34:25 +0200 Subject: Implement language fallback logic for localize_deployment When querying system locale it does return both language and country, so sometimes users want to have both in their .ts file names (e.g. myapp_zh_CN.ts). This is bit problematic in Symbian, where there are separate language codes for only very few language + country combinations. Until now, the unsupported combinations were simply dropped from deployment localization. More proper way to handle these unknown language + country combinations is to fall back to using the plain language code for them instead of dropping them altogether. This is somewhat analogous to how QTranslator::load() loads .ts files if it can't find the file for specified language + country combination. E.g. User defines: TRANSLATIONS += myapp_zh_CN.ts myapp_zh_HK.ts myapp_zh_TW.ts There are separate Symbian language codes for HongKong Chinese (zh_HK = 30) and Taiwanese Chinese (zh_TW = 29), but rest of the world is expected to use just Chinese (zh = 31). This means "zh_CN" mapping is not provided as it would be same as plain "zh". With this fix, qmake will now automatically generate a fallback mapping from "zh_CN" to "31" for deployment localization purposes, and is able to read application captions and pkg names from myapp_zh_CN.ts. If there are multiple TRANSLATIONS defined that would result in same Symbian language code, only the first one is used. Task-number: QTBUG-17927 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/symbian/symbian.conf | 32 +++++++++++++++++++++--- mkspecs/features/symbian/localize_deployment.prf | 9 +++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 65e6aa0e8..5f5c7e1 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -230,16 +230,41 @@ defineReplace(symbianRemoveSpecialCharacters) { # Determines translations that are Symbian supported defineTest(matchSymbianLanguages) { + # Qt language codes for which we need to parse .ts file SYMBIAN_MATCHED_LANGUAGES = + # List of translation files for matched languages SYMBIAN_MATCHED_TRANSLATIONS = + # List of Qt language codes for which we have no mapped Symbian code but we have a fallback code + # and therefore need to generate a mapping for in localize_deployment.prf. + # The fallback code means plain language code for languages that have both language and country codes. + # E.g. the fallback code for language "zh_CN" would be "zh". + SYMBIAN_UNMAPPED_LANGUAGES = + # List of handled Qt language codes to avoid duplicate Symbian language codes in case both + # unmapped language+country combination and its fallback code, or multiple unmapped language+country + # combinations that have same fallback code are included. + HANDLED_LANGUAGES = # Cannot parse .ts file for language here, so detect it from filename. # Allow two and three character language and country codes. for(translation, TRANSLATIONS) { language = $$replace(translation, "^(.*/)?[^/]+_(([^_]{2,3}_)?[^_]{2,3})\\.ts$", \\2) - contains(SYMBIAN_SUPPORTED_LANGUAGES, $$language) { - SYMBIAN_MATCHED_LANGUAGES += $$language - SYMBIAN_MATCHED_TRANSLATIONS += $$translation + !contains(HANDLED_LANGUAGES, $$language) { + HANDLED_LANGUAGES += $$language + contains(SYMBIAN_SUPPORTED_LANGUAGES, $$language) { + SYMBIAN_MATCHED_LANGUAGES += $$language + SYMBIAN_MATCHED_TRANSLATIONS += $$translation + } else { + # No direct mapping for specified language found. Check if a fallback language code can be used. + strippedLanguage = $$replace(language, "_.*$",) + contains(SYMBIAN_SUPPORTED_LANGUAGES, $$strippedLanguage):!contains(HANDLED_LANGUAGES, $$strippedLanguage) { + HANDLED_LANGUAGES += $$strippedLanguage + SYMBIAN_UNMAPPED_LANGUAGES += $$language + SYMBIAN_MATCHED_LANGUAGES += $$language + SYMBIAN_MATCHED_TRANSLATIONS += $$translation + SYMBIAN_LANGUAGE_FALLBACK.$$language = $$strippedLanguage + export(SYMBIAN_LANGUAGE_FALLBACK.$$language) + } + } } } @@ -247,6 +272,7 @@ defineTest(matchSymbianLanguages) { export(SYMBIAN_MATCHED_LANGUAGES) export(SYMBIAN_MATCHED_TRANSLATIONS) + export(SYMBIAN_UNMAPPED_LANGUAGES) } # Symbian pkg files that define multiple languages require a language specific string to be diff --git a/mkspecs/features/symbian/localize_deployment.prf b/mkspecs/features/symbian/localize_deployment.prf index 26a254b..185c713 100644 --- a/mkspecs/features/symbian/localize_deployment.prf +++ b/mkspecs/features/symbian/localize_deployment.prf @@ -101,6 +101,15 @@ isEmpty(SYMBIAN_MATCHED_LANGUAGES) { matchSymbianLanguages() } +# If there are translations that do not have Symbian language code defined for that exact +# language + country combination, but have Symbian language code defined for just the language, +# map the language + country combination to the same value as the plain language. +for(language, SYMBIAN_UNMAPPED_LANGUAGES) { + languageVar = SYMBIAN_LANG.$${language} + fallbackLanguageVar = SYMBIAN_LANG.$$eval(SYMBIAN_LANGUAGE_FALLBACK.$$language) + $$languageVar = $$eval($$fallbackLanguageVar) +} + !isEmpty(SYMBIAN_MATCHED_TRANSLATIONS) { # Generate dependencies to .ts files for pkg files template_pkg_target.depends += $$SYMBIAN_MATCHED_TRANSLATIONS -- cgit v0.12 From fa41a0416394a7a9f2f78b05e19d4a89c8828082 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 9 Mar 2011 16:55:03 +0200 Subject: Fix for misplaced endif in qglobal.h. Reviewed-by: TRUSTME --- src/corelib/global/qglobal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 9b3787e..501f187 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2453,6 +2453,7 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); #ifdef SYMBIAN_GRAPHICS_TRANSITION_EFFECTS_SIGNALING_AVAILABLE # define Q_SYMBIAN_TRANSITION_EFFECTS #endif +#endif #ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS #define Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS -- cgit v0.12 From 09ff8924d5d05b285d9ed6a03817bdf271b6b108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Mar 2011 16:37:19 +0100 Subject: Partial update window surfaces always need a repaint before flush. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we get an Expose, we need to repaint the window surface before we can flush if the window surface doesn't support partial updates, otherwise we'll end up with garbage on the screen. Reviewed-by: Bjørn Erik Nilsen --- src/gui/painting/qbackingstore.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 83c58c4..4fcff1d 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -1117,6 +1117,11 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg return; } + // If there's no partial update support we always need + // to do a full repaint before flushing + if (!windowSurface->hasPartialUpdateSupport()) + fullUpdatePending = true; + // Nothing to repaint. if (!isDirty()) { qt_flush(exposedWidget, exposedRegion, windowSurface, tlw, tlwOffset); -- cgit v0.12 From 5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 10 Mar 2011 11:26:38 +1000 Subject: Fix failing tests RTL text-related tests were failing on mac since QApplication::keyboardInputDirection() is not always initialized when the QApplication instance is created. Change-Id: Ifa7214ffb1941d824a9425015b38aa77366381bb Reviewed-by: Martin Jones --- doc/src/snippets/declarative/states/statechangescript.qml | 1 + tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 5 +++++ .../declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 4 ++++ .../declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/doc/src/snippets/declarative/states/statechangescript.qml b/doc/src/snippets/declarative/states/statechangescript.qml index b885137..f490a97 100644 --- a/doc/src/snippets/declarative/states/statechangescript.qml +++ b/doc/src/snippets/declarative/states/statechangescript.qml @@ -37,6 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +import QtQuick 1.0 Item { //! [state and transition] diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index b5dfba8..2d52642 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -602,6 +602,7 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QCOMPARE(text->hAlign(), QDeclarativeText::AlignLeft); QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().left() < canvas->width()/2); +#ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection text->setText(""); @@ -609,8 +610,11 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight); text->setHAlign(QDeclarativeText::AlignRight); QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight); +#endif + delete canvas; +#ifndef Q_OS_MAC // QTBUG-18040 // alignment of Text with no text set to it QString componentStr = "import QtQuick 1.0\nText {}"; QDeclarativeComponent textComponent(&engine); @@ -619,6 +623,7 @@ void tst_qdeclarativetext::horizontalAlignment_RightToLeft() QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? QDeclarativeText::AlignLeft : QDeclarativeText::AlignRight); delete textObject; +#endif } void tst_qdeclarativetext::verticalAlignment() diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 402c6cd..7aac76c 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -524,6 +524,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignLeft); QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2); +#ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection textEdit->setText(""); @@ -536,9 +537,11 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() textEdit->setHAlign(QDeclarativeTextEdit::AlignRight); QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2); +#endif delete canvas; +#ifndef Q_OS_MAC // QTBUG-18040 // alignment of TextEdit with no text set to it QString componentStr = "import QtQuick 1.0\nTextEdit {}"; QDeclarativeComponent textComponent(&engine); @@ -547,6 +550,7 @@ void tst_qdeclarativetextedit::hAlign_RightToLeft() QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? QDeclarativeTextEdit::AlignLeft : QDeclarativeTextEdit::AlignRight); delete textObject; +#endif } void tst_qdeclarativetextedit::vAlign() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 734f91f..796ac23 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1111,6 +1111,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignLeft); QVERIFY(-textInputPrivate->hscroll < canvas->width()/2); +#ifndef Q_OS_MAC // QTBUG-18040 // empty text with implicit alignment follows the system locale-based // keyboard input direction from QApplication::keyboardInputDirection textInput->setText(""); @@ -1123,9 +1124,11 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() textInput->setHAlign(QDeclarativeTextInput::AlignRight); QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight); QVERIFY(-textInputPrivate->hscroll > canvas->width()/2); +#endif delete canvas; +#ifndef Q_OS_MAC // QTBUG-18040 // alignment of TextInput with no text set to it QString componentStr = "import QtQuick 1.0\nTextInput {}"; QDeclarativeComponent textComponent(&engine); @@ -1134,6 +1137,7 @@ void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft() QCOMPARE(textObject->hAlign(), QApplication::keyboardInputDirection() == Qt::LeftToRight ? QDeclarativeTextInput::AlignLeft : QDeclarativeTextInput::AlignRight); delete textObject; +#endif } void tst_qdeclarativetextinput::positionAt() -- cgit v0.12 From 6fb7a21fc5b7324456d210e2134ffe97ae245d2c Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 10 Mar 2011 08:43:17 +0200 Subject: Visible flashing on QML app when split view is opened and closed The root cause is that input widget is re-positioned twice; once when keyboard opens and second time when window becomes visible. This causes flicker. Task-number: QTBUG-17979 Reviewed-by: Laszlo Agocs --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index cd4e2fd..e3f13ff 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -330,26 +330,6 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE // This should also happen for commands. reset(); - // We need to translate the window content when window becomes available. Changing the window while it is - // not yet ready with OpenVg graphicssystem results in operations silently failing. - - if (event->windowServerEvent() && event->windowServerEvent()->Type() == EEventWindowVisibilityChanged) { - if (S60->splitViewLastWidget) { - QGraphicsView *gv = qobject_cast(S60->splitViewLastWidget); - const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); - TUint visibleFlags = event->windowServerEvent()->VisibilityChanged()->iFlags; - if (!alwaysResize) { - if (visibleFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { - if (!isWidgetVisible(S60->splitViewLastWidget)) { - ensureFocusWidgetVisible(S60->splitViewLastWidget); - } - } else if (visibleFlags & TWsVisibilityChangedEvent::ENotVisible) { - resetSplitViewWidget(true); - } - } - } - } - return false; } -- cgit v0.12 From 7a94ad38f0d730689ff3ed973b5824e5d7ab6408 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 10 Mar 2011 08:46:40 +0200 Subject: QML app: text input field is not visible when split view is opened When using a maximized QML application and user taps to a input widget, opened splitview does not show the focused input widget. The root cause of the problem is that when we move to splitview, we set the window state to fullscreen. Unfortunately, there we were trying to fullscreen the input widget and not the window that where the input widget is. Task-number: QTBUG-17984 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index e3f13ff..86cea60 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -509,7 +509,7 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) // as the statuspane size is not changing. if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { - widget->setWindowState( + windowToMove->setWindowState( (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); } -- cgit v0.12 From af33f9f2e7ec433b81f5c18e3e7395db4a56c5fe Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 10 Mar 2011 16:41:57 +1000 Subject: AnimatedImage does not change progress value This fixes QTBUG-17964 and make AnimatedImage behave like Image. Task-number: QTBUG-17964 Reviewed-By: Martin Jones Change-Id: I33996353a3b4ee0edb03741998f3ea893d4d31e5 --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 25 ++++++++--- .../tst_qdeclarativeanimatedimage.cpp | 49 ++++++++++++++++++++++ 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 016b87d..8cc8165 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -231,9 +231,18 @@ void QDeclarativeAnimatedImage::load() { Q_D(QDeclarativeAnimatedImage); + QDeclarativeImageBase::Status oldStatus = d->status; + qreal oldProgress = d->progress; + if (d->url.isEmpty()) { delete d->_movie; + d->setPixmap(QPixmap()); + d->progress = 0; d->status = Null; + if (d->status != oldStatus) + emit statusChanged(d->status); + if (d->progress != oldProgress) + emit progressChanged(d->progress); } else { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url); @@ -245,7 +254,8 @@ void QDeclarativeAnimatedImage::load() delete d->_movie; d->_movie = 0; d->status = Error; - emit statusChanged(d->status); + if (d->status != oldStatus) + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -262,20 +272,25 @@ void QDeclarativeAnimatedImage::load() d->setPixmap(d->_movie->currentPixmap()); d->status = Ready; d->progress = 1.0; - emit statusChanged(d->status); - emit sourceChanged(d->url); - emit progressChanged(d->progress); + if (d->status != oldStatus) + emit statusChanged(d->status); + if (d->progress != oldProgress) + emit progressChanged(d->progress); return; } #endif d->status = Loading; + d->progress = 0; + emit statusChanged(d->status); + emit progressChanged(d->progress); QNetworkRequest req(d->url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); d->reply = qmlEngine(this)->networkAccessManager()->get(req); QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(movieRequestFinished())); + QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(requestProgress(qint64,qint64))); } - emit statusChanged(d->status); } #define ANIMATEDIMAGE_MAXIMUM_REDIRECT_RECURSION 16 diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 104ee15..7d1b807 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include "../shared/testhttpserver.h" #include "../../../shared/util.h" @@ -76,6 +77,7 @@ private slots: void sourceSizeReadOnly(); void invalidSource(); void qtbug_16520(); + void progressAndStatusChanges(); private: QPixmap grabScene(QGraphicsScene *scene, int width, int height); @@ -333,6 +335,53 @@ void tst_qdeclarativeanimatedimage::qtbug_16520() delete anim; } +void tst_qdeclarativeanimatedimage::progressAndStatusChanges() +{ + TestHTTPServer server(14449); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeEngine engine; + QString componentStr = "import QtQuick 1.0\nAnimatedImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/stickman.gif")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast(component.create()); + QVERIFY(obj != 0); + QVERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + + QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &))); + QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal))); + QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QDeclarativeImageBase::Status))); + + // Loading local file + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.gif")); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 1); + QTRY_COMPARE(progressSpy.count(), 0); + QTRY_COMPARE(statusSpy.count(), 0); + + // Loading remote file + ctxt->setContextProperty("srcImage", "http://127.0.0.1:14449/stickman.gif"); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->progress() == 0.0); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 2); + QTRY_VERIFY(progressSpy.count() > 1); + QTRY_COMPARE(statusSpy.count(), 2); + + ctxt->setContextProperty("srcImage", ""); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Null); + QTRY_VERIFY(obj->progress() == 0.0); + QTRY_COMPARE(sourceSpy.count(), 3); + QTRY_VERIFY(progressSpy.count() > 2); + QTRY_COMPARE(statusSpy.count(), 3); +} + QTEST_MAIN(tst_qdeclarativeanimatedimage) #include "tst_qdeclarativeanimatedimage.moc" -- cgit v0.12 From 9c5aa419ba467ff2d59440bafe2ca82d1065afec Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 10 Mar 2011 10:59:20 +0200 Subject: Polish splitview implementation Remove calls to unnecessary methods. Remove unnecessary checks. Fix whitespace. Reviewed-by: Laszlo Agocs --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 90 +++++++++++-------------- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 86cea60..af48a92 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -382,23 +382,19 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) return; } - QSymbianControl *symControl = static_cast(S60->splitViewLastWidget->effectiveWinId()); + QSymbianControl *symControl = static_cast(gv->effectiveWinId()); symControl->CancelLongTapTimer(); - const bool alwaysResize = (gv && gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); - QWidget *windowToMove = gv ? gv : symControl->widget(); - if (!S60->splitViewLastWidget->isWindow()) - windowToMove = S60->splitViewLastWidget->window(); + const bool alwaysResize = (gv->verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff); + QWidget *windowToMove = gv->window(); - bool userResize = S60->splitViewLastWidget->testAttribute(Qt::WA_Resized); - bool userMove = windowToMove->testAttribute(Qt::WA_Moved); + bool userResize = gv->testAttribute(Qt::WA_Resized); - if (gv) - windowToMove->setUpdatesEnabled(false); + windowToMove->setUpdatesEnabled(false); - if (gv && !alwaysResize) { - disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); - if (gv && gv->scene()) { + if (!alwaysResize) { + if (gv->scene()) { + disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); QGraphicsItem *rootItem; foreach (QGraphicsItem *item, gv->scene()->items()) { if (!item->parentItem()) { @@ -418,12 +414,10 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) windowToMove->setWindowState(m_splitViewPreviousWindowStates); if (m_splitViewResizeBy) - S60->splitViewLastWidget->updateGeometry(); - if (gv) - windowToMove->setUpdatesEnabled(true); + gv->updateGeometry(); + windowToMove->setUpdatesEnabled(true); - S60->splitViewLastWidget->setAttribute(Qt::WA_Resized, userResize); //not a user resize - windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move + gv->setAttribute(Qt::WA_Resized, userResize); //not a user resize m_splitViewResizeBy = 0; if (!keepInputWidget) { @@ -496,50 +490,46 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget) int windowTop = widget->window()->pos().y(); const bool userResize = widget->testAttribute(Qt::WA_Resized); - const bool userMove = windowToMove->testAttribute(Qt::WA_Moved); QRect splitViewRect = qt_TRect2QRect(static_cast(S60->appUi())->ClientRect()); - if (gv) { - // When resizing a window widget, it will lose its maximized window state. - // Native applications hide statuspane in splitview state, so lets move to - // fullscreen mode. This makes available area slightly bigger, which helps usability - // and greatly reduces event passing in orientation switch cases, - // as the statuspane size is not changing. + // When resizing a window widget, it will lose its maximized window state. + // Native applications hide statuspane in splitview state, so lets move to + // fullscreen mode. This makes available area slightly bigger, which helps usability + // and greatly reduces event passing in orientation switch cases, + // as the statuspane size is not changing. - if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { - windowToMove->setWindowState( - (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); - } + if (!(windowToMove->windowState() & Qt::WindowFullScreen)) { + windowToMove->setWindowState( + (windowToMove->windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowFullScreen); + } - if (alwaysResize) { - windowToMove->setUpdatesEnabled(false); - if (!moveWithinVisibleArea) - m_splitViewResizeBy = widget->height(); + if (alwaysResize) { + windowToMove->setUpdatesEnabled(false); + if (!moveWithinVisibleArea) + m_splitViewResizeBy = widget->height(); - windowTop = widget->geometry().top(); - widget->resize(widget->width(), splitViewRect.height() - windowTop); + windowTop = widget->geometry().top(); + widget->resize(widget->width(), splitViewRect.height() - windowTop); - if (gv && gv->scene()) { - const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); - gv->ensureVisible(microFocusRect); - } - windowToMove->setUpdatesEnabled(true); - } else { - if (!moveWithinVisibleArea) { - // Check if the widget contains cursorPositionChanged signal and connect to it. - const char *signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())).constData(); - int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal + 1); - if (index != -1) - connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); - } - translateInputWidget(); + if (gv->scene()) { + const QRectF microFocusRect = gv->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF(); + gv->ensureVisible(microFocusRect); + } + windowToMove->setUpdatesEnabled(true); + } else { + if (!moveWithinVisibleArea) { + // Check if the widget contains cursorPositionChanged signal and connect to it. + const char *signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged())).constData(); + int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal + 1); + if (index != -1) + connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); } + translateInputWidget(); } widget->setAttribute(Qt::WA_Resized, userResize); //not a user resize - windowToMove->setAttribute(Qt::WA_Moved, userMove); //not a user move } static QTextCharFormat qt_TCharFormat2QTextCharFormat(const TCharFormat &cFormat, bool validStyleColor) @@ -836,7 +826,7 @@ void QCoeFepInputContext::translateInputWidget() // New Y position should be ideally at the center of the splitview area. // If that would expose unpainted canvas, limit the tranformation to the visible scene bottom. - const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height(); + const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height(); qreal dy = -(qMin(maxY, (cursor.bottom() - vkbRect.top() / 2))); // Do not allow transform above screen top. -- cgit v0.12 From e1ce31e9ecf7e773895632fcf3087369a50c04f1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 10 Mar 2011 11:22:05 +0200 Subject: Avoid image conversion in fromSymbianCFbsBitmap for certain formats. From now on the image data coming from CFbsBitmap will not be forced to RGB32 or ARGB32_Premultiplied in openvg. This allows copy-less creation and drawing of pixmaps not just from bitmaps with display mode EColor16MAP and EColor16MU, but also a few other modes, like EColor64K. Painting into such pixmaps or drawing them via the raster engine is potentially slower in such cases, which is now reflected in the fromSymbianCFbsBitmap documentation. Note that this patch has no effect on extended bitmaps (e.g. skin graphics), those must always be rasterized first regardless of the display mode. Task-number: QTBUG-18027 Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 2 ++ src/openvg/qpaintengine_vg.cpp | 5 ++++- src/openvg/qvg_symbian.cpp | 23 ++++++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index ca5f133..fbdebf3 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -374,6 +374,8 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const To be sure that QPixmap does not modify your original instance, you should make a copy of your \c CFbsBitmap before calling this function. If the CFbsBitmap is not valid this function will return a null QPixmap. + For performance reasons it is recommended to use a \a bitmap with a display + mode of EColor16MAP or EColor16MU whenever possible. \warning This function is only available on Symbian OS. diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index f0f198f..f1b3277 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -4018,6 +4018,8 @@ VGImageFormat qt_vg_image_to_vg_format(QImage::Format format) switch (format) { case QImage::Format_MonoLSB: return VG_BW_1; + case QImage::Format_Indexed8: + return VG_sL_8; case QImage::Format_ARGB32_Premultiplied: return VG_sARGB_8888_PRE; case QImage::Format_RGB32: @@ -4028,7 +4030,8 @@ VGImageFormat qt_vg_image_to_vg_format(QImage::Format format) return VG_sRGB_565; case QImage::Format_ARGB4444_Premultiplied: return VG_sARGB_4444; - default: break; + default: + break; } return VG_sARGB_8888; // XXX } diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index 5eb64bd..405151d 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -150,6 +150,21 @@ void QVGPixmapData::releaseNativeImageHandle() } } +static inline bool conversionLessFormat(QImage::Format format) +{ + switch (format) { + case QImage::Format_RGB16: // EColor64K + case QImage::Format_RGB32: // EColor16MU + case QImage::Format_ARGB32: // EColor16MA + case QImage::Format_ARGB32_Premultiplied: // EColor16MAP + case QImage::Format_MonoLSB: // EGray2 + case QImage::Format_Indexed8: // EGray256, EColor256 + return true; + default: + return false; + } +} + void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) { if (type == QPixmapData::SgImage && pixmap) { @@ -178,9 +193,11 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) source = QVolatileImage(bitmap); // duplicates only, if possible if (source.isNull()) return; - // Here we may need to copy if the formats do not match. - // (e.g. for display modes other than EColor16MAP and EColor16MU) - source.ensureFormat(idealFormat(&source.imageRef(), Qt::AutoColor)); + if (!conversionLessFormat(source.format())) { + // Here we may need to copy if the formats do not match. + // (e.g. for display modes other than EColor16MAP and EColor16MU) + source.ensureFormat(idealFormat(&source.imageRef(), Qt::AutoColor)); + } recreate = true; } else if (type == QPixmapData::VolatileImage && pixmap) { QVolatileImage *img = static_cast(pixmap); -- cgit v0.12 From 177f6ec7a92e6108491a040e714485d840a40c71 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 10 Mar 2011 13:20:39 +0100 Subject: Get the number of cores from HAL on Symbian. Task-number: QTBUG-2199 Reviewed-by: Shane Kearns --- src/corelib/thread/qthread_unix.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 5177339..9bfd85a 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -54,6 +54,11 @@ #include #endif +#ifdef Q_OS_SYMBIAN +#include +#include +#endif + #include "qthreadstorage.h" #include "qthread_p.h" @@ -63,6 +68,12 @@ #include #include +// You only find these enumerations on Symbian^3 onwards, so we need to provide our own +// to remain compatible with older releases. They won't be called by pre-Sym^3 SDKs. + +// HALData::ENumCpus +#define QT_HALData_ENumCpus 119 + #ifdef Q_OS_BSD4 #include #endif @@ -422,8 +433,20 @@ int QThread::idealThreadCount() // as of aug 2008 Integrity only supports one single core CPU cores = 1; #elif defined(Q_OS_SYMBIAN) - // ### TODO - Get the number of cores from HAL? when multicore architectures (SMP) are supported - cores = 1; + if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) { + TInt inumcpus; + TInt err; + err = HAL::Get(QT_HALData_ENumCpus, inumcpus); + if (err != KErrNone) { + cores = 1; + } else if ( inumcpus <= 0 ) { + cores = 1; + } else { + cores = inumcpus; + } + } else { + cores = 1; + } #elif defined(Q_OS_VXWORKS) // VxWorks # if defined(QT_VXWORKS_HAS_CPUSET) -- cgit v0.12 From d4bfaafbd7dc59f971c1abe67e8245163ca39132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 10 Mar 2011 13:38:14 +0100 Subject: Configuring a static Qt build did not exclude WebKit if the -webkit option was given. Since the script only checked the value of canBuildWebKit when CFG_WEBKIT was set to "auto", a static WebKit build was still possible, this again resulted in build (linking) errors later in the build process. Note: The changes in this patch means that -static will take precedence over -webkit. Reviewed-by: Simon Hausmann --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index cddea86..a542314 100755 --- a/configure +++ b/configure @@ -7479,7 +7479,7 @@ else QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG" fi -if [ "$CFG_WEBKIT" = "auto" ]; then +if [ "$CFG_WEBKIT" != "no" ]; then CFG_WEBKIT="$canBuildWebKit" fi -- cgit v0.12 From 3c3176f43f049e0c26e56f04881bd8047e731915 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 10 Mar 2011 15:54:45 +0200 Subject: Background app visible after split view closed When using an app with graphicsview + vertical scrollbar that has previously opened the splitview, when closing the keyboard, the application is not reset to the original geometry correctly. This is caused by invalid operation in the resetSplitView() method that does not resize the graphics view back to original size AND might even leave it with incorrect window state. Task-number: QTBUG-17937 Reviewed-by: Guoqing Zhang --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index af48a92..73aa982 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -405,16 +405,16 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) if (rootItem) rootItem->resetTransform(); } + } else { + if (m_splitViewResizeBy) + gv->resize(gv->rect().width(), m_splitViewResizeBy); } - // Resizing might have led to widget losing its original windowstate. // Restore previous window state. if (m_splitViewPreviousWindowStates != windowToMove->windowState()) windowToMove->setWindowState(m_splitViewPreviousWindowStates); - if (m_splitViewResizeBy) - gv->updateGeometry(); windowToMove->setUpdatesEnabled(true); gv->setAttribute(Qt::WA_Resized, userResize); //not a user resize -- cgit v0.12 From 433e4380c98b9369a7d55894e9d34f8c87ba06e9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 10 Mar 2011 17:11:09 +0200 Subject: Fix for fromSymbianCFbsBitmap changing the source data unexpectedly. Inverting the pixels for bitmaps of mode EGray2 is done in-place, which is wrong if the bitmap handle was duplicated. Instead, we need to make a copy. This also means that we cannot treat EGray2 a conversion-less format in openvg, but such images are likely to be used as masks only, so optimizing just for mere drawing in case of this format is not really necessary. Reviewed-by: Jani Hautakangas --- src/gui/image/qvolatileimagedata_symbian.cpp | 3 +++ src/openvg/qvg_symbian.cpp | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp index 474d0ef..6e2909b 100644 --- a/src/gui/image/qvolatileimagedata_symbian.cpp +++ b/src/gui/image/qvolatileimagedata_symbian.cpp @@ -392,6 +392,9 @@ void QVolatileImageData::initWithBitmap(CFbsBitmap *source) } else if (needsCopy) { // Rasterize extended and compressed bitmaps. bitmap = rasterizeBitmap(source, EColor16MAP); + } else if (source->DisplayMode() == EGray2) { + // The pixels will be inverted, must make a copy. + bitmap = rasterizeBitmap(source, source->DisplayMode()); } else { // Efficient path: no pixel data copying. Just duplicate. This of course // means the original bitmap's data may get modified, but that's fine diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index 405151d..2924d41 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -157,7 +157,6 @@ static inline bool conversionLessFormat(QImage::Format format) case QImage::Format_RGB32: // EColor16MU case QImage::Format_ARGB32: // EColor16MA case QImage::Format_ARGB32_Premultiplied: // EColor16MAP - case QImage::Format_MonoLSB: // EGray2 case QImage::Format_Indexed8: // EGray256, EColor256 return true; default: -- cgit v0.12 From 555f52c498c3ba67041c880701a66224e7b321b0 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 9 Mar 2011 15:15:02 +0200 Subject: Don't use EGL surfaces for translucency with 32MB GPU chip. Add dynamic GPU chip detection on Symbian to decide if translucent EGL surfaces can be used. With 32MB GPU memory there is not enough memory to create for example transparent video overlay widgets and that's why hw surfaces must not be used. Task-number: QTBUG-18024 Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_p.h | 2 ++ src/gui/kernel/qapplication_s60.cpp | 27 +++++++++++++++++++++- src/gui/kernel/qwidget_s60.cpp | 15 +++++++----- src/opengl/qgraphicssystem_gl.cpp | 12 ++++++++++ .../graphicssystems/openvg/qgraphicssystem_vg.cpp | 12 ++++++---- 5 files changed, 56 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 43634ef..3d2c9d6 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -599,6 +599,8 @@ public: int pressureSupported; int maxTouchPressure; QList appAllTouchPoints; + + bool useTranslucentEGLSurfaces; #endif private: diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6e43c8b..43b9b01 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -100,7 +100,6 @@ static const int KGoomMemoryGoodEvent = 0x20026790; static const int KSplitViewOpenEvent = 0x2001E2C0; static const int KSplitViewCloseEvent = 0x2001E2C1; - #if defined(QT_DEBUG) static bool appNoGrab = false; // Grabbing enabled #endif @@ -1665,6 +1664,32 @@ void qt_init(QApplicationPrivate * /* priv */, int) QObject::connect(qApp, SIGNAL(aboutToQuit()), qApp, SLOT(_q_aboutToQuit())); #endif +#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = true; + + const TUid KIvePropertyCat = {0x2726beef}; + enum TIvePropertyChipType { + EVCBCM2727B1 = 0x00000000, + EVCBCM2763A0 = 0x04000100, + EVCBCM2763B0 = 0x04000102, + EVCBCM2763C0 = 0x04000103, + EVCBCM2763C1 = 0x04000104, + EVCBCMUnknown = 0x7fffffff + }; + + TInt chipType = EVCBCMUnknown; + if (RProperty::Get(KIvePropertyCat, 0 /*chip type*/, chipType) == KErrNone) { + if (chipType == EVCBCM2727B1) { + // We have only 32MB GPU memory. Use raster surfaces + // for transparent TLWs. + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; + } + } else { + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; + } +#else + QApplicationPrivate::instance()->useTranslucentEGLSurfaces = false; +#endif /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index be212fb..62d09fe 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -813,17 +813,21 @@ void QWidgetPrivate::s60UpdateIsOpaque() RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE - window->SetSurfaceTransparency(!isOpaque); - extra->topextra->nativeWindowTransparencyEnabled = !isOpaque; -#else + if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces) { + window->SetSurfaceTransparency(!isOpaque); + extra->topextra->nativeWindowTransparencyEnabled = !isOpaque; + return; + } +#endif if (!isOpaque) { const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); extra->topextra->nativeWindowTransparencyEnabled = 1; - if (extra->topextra->backingStore.data() && - QApplicationPrivate::graphics_system_name == QLatin1String("openvg")) { + if (extra->topextra->backingStore.data() && ( + QApplicationPrivate::graphics_system_name == QLatin1String("openvg") + || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) { // Semi-transparent EGL surfaces aren't supported. We need to // recreate backing store to get translucent surface (raster surface). extra->topextra->backingStore.create(q); @@ -834,7 +838,6 @@ void QWidgetPrivate::s60UpdateIsOpaque() window->SetTransparentRegion(TRegionFix<1>()); extra->topextra->nativeWindowTransparencyEnabled = 0; } -#endif } void QWidgetPrivate::setWindowIcon_sys(bool forceReset) diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp index 79911fb..3574756 100644 --- a/src/opengl/qgraphicssystem_gl.cpp +++ b/src/opengl/qgraphicssystem_gl.cpp @@ -53,6 +53,10 @@ #include "private/qwindowsurface_x11gl_p.h" #endif +#if defined(Q_OS_SYMBIAN) +#include +#endif + QT_BEGIN_NAMESPACE extern QGLWidget *qt_gl_getShareWidget(); @@ -86,6 +90,14 @@ QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const } #endif +#if defined(Q_OS_SYMBIAN) + if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) { + QWidgetPrivate *d = qt_widget_private(widget); + if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) + return d->createDefaultWindowSurface_sys(); + } +#endif + return new QGLWindowSurface(widget); } diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp index 1da58e1..4b4f677 100644 --- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp +++ b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp @@ -43,7 +43,7 @@ #include #include #include -#if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) +#if defined(Q_OS_SYMBIAN) #include #endif #include @@ -70,10 +70,12 @@ QPixmapData *QVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) co QWindowSurface *QVGGraphicsSystem::createWindowSurface(QWidget *widget) const { -#if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) - QWidgetPrivate *d = qt_widget_private(widget); - if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) - return d->createDefaultWindowSurface_sys(); +#if defined(Q_OS_SYMBIAN) + if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) { + QWidgetPrivate *d = qt_widget_private(widget); + if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) + return d->createDefaultWindowSurface_sys(); + } #endif return new QVGWindowSurface(widget); } -- cgit v0.12 From 1b326932d48c0e584f9d5173fa5f892c5086fee8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 10 Mar 2011 16:17:14 +0100 Subject: Not requiring valid QTextBlock in previous() Commit 64852122ba7 introduced a regression in QTextBlock::previous(), programs that do doc.end().previous() will not be able to retrieve the last valid block. Revert this change so that we can keep the behavior consistent with previous versions. Task-number: QTBUG-18026 Reviewed-by: Eskil --- src/gui/text/qtextobject.cpp | 2 +- tests/auto/qtextblock/tst_qtextblock.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index e323fd0..94f2fc7 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1504,7 +1504,7 @@ QTextBlock QTextBlock::next() const */ QTextBlock QTextBlock::previous() const { - if (!isValid()) + if (!p) return QTextBlock(); return QTextBlock(p, p->blockMap().previous(n)); diff --git a/tests/auto/qtextblock/tst_qtextblock.cpp b/tests/auto/qtextblock/tst_qtextblock.cpp index 7b41874..cec3a6a 100644 --- a/tests/auto/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/qtextblock/tst_qtextblock.cpp @@ -75,6 +75,7 @@ private slots: void fragmentOverBlockBoundaries(); void excludeParagraphSeparatorFragment(); void backwardsBlockIterator(); + void previousBlock_qtbug18026(); private: QTextDocument *doc; @@ -174,5 +175,11 @@ void tst_QTextBlock::backwardsBlockIterator() QCOMPARE(it.fragment().position(), 0); } +void tst_QTextBlock::previousBlock_qtbug18026() +{ + QTextBlock last = doc->end().previous(); + QVERIFY(last.isValid()); +} + QTEST_MAIN(tst_QTextBlock) #include "tst_qtextblock.moc" -- cgit v0.12 From 98a4ec8358c6da17c8dd77c504a7e4d76e8c612a Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 10 Mar 2011 16:43:53 +0100 Subject: Cast int to HALData::TAttribute for QT_HALData_ENumCpus and compile with RVCT4. Reviewed-by: Jani Hautakangas Reviewed-by: Shane Kearns --- src/corelib/thread/qthread_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 9bfd85a..c2bc895 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -436,7 +436,7 @@ int QThread::idealThreadCount() if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) { TInt inumcpus; TInt err; - err = HAL::Get(QT_HALData_ENumCpus, inumcpus); + err = HAL::Get((HALData::TAttribute)QT_HALData_ENumCpus, inumcpus); if (err != KErrNone) { cores = 1; } else if ( inumcpus <= 0 ) { -- cgit v0.12 From 1b3514e4b2d9a41f73bf5b87caf73ce409eadf2a Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 10 Mar 2011 17:24:46 +0100 Subject: Fix QGraphicsScene returning incorrect focus item. When the scene was losing and regaining focus, it was incorrectly setting the focus on any item that had its focus previously explicitly cleared. Autotest included. Task-number: QTBUG-16401 Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 4 ++- src/gui/graphicsview/qgraphicsscene.cpp | 11 ++++++--- src/gui/graphicsview/qgraphicsscene_p.h | 1 + tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 31 ++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 52e4d79..9c3198b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5577,8 +5577,10 @@ void QGraphicsItemPrivate::setSubFocus(QGraphicsItem *rootItem, QGraphicsItem *s parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible)); - if (scene && !scene->isActive()) + if (scene && !scene->isActive()) { + scene->d_func()->passiveFocusItem = subFocusItem; scene->d_func()->lastFocusItem = subFocusItem; + } } /*! diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 5e5077b..699d561 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -306,6 +306,7 @@ QGraphicsScenePrivate::QGraphicsScenePrivate() rectAdjust(2), focusItem(0), lastFocusItem(0), + passiveFocusItem(0), tabFocusFirst(0), activePanel(0), lastActivePanel(0), @@ -630,6 +631,8 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) focusItem = 0; if (item == lastFocusItem) lastFocusItem = 0; + if (item == passiveFocusItem) + passiveFocusItem = 0; if (item == activePanel) { // ### deactivate... activePanel = 0; @@ -2985,7 +2988,7 @@ void QGraphicsScene::removeItem(QGraphicsItem *item) QGraphicsItem *QGraphicsScene::focusItem() const { Q_D(const QGraphicsScene); - return isActive() ? d->focusItem : d->lastFocusItem; + return isActive() ? d->focusItem : d->passiveFocusItem; } /*! @@ -3059,6 +3062,7 @@ void QGraphicsScene::clearFocus() Q_D(QGraphicsScene); if (d->hasFocus) { d->hasFocus = false; + d->passiveFocusItem = d->focusItem; setFocusItem(0, Qt::OtherFocusReason); } } @@ -3761,9 +3765,9 @@ void QGraphicsScene::focusInEvent(QFocusEvent *focusEvent) focusEvent->ignore(); break; default: - if (d->lastFocusItem) { + if (d->passiveFocusItem) { // Set focus on the last focus item - setFocusItem(d->lastFocusItem, focusEvent->reason()); + setFocusItem(d->passiveFocusItem, focusEvent->reason()); } break; } @@ -3782,6 +3786,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent) { Q_D(QGraphicsScene); d->hasFocus = false; + d->passiveFocusItem = d->focusItem; setFocusItem(0, focusEvent->reason()); // Remove all popups when the scene loses focus. diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 815c70b..2b47105 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -150,6 +150,7 @@ public: quint32 rectAdjust; QGraphicsItem *focusItem; QGraphicsItem *lastFocusItem; + QGraphicsItem *passiveFocusItem; QGraphicsWidget *tabFocusFirst; QGraphicsItem *activePanel; QGraphicsItem *lastActivePanel; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index b221cd9..5a5c9b7 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -289,6 +289,7 @@ private slots: void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); void taskQT_3674_doNotCrash(); void taskQTBUG_15977_renderWithDeviceCoordinateCache(); + void taskQTBUG_16401_focusItem(); }; void tst_QGraphicsScene::initTestCase() @@ -4652,5 +4653,35 @@ void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache() QCOMPARE(image, expected); } +void tst_QGraphicsScene::taskQTBUG_16401_focusItem() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + rect->setFlag(QGraphicsItem::ItemIsFocusable); + + view.show(); + QTest::qWaitForWindowShown(&view); + QApplication::setActiveWindow(&view); + + QVERIFY(!scene.focusItem()); + + rect->setFocus(); + QCOMPARE(scene.focusItem(), rect); + QFocusEvent focusOut(QEvent::FocusOut); + QApplication::sendEvent(&view, &focusOut); + QVERIFY(!scene.focusItem()); + QFocusEvent focusIn(QEvent::FocusIn); + QApplication::sendEvent(&view, &focusIn); + QCOMPARE(scene.focusItem(), rect); + + rect->clearFocus(); + QVERIFY(!scene.focusItem()); + QApplication::sendEvent(&view, &focusOut); + QVERIFY(!scene.focusItem()); + QApplication::sendEvent(&view, &focusIn); + QVERIFY(!scene.focusItem()); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -- cgit v0.12 From 2ecb0ea77c04424f6f557ca8a13c1d86666763df Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 10 Mar 2011 17:50:12 +0200 Subject: Fix for major regression in OpenVG clipping OpenVG paint engine didn't reset it's mask fallback state correctly when engine was resetted. Task-number: QTBUG-17966 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index f1b3277..3d50558 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -2333,6 +2333,7 @@ bool QVGPaintEngine::isDefaultClipRect(const QRect& rect) void QVGPaintEngine::clipEnabledChanged() { #if defined(QVG_SCISSOR_CLIP) + vgSeti(VG_MASKING, VG_FALSE); // disable mask fallback updateScissor(); #else Q_D(QVGPaintEngine); -- cgit v0.12 From ce59628ba366800fe2f3afdadc37be02f98480a7 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 11 Mar 2011 09:39:27 +1000 Subject: Update copyright year to 2011. Reviewed-by: Trust Me (cherry picked from commit 774a3536b00c4d6e4c4c10b708e31b4373a338e3) --- bin/elf2e32_qtwrapper.pl | 2 +- config.profiles/symbian/translations/qt_fr_symbian.ts | 4 ++-- config.profiles/symbian/translations/qt_pl_symbian.ts | 4 ++-- config.profiles/symbian/translations/qt_ru_symbian.ts | 4 ++-- config.profiles/symbian/translations/qt_zh_cn_symbian.ts | 2 +- config.profiles/symbian/translations/qt_zh_tw_symbian.ts | 4 ++-- config.tests/mac/coreservices/coreservices.mm | 2 +- config.tests/unix/opengldesktop/opengldesktop.cpp | 2 +- doc/src/examples/multicastreceiver.qdoc | 2 +- doc/src/examples/multicastsender.qdoc | 2 +- doc/src/examples/wheel.qdoc | 2 +- doc/src/snippets/declarative/application.qml | 2 +- doc/src/snippets/declarative/focus/focusColumn.qml | 2 +- doc/src/snippets/declarative/states/statechangescript.qml | 2 +- doc/src/snippets/declarative/webview/webview.qml | 2 +- examples/declarative/positioners/layoutdirection/layoutdirection.qml | 2 +- examples/declarative/touchinteraction/pincharea/flickresize.qml | 2 +- examples/network/multicastreceiver/main.cpp | 2 +- examples/network/multicastreceiver/receiver.cpp | 2 +- examples/network/multicastreceiver/receiver.h | 2 +- examples/network/multicastsender/main.cpp | 2 +- examples/network/multicastsender/sender.cpp | 2 +- examples/network/multicastsender/sender.h | 2 +- examples/scroller/graphicsview/main.cpp | 2 +- examples/scroller/plot/main.cpp | 2 +- examples/scroller/plot/plotwidget.cpp | 2 +- examples/scroller/plot/plotwidget.h | 2 +- examples/scroller/plot/settingswidget.cpp | 2 +- examples/scroller/plot/settingswidget.h | 2 +- examples/scroller/wheel/main.cpp | 2 +- examples/scroller/wheel/wheelwidget.cpp | 2 +- examples/scroller/wheel/wheelwidget.h | 2 +- mkspecs/common/mac/qplatformdefs.h | 2 +- mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 2 +- mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 2 +- mkspecs/symbian-armcc/qplatformdefs.h | 2 +- mkspecs/symbian-gcce/qplatformdefs.h | 2 +- mkspecs/unsupported/linux-armcc/qplatformdefs.h | 2 +- mkspecs/unsupported/linux-clang/qplatformdefs.h | 2 +- mkspecs/unsupported/macx-clang/qplatformdefs.h | 2 +- src/corelib/arch/qatomic_armv5.h | 2 +- src/corelib/arch/qatomic_armv7.h | 2 +- src/corelib/global/qconfig-minimal-system-dependencies.h | 2 +- src/corelib/global/qnaclunimplemented.cpp | 2 +- src/corelib/global/qnaclunimplemented.h | 2 +- src/corelib/io/qdir_p.h | 2 +- src/corelib/io/qfilesystemengine.cpp | 2 +- src/corelib/io/qfilesystemengine_mac.cpp | 2 +- src/corelib/io/qfilesystemengine_p.h | 2 +- src/corelib/io/qfilesystemengine_symbian.cpp | 2 +- src/corelib/io/qfilesystemengine_unix.cpp | 2 +- src/corelib/io/qfilesystemengine_win.cpp | 2 +- src/corelib/io/qfilesystementry.cpp | 2 +- src/corelib/io/qfilesystementry_p.h | 2 +- src/corelib/io/qfilesystemiterator_p.h | 2 +- src/corelib/io/qfilesystemiterator_symbian.cpp | 2 +- src/corelib/io/qfilesystemiterator_unix.cpp | 2 +- src/corelib/io/qfilesystemiterator_win.cpp | 2 +- src/corelib/io/qfilesystemmetadata_p.h | 2 +- src/corelib/kernel/qsystemerror.cpp | 2 +- src/corelib/kernel/qsystemerror_p.h | 2 +- src/corelib/plugin/qelfparser_p.cpp | 2 +- src/corelib/plugin/qelfparser_p.h | 2 +- src/declarative/debugger/qdeclarativedebugserver.cpp | 2 +- src/declarative/debugger/qdeclarativedebugserver_p.h | 2 +- src/declarative/debugger/qdeclarativedebugserverconnection_p.h | 2 +- src/declarative/debugger/qdeclarativedebugservice_p_p.h | 2 +- src/declarative/graphicsitems/qdeclarativepincharea.cpp | 2 +- src/declarative/graphicsitems/qdeclarativepincharea_p.h | 2 +- src/declarative/graphicsitems/qdeclarativepincharea_p_p.h | 2 +- src/declarative/qml/qperformancetimer.cpp | 2 +- src/declarative/qml/qperformancetimer_p.h | 2 +- src/declarative/util/qdeclarativeapplication.cpp | 2 +- src/declarative/util/qdeclarativeapplication_p.h | 2 +- src/gui/image/qpixmap_blitter.cpp | 2 +- src/gui/image/qpixmap_blitter_p.h | 2 +- src/gui/kernel/qcocoaintrospection_mac.mm | 2 +- src/gui/kernel/qcocoaintrospection_p.h | 2 +- src/gui/kernel/qdesktopwidget_qpa_p.h | 2 +- src/gui/kernel/qeventdispatcher_glib_qpa.cpp | 2 +- src/gui/kernel/qeventdispatcher_glib_qpa_p.h | 2 +- src/gui/kernel/qeventdispatcher_qpa.cpp | 2 +- src/gui/kernel/qeventdispatcher_qpa_p.h | 2 +- src/gui/kernel/qplatformclipboard_qpa.cpp | 2 +- src/gui/kernel/qplatformclipboard_qpa.h | 2 +- src/gui/kernel/qplatformcursor_qpa.cpp | 2 +- src/gui/kernel/qplatformeventloopintegration_qpa.cpp | 2 +- src/gui/kernel/qplatformeventloopintegration_qpa.h | 2 +- src/gui/kernel/qplatformglcontext_qpa.cpp | 2 +- src/gui/kernel/qplatformglcontext_qpa.h | 2 +- src/gui/kernel/qplatformintegration_qpa.cpp | 2 +- src/gui/kernel/qplatformintegration_qpa.h | 2 +- src/gui/kernel/qplatformintegrationfactory_qpa.cpp | 2 +- src/gui/kernel/qplatformintegrationfactory_qpa_p.h | 2 +- src/gui/kernel/qplatformintegrationplugin_qpa.cpp | 2 +- src/gui/kernel/qplatformintegrationplugin_qpa.h | 2 +- src/gui/kernel/qplatformscreen_qpa.cpp | 2 +- src/gui/kernel/qplatformscreen_qpa.h | 2 +- src/gui/kernel/qplatformwindow_qpa.cpp | 2 +- src/gui/kernel/qplatformwindow_qpa.h | 2 +- src/gui/kernel/qplatformwindowformat_qpa.cpp | 2 +- src/gui/kernel/qplatformwindowformat_qpa.h | 2 +- src/gui/kernel/qwindowsysteminterface_qpa.cpp | 2 +- src/gui/kernel/qwindowsysteminterface_qpa.h | 2 +- src/gui/painting/qblittable.cpp | 2 +- src/gui/painting/qblittable_p.h | 2 +- src/gui/painting/qpaintengine_blitter.cpp | 2 +- src/gui/painting/qpaintengine_blitter_p.h | 2 +- src/gui/painting/qprintengine_pdf.cpp | 2 +- src/gui/painting/qprinterinfo_p.h | 2 +- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 2 +- src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 2 +- src/gui/text/qfont_qpa.cpp | 2 +- src/gui/text/qfontdatabase_qpa.cpp | 2 +- src/gui/text/qfontengine_coretext.mm | 2 +- src/gui/text/qfontengine_coretext_p.h | 2 +- src/gui/text/qfontengine_mac_p.h | 2 +- src/gui/text/qfontengine_qpa.cpp | 2 +- src/gui/text/qfontengine_qpa_p.h | 2 +- src/gui/text/qglyphs.cpp | 2 +- src/gui/text/qglyphs.h | 2 +- src/gui/text/qglyphs_p.h | 2 +- src/gui/text/qplatformfontdatabase_qpa.cpp | 2 +- src/gui/text/qplatformfontdatabase_qpa.h | 2 +- src/gui/util/qflickgesture.cpp | 2 +- src/gui/util/qflickgesture_p.h | 2 +- src/gui/util/qscroller.cpp | 2 +- src/gui/util/qscroller.h | 2 +- src/gui/util/qscroller_mac.mm | 2 +- src/gui/util/qscroller_p.h | 2 +- src/gui/util/qscrollerproperties.cpp | 2 +- src/gui/util/qscrollerproperties.h | 2 +- src/gui/util/qscrollerproperties_p.h | 2 +- src/network/access/qhttpthreaddelegate.cpp | 2 +- src/network/access/qhttpthreaddelegate_p.h | 2 +- src/network/access/qnetworkreplydataimpl.cpp | 2 +- src/network/access/qnetworkreplydataimpl_p.h | 2 +- src/network/access/qnetworkreplyfileimpl_p.h | 2 +- src/network/bearer/qsharednetworksession_p.h | 2 +- src/opengl/gl2paintengineex/qglshadercache_meego_p.h | 2 +- src/opengl/gl2paintengineex/qglshadercache_p.h | 2 +- src/opengl/qgl_qpa.cpp | 2 +- src/opengl/qglfunctions.cpp | 2 +- src/opengl/qglfunctions.h | 2 +- src/opengl/qglpixelbuffer_stub.cpp | 2 +- src/opengl/util/meego/main.cpp | 2 +- src/plugins/generic/tslib/main.cpp | 2 +- src/plugins/generic/tslib/qtslib.cpp | 2 +- src/plugins/generic/tslib/qtslib.h | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp | 2 +- src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h | 2 +- src/plugins/platforms/directfb/qdirectfbblitter.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbblitter.h | 2 +- src/plugins/platforms/directfb/qdirectfbconvenience.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbconvenience.h | 2 +- src/plugins/platforms/directfb/qdirectfbcursor.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbcursor.h | 2 +- src/plugins/platforms/directfb/qdirectfbglcontext.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbglcontext.h | 2 +- src/plugins/platforms/directfb/qdirectfbinput.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbinput.h | 2 +- src/plugins/platforms/directfb/qdirectfbintegration.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbintegration.h | 2 +- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbwindow.h | 2 +- src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbwindowsurface.h | 2 +- src/plugins/platforms/eglconvenience/qeglconvenience.cpp | 2 +- src/plugins/platforms/eglconvenience/qeglconvenience.h | 2 +- src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp | 2 +- src/plugins/platforms/eglconvenience/qeglplatformcontext.h | 2 +- src/plugins/platforms/eglfs/main.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.h | 2 +- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsscreen.h | 2 +- src/plugins/platforms/eglfs/qeglfswindow.cpp | 2 +- src/plugins/platforms/eglfs/qeglfswindow.h | 2 +- src/plugins/platforms/eglfs/qeglfswindowsurface.cpp | 2 +- src/plugins/platforms/eglfs/qeglfswindowsurface.h | 2 +- src/plugins/platforms/fb_base/fb_base.cpp | 2 +- src/plugins/platforms/fb_base/fb_base.h | 2 +- .../platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp | 2 +- .../platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h | 2 +- .../platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp | 2 +- src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h | 2 +- .../platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h | 2 +- src/plugins/platforms/minimal/main.cpp | 2 +- src/plugins/platforms/minimal/qminimalintegration.cpp | 2 +- src/plugins/platforms/minimal/qminimalintegration.h | 2 +- src/plugins/platforms/minimal/qminimalwindowsurface.cpp | 2 +- src/plugins/platforms/minimal/qminimalwindowsurface.h | 2 +- src/plugins/platforms/openkode/main.cpp | 2 +- src/plugins/platforms/openkode/openkodekeytranslator.h | 2 +- src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp | 2 +- src/plugins/platforms/openkode/qopenkodeeventloopintegration.h | 2 +- src/plugins/platforms/openkode/qopenkodeintegration.cpp | 2 +- src/plugins/platforms/openkode/qopenkodeintegration.h | 2 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 2 +- src/plugins/platforms/openkode/qopenkodewindow.h | 2 +- src/plugins/platforms/openkode/shaders/frag.glslf | 2 +- src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp | 2 +- src/plugins/qmltooling/tcpserver/qtcpserverconnection.h | 2 +- tests/arthur/baselineserver/src/baselineserver.cpp | 2 +- tests/arthur/baselineserver/src/baselineserver.h | 2 +- tests/arthur/baselineserver/src/main.cpp | 2 +- tests/arthur/baselineserver/src/report.cpp | 2 +- tests/arthur/baselineserver/src/report.h | 2 +- tests/arthur/common/baselineprotocol.cpp | 2 +- tests/arthur/common/baselineprotocol.h | 2 +- tests/arthur/common/lookup3.cpp | 2 +- tests/arthur/common/qbaselinetest.cpp | 2 +- tests/arthur/common/qbaselinetest.h | 2 +- tests/auto/baselineexample/tst_baselineexample.cpp | 2 +- .../qdeclarativeapplication/tst_qdeclarativeapplication.cpp | 2 +- tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp | 2 +- tests/auto/lancelot/tst_lancelot.cpp | 2 +- tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp | 2 +- tests/auto/qfilesystementry/tst_qfilesystementry.cpp | 2 +- tests/auto/qglfunctions/tst_qglfunctions.cpp | 2 +- tests/auto/qglyphs/tst_qglyphs.cpp | 2 +- tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp | 2 +- tests/auto/qscriptextensionplugin/simpleplugin/simpleplugin.cpp | 2 +- tests/auto/qscriptextensionplugin/staticplugin/staticplugin.cpp | 2 +- tests/auto/qscriptextensionplugin/tst_qscriptextensionplugin.cpp | 2 +- tests/auto/qscriptvaluegenerated/testgen/testgenerator.h | 2 +- tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp | 2 +- tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h | 2 +- tests/auto/qscroller/tst_qscroller.cpp | 2 +- tests/auto/qstringref/tst_qstringref.cpp | 2 +- tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp | 2 +- .../declarative/qperformancetimer/tst_qperformancetimer.cpp | 2 +- tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp | 2 +- tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp | 2 +- tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp | 2 +- tests/benchmarks/script/sunspider/tst_sunspider.cpp | 2 +- tests/benchmarks/script/v8/tst_v8.cpp | 2 +- tests/manual/mkspecs/test.sh | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 2 +- tools/assistant/tools/assistant/globalactions.cpp | 2 +- tools/assistant/tools/assistant/globalactions.h | 2 +- tools/assistant/tools/assistant/openpagesmanager.cpp | 2 +- tools/assistant/tools/assistant/openpagesmanager.h | 2 +- tools/assistant/tools/assistant/openpagesmodel.cpp | 2 +- tools/assistant/tools/assistant/openpagesmodel.h | 2 +- tools/assistant/tools/assistant/openpagesswitcher.cpp | 2 +- tools/assistant/tools/assistant/openpagesswitcher.h | 2 +- tools/assistant/tools/assistant/openpageswidget.cpp | 2 +- tools/doxygen/config/footer.html | 2 +- tools/qdoc3/doc/qdoc-manual.qdocconf | 2 +- tools/qdoc3/jscodemarker.cpp | 2 +- tools/qdoc3/qmlcodemarker.cpp | 2 +- tools/qdoc3/qmlcodeparser.cpp | 2 +- tools/qdoc3/qmlmarkupvisitor.cpp | 2 +- tools/qdoc3/qmlmarkupvisitor.h | 2 +- tools/qdoc3/qmlvisitor.cpp | 2 +- tools/qdoc3/test/carbide-eclipse-integration.qdocconf | 2 +- tools/qdoc3/test/jambi.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf | 2 +- tools/qdoc3/test/standalone-eclipse-integration.qdocconf | 2 +- translations/assistant_cs.ts | 2 +- translations/assistant_sl.ts | 2 +- translations/designer_cs.ts | 2 +- translations/linguist_cs.ts | 4 ++-- translations/linguist_sl.ts | 2 +- translations/qt_cs.ts | 4 ++-- translations/qt_gl.ts | 4 ++-- translations/qtconfig_sl.ts | 2 +- util/qlalr/doc/qlalr.qdocconf | 2 +- 276 files changed, 283 insertions(+), 283 deletions(-) diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl index a90877e..02f4f0d 100755 --- a/bin/elf2e32_qtwrapper.pl +++ b/bin/elf2e32_qtwrapper.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/config.profiles/symbian/translations/qt_fr_symbian.ts b/config.profiles/symbian/translations/qt_fr_symbian.ts index c0b0699..e10f963 100644 --- a/config.profiles/symbian/translations/qt_fr_symbian.ts +++ b/config.profiles/symbian/translations/qt_fr_symbian.ts @@ -2660,8 +2660,8 @@ Voulez-vous quand même le supprimer ? <h3>Présentation de Qt</h3><p>Ce programme utilise Qt version %1.</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt est une boîte à outils C++ pour le développement d’applications multiplateformes.</p><p>Qt fournit une portabilité source unique pour MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux et les principales variantes commerciales d’Unix. Qt est également disponible pour appareils intégrés tels que Qt pour Embedded Linux et Qt pour Windows CE.</p><p>Il existe trois options de licence différentes conçues pour s’adapter aux besoins d’utilisateurs variés.</p><p>Qt concédée sous notre contrat de licence commerciale est destinée au développement de logiciels propriétaires/commerciaux dont vous ne souhaitez pas partager le code source avec des tiers ou qui ne peuvent se conformer aux termes de la LGPL GNU version 2.1 ou GPL GNU version 3.0.</p><p>Qt concédée sous la LGPL GNU version 2.1 est destinée au développement d’applications Qt (propriétaires ou source libre) à condition que vous vous conformiez aux conditions générales de la LGPL GNU version 2.1.</p><p>Qt concédée sous la licence publique générale GNU version 3.0 est destinée au développement d’applications Qt lorsque vous souhaitez utiliser ces applications avec d’autres logiciels soumis aux termes de la GPL GNU version 3.0 ou lorsque vous acceptez les termes de la GPL GNU version 3.0.</p><p>Veuillez consulter<a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> pour un aperçu des concessions de licences Qt.</p><p>Copyright (C) 2010 Nokia Corporation et/ou ses filiales.</p><p>Qt est un produit Nokia. Voir <a href="http://qt.nokia.com/">qt.nokia.com</a> pour de plus amples informations.</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt est une boîte à outils C++ pour le développement d’applications multiplateformes.</p><p>Qt fournit une portabilité source unique pour MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux et les principales variantes commerciales d’Unix. Qt est également disponible pour appareils intégrés tels que Qt pour Embedded Linux et Qt pour Windows CE.</p><p>Il existe trois options de licence différentes conçues pour s’adapter aux besoins d’utilisateurs variés.</p><p>Qt concédée sous notre contrat de licence commerciale est destinée au développement de logiciels propriétaires/commerciaux dont vous ne souhaitez pas partager le code source avec des tiers ou qui ne peuvent se conformer aux termes de la LGPL GNU version 2.1 ou GPL GNU version 3.0.</p><p>Qt concédée sous la LGPL GNU version 2.1 est destinée au développement d’applications Qt (propriétaires ou source libre) à condition que vous vous conformiez aux conditions générales de la LGPL GNU version 2.1.</p><p>Qt concédée sous la licence publique générale GNU version 3.0 est destinée au développement d’applications Qt lorsque vous souhaitez utiliser ces applications avec d’autres logiciels soumis aux termes de la GPL GNU version 3.0 ou lorsque vous acceptez les termes de la GPL GNU version 3.0.</p><p>Veuillez consulter<a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> pour un aperçu des concessions de licences Qt.</p><p>Copyright (C) 2011 Nokia Corporation et/ou ses filiales.</p><p>Qt est un produit Nokia. Voir <a href="http://qt.nokia.com/">qt.nokia.com</a> pour de plus amples informations.</p> About Qt diff --git a/config.profiles/symbian/translations/qt_pl_symbian.ts b/config.profiles/symbian/translations/qt_pl_symbian.ts index 4208c55..e3902ae 100644 --- a/config.profiles/symbian/translations/qt_pl_symbian.ts +++ b/config.profiles/symbian/translations/qt_pl_symbian.ts @@ -2664,8 +2664,8 @@ Czy na pewno chcesz go skasować? <h3>Informacje o Qt</h3><p> Ten program używa Qt w wersji %1.</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt jest zestawem narzędzi programistycznych dedykowanym dla języka C++. Służy on do opracowywania aplikacji międzyplatformowych.</p><p>Qt umożliwia jednoźródłowe przenoszenie między systemami MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux i wszystkimi głównymi wersjami komercyjnymi systemu Unix. Środowisko Qt jest dostępne dla urządzeń wbudowanych opartych na systemie Linux ( Qt dla wbudowanego systemu Linux) oraz Windows CE.</p><p>Zestaw Qt jest dostępny w trzech różnych opcjach licencjonowania stworzonych w celu zadowolenia naszych różnych użytkowników.</p><p>Qt podlegający licencji zgodnie z naszą komercyjną umową licencyjną jest odpowiedni do opracowywania oprogramowań własnościowych/komercyjnych, dzięki czemu kod źródłowy nie jest udostępniany osobom trzecim. W przeciwnym razie zestaw Qt jest niezgodny z warunkami licencji GNU LGPL w wersji 2.1 lub GNU GPL w wersji 3.0.</p><p>Środowisko Qt objęte licencją GNU LGPL w wersji 2.1 nadaje się do tworzenia aplikacji Qt (własnościowych lub oprogramowań otwartych) tylko wtedy, gdy przestrzegane są warunki licencji GNU LGPL w wersji 2.1.</p><p>Qt objęty Powszechną Licencją Publiczną GNU w wersji 3.0 jest odpowiedni do opracowywania aplikacji QT, aby móc korzystać z aplikacji w połączeniu z oprogramowaniem podlegającym warunkom licencji GNU GPL w wersji 3.0 lub aby przestrzegać warunków licencji GNU GPL w wersji 3.0.</p><p>Więcej informacji na temat licencji Qt można znaleźć na stronie <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Copyright (C) 2010 Nokia Corporation i/lub oddziały firmy.</p><p>Qt jest produktem firmy Nokia. Dodatkowe informacje znajdują się na stronie <a href="http://qt.nokia.com/">qt.nokia.com</a> </p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt jest zestawem narzędzi programistycznych dedykowanym dla języka C++. Służy on do opracowywania aplikacji międzyplatformowych.</p><p>Qt umożliwia jednoźródłowe przenoszenie między systemami MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux i wszystkimi głównymi wersjami komercyjnymi systemu Unix. Środowisko Qt jest dostępne dla urządzeń wbudowanych opartych na systemie Linux ( Qt dla wbudowanego systemu Linux) oraz Windows CE.</p><p>Zestaw Qt jest dostępny w trzech różnych opcjach licencjonowania stworzonych w celu zadowolenia naszych różnych użytkowników.</p><p>Qt podlegający licencji zgodnie z naszą komercyjną umową licencyjną jest odpowiedni do opracowywania oprogramowań własnościowych/komercyjnych, dzięki czemu kod źródłowy nie jest udostępniany osobom trzecim. W przeciwnym razie zestaw Qt jest niezgodny z warunkami licencji GNU LGPL w wersji 2.1 lub GNU GPL w wersji 3.0.</p><p>Środowisko Qt objęte licencją GNU LGPL w wersji 2.1 nadaje się do tworzenia aplikacji Qt (własnościowych lub oprogramowań otwartych) tylko wtedy, gdy przestrzegane są warunki licencji GNU LGPL w wersji 2.1.</p><p>Qt objęty Powszechną Licencją Publiczną GNU w wersji 3.0 jest odpowiedni do opracowywania aplikacji QT, aby móc korzystać z aplikacji w połączeniu z oprogramowaniem podlegającym warunkom licencji GNU GPL w wersji 3.0 lub aby przestrzegać warunków licencji GNU GPL w wersji 3.0.</p><p>Więcej informacji na temat licencji Qt można znaleźć na stronie <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>.</p><p>Copyright (C) 2011 Nokia Corporation i/lub oddziały firmy.</p><p>Qt jest produktem firmy Nokia. Dodatkowe informacje znajdują się na stronie <a href="http://qt.nokia.com/">qt.nokia.com</a> </p> About Qt diff --git a/config.profiles/symbian/translations/qt_ru_symbian.ts b/config.profiles/symbian/translations/qt_ru_symbian.ts index b7e69cb..08b201e 100644 --- a/config.profiles/symbian/translations/qt_ru_symbian.ts +++ b/config.profiles/symbian/translations/qt_ru_symbian.ts @@ -2661,8 +2661,8 @@ Do you want to delete it anyway? <h3>О Qt</h3><p>Данная программа использует Qt версии %1.</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt - это инструментарий для разработки кроссплатформенных приложений на C++.</p><p>Qt предоставляет совместимость на уровне исходных текстов между MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux и всеми популярными коммерческими вариантами Unix. Также Qt доступна для встраиваемых устройств в виде Qt для Embedded Linux и Qt для Windows CE.</p><p>Qt доступна под тремя различными лицензиями, разработанными для удовлетворения различных требований.</p><p>Qt под нашей коммерческой лицензией предназначена для развития проприетарного/коммерческого программного обеспечения, когда Вы не желаете предоставлять исходные тексты третьим сторонам, или в случае невозможности принятия условий лицензий GNU LGPL версии 2.1 или GNU GPL версии 3.0.</p><p>Qt под лицензией GNU LGPL версии 2.1 предназначена для разработки программного обеспечения с открытыми исходными текстами или коммерческого программного обеспечения при соблюдении условий лицензии GNU LGPL версии 2.1.</p><p>Qt под лицензией GNU General Public License версии 3.0 предназначена для разработки программных приложений в тех случаях, когда Вы хотели бы использовать такие приложения в сочетании с программным обеспечением на условиях лицензии GNU GPL с версии 3.0 или если Вы готовы соблюдать условия лицензии GNU GPL версии 3.0.</p><p>Обратитесь к <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> для обзора лицензий Qt.</p><p>Copyright (C) 2010 Корпорация Nokia и/или её дочерние подразделения.</p><p>Qt - продукт компании Nokia. Обратитесь к <a href="http://qt.nokia.com/">qt.nokia.com</a> для получения дополнительной информации.</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt - это инструментарий для разработки кроссплатформенных приложений на C++.</p><p>Qt предоставляет совместимость на уровне исходных текстов между MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux и всеми популярными коммерческими вариантами Unix. Также Qt доступна для встраиваемых устройств в виде Qt для Embedded Linux и Qt для Windows CE.</p><p>Qt доступна под тремя различными лицензиями, разработанными для удовлетворения различных требований.</p><p>Qt под нашей коммерческой лицензией предназначена для развития проприетарного/коммерческого программного обеспечения, когда Вы не желаете предоставлять исходные тексты третьим сторонам, или в случае невозможности принятия условий лицензий GNU LGPL версии 2.1 или GNU GPL версии 3.0.</p><p>Qt под лицензией GNU LGPL версии 2.1 предназначена для разработки программного обеспечения с открытыми исходными текстами или коммерческого программного обеспечения при соблюдении условий лицензии GNU LGPL версии 2.1.</p><p>Qt под лицензией GNU General Public License версии 3.0 предназначена для разработки программных приложений в тех случаях, когда Вы хотели бы использовать такие приложения в сочетании с программным обеспечением на условиях лицензии GNU GPL с версии 3.0 или если Вы готовы соблюдать условия лицензии GNU GPL версии 3.0.</p><p>Обратитесь к <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> для обзора лицензий Qt.</p><p>Copyright (C) 2011 Корпорация Nokia и/или её дочерние подразделения.</p><p>Qt - продукт компании Nokia. Обратитесь к <a href="http://qt.nokia.com/">qt.nokia.com</a> для получения дополнительной информации.</p> About Qt diff --git a/config.profiles/symbian/translations/qt_zh_cn_symbian.ts b/config.profiles/symbian/translations/qt_zh_cn_symbian.ts index b1b9941..91ac2af 100644 --- a/config.profiles/symbian/translations/qt_zh_cn_symbian.ts +++ b/config.profiles/symbian/translations/qt_zh_cn_symbian.ts @@ -2662,7 +2662,7 @@ Do you want to delete it anyway? <h3>关于Qt</h3><p>此程序使用Qt版本%1。</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> <p>Qt是一个C++工具箱,用于跨平台应用程序开发。</p><p>Qt具有单一源跨可移植性,可跨越MS&nbsp;Windows、Mac&nbsp;OS&nbsp;X、Linux和所有主要的商业Unix类平台进行移植。Qt还适用于嵌入式设备,如Qt for Embedded Linux和Qt for Windows CE。</p><p>Qt有三种不同许可方式,以满足各种用户需求。</p><p>假如您要开发专利/商业软件,但不希望与第三方共享任何源代码,或者无法符合GNU LGPL版本2.1或GNU GPL版本3.0的条款,则按照我们的商业许可证协议授权的Qt非常适用。</p><p>假如您能够符合GNU LGPL版本2.1的条款和条件,则按照GNU LGPL版本2.1授权的Qt非常适合开发Qt应用程序(专有或开放源码)。</p><p>假如在开发Qt应用程序过程中,您希望这类应用程序能与遵循GNU GPL版本3.0的软件合用,或者您愿意符合GNU GPL版本3.0条款,则按照GNU通用公共许可证版本3.0授权的Qt非常适用。</p><p>请参阅<a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>了解Qt授权概况。</p><p>版权所有 (C) 2010 诺基亚公司和/或附属公司。</p><p>Qt是一款诺基亚产品。请参阅<a href="http://qt.nokia.com/">qt.nokia.com</a>了解详情。</p> diff --git a/config.profiles/symbian/translations/qt_zh_tw_symbian.ts b/config.profiles/symbian/translations/qt_zh_tw_symbian.ts index 3b1fb51..c9eb563 100644 --- a/config.profiles/symbian/translations/qt_zh_tw_symbian.ts +++ b/config.profiles/symbian/translations/qt_zh_tw_symbian.ts @@ -2649,8 +2649,8 @@ Do you want to delete it anyway? <h3>關於Qt</h3><p>本程式使用Qt %1版。</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt是一套應用於跨平台應用程式開發的C++工具集。</p><p>Qt提供橫跨MS&nbsp;Windows、Mac&nbsp;OS&nbsp;X、Linux及各主要商業Unix系統的單一來源移植能力。Qt也提供適用於嵌入式裝置的版本,例如Qt for Embedded Linux和Qt for Windows CE。</p><p>針對不同使用者的需求,Qt有三種不同授權方式。</p><p>商業授權合約下的Qt授權適用於專利/商業軟體的開發,在這種情況中,您可能不想與第三方分享任何原始碼或無法遵從GNU LGPL 2.1版或GNU GPL 3.0版的條款。</p><p>GNU LGPL 2.1版下的Qt授權適用於開發Qt應用程式(專利或開放原始碼),您必須遵從GNU LGPL 2.1版的條款與條件。</p><p>GNU GPL 3.0版下的Qt授權適用於開發Qt應用程式,在這種情況中,您希望將此應用程式搭配基於GNU GPL 3.0版開發的軟體一起使用,或您樂意遵從GNU GPL 3.0版的條款。</p><p>請參閱<a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>,此頁面對於Qt授權會有概略的介紹。</p><p>Copyright (C) 2010 諾基亞公司及/或其子公司。</p><p>Qt是一項諾基亞產品。如需詳細資訊,請參閱<a href="http://qt.nokia.com/">qt.nokia.com</a>。</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt是一套應用於跨平台應用程式開發的C++工具集。</p><p>Qt提供橫跨MS&nbsp;Windows、Mac&nbsp;OS&nbsp;X、Linux及各主要商業Unix系統的單一來源移植能力。Qt也提供適用於嵌入式裝置的版本,例如Qt for Embedded Linux和Qt for Windows CE。</p><p>針對不同使用者的需求,Qt有三種不同授權方式。</p><p>商業授權合約下的Qt授權適用於專利/商業軟體的開發,在這種情況中,您可能不想與第三方分享任何原始碼或無法遵從GNU LGPL 2.1版或GNU GPL 3.0版的條款。</p><p>GNU LGPL 2.1版下的Qt授權適用於開發Qt應用程式(專利或開放原始碼),您必須遵從GNU LGPL 2.1版的條款與條件。</p><p>GNU GPL 3.0版下的Qt授權適用於開發Qt應用程式,在這種情況中,您希望將此應用程式搭配基於GNU GPL 3.0版開發的軟體一起使用,或您樂意遵從GNU GPL 3.0版的條款。</p><p>請參閱<a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a>,此頁面對於Qt授權會有概略的介紹。</p><p>Copyright (C) 2011 諾基亞公司及/或其子公司。</p><p>Qt是一項諾基亞產品。如需詳細資訊,請參閱<a href="http://qt.nokia.com/">qt.nokia.com</a>。</p> About Qt diff --git a/config.tests/mac/coreservices/coreservices.mm b/config.tests/mac/coreservices/coreservices.mm index 0091e49..c70802c 100644 --- a/config.tests/mac/coreservices/coreservices.mm +++ b/config.tests/mac/coreservices/coreservices.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/config.tests/unix/opengldesktop/opengldesktop.cpp b/config.tests/unix/opengldesktop/opengldesktop.cpp index 969767c..a3d8548 100644 --- a/config.tests/unix/opengldesktop/opengldesktop.cpp +++ b/config.tests/unix/opengldesktop/opengldesktop.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/examples/multicastreceiver.qdoc b/doc/src/examples/multicastreceiver.qdoc index 9c4dda4..776c5fa 100644 --- a/doc/src/examples/multicastreceiver.qdoc +++ b/doc/src/examples/multicastreceiver.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/examples/multicastsender.qdoc b/doc/src/examples/multicastsender.qdoc index be5fb6a..bfb91a6 100644 --- a/doc/src/examples/multicastsender.qdoc +++ b/doc/src/examples/multicastsender.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/examples/wheel.qdoc b/doc/src/examples/wheel.qdoc index 992aba6..995ff87 100644 --- a/doc/src/examples/wheel.qdoc +++ b/doc/src/examples/wheel.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/declarative/application.qml b/doc/src/snippets/declarative/application.qml index 06f83f2..fa8cf0b 100644 --- a/doc/src/snippets/declarative/application.qml +++ b/doc/src/snippets/declarative/application.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/declarative/focus/focusColumn.qml b/doc/src/snippets/declarative/focus/focusColumn.qml index 42ee3da..e6a6fcf 100644 --- a/doc/src/snippets/declarative/focus/focusColumn.qml +++ b/doc/src/snippets/declarative/focus/focusColumn.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/declarative/states/statechangescript.qml b/doc/src/snippets/declarative/states/statechangescript.qml index b885137..37cc31f 100644 --- a/doc/src/snippets/declarative/states/statechangescript.qml +++ b/doc/src/snippets/declarative/states/statechangescript.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/snippets/declarative/webview/webview.qml b/doc/src/snippets/declarative/webview/webview.qml index c1cef33..dac8010 100644 --- a/doc/src/snippets/declarative/webview/webview.qml +++ b/doc/src/snippets/declarative/webview/webview.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/declarative/positioners/layoutdirection/layoutdirection.qml b/examples/declarative/positioners/layoutdirection/layoutdirection.qml index 3e23b15..89a860e 100644 --- a/examples/declarative/positioners/layoutdirection/layoutdirection.qml +++ b/examples/declarative/positioners/layoutdirection/layoutdirection.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml index 9439ace..cf5278d 100644 --- a/examples/declarative/touchinteraction/pincharea/flickresize.qml +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastreceiver/main.cpp b/examples/network/multicastreceiver/main.cpp index 8483271..0411631 100644 --- a/examples/network/multicastreceiver/main.cpp +++ b/examples/network/multicastreceiver/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastreceiver/receiver.cpp b/examples/network/multicastreceiver/receiver.cpp index 073fdce..77446b9 100644 --- a/examples/network/multicastreceiver/receiver.cpp +++ b/examples/network/multicastreceiver/receiver.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastreceiver/receiver.h b/examples/network/multicastreceiver/receiver.h index e226028..fd1a673 100644 --- a/examples/network/multicastreceiver/receiver.h +++ b/examples/network/multicastreceiver/receiver.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastsender/main.cpp b/examples/network/multicastsender/main.cpp index 9309322..56e35c9 100644 --- a/examples/network/multicastsender/main.cpp +++ b/examples/network/multicastsender/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastsender/sender.cpp b/examples/network/multicastsender/sender.cpp index 7fa9750..aab94aa 100644 --- a/examples/network/multicastsender/sender.cpp +++ b/examples/network/multicastsender/sender.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/network/multicastsender/sender.h b/examples/network/multicastsender/sender.h index f119883..75ce4c9 100644 --- a/examples/network/multicastsender/sender.h +++ b/examples/network/multicastsender/sender.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/graphicsview/main.cpp b/examples/scroller/graphicsview/main.cpp index 77d00f0..6378f91 100644 --- a/examples/scroller/graphicsview/main.cpp +++ b/examples/scroller/graphicsview/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/plot/main.cpp b/examples/scroller/plot/main.cpp index 1e7db64..a98abfc 100644 --- a/examples/scroller/plot/main.cpp +++ b/examples/scroller/plot/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/plot/plotwidget.cpp b/examples/scroller/plot/plotwidget.cpp index a03f613..c47f107 100644 --- a/examples/scroller/plot/plotwidget.cpp +++ b/examples/scroller/plot/plotwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/plot/plotwidget.h b/examples/scroller/plot/plotwidget.h index c96ceac..dc886d8 100644 --- a/examples/scroller/plot/plotwidget.h +++ b/examples/scroller/plot/plotwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/plot/settingswidget.cpp b/examples/scroller/plot/settingswidget.cpp index 1929eb6..792d8d0 100644 --- a/examples/scroller/plot/settingswidget.cpp +++ b/examples/scroller/plot/settingswidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/plot/settingswidget.h b/examples/scroller/plot/settingswidget.h index 13edbf4..e0ffb4a 100644 --- a/examples/scroller/plot/settingswidget.h +++ b/examples/scroller/plot/settingswidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/wheel/main.cpp b/examples/scroller/wheel/main.cpp index 203c930..22bae5c 100644 --- a/examples/scroller/wheel/main.cpp +++ b/examples/scroller/wheel/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/wheel/wheelwidget.cpp b/examples/scroller/wheel/wheelwidget.cpp index 0449f53..54daca3 100644 --- a/examples/scroller/wheel/wheelwidget.cpp +++ b/examples/scroller/wheel/wheelwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/examples/scroller/wheel/wheelwidget.h b/examples/scroller/wheel/wheelwidget.h index 8f49169..1e41c02 100644 --- a/examples/scroller/wheel/wheelwidget.h +++ b/examples/scroller/wheel/wheelwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/common/mac/qplatformdefs.h b/mkspecs/common/mac/qplatformdefs.h index 5d1f99a..114a1a3 100644 --- a/mkspecs/common/mac/qplatformdefs.h +++ b/mkspecs/common/mac/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h index 01b26d9..9ea192f 100644 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h index 01b26d9..9ea192f 100644 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/symbian-armcc/qplatformdefs.h b/mkspecs/symbian-armcc/qplatformdefs.h index 6f084d3..0eb74ca 100644 --- a/mkspecs/symbian-armcc/qplatformdefs.h +++ b/mkspecs/symbian-armcc/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/symbian-gcce/qplatformdefs.h b/mkspecs/symbian-gcce/qplatformdefs.h index 8549347..9d95a37 100644 --- a/mkspecs/symbian-gcce/qplatformdefs.h +++ b/mkspecs/symbian-gcce/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/unsupported/linux-armcc/qplatformdefs.h b/mkspecs/unsupported/linux-armcc/qplatformdefs.h index a1ce6a1..31927a6 100644 --- a/mkspecs/unsupported/linux-armcc/qplatformdefs.h +++ b/mkspecs/unsupported/linux-armcc/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/unsupported/linux-clang/qplatformdefs.h b/mkspecs/unsupported/linux-clang/qplatformdefs.h index 2dd7b80..f4f27f3 100644 --- a/mkspecs/unsupported/linux-clang/qplatformdefs.h +++ b/mkspecs/unsupported/linux-clang/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/mkspecs/unsupported/macx-clang/qplatformdefs.h b/mkspecs/unsupported/macx-clang/qplatformdefs.h index 72f3ac7..eea6495 100644 --- a/mkspecs/unsupported/macx-clang/qplatformdefs.h +++ b/mkspecs/unsupported/macx-clang/qplatformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/arch/qatomic_armv5.h b/src/corelib/arch/qatomic_armv5.h index 820be7b..ac8fe96 100644 --- a/src/corelib/arch/qatomic_armv5.h +++ b/src/corelib/arch/qatomic_armv5.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/arch/qatomic_armv7.h b/src/corelib/arch/qatomic_armv7.h index a95c4ea..b35866b 100644 --- a/src/corelib/arch/qatomic_armv7.h +++ b/src/corelib/arch/qatomic_armv7.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/global/qconfig-minimal-system-dependencies.h b/src/corelib/global/qconfig-minimal-system-dependencies.h index 63319b9..a44391c 100644 --- a/src/corelib/global/qconfig-minimal-system-dependencies.h +++ b/src/corelib/global/qconfig-minimal-system-dependencies.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/global/qnaclunimplemented.cpp b/src/corelib/global/qnaclunimplemented.cpp index 1a89b8df..5116d80 100644 --- a/src/corelib/global/qnaclunimplemented.cpp +++ b/src/corelib/global/qnaclunimplemented.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h index 2d3d426..09c6c49 100644 --- a/src/corelib/global/qnaclunimplemented.h +++ b/src/corelib/global/qnaclunimplemented.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h index 5f97c1f..7f77a84 100644 --- a/src/corelib/io/qdir_p.h +++ b/src/corelib/io/qdir_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index cf19224..00c33bd 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine_mac.cpp b/src/corelib/io/qfilesystemengine_mac.cpp index 30d7fa5..1c0056b 100644 --- a/src/corelib/io/qfilesystemengine_mac.cpp +++ b/src/corelib/io/qfilesystemengine_mac.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine_p.h b/src/corelib/io/qfilesystemengine_p.h index a3ec0ab..d6033e6 100644 --- a/src/corelib/io/qfilesystemengine_p.h +++ b/src/corelib/io/qfilesystemengine_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp index 84c3aa1..41a550a 100644 --- a/src/corelib/io/qfilesystemengine_symbian.cpp +++ b/src/corelib/io/qfilesystemengine_symbian.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 030be1b..1becea5 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 19c94e5..82c6eba 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index d4c6d0a..ccbb10d 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h index 2ce0a83..d4d16d0 100644 --- a/src/corelib/io/qfilesystementry_p.h +++ b/src/corelib/io/qfilesystementry_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h index 66f4b1e..2dc4a9f 100644 --- a/src/corelib/io/qfilesystemiterator_p.h +++ b/src/corelib/io/qfilesystemiterator_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemiterator_symbian.cpp b/src/corelib/io/qfilesystemiterator_symbian.cpp index e316526..23c726a 100644 --- a/src/corelib/io/qfilesystemiterator_symbian.cpp +++ b/src/corelib/io/qfilesystemiterator_symbian.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 00ccd41..3efdd9e 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp index b5fce12..0e94130 100644 --- a/src/corelib/io/qfilesystemiterator_win.cpp +++ b/src/corelib/io/qfilesystemiterator_win.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 7f75b05..f7f1fa1 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 953ed95..3381afa 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h index c2a13a8..e96e85a 100644 --- a/src/corelib/kernel/qsystemerror_p.h +++ b/src/corelib/kernel/qsystemerror_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index c60b3d5..fc5b0d9 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index 8087da5..163d2c1 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index ea3d9a3..1581675 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/debugger/qdeclarativedebugserver_p.h b/src/declarative/debugger/qdeclarativedebugserver_p.h index ec3e60f..68ea4d8 100644 --- a/src/declarative/debugger/qdeclarativedebugserver_p.h +++ b/src/declarative/debugger/qdeclarativedebugserver_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h index 631da74..0c2bdb4 100644 --- a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h +++ b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/debugger/qdeclarativedebugservice_p_p.h b/src/declarative/debugger/qdeclarativedebugservice_p_p.h index d2c8dda..d0423f7 100644 --- a/src/declarative/debugger/qdeclarativedebugservice_p_p.h +++ b/src/declarative/debugger/qdeclarativedebugservice_p_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp index eae83f6..28b862f 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h index 6d04708..5d06db0 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h index 5641e35..1e1bfa4 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp index 1d7ca80..3b1e09b 100644 --- a/src/declarative/qml/qperformancetimer.cpp +++ b/src/declarative/qml/qperformancetimer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/qml/qperformancetimer_p.h b/src/declarative/qml/qperformancetimer_p.h index 14310bf..2787921 100644 --- a/src/declarative/qml/qperformancetimer_p.h +++ b/src/declarative/qml/qperformancetimer_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp index e0f6df2..3e66e14 100644 --- a/src/declarative/util/qdeclarativeapplication.cpp +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/declarative/util/qdeclarativeapplication_p.h b/src/declarative/util/qdeclarativeapplication_p.h index caaed18..f59a5fb 100644 --- a/src/declarative/util/qdeclarativeapplication_p.h +++ b/src/declarative/util/qdeclarativeapplication_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index e8a7b89..26d3b87 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 55b5618..9f4260c 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qcocoaintrospection_mac.mm b/src/gui/kernel/qcocoaintrospection_mac.mm index 9b536b7..70c893a 100644 --- a/src/gui/kernel/qcocoaintrospection_mac.mm +++ b/src/gui/kernel/qcocoaintrospection_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qcocoaintrospection_p.h b/src/gui/kernel/qcocoaintrospection_p.h index b9422e8..1c7d6ac 100644 --- a/src/gui/kernel/qcocoaintrospection_p.h +++ b/src/gui/kernel/qcocoaintrospection_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qdesktopwidget_qpa_p.h b/src/gui/kernel/qdesktopwidget_qpa_p.h index 47ccca2..abee8a1 100644 --- a/src/gui/kernel/qdesktopwidget_qpa_p.h +++ b/src/gui/kernel/qdesktopwidget_qpa_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp index 01d40ca..603aa2d 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h index 1c32ab2..701f673 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h +++ b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 519d2a6..7701612 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/gui/kernel/qeventdispatcher_qpa_p.h index 8065c3e..d4d2be1 100644 --- a/src/gui/kernel/qeventdispatcher_qpa_p.h +++ b/src/gui/kernel/qeventdispatcher_qpa_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index fff4e19..e169f08 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 3f7bfbb..78cd444 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index ac557b9..2ea8332 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.cpp b/src/gui/kernel/qplatformeventloopintegration_qpa.cpp index fdb3852..0ed43eb 100644 --- a/src/gui/kernel/qplatformeventloopintegration_qpa.cpp +++ b/src/gui/kernel/qplatformeventloopintegration_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.h b/src/gui/kernel/qplatformeventloopintegration_qpa.h index 6e0f984..87df7ae 100644 --- a/src/gui/kernel/qplatformeventloopintegration_qpa.h +++ b/src/gui/kernel/qplatformeventloopintegration_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 1673aed..86740e8 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 807ed3d..a680c85 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 0cac57d..7fb7fbd 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 7050245..e40cb48 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index 17a130d..4135c9e 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h index 77e1da1..a6042a8 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h +++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp index 3bf2474..62920b6 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h index 9c37cf7..17bcba0 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.h +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 118835f..c9f3dc6 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h index 1f52764..b3bb121 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index b6b6693..19bf7a9 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index abc35d1..41a4bac 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index 44b0698..ddc6239 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 790385b..fa01a8a 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index b6177b0..c53eedb 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 39c2f79..9dce7ea 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp index f4b84a9..5802531 100644 --- a/src/gui/painting/qblittable.cpp +++ b/src/gui/painting/qblittable.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index cb56cb2..9d0e822 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 2e8d9dd..500748e 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index c8aa536..be8b2bc 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index f262144..b7f5160 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -936,7 +936,7 @@ void QPdfEnginePrivate::writeInfo() xprintf("\n/Creator "); printString(creator); xprintf("\n/Producer "); - printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies)")); + printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2011 Nokia Corporation and/or its subsidiary(-ies)")); QDateTime now = QDateTime::currentDateTime().toUTC(); QTime t = now.time(); QDate d = now.date(); diff --git a/src/gui/painting/qprinterinfo_p.h b/src/gui/painting/qprinterinfo_p.h index 7781d59..fcc1acb 100644 --- a/src/gui/painting/qprinterinfo_p.h +++ b/src/gui/painting/qprinterinfo_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 02ba8db..e7434c7 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index 3bc0404..e1157d7 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp index 7b09b59..ff12da8 100644 --- a/src/gui/text/qfont_qpa.cpp +++ b/src/gui/text/qfont_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index e6d99c6..7bcce56 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 2ae60b1..a24a79e 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h index b4450fa..7d17aef 100644 --- a/src/gui/text/qfontengine_coretext_p.h +++ b/src/gui/text/qfontengine_coretext_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontengine_mac_p.h b/src/gui/text/qfontengine_mac_p.h index 5577c76..6967348 100644 --- a/src/gui/text/qfontengine_mac_p.h +++ b/src/gui/text/qfontengine_mac_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index cccbc92..851bb59 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index 467fca6..e15beae 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qglyphs.cpp b/src/gui/text/qglyphs.cpp index 2447752..affa08a 100644 --- a/src/gui/text/qglyphs.cpp +++ b/src/gui/text/qglyphs.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qglyphs.h b/src/gui/text/qglyphs.h index 282ecb4..5f37136 100644 --- a/src/gui/text/qglyphs.h +++ b/src/gui/text/qglyphs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qglyphs_p.h b/src/gui/text/qglyphs_p.h index c39f5d0..c632e2f 100644 --- a/src/gui/text/qglyphs_p.h +++ b/src/gui/text/qglyphs_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index afe762a..ef4e565 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h index a1faea9..e0e4f04 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.h +++ b/src/gui/text/qplatformfontdatabase_qpa.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qflickgesture.cpp b/src/gui/util/qflickgesture.cpp index eb0cc8d..8baca07 100644 --- a/src/gui/util/qflickgesture.cpp +++ b/src/gui/util/qflickgesture.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qflickgesture_p.h b/src/gui/util/qflickgesture_p.h index c3c263b..451b579 100644 --- a/src/gui/util/qflickgesture_p.h +++ b/src/gui/util/qflickgesture_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscroller.cpp b/src/gui/util/qscroller.cpp index d60f44e..ac5607c 100644 --- a/src/gui/util/qscroller.cpp +++ b/src/gui/util/qscroller.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscroller.h b/src/gui/util/qscroller.h index 7d7e1ca..a026be4 100644 --- a/src/gui/util/qscroller.h +++ b/src/gui/util/qscroller.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscroller_mac.mm b/src/gui/util/qscroller_mac.mm index 3203036..f544788 100644 --- a/src/gui/util/qscroller_mac.mm +++ b/src/gui/util/qscroller_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscroller_p.h b/src/gui/util/qscroller_p.h index d16eef9..fb2b257 100644 --- a/src/gui/util/qscroller_p.h +++ b/src/gui/util/qscroller_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscrollerproperties.cpp b/src/gui/util/qscrollerproperties.cpp index b159e05..85e2e82 100644 --- a/src/gui/util/qscrollerproperties.cpp +++ b/src/gui/util/qscrollerproperties.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscrollerproperties.h b/src/gui/util/qscrollerproperties.h index e292d8d..75d8932 100644 --- a/src/gui/util/qscrollerproperties.h +++ b/src/gui/util/qscrollerproperties.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/gui/util/qscrollerproperties_p.h b/src/gui/util/qscrollerproperties_p.h index 093f615..76d8b0a 100644 --- a/src/gui/util/qscrollerproperties_p.h +++ b/src/gui/util/qscrollerproperties_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index b5cf00a..81410a4 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h index 086a35d..3b598aa 100644 --- a/src/network/access/qhttpthreaddelegate_p.h +++ b/src/network/access/qhttpthreaddelegate_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/access/qnetworkreplydataimpl.cpp b/src/network/access/qnetworkreplydataimpl.cpp index 52cfe95..a09ff5c 100644 --- a/src/network/access/qnetworkreplydataimpl.cpp +++ b/src/network/access/qnetworkreplydataimpl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/access/qnetworkreplydataimpl_p.h b/src/network/access/qnetworkreplydataimpl_p.h index 6c62d28..2048376 100644 --- a/src/network/access/qnetworkreplydataimpl_p.h +++ b/src/network/access/qnetworkreplydataimpl_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h index 393e3cd..c5126de 100644 --- a/src/network/access/qnetworkreplyfileimpl_p.h +++ b/src/network/access/qnetworkreplyfileimpl_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qsharednetworksession_p.h b/src/network/bearer/qsharednetworksession_p.h index dc84166..57b3a49 100644 --- a/src/network/bearer/qsharednetworksession_p.h +++ b/src/network/bearer/qsharednetworksession_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h b/src/opengl/gl2paintengineex/qglshadercache_meego_p.h index 5f51fc2..d20c731 100644 --- a/src/opengl/gl2paintengineex/qglshadercache_meego_p.h +++ b/src/opengl/gl2paintengineex/qglshadercache_meego_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/gl2paintengineex/qglshadercache_p.h b/src/opengl/gl2paintengineex/qglshadercache_p.h index 29616ae..6e496ab 100644 --- a/src/opengl/gl2paintengineex/qglshadercache_p.h +++ b/src/opengl/gl2paintengineex/qglshadercache_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 0f4b305..f7991b7 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index 8a544c1..29e32ff 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h index 88f43c0..44d9bad 100644 --- a/src/opengl/qglfunctions.h +++ b/src/opengl/qglfunctions.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/qglpixelbuffer_stub.cpp b/src/opengl/qglpixelbuffer_stub.cpp index 2caef6b..98203fd 100644 --- a/src/opengl/qglpixelbuffer_stub.cpp +++ b/src/opengl/qglpixelbuffer_stub.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/opengl/util/meego/main.cpp b/src/opengl/util/meego/main.cpp index 5522855..65d6e57 100644 --- a/src/opengl/util/meego/main.cpp +++ b/src/opengl/util/meego/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/generic/tslib/main.cpp b/src/plugins/generic/tslib/main.cpp index 502c6a0..3c2d21c 100644 --- a/src/plugins/generic/tslib/main.cpp +++ b/src/plugins/generic/tslib/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp index 12963a0..0143db4 100644 --- a/src/plugins/generic/tslib/qtslib.cpp +++ b/src/plugins/generic/tslib/qtslib.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/generic/tslib/qtslib.h b/src/plugins/generic/tslib/qtslib.h index 5eab8b9..4309185 100644 --- a/src/plugins/generic/tslib/qtslib.h +++ b/src/plugins/generic/tslib/qtslib.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp index b8ea5d5..d090e85 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h index 7f794bc..08ba2fa 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp index 67b3f56..f708033 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h index 84f0699..64a3623 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp index da4b728..8af4d40 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h index b730415..793d325 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h +++ b/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index d379b65..19998ce 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 1e874ba..bd5dbda 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 91a1b3a..01cef83 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index 3669159..e85c502 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 51502f8..3cd81ac 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h index ea8b7b0..f37bbed 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.h +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index 033ff1e..ee46691 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.h b/src/plugins/platforms/directfb/qdirectfbglcontext.h index 1785666..f25b1a7 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.h +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp index 9d2a8a8..30654bf 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.cpp +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index bca155f..35a345c 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 8639bdb..52b7774 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 965bdd2..bfd4af4 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index 1cd23ad..040580b 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h index 19491c5..4c6476a 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.h +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index b1a8899..81f989d 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h index aaa74d4..a762bf6 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index 1612f79..24c21e6 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index 98c30b8..f624e97 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index 4b83a22..126dc74 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index ac53559..4b98619 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index d0a82b7..c07e546 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index a48fde8..f4a97fc 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 0342539..c199653 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index db90ff2..2200d1d 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index bfbfa62..6a2a504 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index b5b7e05..2ef12aa 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index 43f185b..ad51114 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp index ebc04bd..393e646 100644 --- a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.h b/src/plugins/platforms/eglfs/qeglfswindowsurface.h index f8aca40..2fa655b 100644 --- a/src/plugins/platforms/eglfs/qeglfswindowsurface.h +++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index b000a18..e118ce8 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 45a5663..c5ae378 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index ee520be..895f8af 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h index 0af118d..f04d453 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 9b9be07..2a3fd5a 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h index cf62b88..ee441f7 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h b/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h index 327c8f5..bfe014a 100644 --- a/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h +++ b/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 82c15c2..b15f183 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index c90e92e..f72fadb 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 95b952e..133feee 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp index acf0e6e..dd8c9b7 100644 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp +++ b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.h b/src/plugins/platforms/minimal/qminimalwindowsurface.h index 98b26f6..bfeeaca 100644 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.h +++ b/src/plugins/platforms/minimal/qminimalwindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/openkode/main.cpp index 527747e..ead17a4 100644 --- a/src/plugins/platforms/openkode/main.cpp +++ b/src/plugins/platforms/openkode/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/openkodekeytranslator.h b/src/plugins/platforms/openkode/openkodekeytranslator.h index 0070edc..502bf03 100644 --- a/src/plugins/platforms/openkode/openkodekeytranslator.h +++ b/src/plugins/platforms/openkode/openkodekeytranslator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp index aefabf0..4ca82db 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h index 73b287f..cef3465 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 763e69e..5176397 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index a067491..ade3366 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 01f8d21..66530a5 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 4992807..83b04b4 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openkode/shaders/frag.glslf b/src/plugins/platforms/openkode/shaders/frag.glslf index c768437..ceac785 100644 --- a/src/plugins/platforms/openkode/shaders/frag.glslf +++ b/src/plugins/platforms/openkode/shaders/frag.glslf @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp index 69c1ef5..e1298e8 100644 --- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h index a6e17e6..66a10e1 100644 --- a/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h +++ b/src/plugins/qmltooling/tcpserver/qtcpserverconnection.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index d3710ac..0c0871a 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 33b2ed7..cae490f 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/baselineserver/src/main.cpp b/tests/arthur/baselineserver/src/main.cpp index 02fc2fa..3a03b2f 100644 --- a/tests/arthur/baselineserver/src/main.cpp +++ b/tests/arthur/baselineserver/src/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/baselineserver/src/report.cpp b/tests/arthur/baselineserver/src/report.cpp index 88b5625..5854706 100644 --- a/tests/arthur/baselineserver/src/report.cpp +++ b/tests/arthur/baselineserver/src/report.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/baselineserver/src/report.h b/tests/arthur/baselineserver/src/report.h index 685539e..d549a72 100644 --- a/tests/arthur/baselineserver/src/report.h +++ b/tests/arthur/baselineserver/src/report.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index cff74cc..0e7e507 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 2315bc3..259555d 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/common/lookup3.cpp b/tests/arthur/common/lookup3.cpp index 8cdc64b..1aa501f 100644 --- a/tests/arthur/common/lookup3.cpp +++ b/tests/arthur/common/lookup3.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/common/qbaselinetest.cpp b/tests/arthur/common/qbaselinetest.cpp index 79241d5..1d028f8 100644 --- a/tests/arthur/common/qbaselinetest.cpp +++ b/tests/arthur/common/qbaselinetest.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/arthur/common/qbaselinetest.h b/tests/arthur/common/qbaselinetest.h index e27cda2..dc32109 100644 --- a/tests/arthur/common/qbaselinetest.h +++ b/tests/arthur/common/qbaselinetest.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/baselineexample/tst_baselineexample.cpp b/tests/auto/baselineexample/tst_baselineexample.cpp index b97cc63..02af816 100644 --- a/tests/auto/baselineexample/tst_baselineexample.cpp +++ b/tests/auto/baselineexample/tst_baselineexample.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp index 64f327b..1168471 100644 --- a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp +++ b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp index 2029c8a..057a8ca 100644 --- a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp +++ b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 0e8757b..e515c48 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp index 5952252..1178169 100644 --- a/tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp +++ b/tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/qfilesystementry/tst_qfilesystementry.cpp index 4375f99..dea6d2e 100644 --- a/tests/auto/qfilesystementry/tst_qfilesystementry.cpp +++ b/tests/auto/qfilesystementry/tst_qfilesystementry.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qglfunctions/tst_qglfunctions.cpp b/tests/auto/qglfunctions/tst_qglfunctions.cpp index 73e63b5..8756438 100644 --- a/tests/auto/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/qglfunctions/tst_qglfunctions.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qglyphs/tst_qglyphs.cpp b/tests/auto/qglyphs/tst_qglyphs.cpp index da91063..1c0aa9e 100644 --- a/tests/auto/qglyphs/tst_qglyphs.cpp +++ b/tests/auto/qglyphs/tst_qglyphs.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 41da16e..2baee27 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptextensionplugin/simpleplugin/simpleplugin.cpp b/tests/auto/qscriptextensionplugin/simpleplugin/simpleplugin.cpp index 1679512..c4fb0e3 100644 --- a/tests/auto/qscriptextensionplugin/simpleplugin/simpleplugin.cpp +++ b/tests/auto/qscriptextensionplugin/simpleplugin/simpleplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.cpp b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.cpp index b13f723..e4b9e4e 100644 --- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.cpp +++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptextensionplugin/tst_qscriptextensionplugin.cpp b/tests/auto/qscriptextensionplugin/tst_qscriptextensionplugin.cpp index e8b5e0a..78e949c 100644 --- a/tests/auto/qscriptextensionplugin/tst_qscriptextensionplugin.cpp +++ b/tests/auto/qscriptextensionplugin/tst_qscriptextensionplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h index 1c61fc5..be4f79f 100644 --- a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h +++ b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp index 962a2af..529558f 100644 --- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h index 8248ef3..f625399 100644 --- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qscroller/tst_qscroller.cpp b/tests/auto/qscroller/tst_qscroller.cpp index b4e4ddf..a9b3d9f 100644 --- a/tests/auto/qscroller/tst_qscroller.cpp +++ b/tests/auto/qscroller/tst_qscroller.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/auto/qstringref/tst_qstringref.cpp b/tests/auto/qstringref/tst_qstringref.cpp index 585e14e..301559e 100644 --- a/tests/auto/qstringref/tst_qstringref.cpp +++ b/tests/auto/qstringref/tst_qstringref.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index b0c5702..aa4c15a 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp index 497a556..a03e095 100644 --- a/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp +++ b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp index f94767b..fd5132c 100644 --- a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp index 4016be1..a9e49b5 100644 --- a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp +++ b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp index 62f3c2a..926d2ce 100644 --- a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp +++ b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/script/sunspider/tst_sunspider.cpp b/tests/benchmarks/script/sunspider/tst_sunspider.cpp index 9e2bb6f..da1458e 100644 --- a/tests/benchmarks/script/sunspider/tst_sunspider.cpp +++ b/tests/benchmarks/script/sunspider/tst_sunspider.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/benchmarks/script/v8/tst_v8.cpp b/tests/benchmarks/script/v8/tst_v8.cpp index b9cb859..c23395a 100644 --- a/tests/benchmarks/script/v8/tst_v8.cpp +++ b/tests/benchmarks/script/v8/tst_v8.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tests/manual/mkspecs/test.sh b/tests/manual/mkspecs/test.sh index 7e942a4..0aae76a 100755 --- a/tests/manual/mkspecs/test.sh +++ b/tests/manual/mkspecs/test.sh @@ -1,7 +1,7 @@ #!/bin/bash ############################################################################# ## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## Contact: Nokia Corporation (qt-info@nokia.com) ## diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 491f159..4bd3842 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -10,7 +10,7 @@ description = "Qt Assistant" HTML.{postheader,address} = "" HTML.footer = "


\n" \ "\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.8.0
" diff --git a/tools/assistant/tools/assistant/globalactions.cpp b/tools/assistant/tools/assistant/globalactions.cpp index 0eeab21..7fc59eb 100644 --- a/tools/assistant/tools/assistant/globalactions.cpp +++ b/tools/assistant/tools/assistant/globalactions.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/globalactions.h b/tools/assistant/tools/assistant/globalactions.h index ca8d7eb..a9059a9 100644 --- a/tools/assistant/tools/assistant/globalactions.h +++ b/tools/assistant/tools/assistant/globalactions.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesmanager.cpp b/tools/assistant/tools/assistant/openpagesmanager.cpp index 75b8653..272d9e2 100644 --- a/tools/assistant/tools/assistant/openpagesmanager.cpp +++ b/tools/assistant/tools/assistant/openpagesmanager.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesmanager.h b/tools/assistant/tools/assistant/openpagesmanager.h index 5837392..c34686c 100644 --- a/tools/assistant/tools/assistant/openpagesmanager.h +++ b/tools/assistant/tools/assistant/openpagesmanager.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesmodel.cpp b/tools/assistant/tools/assistant/openpagesmodel.cpp index 2663b85..3517693 100644 --- a/tools/assistant/tools/assistant/openpagesmodel.cpp +++ b/tools/assistant/tools/assistant/openpagesmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesmodel.h b/tools/assistant/tools/assistant/openpagesmodel.h index 64013a6..dd28a7c 100644 --- a/tools/assistant/tools/assistant/openpagesmodel.h +++ b/tools/assistant/tools/assistant/openpagesmodel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesswitcher.cpp b/tools/assistant/tools/assistant/openpagesswitcher.cpp index d4b7d82..8e7f29b 100644 --- a/tools/assistant/tools/assistant/openpagesswitcher.cpp +++ b/tools/assistant/tools/assistant/openpagesswitcher.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpagesswitcher.h b/tools/assistant/tools/assistant/openpagesswitcher.h index e27db6b..80c7e96 100644 --- a/tools/assistant/tools/assistant/openpagesswitcher.h +++ b/tools/assistant/tools/assistant/openpagesswitcher.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/assistant/tools/assistant/openpageswidget.cpp b/tools/assistant/tools/assistant/openpageswidget.cpp index b7ac33e..db03712 100644 --- a/tools/assistant/tools/assistant/openpageswidget.cpp +++ b/tools/assistant/tools/assistant/openpageswidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/doxygen/config/footer.html b/tools/doxygen/config/footer.html index 8e99c72..d7e968d 100644 --- a/tools/doxygen/config/footer.html +++ b/tools/doxygen/config/footer.html @@ -1,6 +1,6 @@


- +
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies). Trademarks
Qt $projectnumber
diff --git a/tools/qdoc3/doc/qdoc-manual.qdocconf b/tools/qdoc3/doc/qdoc-manual.qdocconf index 9514d63..53486be 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdocconf +++ b/tools/qdoc3/doc/qdoc-manual.qdocconf @@ -174,7 +174,7 @@ HTML.footer = "" \ " \n" \ "
\n" \ "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

\n" \ "

\n" \ diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 5a513f7..e0b7c50 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp index a7dc5a0..bdb2631 100644 --- a/tools/qdoc3/qmlcodemarker.cpp +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index 9c1d4ee..269a566 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 7acac48..f849319 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 709a858..6cee613 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 9295624..7045313 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/tools/qdoc3/test/carbide-eclipse-integration.qdocconf b/tools/qdoc3/test/carbide-eclipse-integration.qdocconf index 4d43403..ff50ce6 100644 --- a/tools/qdoc3/test/carbide-eclipse-integration.qdocconf +++ b/tools/qdoc3/test/carbide-eclipse-integration.qdocconf @@ -6,7 +6,7 @@ macro.TheEclipseIntegration = Carbide.c++ HTML.footer = "


\n" \ "\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Carbide.c++
" diff --git a/tools/qdoc3/test/jambi.qdocconf b/tools/qdoc3/test/jambi.qdocconf index aa87826..3f4b42d 100644 --- a/tools/qdoc3/test/jambi.qdocconf +++ b/tools/qdoc3/test/jambi.qdocconf @@ -42,7 +42,7 @@ HTML.postheader = "\n" \ "
\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt Jambi \\version
" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf index fa15d90..a69d7a1 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf @@ -149,7 +149,7 @@ HTML.footer = \ " \n" \ "
\n" \ "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

\n" \ "

\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index 18ed5c1..74a4d14 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -36,7 +36,7 @@ HTML.footer = \ "

\n" \ "
\n" \ "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

\n" \ "

\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf index 285ec27..ed2162e 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf @@ -149,7 +149,7 @@ HTML.footer = \ "

\n" \ "
\n" \ "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

\n" \ "

\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 402ee9e..b4c8f7b 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -149,7 +149,7 @@ HTML.footer = \ "

\n" \ "
\n" \ "

\n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

\n" \ "

\n" \ diff --git a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf index 96c2c98..850a2db 100644 --- a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf +++ b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf @@ -5,7 +5,7 @@ macro.TheEclipseIntegration = The Qt Eclipse Integration HTML.footer = "


\n" \ "\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt Eclipse Integration 1.5.3
" diff --git a/translations/assistant_cs.ts b/translations/assistant_cs.ts index 9b9e486..be54f86 100755 --- a/translations/assistant_cs.ts +++ b/translations/assistant_cs.ts @@ -1078,7 +1078,7 @@ Grund: Nepodařilo se najít příslušnou položku obsahu. - <center><h3>%1</h3><p>Version %2</p></center><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p> + <center><h3>%1</h3><p>Version %2</p></center><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p> <center><h3>%1</h3><p>Verze %2</p></center><p>Autorské právo (C) 2009 Nokia Corporation a/nebo její dceřinná společnost(i).</p> diff --git a/translations/assistant_sl.ts b/translations/assistant_sl.ts index a7f79e0..40dff80 100644 --- a/translations/assistant_sl.ts +++ b/translations/assistant_sl.ts @@ -1088,7 +1088,7 @@ Razlog: <center><h3>%1</h3><p>Version %2</p></center><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p> - <center><h3>%1</h3><p>Različica %2</p></center><p>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> + <center><h3>%1</h3><p>Različica %2</p></center><p>Avtorske pravice © 2011 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> About %1 diff --git a/translations/designer_cs.ts b/translations/designer_cs.ts index 4099695..3db20bd 100755 --- a/translations/designer_cs.ts +++ b/translations/designer_cs.ts @@ -3259,7 +3259,7 @@ Chcete tuto předlohu přepsat? <br/>Qt Designer je obrazový návrhář uživatelského rozhraní pro programy Qt.<br/> - %1<br/>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + %1<br/>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). %1<br/>Autorské právo (C) 2009 Nokia Corporation a/nebo její dceřinná společnost(i). diff --git a/translations/linguist_cs.ts b/translations/linguist_cs.ts index 5023355..fb56289 100755 --- a/translations/linguist_cs.ts +++ b/translations/linguist_cs.ts @@ -1907,8 +1907,8 @@ Všechny soubory (*) Verze %1 - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je nástrojem pro přidávání překladů do programů Qt.</p><p>Copyright (C) 2010 Nokia Corporation a/nebo její dceřinná společnost(i). + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je nástrojem pro přidávání překladů do programů Qt.</p><p>Copyright (C) 2011 Nokia Corporation a/nebo její dceřinná společnost(i). <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). diff --git a/translations/linguist_sl.ts b/translations/linguist_sl.ts index 4499133..b5769e4 100644 --- a/translations/linguist_sl.ts +++ b/translations/linguist_sl.ts @@ -1749,7 +1749,7 @@ Vse datoteke (*) <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist is a tool for adding translations to Qt applications.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je orodje za dodajanje prevodov programom Qt..</p><p>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> + <center><img src=":/images/splash.png"/></img><p>%1</p></center><p>Qt Linguist je orodje za dodajanje prevodov programom Qt..</p><p>Avtorske pravice © 2011 Nokia Corporation in/ali njene podružnice.</p><p>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a></p> Do you want to save the modified files? diff --git a/translations/qt_cs.ts b/translations/qt_cs.ts index 3e72f01..193dfa4 100755 --- a/translations/qt_cs.ts +++ b/translations/qt_cs.ts @@ -3763,8 +3763,8 @@ Ověřte, prosím, že byl zadán správný název souboru. Nápověda - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - <p>Qt je sadou softwarových nástrojů C++ určených pro vývoj aplikací napříč platformami.</p><p>Qt poskytuje jednoduchou přenositelnost přes MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, a všechny hlavní obchodní varianty systému Unix. Qt je rovněž dostupný pro vložená zařízení jako Qt pro Embedded Linux a Qt pro Windows CE.</p><p>Qt je dostupné pod třemi rozdílnými licenčními volbami navrženými pro přizpůsobení se potřebám našich různých uživatelů.</p>Qt licencované pod naší obchodní licenční smlouvou je vhodné pro vývoj soukromého/obchodního software, kde si nepřejete sdílet jakýkoli zdrojový kód se třetími stranami, nebo jinak řečeno, když nemůžete vyhovět podmínkám GNU LGPL ve verzi 2.1 nebo GNU GPL ve verzi 3.0.</p><p>Qt licencované pod GNU LGPL ve verzi 2.1 je vhodné pro vývoj Qt aplikací (soukromých nebo s otevřeným zdrojovým kódem), za předpokladu že můžete souhlasit s požadavky a podmínkami GNU LGPL version 2.1.</p><p>Qt licencované pod GNU General Public License ve verzi 3.0 je vhodné pro vývoj aplikací Qt, u nichž si přejete použít takovou aplikaci ve spojení se software, který podléhá požadavkům GNU GPL ve verzi 3.0, nebo kde jste jinak ochoten souhlasit s podmínkami GNU GPL ve verzi 3.0.</p><p>Podívejte se, prosím, na <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> kvůli přehledu licencování Qt.</p><p>Autorské právo (C) 2010 Nokia Corporation a/nebo její dceřinná(é) společnost(i).</p><p>Qt je výrobkem společnosti Nokia. Podívejte se na <a href="http://qt.nokia.com/">qt.nokia.com</a>kvůli více informacím.</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt je sadou softwarových nástrojů C++ určených pro vývoj aplikací napříč platformami.</p><p>Qt poskytuje jednoduchou přenositelnost přes MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, a všechny hlavní obchodní varianty systému Unix. Qt je rovněž dostupný pro vložená zařízení jako Qt pro Embedded Linux a Qt pro Windows CE.</p><p>Qt je dostupné pod třemi rozdílnými licenčními volbami navrženými pro přizpůsobení se potřebám našich různých uživatelů.</p>Qt licencované pod naší obchodní licenční smlouvou je vhodné pro vývoj soukromého/obchodního software, kde si nepřejete sdílet jakýkoli zdrojový kód se třetími stranami, nebo jinak řečeno, když nemůžete vyhovět podmínkám GNU LGPL ve verzi 2.1 nebo GNU GPL ve verzi 3.0.</p><p>Qt licencované pod GNU LGPL ve verzi 2.1 je vhodné pro vývoj Qt aplikací (soukromých nebo s otevřeným zdrojovým kódem), za předpokladu že můžete souhlasit s požadavky a podmínkami GNU LGPL version 2.1.</p><p>Qt licencované pod GNU General Public License ve verzi 3.0 je vhodné pro vývoj aplikací Qt, u nichž si přejete použít takovou aplikaci ve spojení se software, který podléhá požadavkům GNU GPL ve verzi 3.0, nebo kde jste jinak ochoten souhlasit s podmínkami GNU GPL ve verzi 3.0.</p><p>Podívejte se, prosím, na <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> kvůli přehledu licencování Qt.</p><p>Autorské právo (C) 2011 Nokia Corporation a/nebo její dceřinná(é) společnost(i).</p><p>Qt je výrobkem společnosti Nokia. Podívejte se na <a href="http://qt.nokia.com/">qt.nokia.com</a>kvůli více informacím.</p> <h3>About Qt</h3><p>This program uses Qt version %1.</p><p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> diff --git a/translations/qt_gl.ts b/translations/qt_gl.ts index 23e71c2..2431a5d 100644 --- a/translations/qt_gl.ts +++ b/translations/qt_gl.ts @@ -3728,7 +3728,7 @@ ou comercial onde non é preciso compartir ningún código fonte con terceiras p <p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p> - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> <p>Qt é un toolkit de C++ para o desenvolvemento de programas multiplataforma.</p> <p>Qt fornece portabilidade entre MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux e as principais variantes comerciais de Unix cun único código fonte. Qt tamén está dispoñíbel para dispositivos incrustados como Qt para Embedded Linux e Qt para Windows CE.</p> <p>Qt está dispoñíbel en tres opcións de licenzas diferentes deseñadas para adaptarse ás necesidades dos diferentes usuarios.</p> </p>Qt distribuída sob o acordo de licenza comercial é adecuado para o desenvolvemento de software propietario @@ -3736,7 +3736,7 @@ ou comercial onde non é preciso compartir ningún código fonte con terceiras p <p>Qt sob a licenza GNU General Public License versión 2.1 é apropiada para o desenvolvemento de programas Qt (propietario ou de fontes abertas) supoñendo que poda cumprir cos termos e condicións da licenza GNU GPL versión 2.1.</p> <p>Qt sob a licenza GNU General Public License versión 3.0 é apropiada para o desenvolvemento de programas Qt onde desexe empregar tales programas en combinación con software suxeito aos termos da GNU GPL versión 3.0 ou onde desexe cumprir cos termos da GNU GPL versión 3.0.</p> <p>Consulte <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> para ler un resumo das licenzas de Qt.</p> -<p>Copyright (C) 2010 Nokia Corporation ou as súas subsidiarias.</p> +<p>Copyright (C) 2011 Nokia Corporation ou as súas subsidiarias.</p> <p>Qt é un produto de Nokia. Consulte <a href="http://qt.nokia.com/">qt.nokia.com</a> para máis información.</p> diff --git a/translations/qtconfig_sl.ts b/translations/qtconfig_sl.ts index 568efbe..9e09432 100644 --- a/translations/qtconfig_sl.ts +++ b/translations/qtconfig_sl.ts @@ -96,7 +96,7 @@ <h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - <h3>%1</h3><br/>Različica %2<br/><br/>Avtorske pravice © 2010 Nokia Corporation in/ali njene podružnice.<br/><br/>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a> + <h3>%1</h3><br/>Različica %2<br/><br/>Avtorske pravice © 2011 Nokia Corporation in/ali njene podružnice.<br/><br/>Prevedel: <a href="mailto:jlp@holodeck1.com">Jure Repinc</a>, <a href="http://www.lugos.si/">LUGOS</a> Qt Configuration diff --git a/util/qlalr/doc/qlalr.qdocconf b/util/qlalr/doc/qlalr.qdocconf index ea9eaa6..f5af331 100644 --- a/util/qlalr/doc/qlalr.qdocconf +++ b/util/qlalr/doc/qlalr.qdocconf @@ -59,7 +59,7 @@ HTML.postheader = "\n" \ "
\n" \ - "\n" \ + "\n" \ "\n" \ "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Copyright © 2011 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt \\version
" -- cgit v0.12 From c7787f7df7a507d29b49f66b430e251d1a879ccd Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 11 Mar 2011 12:03:58 +1000 Subject: Fix compiler warning. Add parentheses around nested || statment. Change-Id: I836b39b438dea5236d2c45a9920cd8307623df3d --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 6c26fd3..12d0c98 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1672,8 +1672,8 @@ void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode) finder.setPosition(anchor); const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons(); - if (anchor < text.length() && !(reasons & QTextBoundaryFinder::StartWord) - || ((reasons & QTextBoundaryFinder::EndWord) && anchor > cursor)) { + if (anchor < text.length() && (!(reasons & QTextBoundaryFinder::StartWord) + || ((reasons & QTextBoundaryFinder::EndWord) && anchor > cursor))) { finder.toPreviousBoundary(); } anchor = finder.position() != -1 ? finder.position() : 0; @@ -1690,8 +1690,8 @@ void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode) finder.setPosition(anchor); const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons(); - if (anchor > 0 && !(reasons & QTextBoundaryFinder::EndWord) - || ((reasons & QTextBoundaryFinder::StartWord) && anchor < cursor)) { + if (anchor > 0 && (!(reasons & QTextBoundaryFinder::EndWord) + || ((reasons & QTextBoundaryFinder::StartWord) && anchor < cursor))) { finder.toNextBoundary(); } anchor = finder.position() != -1 ? finder.position() : text.length(); -- cgit v0.12 From 68415b0bcc3e531dc16516aa6788aeef8bced6f2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 11 Mar 2011 12:39:04 +1000 Subject: Fix ListView boundary extents for RTL layout. The delegates were laid out RTL, but the first item was not aligned with the right edge. Also fixes QTBUG-18037. Change-Id: I6387c2f1ad37385376304f8cc76407b34d9fb834 Task-number: QTBUG-16010 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativelistview.cpp | 48 +++++++-- .../qdeclarativelistview/data/headerfooter.qml | 26 +++++ .../tst_qdeclarativelistview.cpp | 117 +++++++++++++++++++++ 3 files changed, 182 insertions(+), 9 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index f9f1a48..2c23a1b 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -272,6 +272,22 @@ public: void regenerate() { Q_Q(QDeclarativeListView); if (q->isComponentComplete()) { + if (header) { + if (q->scene()) + q->scene()->removeItem(header->item); + header->item->deleteLater(); + delete header; + header = 0; + } + if (footer) { + if (q->scene()) + q->scene()->removeItem(footer->item); + footer->item->deleteLater(); + delete footer; + footer = 0; + } + updateHeader(); + updateFooter(); clear(); setPosition(0); q->refill(); @@ -2633,7 +2649,8 @@ qreal QDeclarativeListView::maxYExtent() const return height(); if (d->maxExtentDirty) { if (!d->model || !d->model->count()) { - d->maxExtent = 0; + d->maxExtent = d->header ? -d->header->size() : 0; + d->maxExtent += height(); } else if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { d->maxExtent = -(d->positionAt(d->model->count()-1) - d->highlightRangeStart); if (d->highlightRangeEnd != d->highlightRangeStart) @@ -2661,21 +2678,26 @@ qreal QDeclarativeListView::minXExtent() const qreal highlightStart; qreal highlightEnd; - qreal endPositionFirstItem; + qreal endPositionFirstItem = 0; if (d->isRightToLeft()) { if (d->model && d->model->count()) endPositionFirstItem = d->positionAt(d->model->count()-1); + else if (d->header) + d->minExtent += d->header->size(); highlightStart = d->highlightRangeStartValid ? d->highlightRangeStart - (d->lastPosition()-endPositionFirstItem) : d->size() - (d->lastPosition()-endPositionFirstItem); highlightEnd = d->highlightRangeEndValid ? d->highlightRangeEnd : d->size(); if (d->footer) d->minExtent += d->footer->size(); + qreal maxX = maxXExtent(); + if (d->minExtent < maxX) + d->minExtent = maxX; } else { endPositionFirstItem = d->endPositionAt(0); highlightStart = d->highlightRangeStart; highlightEnd = d->highlightRangeEnd; - if (d->header) + if (d->header && d->visibleItems.count()) d->minExtent += d->header->size(); } if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { @@ -2696,7 +2718,8 @@ qreal QDeclarativeListView::maxXExtent() const if (d->maxExtentDirty) { qreal highlightStart; qreal highlightEnd; - qreal lastItemPosition; + qreal lastItemPosition = 0; + d->maxExtent = 0; if (d->isRightToLeft()) { highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size(); highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size(); @@ -2708,7 +2731,9 @@ qreal QDeclarativeListView::maxXExtent() const lastItemPosition = d->positionAt(d->model->count()-1); } if (!d->model || !d->model->count()) { - d->maxExtent = 0; + if (!d->isRightToLeft()) + d->maxExtent = d->header ? -d->header->size() : 0; + d->maxExtent += width(); } else if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { d->maxExtent = -(lastItemPosition - highlightStart); if (highlightEnd != highlightStart) { @@ -2720,15 +2745,15 @@ qreal QDeclarativeListView::maxXExtent() const d->maxExtent = -(d->endPosition() - width() + 1); } if (d->isRightToLeft()) { - if (d->header) + if (d->header && d->visibleItems.count()) d->maxExtent -= d->header->size(); } else { if (d->footer) d->maxExtent -= d->footer->size(); + qreal minX = minXExtent(); + if (d->maxExtent > minX) + d->maxExtent = minX; } - qreal minX = minXExtent(); - if (d->maxExtent > minX) - d->maxExtent = minX; d->maxExtentDirty = false; } return d->maxExtent; @@ -2776,6 +2801,11 @@ void QDeclarativeListView::geometryChanged(const QRectF &newGeometry, Q_D(QDeclarativeListView); d->maxExtentDirty = true; d->minExtentDirty = true; + if (d->isRightToLeft() && d->orient == Qt::Horizontal) { + // maintain position relative to the right edge + int dx = newGeometry.width() - oldGeometry.width(); + setContentX(contentX() - dx); + } QDeclarativeFlickable::geometryChanged(newGeometry, oldGeometry); } diff --git a/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml b/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml new file mode 100644 index 0000000..5633831 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/headerfooter.qml @@ -0,0 +1,26 @@ +import QtQuick 1.1 + +ListView { + id: view + property bool horizontal: false + property bool rtl: false + width: 240 + height: 320 + + orientation: horizontal ? ListView.Horizontal : ListView.Vertical + header: Rectangle { + objectName: "header" + width: horizontal ? 20 : view.width + height: horizontal ? view.height : 20 + color: "red" + } + footer: Rectangle { + objectName: "footer" + width: horizontal ? 30 : view.width + height: horizontal ? view.height : 30 + color: "blue" + } +// model: testModel + delegate: Text { width: 30; height: 30; text: index + "(" + x + ")" } + layoutDirection: rtl ? Qt.RightToLeft : Qt.LeftToRight +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index a699bbe..c87318e 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -103,6 +103,7 @@ private slots: void QTBUG_11105(); void header(); void footer(); + void headerFooter(); void resizeView(); void sizeLessThan1(); void QTBUG_14821(); @@ -1958,6 +1959,112 @@ void tst_QDeclarativeListView::footer() delete canvas; } +class LVAccessor : public QDeclarativeListView +{ +public: + qreal minY() const { return minYExtent(); } + qreal maxY() const { return maxYExtent(); } + qreal minX() const { return minXExtent(); } + qreal maxX() const { return maxXExtent(); } +}; + +void tst_QDeclarativeListView::headerFooter() +{ + { + // Vertical + QDeclarativeView *canvas = createView(); + + TestModel model; + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast(canvas->rootObject()); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeItem *header = findItem(contentItem, "header"); + QVERIFY(header); + QCOMPARE(header->y(), 0.0); + + QDeclarativeItem *footer = findItem(contentItem, "footer"); + QVERIFY(footer); + QCOMPARE(footer->y(), 20.0); + + QVERIFY(static_cast(listview)->minY() == 0); + QVERIFY(static_cast(listview)->maxY() == 0); + + delete canvas; + } + { + // Horizontal + QDeclarativeView *canvas = createView(); + + TestModel model; + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + canvas->rootObject()->setProperty("horizontal", true); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast(canvas->rootObject()); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeItem *header = findItem(contentItem, "header"); + QVERIFY(header); + QCOMPARE(header->x(), 0.0); + + QDeclarativeItem *footer = findItem(contentItem, "footer"); + QVERIFY(footer); + QCOMPARE(footer->x(), 20.0); + + QVERIFY(static_cast(listview)->minX() == 0); + QVERIFY(static_cast(listview)->maxX() == 0); + + delete canvas; + } + { + // Horizontal RTL + QDeclarativeView *canvas = createView(); + + TestModel model; + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + canvas->rootObject()->setProperty("horizontal", true); + canvas->rootObject()->setProperty("rtl", true); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast(canvas->rootObject()); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeItem *header = findItem(contentItem, "header"); + QVERIFY(header); + QCOMPARE(header->x(), -20.0); + + QDeclarativeItem *footer = findItem(contentItem, "footer"); + QVERIFY(footer); + QCOMPARE(footer->x(), -50.0); + + QCOMPARE(static_cast(listview)->minX(), 240.); + QCOMPARE(static_cast(listview)->maxX(), 240.); + + delete canvas; + } +} + void tst_QDeclarativeListView::resizeView() { QDeclarativeView *canvas = createView(); @@ -2360,6 +2467,7 @@ void tst_QDeclarativeListView::testQtQuick11Attributes_data() void tst_QDeclarativeListView::rightToLeft() { QDeclarativeView *canvas = createView(); + canvas->setFixedSize(640,320); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); qApp->processEvents(); @@ -2376,6 +2484,9 @@ void tst_QDeclarativeListView::rightToLeft() QTRY_VERIFY(model->count() == 3); QTRY_COMPARE(listview->currentIndex(), 0); + // initial position at first item, right edge aligned + QCOMPARE(listview->contentX(), -640.); + QDeclarativeItem *item = findItem(contentItem, "item1"); QTRY_VERIFY(item); QTRY_COMPARE(item->x(), -100.0); @@ -2395,6 +2506,12 @@ void tst_QDeclarativeListView::rightToLeft() QTRY_VERIFY(text); QTRY_COMPARE(text->text(), QLatin1String("index: 2")); + QCOMPARE(listview->contentX(), -640.); + + // Ensure resizing maintains position relative to right edge + qobject_cast(canvas->rootObject())->setWidth(600); + QTRY_COMPARE(listview->contentX(), -600.); + delete canvas; } -- cgit v0.12 From 27f0c5054e5326bf16f40436ba4e72927ea89cc1 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 10 Mar 2011 16:38:20 +1000 Subject: Don't reveal TextInput text on refocus in PasswordEchoOnEdit mode. In PasswordEchoOnEdit mode return the display text instead of the real text from inputMethodQuery() when not editing the password and clear old password if new input is received through an input method event. Change-Id: I7f24f510bf8e356e460900c3b9ff55ea16b32ab3 Task-number: QTBUG-17562 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 7 ++++++- src/gui/widgets/qlinecontrol.cpp | 6 +++++- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 10 ++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 12d0c98..b4395e3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1374,7 +1374,10 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) case Qt::ImCursorPosition: return QVariant(d->control->cursor()); case Qt::ImSurroundingText: - return QVariant(text()); + if (d->control->echoMode() == PasswordEchoOnEdit && !d->control->passwordEchoEditing()) + return QVariant(displayText()); + else + return QVariant(text()); case Qt::ImCurrentSelection: return QVariant(selectedText()); case Qt::ImMaximumTextLength: @@ -1867,6 +1870,8 @@ void QDeclarativeTextInputPrivate::init() #endif // QT_NO_CLIPBOARD q->connect(control, SIGNAL(updateMicroFocus()), q, SLOT(updateMicroFocus())); + q->connect(control, SIGNAL(displayTextChanged(QString)), + q, SLOT(updateRect())); q->updateSize(); oldValidity = control->hasAcceptableInput(); lastSelectionStart = 0; diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index bffc2b5..5a281ad 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -414,10 +414,14 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (isGettingInput) { // If any text is being input, remove selected text. priorState = m_undoState; + if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) { + updatePasswordEchoEditing(true); + m_selstart = 0; + m_selend = m_text.length(); + } removeSelectedText(); } - int c = m_cursor; // cursor position after insertion of commit string if (event->replacementStart() <= 0) c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 796ac23..45f38a4 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1829,13 +1829,23 @@ void tst_qdeclarativetextinput::echoMode() QCOMPARE(input->inputMethodHints(), ref); QCOMPARE(input->text(), initial); QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ")); + QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("QQQQQQQQ")); QTest::keyPress(canvas, Qt::Key_A);//Clearing previous entry is part of PasswordEchoOnEdit QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); QCOMPARE(input->text(), QLatin1String("a")); QCOMPARE(input->displayText(), QLatin1String("a")); + QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("a")); input->setFocus(false); QVERIFY(input->hasActiveFocus() == false); QCOMPARE(input->displayText(), QLatin1String("Q")); + QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QLatin1String("Q")); + input->setFocus(true); + QInputMethodEvent inputEvent; + inputEvent.setCommitString(initial); + QApplication::sendEvent(canvas, &inputEvent); + QCOMPARE(input->text(), initial); + QCOMPARE(input->displayText(), initial); + QCOMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), initial); delete canvas; } -- cgit v0.12 From c422ed3b861ab92276c91a6672b313f037de6ff6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 11 Mar 2011 17:10:16 +1000 Subject: Update QML "What's New" docs. Change-Id: I80d2247cd05ef71907bbf690e8e68a8860a65d4c --- doc/src/declarative/whatsnew.qdoc | 42 +++++++++++++++++++--- src/declarative/graphicsitems/qdeclarativeitem.cpp | 4 +++ .../graphicsitems/qdeclarativetextedit.cpp | 2 +- .../graphicsitems/qdeclarativetextinput.cpp | 2 +- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index e8c2124..1a8ebd7 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -31,20 +31,33 @@ \section1 Qt 4.7.3 includes QtQuick 1.1 -QtQuick 1.1 is a minor feature update. +QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new features. \section2 PinchArea PinchArea provides support for the common two finger pinch gesture. +\section2 LayoutMirroring + +\l {LayoutMirroring}{Layout mirroring} is useful when you need to support both left-to-right and right-to-left layout versions of your application that target different language areas. + +\section2 Anchors + +Added the following property: +\list +\o \l {Item::}{anchors.mirrored} +\endlist + \section2 Text Added the following properties: \list \o \l {Text::}{lineHeight} +\o \l {Text::}{lineHeightMode} \o \l {Text::}{lineCount} \o \l {Text::}{maximumLineCount} \o \l {Text::}{truncated} +\o \l {Text::}{effectiveHorizontalAlignment} \endlist horizontalAlignment now accepts Text.AlignJustify alignment mode. @@ -55,7 +68,11 @@ Added the following properties, methods and signal handlers: \list \o \l {TextEdit::}{canPaste} \o \l {TextEdit::}{lineCount} +\o \l {TextEdit::}{inputMethodComposing} +\o \l {TextEdit::}{mouseSelectionMode} +\o \l {TextEdit::}{effectiveHorizontalAlignment} \o \l {TextEdit::}{deselect()} +\o \l {TextEdit::}{isRightToLeft()} \o \l {TextEdit::}{moveCursorSelection()} to enable selection by word \o \l {TextEdit::}{onLinkActivated} \endlist @@ -64,9 +81,13 @@ Added the following properties, methods and signal handlers: Added the following properties and methods: \list -\o \l{TextInput::}{canPaste} -\o \l{TextInput::}{deselect()} -\o \l{TextInput::}{moveCursorSelection()} to enable selection by word +\o \l {TextInput::}{canPaste} +\o \l {TextInput::}{inputMethodComposing} +\o \l {TextInput::}{mouseSelectionMode} +\o \l {TextInput::}{effectiveHorizontalAlignment} +\o \l {TextInput::}{deselect()} +\o \l {TextInput::}{isRightToLeft()} +\o \l {TextInput::}{moveCursorSelection()} to enable selection by word \endlist \section2 Image, BorderImage and AnimatedImage @@ -92,10 +113,19 @@ Added the following methods: \o \l{Flickable::}{returnToBounds()} \endlist +\section2 MouseArea + +Added the following property: +\list +\o \l{MouseArea::}{preventStealing} +\endlist + \section2 ListView and GridView -Added the following methods: +Added the following properties and methods: \list +\o \l{ListView::}{layoutDirection} +\o \l{ListView::}{effectiveLayoutDirection} \o \l{ListView::}{positionViewAtBeginning()} \o \l{ListView::}{positionViewAtEnd()} \endlist @@ -105,6 +135,7 @@ Added the following methods: Added the following properties: \list \o \l{Flow::}{layoutDirection} +\o \l{Flow::}{effectiveLayoutDirection} \endlist \section2 Repeater @@ -135,6 +166,7 @@ properties. \list \o Functions can be \l{Binding Properties from JavaScript}{assigned to properties from JavaScript} to create property bindings. +\o QtQuick now supports Right to Left layout in positioners, views, anchors and text elements. \endlist diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 1b1c476..9cf1e78 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2317,6 +2317,8 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \qmlproperty real Item::anchors.verticalCenterOffset \qmlproperty real Item::anchors.baselineOffset + \qmlproperty bool Item::anchors.mirrored + Anchors provide a way to position an item by specifying its relationship with other items. @@ -2374,6 +2376,8 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const To clear an anchor value, set it to \c undefined. + \c anchors.mirrored returns true it the layout has been \l {LayoutMirroring}{mirrored}. + \note You can only anchor an item to siblings or a parent. For more information see \l {anchor-layout}{Anchor Layouts}. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index babc020..2cb1c94 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1508,7 +1508,7 @@ bool QDeclarativeTextEdit::canPaste() const } /*! - \qmlproperty bool TextEdit::isInputMethodComposing() + \qmlproperty bool TextEdit::inputMethodComposing \since QtQuick 1.1 diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index b4395e3..c6de7a0 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1824,7 +1824,7 @@ void QDeclarativeTextInput::focusInEvent(QFocusEvent *event) } /*! - \qmlproperty bool TextInput::isInputMethodComposing() + \qmlproperty bool TextInput::inputMethodComposing \since QtQuick 1.1 -- cgit v0.12 From 0d67f69f6b49841cdef5cd48176598e4bbb349d6 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 11 Mar 2011 14:38:22 +0100 Subject: Deprecate QScriptValue::QObjectMember This property flag serves no valid use case. We don't want users to write code that depends on whether the property is a Qt/C++ property or a JS property. Task-number: QTBUG-17760 Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptvalue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 4772fa1..2b54f1f 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -145,7 +145,7 @@ \value PropertySetter The property is defined by a function which will be called to set the property value. - \value QObjectMember This flag is used to indicate that an existing property is a QObject member (a property or method). + \omitvalue QObjectMember This flag is used to indicate that an existing property is a QObject member (a property or method). \value KeepExistingFlags This value is used to indicate to setProperty() that the property's flags should be left unchanged. If the property doesn't exist, the default flags (0) will be used. -- cgit v0.12 From fefc004a71b6744e3ad7d2fe0e1d45824beb3c3a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 11 Mar 2011 14:42:58 +0100 Subject: Deprecate QScriptValue::UserRange QScriptValue::PropertyFlags should only represent standard (ECMA) attributes. Since we can't guarantee that the back-end will be able to retain extra "user" bits, we don't want users to write code that rely on them. Task-number: QTBUG-15571 Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptvalue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 2b54f1f..2a22c72 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -149,7 +149,7 @@ \value KeepExistingFlags This value is used to indicate to setProperty() that the property's flags should be left unchanged. If the property doesn't exist, the default flags (0) will be used. - \value UserRange Flags in this range are not used by Qt Script, and can be used for custom purposes. + \omitvalue UserRange Flags in this range are not used by Qt Script, and can be used for custom purposes. */ /*! -- cgit v0.12 From a1a9929acaeccd7027605ffeb9794b034b146c92 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 14 Mar 2011 10:47:36 +1000 Subject: Fix TextEdit mouseSelectionMode overriding selectByMouse. If selectByMouse is false don't allow any text selection on mouse move. Change-Id: Ic9f309899bc0de48066a2393e088e15b3a2f06db Task-number: QTBUG-18072 Reviewed-by: Martin Jones --- src/gui/text/qtextcontrol.cpp | 11 +++++++++-- .../qdeclarativetextedit/data/mouseselection_false_words.qml | 7 +++++++ .../qdeclarativetextedit/data/mouseselection_true_words.qml | 7 +++++++ .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index f5da079..6babca1 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1607,7 +1607,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons if (!(buttons & Qt::LeftButton)) return; - if (!((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) + const bool selectable = interactionFlags & Qt::TextSelectableByMouse; + const bool editable = interactionFlags & Qt::TextEditable; + + if (!selectable && !editable) return; if (!(mousePressed @@ -1623,6 +1626,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons startDrag(); return; } + + if (!selectable) + return; + const qreal mouseX = qreal(mousePos.x()); int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); @@ -1638,7 +1645,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); - else if (interactionFlags & Qt::TextSelectableByMouse) + else setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); if (interactionFlags & Qt::TextEditable) { diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml new file mode 100644 index 0000000..22a9871 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false_words.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +TextEdit { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: false +} diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml new file mode 100644 index 0000000..d61da46 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true_words.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +TextEdit { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: true +} diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 7aac76c..f62c2c5 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1305,6 +1305,8 @@ void tst_qdeclarativetextedit::mouseSelection_data() QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true; QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false; QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false; + QTest::newRow("on word selection") << SRCDIR "/data/mouseselection_true_words.qml" << true; + QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << false; } void tst_qdeclarativetextedit::mouseSelection() -- cgit v0.12 From 8b7c98123eadf9263c6bde4b1263bd64fc388c8d Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 14 Mar 2011 12:06:04 +0200 Subject: QS60Style: QTreeView::indexRowSizeHint returns incorrect value Fix for http://bugreports.qt.nokia.com/browse/QTBUG-17786. QS60Style tries to work around the hardcoded margin that the QCommonStyle adds to menu items (line 4782 in my QCommonStyle.cpp). Unfortunately regular itemview items are handled in the same code branch in QS60Style, so the class incorrectly reduces the itemview height 8 pixels. The reduction should only happen with menu items. Task-number: QTBUG-17786 Reviewed-by: Laszlo Agocs --- src/gui/styles/qs60style.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 38a4b7c..87d990e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2643,10 +2643,13 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); //native items have small empty areas at the beginning and end of menu item sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); - if (QS60StylePrivate::isTouchSupported()) + if (QS60StylePrivate::isTouchSupported()) { //Make itemview easier to use in touch devices + sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); //QCommonStyle does not adjust height with horizontal margin, it only adjusts width - sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values + if (ct == CT_MenuItem) + sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values + } break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: { -- cgit v0.12