diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-07-01 07:00:13 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-07-01 07:00:13 (GMT) |
commit | 3dc0c38389670d6adddd972c532af98dd6b5deb5 (patch) | |
tree | 779945938b51cc6290bc6dcee1cb34f696f42242 | |
parent | 73f0d9534b593c65e4facf9a975e2c2e63608f03 (diff) | |
parent | f5feea56fc7202ab64a1b9c5f9b05391c2b88238 (diff) | |
download | Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.zip Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.gz Qt-3dc0c38389670d6adddd972c532af98dd6b5deb5.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/s60installs/s60installs.pro
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextlayout.cpp | 15 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextlayout_p.h | 2 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 23 | ||||
-rw-r--r-- | src/gui/text/qstatictext.cpp | 10 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/qnetworksession_impl.cpp | 9 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | src/s60installs/s60installs.pro | 17 | ||||
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 40 |
8 files changed, 105 insertions, 25 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index 73a8570..e7bcf1f 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -69,14 +69,17 @@ class DrawTextItemRecorder: public QPaintEngine public: DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations) : m_inertText(0), m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations), - m_untransformedCoordinates(untransformedCoordinates) + m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black) { } virtual void updateState(const QPaintEngineState &newState) { - if (newState.state() & QPaintEngine::DirtyPen) + if (newState.state() & QPaintEngine::DirtyPen + && newState.pen().color() != m_currentColor) { m_dirtyPen = true; + m_currentColor = newState.pen().color(); + } } virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) @@ -112,7 +115,7 @@ class DrawTextItemRecorder: public QPaintEngine currentItem.positionOffset = positionOffset; currentItem.useBackendOptimizations = m_useBackendOptimizations; if (m_dirtyPen) - currentItem.color = state->pen().color(); + currentItem.color = m_currentColor; m_inertText->items.append(currentItem); } @@ -169,6 +172,7 @@ class DrawTextItemRecorder: public QPaintEngine bool m_dirtyPen; bool m_useBackendOptimizations; bool m_untransformedCoordinates; + QColor m_currentColor; }; class DrawTextItemDevice: public QPaintDevice @@ -296,7 +300,7 @@ void QDeclarativeTextLayout::clearLayout() QTextLayout::clearLayout(); } -void QDeclarativeTextLayout::prepare(QPainter *painter) +void QDeclarativeTextLayout::prepare() { if (!d || !d->cached) { @@ -305,7 +309,6 @@ void QDeclarativeTextLayout::prepare(QPainter *painter) InertTextPainter *itp = inertTextPainter(); itp->device.begin(d); - itp->painter.setPen(painter->pen()); QTextLayout::draw(&itp->painter, QPointF(0, 0)); glyph_t *glyphPool = d->glyphs.data(); @@ -344,7 +347,7 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p) return; } - prepare(painter); + prepare(); int itemCount = d->items.count(); diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h index 85d333e..d83ce7e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h @@ -61,7 +61,7 @@ public: void beginLayout(); void clearLayout(); - void prepare(QPainter *); + void prepare(); void draw(QPainter *, const QPointF & = QPointF()); private: diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 2d2710c..14fdbd3 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -44,6 +44,7 @@ #include "qpainter.h" #include "qstyleoption.h" #include "qstyle.h" +#include "private/qapplication_p.h" #include "private/qt_s60_p.h" #include "private/qpixmap_raster_symbian_p.h" #include "private/qcore_symbian_p.h" @@ -1387,12 +1388,26 @@ QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation) // Notify all widgets that palette is updated with the actual background texture. QPalette pal = QApplication::palette(); pal.setBrush(QPalette::Window, *m_background); + + //Application palette hash is automatically cleared when QApplication::setPalette is called. + //To avoid losing palette hash data, back it up before calling the setPalette() API and + //restore it afterwards. + typedef QHash<QByteArray, QPalette> PaletteHash; + PaletteHash hash; + if (qt_app_palettes_hash() || !qt_app_palettes_hash()->isEmpty()) + hash = *qt_app_palettes_hash(); QApplication::setPalette(pal); - setThemePaletteHash(&pal); + if (hash.isEmpty()) { + //set default theme palette hash + setThemePaletteHash(&pal); + } else { + for (int i = 0; i < hash.count() - 1; i++) { + QByteArray widgetClassName = hash.keys().at(i); + QApplication::setPalette(hash.value(widgetClassName), widgetClassName); + } + } storeThemePalette(&pal); - foreach (QWidget *widget, QApplication::allWidgets()){ - QEvent e(QEvent::PaletteChange); - QApplication::sendEvent(widget, &e); + foreach (QWidget *widget, QApplication::allWidgets()) { setThemePalette(widget); widget->ensurePolished(); } diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index d8192b7..c985427 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -427,14 +427,17 @@ namespace { public: DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations) : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations), - m_untransformedCoordinates(untransformedCoordinates) + m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black) { } virtual void updateState(const QPaintEngineState &newState) { - if (newState.state() & QPaintEngine::DirtyPen) + if (newState.state() & QPaintEngine::DirtyPen + && newState.pen().color() != m_currentColor) { m_dirtyPen = true; + m_currentColor = newState.pen().color(); + } } virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) @@ -450,7 +453,7 @@ namespace { currentItem.positionOffset = m_glyphs.size(); // Offset into position pool currentItem.useBackendOptimizations = m_useBackendOptimizations; if (m_dirtyPen) - currentItem.color = state->pen().color(); + currentItem.color = m_currentColor; QTransform matrix = m_untransformedCoordinates ? QTransform() : state->transform(); matrix.translate(position.x(), position.y()); @@ -521,6 +524,7 @@ namespace { bool m_dirtyPen; bool m_useBackendOptimizations; bool m_untransformedCoordinates; + QColor m_currentColor; }; class DrawTextItemDevice: public QPaintDevice diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 107f347..fc65b86 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -459,6 +459,8 @@ TUint QNetworkSessionPrivateImpl::iapClientCount(TUint aIAPId) const { TRequestStatus status; TUint connectionCount; + if (!iConnectionMonitor.Handle()) + return 0; iConnectionMonitor.GetConnectionCount(connectionCount, status); User::WaitForRequest(status); if (status.Int() == KErrNone) { @@ -536,7 +538,8 @@ void QNetworkSessionPrivateImpl::stop() #endif if (!isOpen && publicConfig.isValid() && - publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + publicConfig.type() == QNetworkConfiguration::InternetAccessPoint && + iConnectionMonitor.Handle()) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "since session is not open, using RConnectionMonitor to stop() the interface"; @@ -801,6 +804,8 @@ quint64 QNetworkSessionPrivateImpl::transferredData(TUint dataType) const return 0; } + if (!iConnectionMonitor.Handle()) + return 0; TUint count; TRequestStatus status; iConnectionMonitor.GetConnectionCount(count, status); @@ -1415,6 +1420,8 @@ bool QNetworkSessionPrivateImpl::easyWlanTrueIapId(TUint32 &trueIapId) const // Loop through all connections that connection monitor is aware // and check for IAPs based on easy WLAN + if (!iConnectionMonitor.Handle()) + return false; TRequestStatus status; TUint connectionCount; iConnectionMonitor.GetConnectionCount(connectionCount, status); diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 71687dd..04edbb7 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -104,11 +104,19 @@ void SymbianEngine::initialize() return; } - TRAP_IGNORE(iConnectionMonitor.ConnectL()); + TRAP(error, { + iConnectionMonitor.ConnectL(); + CleanupClosePushL(iConnectionMonitor); #ifdef SNAP_FUNCTIONALITY_AVAILABLE - TRAP_IGNORE(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1)); + User::LeaveIfError(iConnectionMonitor.SetUintAttribute(EBearerIdAll, 0, KBearerGroupThreshold, 1)); #endif - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + iConnectionMonitor.NotifyEventL(*this); + CleanupStack::Pop(); + }); + if (error != KErrNone) { + iInitOk = false; + return; + } #ifdef SNAP_FUNCTIONALITY_AVAILABLE TRAP(error, iCmManager.OpenL()); diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 0d257fb..d96b46a 100644..100755 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -134,19 +134,22 @@ symbian: { contains(QT_CONFIG, declarative): { qtlibraries.files += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll - folderlistmodelImport.files = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll - gesturesImport.files = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll - particlesImport.files = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll + folderlistmodelImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll + gesturesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll + particlesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll + shadersImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/shaders/qmlshadersplugin$${QT_LIBINFIX}.dll - folderlistmodelImport.files += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir - gesturesImport.files += $$QT_SOURCE_TREE/src/imports/gestures/qmldir - particlesImport.files += $$QT_SOURCE_TREE/src/imports/particles/qmldir + folderlistmodelImport.sources += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir + gesturesImport.sources += $$QT_SOURCE_TREE/src/imports/gestures/qmldir + particlesImport.sources += $$QT_SOURCE_TREE/src/imports/particles/qmldir + shadersImport.sources += $$QT_SOURCE_TREE/src/imports/shaders/qmldir folderlistmodelImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/folderlistmodel gesturesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/gestures particlesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/particles + shadersImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/shaders - DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport + DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport shadersImport } graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index e14c9db..704f19b 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -96,6 +96,9 @@ private slots: void drawUnderlinedText(); void unprintableCharacter_qtbug12614(); + + void underlinedColor_qtbug20159(); + void textDocumentColor(); }; void tst_QStaticText::init() @@ -783,5 +786,42 @@ void tst_QStaticText::unprintableCharacter_qtbug12614() QVERIFY(staticText.size().isValid()); // Force layout. Should not crash. } +void tst_QStaticText::underlinedColor_qtbug20159() +{ + QString multiScriptText; + multiScriptText += QChar(0x0410); // Cyrillic 'A' + multiScriptText += QLatin1Char('A'); + + QStaticText staticText(multiScriptText); + + QFont font; + font.setUnderline(true); + + staticText.prepare(QTransform(), font); + + QStaticTextPrivate *d = QStaticTextPrivate::get(&staticText); + QCOMPARE(d->itemCount, 2); + + // The pen should not be marked as dirty when drawing the underline + QVERIFY(!d->items[0].color.isValid()); + QVERIFY(!d->items[1].color.isValid()); +} + +void tst_QStaticText::textDocumentColor() +{ + QStaticText staticText("A<font color=\"red\">B</font>"); + staticText.setTextFormat(Qt::RichText); + staticText.prepare(); + + QStaticTextPrivate *d = QStaticTextPrivate::get(&staticText); + QCOMPARE(d->itemCount, 2); + + // The pen should not be marked as dirty when drawing the underline + QVERIFY(!d->items[0].color.isValid()); + QVERIFY(d->items[1].color.isValid()); + + QCOMPARE(d->items[1].color, QColor(Qt::red)); +} + QTEST_MAIN(tst_QStaticText) #include "tst_qstatictext.moc" |