summaryrefslogtreecommitdiffstats
path: root/dist/changes-3.1.0-b2
Commit message (Collapse)AuthorAgeFilesLines
* Long live Qt!Lars Knoll2009-03-231-0/+220
ole 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 op