From 88dd7568fff419510a7c26ffb93d93cc276d7b3b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 23 Nov 2010 15:31:12 +0100 Subject: Fix filtering of columns in QSFPM. Fixes a crash introduced in 315c09c3873f7c5d8b785443372bf975bae47ee7 Reviewed-by: Gabriel de Dietrich Reviewed-by: Olivier --- src/gui/itemviews/qsortfilterproxymodel.cpp | 4 +-- .../qsortfilterproxymodel.pro | 5 +-- .../tst_qsortfilterproxymodel.cpp | 39 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index dc8d938..0d9819e 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -782,14 +782,14 @@ void QSortFilterProxyModelPrivate::source_items_inserted( if (orthogonal_source_to_proxy.isEmpty()) { const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent); + orthogonal_source_to_proxy.resize(ortho_end); + for (int ortho_item = 0; ortho_item < ortho_end; ++ortho_item) { if ((orient == Qt::Horizontal) ? q->filterAcceptsRow(ortho_item, source_parent) : q->filterAcceptsColumn(ortho_item, source_parent)) { orthogonal_proxy_to_source.append(ortho_item); } } - orthogonal_source_to_proxy.resize(orthogonal_proxy_to_source.size()); - if (orient == Qt::Horizontal) { // We're reacting to columnsInserted, but we've just inserted new rows. Sort them. sort_source_rows(orthogonal_proxy_to_source, source_parent); diff --git a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro index d2c1147..7edd4a5 100644 --- a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -1,6 +1,7 @@ load(qttest_p4) -SOURCES += tst_qsortfilterproxymodel.cpp - +INCLUDEPATH += $$PWD/../modeltest +SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp +HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 66caf4a..93b9d30 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -43,6 +43,9 @@ #include #include "../../shared/util.h" +#include "dynamictreemodel.h" +#include "modeltest.h" + #include #include @@ -144,6 +147,7 @@ private slots: void testMultipleProxiesWithSelection(); void mapSelectionFromSource(); + void filteredColumns(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -3174,5 +3178,40 @@ void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation() // No assert failure, it passes. } +class FilteredColumnProxyModel : public QSortFilterProxyModel +{ + Q_OBJECT +public: + FilteredColumnProxyModel(QObject *parent = 0) + : QSortFilterProxyModel(parent) + { + + } + +protected: + bool filterAcceptsColumn(int column, const QModelIndex &source_parent) const + { + return column % 2 != 0; + } +}; + +void tst_QSortFilterProxyModel::filteredColumns() +{ + DynamicTreeModel *model = new DynamicTreeModel(this); + + FilteredColumnProxyModel *proxy = new FilteredColumnProxyModel(this); + proxy->setSourceModel(model); + + new ModelTest(proxy, this); + + ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this); + insertCommand->setNumCols(2); + insertCommand->setStartRow(0); + insertCommand->setEndRow(0); + // Parent is QModelIndex() + insertCommand->doCommand(); + +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" -- cgit v0.12 From 0b728313dbca3ca6ea54bb8f533dbe70028f96e0 Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Fri, 26 Nov 2010 10:38:45 +0200 Subject: Adding warning to QMenu documentation If the QMenu is made visible using show() it causes problems because the scrolling and layout is not set properly. The warning suggests to use exec() or popup() instead. Task-number: QTBUG-12119 --- src/gui/widgets/qmenu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 4bea6de..551e19e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1319,6 +1319,9 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) Conversely, actions can be added to widgets with the addAction(), addActions() and insertAction() functions. + + \warning To make QMenu visible on the screen, exec() or popup() should be + used instead of show(). \section1 QMenu on Qt for Windows CE -- cgit v0.12 From 87291d518beb131b5b80540d46d53b54c2366a9c Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Mon, 29 Nov 2010 14:21:23 +0200 Subject: Removes the reseting of the QMenu offset. On s60 when the qmenu is opened on the second time, it restores the position of the last activated menu, so there is no need to reset the offset when the popup() is called again. Task-number: QTBUG-9505 --- src/gui/widgets/qmenu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 4bea6de..d9233f5 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1795,10 +1795,14 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); +#ifndef Q_WS_S60 + //on S60 opens the menu at the same position it was activated last time + //there is no need to reset the offset fix for QTBUG-9505 if (d->scroll) { // reset scroll state from last popup d->scroll->scrollOffset = 0; d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } +#endif d->tearoffHighlighted = 0; d->motions = 0; d->doChildEffects = true; -- cgit v0.12 From 0b8a04253e4842465427b3fcf6918a220905db0c Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Mon, 29 Nov 2010 15:20:43 +0100 Subject: Fix documentation for QML extended types Fixes the documentation for QML extended types, one should use 'qmlRegisterExtendedType' instead of 'qmlRegisterType'. Reviewed-by: Leonardo Sobral Cunha --- doc/src/declarative/extending.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 5c1b977..1e6e301 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -594,10 +594,10 @@ the appropriate property on the extension object is used instead. When an extended type is installed, one of the \code template -int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) +int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) template -int qmlRegisterType() +int qmlRegisterExtendedType() \endcode functions should be used instead of the regular \c qmlRegisterType() variations. The arguments are identical to the corresponding non-extension registration functions, -- cgit v0.12 From 3f7c80d105d18a3b901a7f3077d8faaea63e0659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 3 Dec 2010 10:01:28 +0100 Subject: Fix integer overflow in bitfield UnfeasibleConstraint is 4, and that does not fit in 2 bits. Spotted by Thiago Reviewed-by: Thiago --- src/gui/graphicsview/qgridlayoutengine_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 44efbba..1b2e2ec 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -433,7 +433,7 @@ private: // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; mutable int q_cachedEffectiveLastRows[NOrientations]; - mutable quint8 q_cachedConstraintOrientation : 2; + mutable quint8 q_cachedConstraintOrientation : 3; // Layout item input mutable QLayoutStyleInfo q_cachedDataForStyleInfo; -- cgit v0.12 From c343e2139b1764008b812ee6cc3a2a980fa4d147 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Tue, 30 Nov 2010 10:20:37 +0000 Subject: QGraphicsLayoutItem - fix invalidating sizehint-with-constraints cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jan-Arve Sæther --- src/gui/graphicsview/qgraphicslayout.cpp | 7 +++++-- src/gui/graphicsview/qgraphicslayoutitem.cpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 86b4589..3e95735 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -307,10 +307,13 @@ void QGraphicsLayout::invalidate() // does not call the base implementation? In addition, updateGeometry() // does more than we need. layoutItem->d_func()->sizeHintCacheDirty = true; - layoutItem = layoutItem->parentLayoutItem(); + layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true; + layoutItem = layoutItem->parentLayoutItem(); } - if (layoutItem) + if (layoutItem) { layoutItem->d_func()->sizeHintCacheDirty = true; + layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true; + } bool postIt = layoutItem ? !layoutItem->isLayout() : false; if (postIt) { diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 016cfbf..df13039 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -128,6 +128,7 @@ QGraphicsLayoutItemPrivate::~QGraphicsLayoutItemPrivate() void QGraphicsLayoutItemPrivate::init() { sizeHintCacheDirty = true; + sizeHintWithConstraintCacheDirty = true; sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } @@ -828,6 +829,7 @@ void QGraphicsLayoutItem::updateGeometry() { Q_D(QGraphicsLayoutItem); d->sizeHintCacheDirty = true; + d->sizeHintWithConstraintCacheDirty = true; } /*! -- cgit v0.12 From 700ce118e1f294148fbbd9b92672f9ff7ec21f8e Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Tue, 7 Dec 2010 11:46:55 +0200 Subject: Updating merge request 2512 Removing unnecessary comments and changing define to Q_OS_SYMBIAN. Task-number: QTBUG_9505 --- src/gui/widgets/qmenu.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d9233f5..538df35 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1795,9 +1795,7 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); -#ifndef Q_WS_S60 - //on S60 opens the menu at the same position it was activated last time - //there is no need to reset the offset fix for QTBUG-9505 +#ifndef Q_OS_SYMBIAN if (d->scroll) { // reset scroll state from last popup d->scroll->scrollOffset = 0; d->scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; -- cgit v0.12 From 3ca55de912dc01e23fc01d4aab953c08619a51a9 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Wed, 8 Dec 2010 14:21:53 +0200 Subject: Remove whitespace and leading tab from documentation change Task-number: QTBUG-12119 Reviewed-by: TrustMe --- src/gui/widgets/qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 2e42cdb..74c2a9e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1319,7 +1319,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) Conversely, actions can be added to widgets with the addAction(), addActions() and insertAction() functions. - + \warning To make QMenu visible on the screen, exec() or popup() should be used instead of show(). -- cgit v0.12 From 8f5a46deb3604d1d07a7f291695f0da2b04f1b73 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Wed, 8 Dec 2010 21:31:14 +0200 Subject: QT::Window palette brush fails to render correctly. QWidget uses QPainter::drawTiledPixmap to draw textured background brush but OpenVG paint engine fails to render pixmaps correctly because of incorrect offset calculation. Task-number: QTBUG-15737 Reviewed-by: Gunnar Sletta --- src/openvg/qpaintengine_vg.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index b8e8bad..13156d7 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3210,8 +3210,7 @@ void QVGPaintEngine::drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s) { QBrush brush(state()->pen.color(), pixmap); - QTransform xform; - xform.translate(-s.x(), -s.y()); + QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y()); brush.setTransform(xform); fillRect(r, brush); } -- cgit v0.12 From f9057f290bc89884d32ec88bddc8de6e0a3b3f7f Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 8 Dec 2010 12:25:29 +0200 Subject: QLabel wordwrap to respect maximumSize 80 characters width can be longer than maximum size of QLabel. Restrict to max size. Task-number: QT-4354 Reviewed-by: Sami Merila --- src/gui/widgets/qlabel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 42be03b..011b07a 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -682,7 +682,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const bool tryWidth = (w < 0) && (align & Qt::TextWordWrap); if (tryWidth) - w = fm.averageCharWidth() * 80; + w = qMin(fm.averageCharWidth() * 80, q->maximumSize().width()); else if (w < 0) w = 2000; w -= (hextra + contentsMargin.width()); -- cgit v0.12