diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-22 12:56:51 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-22 12:56:51 (GMT) |
commit | 785698be659723c0a33016dd724afc3e26089145 (patch) | |
tree | 1dac3ef0364db41da3ea19d46e8cf676ef31e0c6 | |
parent | 82bd4b28f3819b992743ab76fda3e9bc32f6702c (diff) | |
parent | 12eac6fa53680b5c7a6c898749a4ac0d3c427c18 (diff) | |
download | Qt-785698be659723c0a33016dd724afc3e26089145.zip Qt-785698be659723c0a33016dd724afc3e26089145.tar.gz Qt-785698be659723c0a33016dd724afc3e26089145.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Added 'parallel_test' for some QGraphics* auto-tests.
QAbstractGraphicsShapeItem: ignore already set pen or brush
Made sure that QTabWidget reported a big enough size hint.
Fixed wasted space in the texture cache.
Get debug code compiling since function signature changes
--warn;
19 files changed, 100 insertions, 16 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9759b39..d1c5fd2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -8007,6 +8007,8 @@ QPen QAbstractGraphicsShapeItem::pen() const void QAbstractGraphicsShapeItem::setPen(const QPen &pen) { Q_D(QAbstractGraphicsShapeItem); + if (d->pen == pen) + return; prepareGeometryChange(); d->pen = pen; d->boundingRect = QRectF(); @@ -8037,6 +8039,8 @@ QBrush QAbstractGraphicsShapeItem::brush() const void QAbstractGraphicsShapeItem::setBrush(const QBrush &brush) { Q_D(QAbstractGraphicsShapeItem); + if (d->brush == brush) + return; d->brush = brush; update(); } @@ -9167,6 +9171,8 @@ QPen QGraphicsLineItem::pen() const void QGraphicsLineItem::setPen(const QPen &pen) { Q_D(QGraphicsLineItem); + if (d->pen == pen) + return; prepareGeometryChange(); d->pen = pen; update(); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 631a9cf..bf57460 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -140,6 +140,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const // no room on the current line, start new glyph strip m_cx = 0; m_cy += m_currentRowHeight + paddingDoubled; + m_cy += rowHeight; m_currentRowHeight = 0; // New row } if (m_cy + c.h > m_h) { diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 074dd89..f8fc126 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -5616,6 +5616,57 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // hack to work around horrible sizeHint() code in QAbstractSpinBox sz.setHeight(sz.height() - 3); break; + case QStyle::CT_TabWidget: + // the size between the pane and the "contentsRect" (+4,+4) + // (the "contentsRect" is on the inside of the pane) + sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); + /** + This is supposed to show the relationship between the tabBar and + the stack widget of a QTabWidget. + Unfortunately ascii is not a good way of representing graphics..... + PS: The '=' line is the painted frame. + + top ---+ + | + | + | + | vvv just outside the painted frame is the "pane" + - -|- - - - - - - - - - <-+ + TAB BAR +=====^============ | +2 pixels + - - -|- - -|- - - - - - - <-+ + | | ^ ^^^ just inside the painted frame is the "contentsRect" + | | | + | overlap | + | | | + bottom ------+ <-+ +14 pixels + | + v + ------------------------------ <- top of stack widget + + + To summarize: + * 2 is the distance between the pane and the contentsRect + * The 14 and the 1's are the distance from the contentsRect to the stack widget. + (same value as used in SE_TabWidgetTabContents) + * overlap is how much the pane should overlap the tab bar + */ + // then add the size between the stackwidget and the "contentsRect" + + if (const QStyleOptionTabWidgetFrame *twf + = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { + QSize extra(0,0); + const int overlap = pixelMetric(PM_TabBarBaseOverlap, opt, widget); + const int gapBetweenTabbarAndStackWidget = 2 + 14 - overlap; + + if (getTabDirection(twf->shape) == kThemeTabNorth || getTabDirection(twf->shape) == kThemeTabSouth) { + extra = QSize(2, gapBetweenTabbarAndStackWidget + 1); + } else { + extra = QSize(gapBetweenTabbarAndStackWidget + 1, 2); + } + sz+= extra; + } + + break; case QStyle::CT_TabBarTab: if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget); diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp index 047a905..583c112 100644 --- a/src/gui/widgets/qtabwidget.cpp +++ b/src/gui/widgets/qtabwidget.cpp @@ -814,8 +814,8 @@ QSize QTabWidget::sizeHint() const { Q_D(const QTabWidget); QSize lc(0, 0), rc(0, 0); - QStyleOption opt(0); - opt.init(this); + QStyleOptionTabWidgetFrameV2 opt; + initStyleOption(&opt); opt.state = QStyle::State_None; if (d->leftCornerWidget) @@ -863,8 +863,8 @@ QSize QTabWidget::minimumSizeHint() const QSize sz = basicSize(d->pos == North || d->pos == South, lc, rc, s, t); - QStyleOption opt(0); - opt.rect = rect(); + QStyleOptionTabWidgetFrameV2 opt; + initStyleOption(&opt); opt.palette = palette(); opt.state = QStyle::State_None; return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) diff --git a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro index 4c065f4..8768425 100644 --- a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -1,3 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicsanchorlayout.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro index 27f48e0..90b7878 100644 --- a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro +++ b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro @@ -1,3 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicsanchorlayout1.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicseffect/qgraphicseffect.pro b/tests/auto/qgraphicseffect/qgraphicseffect.pro index 7effaca..94b3ce6 100644 --- a/tests/auto/qgraphicseffect/qgraphicseffect.pro +++ b/tests/auto/qgraphicseffect/qgraphicseffect.pro @@ -1,3 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicseffect.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro index d506c6d..5658ad7 100644 --- a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro +++ b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro @@ -1,3 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicseffectsource.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro index 97e68bc..d66d639 100644 --- a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicsgridlayout.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro index 6be3bfe..01875c7 100644 --- a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro +++ b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro @@ -1,5 +1,5 @@ load(qttest_p4) SOURCES += tst_qgraphicsitemanimation.cpp DEFINES += QT_NO_CAST_TO_ASCII - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicslayout/qgraphicslayout.pro b/tests/auto/qgraphicslayout/qgraphicslayout.pro index 1dc916a..eafd213 100644 --- a/tests/auto/qgraphicslayout/qgraphicslayout.pro +++ b/tests/auto/qgraphicslayout/qgraphicslayout.pro @@ -5,4 +5,4 @@ load(qttest_p4) SOURCES += tst_qgraphicslayout.cpp DEFINES += QT_USE_USING_NAMESPACE - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro index 6c8bf0c..816224b 100644 --- a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro +++ b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicslayoutitem.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro index 114e5e9..df5a827 100644 --- a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro +++ b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicslinearlayout.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicsobject/qgraphicsobject.pro b/tests/auto/qgraphicsobject/qgraphicsobject.pro index 965b319..2418845 100644 --- a/tests/auto/qgraphicsobject/qgraphicsobject.pro +++ b/tests/auto/qgraphicsobject/qgraphicsobject.pro @@ -1,2 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicsobject.cpp +CONFIG += parallel_test
\ No newline at end of file diff --git a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro index f6d6c8f..6b4db95 100644 --- a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro +++ b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicspixmapitem.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro index d54b78b..4da949b 100644 --- a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro +++ b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qgraphicspolygonitem.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro index d1bf3cc..1fdd176 100644 --- a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro +++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro @@ -1,4 +1,4 @@ load(qttest_p4) requires(contains(QT_CONFIG,private_tests)) SOURCES += tst_qgraphicssceneindex.cpp - +CONFIG += parallel_test diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro index 709cff6..67c939e 100644 --- a/tests/auto/qgraphicstransform/qgraphicstransform.pro +++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro @@ -1,2 +1,3 @@ load(qttest_p4) SOURCES += tst_qgraphicstransform.cpp +CONFIG += parallel_test diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp index 4491fb3..6d5a873 100644 --- a/tests/auto/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp @@ -45,6 +45,7 @@ #include <qdebug.h> #include <qapplication.h> #include <qlabel.h> +#include <QtGui/qboxlayout.h> //TESTED_CLASS= //TESTED_FILES= @@ -120,6 +121,7 @@ class tst_QTabWidget:public QObject { void clear(); void keyboardNavigation(); void paintEventCount(); + void minimumSizeHint(); private: int addPage(); @@ -621,6 +623,28 @@ void tst_QTabWidget::paintEventCount() QCOMPARE(tab2->count, 1); } +void tst_QTabWidget::minimumSizeHint() +{ + QTabWidget tw; + QWidget *page = new QWidget; + QVBoxLayout *lay = new QVBoxLayout; + + QLabel *label = new QLabel(QLatin1String("XXgypq lorem ipsum must be long, must be long. lorem ipsumMMMW")); + lay->addWidget(label); + + page->setLayout(lay); + + tw.addTab(page, QLatin1String("page1")); + + tw.show(); + QTest::qWaitForWindowShown(&tw); + tw.resize(tw.minimumSizeHint()); + + QSize minSize = label->minimumSizeHint(); + QSize actSize = label->geometry().size(); + QVERIFY(minSize.width() <= actSize.width()); + QVERIFY(minSize.height() <= actSize.height()); +} QTEST_MAIN(tst_QTabWidget) #include "tst_qtabwidget.moc" |