From e453fce2731069dce993a94b0c2291307cc7806c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Sep 2011 13:16:35 +0200 Subject: doc: Fix incorrect enum name in QRawFont::alphaMapForGlyph docs There's no QImage::Format_A8 format. This is a term used in the corresponding QFontEngineGlyphCache enum. Reviewed-by: Jiang Jiang --- src/gui/text/qrawfont.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 61bc63e..7c7d4eb 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -238,7 +238,8 @@ void QRawFont::loadFromData(const QByteArray &fontData, If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of - QImage::Format_A8 and each pixel will contain the opacity of the pixel in the rasterization. + QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the + rasterization. \sa pathForGlyph(), QPainter::drawGlyphRun() */ -- cgit v0.12 From 36045c4b68f7b3771d18da397590eee5ae4f3c6f Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 13 Sep 2011 17:35:08 +0200 Subject: Do not put cursor at non-stop character positions When moving cursors, non-stop positions are skipped, however certain input sequences can still lead us there. In such cases we should simply ignore those positions in cursorToX. Task-number: QTBUG-7076 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 3 +++ tests/auto/qtextlayout/tst_qtextlayout.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 4595ef5..c92e15b 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2507,6 +2507,9 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const int pos = *cursorPos; int itm; + const HB_CharAttributes *attributes = eng->attributes(); + while (pos < line.from + line.length && !attributes[pos].charStop) + pos++; if (pos == line.from + (int)line.length) { // end of line ensure we have the last item on the line itm = eng->findItem(pos-1); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 2414ab3..6c989ac 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -129,6 +129,7 @@ private slots: void textWidthWithLineSeparator(); void cursorInLigatureWithMultipleLines(); void xToCursorForLigatures(); + void cursorInNonStopChars(); private: QFont testFont; @@ -1502,5 +1503,19 @@ void tst_QTextLayout::xToCursorForLigatures() line.xToCursor(width) == line.xToCursor(width / 2)); } +void tst_QTextLayout::cursorInNonStopChars() +{ +#if defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout(QString::fromUtf8("\u0924\u094d\u0928")); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.cursorToX(1) == line.cursorToX(3)); + QVERIFY(line.cursorToX(2) == line.cursorToX(3)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From ead8dff4884d6081683b8281db69062413950673 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 15 Sep 2011 10:53:59 +0200 Subject: Updated Changelog --- dist/changes-4.8.0 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index b8e3842..b36f1ee 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -58,6 +58,7 @@ QtCore - QUrl: add method for retrieving effective top level domain [QTBUG-13601] (MR-1205) - optimised performance of QFileInfo, QDir, QDirIterator, these classes now share metadata and access the filesystem less - QFile: new open() overloads allow control over whether QFile should close an adopted file handle or not + - QLocale: added locale dependent to{Upper,Lower} string conversions QtGui ----- @@ -77,6 +78,8 @@ QtGui like UltraLight. [QTBUG-19366] - Visual text cursor movement behavior is added to QTextEdit and QLineEdit controls, which can be used as an optional mode for bi-directional text editing. [QTBUG-13859] + - QPainter: Added a fast stroking algorithm for thin (< 1px wide) aliased and antialiased + lines, giving a huge improvement in drawing speed for certain cases - Fixed a rare race condition when showing toplevel windows on X11 - Accessibility: Fix potential crash in QDockWidget. - Accessibility: Fix crash when asking for relations of child accessibles. @@ -119,9 +122,12 @@ QtScript -------- - Deprecated qScriptValueFromQMetaObject, qScriptValueToValue, qScriptValueFromValue +QtDBus +------ + - Added a method that returns the local machine ID + QtSql ----- - - Update sqlite to 3.7.7.1 **************************************************************************** * Database Drivers * -- cgit v0.12 From 9463ba63bc7e41a1d6aa320aced392843e31b160 Mon Sep 17 00:00:00 2001 From: Kalle Viironen Date: Thu, 15 Sep 2011 15:56:31 +0200 Subject: Fix - QGraphicsTextItem in a tab of QTabWidget cannot get focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Any QGraphicsTextItems in those tabs which are not the first tab of QTabWidget, cannot get focus although the tab is current tab of QTabWidget.But the QGraphicsTextItem in the first tab of QTabWidget can get focus. i.e. a focus frame (dotted box) appears around the QGraphicsTextItem. Those QGraphicsTextItems which cannot get focus can get focus only after the main window is minimized and then maximized. i.e. After that, a focus frame appears around it. Task-number: QTBUG-19680 Merge-request: 2676 Reviewed-by: Samuel Rødal --- src/gui/graphicsview/qgraphicsscene.cpp | 4 +- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 68 ++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 1551944..867880c 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -3504,7 +3504,9 @@ bool QGraphicsScene::event(QEvent *event) } break; case QEvent::WindowDeactivate: - if (!--d->activationRefCount) { + if (d->activationRefCount > 0) + --d->activationRefCount; + if (!d->activationRefCount) { if (d->activePanel) { // Deactivate the active panel (but keep it so we can // reactivate it later). diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index b8741fe..8a26323 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -290,6 +290,7 @@ private slots: void taskQT_3674_doNotCrash(); void taskQTBUG_15977_renderWithDeviceCoordinateCache(); void taskQTBUG_16401_focusItem(); + void taskQTBUG_19680_tabWidgetFocus(); }; void tst_QGraphicsScene::initTestCase() @@ -4711,5 +4712,72 @@ void tst_QGraphicsScene::taskQTBUG_16401_focusItem() QVERIFY(!scene.focusItem()); } +void tst_QGraphicsScene::taskQTBUG_19680_tabWidgetFocus() +{ + QTabWidget tabWidget; + QGraphicsScene scene1; + QGraphicsScene scene2; + QGraphicsView view1(&scene1); + QGraphicsView view2(&scene2); + + tabWidget.show(); + + tabWidget.addTab(&view1, "view1"); + tabWidget.setCurrentWidget(&view1); + + QGraphicsTextItem *textItem1 = scene1.addText("Text1"); + textItem1->setFlags(QGraphicsItem::ItemIsFocusable); + textItem1->setTextInteractionFlags(Qt::TextEditorInteraction); + textItem1->setEnabled(true); + textItem1->setFocus(); + + tabWidget.addTab(&view2, "view2"); + tabWidget.setCurrentWidget(&view2); + + QGraphicsTextItem *textItem2 = scene2.addText("Text2"); + textItem2->setFlags(QGraphicsItem::ItemIsFocusable); + textItem2->setTextInteractionFlags(Qt::TextEditorInteraction); + textItem2->setEnabled(true); + textItem2->setFocus(); + + scene2.clearFocus(); + + view2.clearFocus(); + view2.setEnabled(false); + view2.setInteractive(false); + view2.setVisible(false); + view2.setShown(false); + view2.hide(); + + tabWidget.clearFocus(); + tabWidget.setEnabled(false); + tabWidget.setShown(false); + tabWidget.setVisible(false); + tabWidget.hide(); + + tabWidget.setFocus(); + tabWidget.setEnabled(true); + tabWidget.activateWindow(); + tabWidget.setShown(true); + tabWidget.setVisible(true); + tabWidget.show(); + + view2.setFocus(); + view2.setEnabled(true); + view2.activateWindow(); + view2.setInteractive(true); + view2.setVisible(true); + view2.setShown(true); + view2.show(); + + QTest::qWaitForWindowShown(&view2); + QApplication::setActiveWindow(&tabWidget); + + textItem2->setFocus(); + + QVERIFY(scene2.isActive()); + QVERIFY(textItem2->hasFocus()); +} + QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" -- cgit v0.12 From 8935a84e18804c7ff4b7336e3cfdf1cd558eaf1c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 9 Sep 2011 14:31:39 +0200 Subject: Release font engine refcount when done using it in QTextEngine 5f2b6dd2a50275bc05ae5d7e9dd8902d6d49d9df increased refcounts for font engines in QTextEngine cache, we need to decrease them when the QTextEngine is deallocated. Task-number: QTBUG-21222 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 12 +++++++++--- src/gui/text/qtextengine_p.h | 1 + src/gui/text/qtextlayout.cpp | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index a0e1751..a1b0cb0 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1387,6 +1387,7 @@ QTextEngine::~QTextEngine() if (!stackEngine) delete layoutData; delete specialData; + resetFontEngineCache(); } const HB_CharAttributes *QTextEngine::attributes() const @@ -1447,6 +1448,13 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine) } } +void QTextEngine::resetFontEngineCache() +{ + releaseCachedFontEngine(feCache.prevFontEngine); + releaseCachedFontEngine(feCache.prevScaledFontEngine); + feCache.reset(); +} + void QTextEngine::invalidate() { freeMemory(); @@ -1455,9 +1463,7 @@ void QTextEngine::invalidate() if (specialData) specialData->resolvedFormatIndices.clear(); - releaseCachedFontEngine(feCache.prevFontEngine); - releaseCachedFontEngine(feCache.prevScaledFontEngine); - feCache.reset(); + resetFontEngineCache(); } void QTextEngine::clearLineData() diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 0a86886..9362022 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -629,6 +629,7 @@ public: int lineNumberForTextPosition(int pos); int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op); void insertionPointsForLine(int lineNum, QVector &insertionPoints); + void resetFontEngineCache(); private: void setBoundary(int strPos) const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c92e15b..d0c1a0e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -375,7 +375,7 @@ QTextLayout::~QTextLayout() void QTextLayout::setFont(const QFont &font) { d->fnt = font; - d->feCache.reset(); + d->resetFontEngineCache(); } /*! @@ -515,7 +515,7 @@ void QTextLayout::setAdditionalFormats(const QList &formatList) } if (d->block.docHandle()) d->block.docHandle()->documentChange(d->block.position(), d->block.length()); - d->feCache.reset(); + d->resetFontEngineCache(); } /*! -- cgit v0.12 From 57240c1f931eb4c340de6e2bb17972235265f89c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 16 Sep 2011 13:03:15 +0200 Subject: Use more widely supported Unicode character representation --- tests/auto/qtextlayout/tst_qtextlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 6c989ac..67d8269 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -1466,7 +1466,7 @@ void tst_QTextLayout::textWidthWithLineSeparator() void tst_QTextLayout::cursorInLigatureWithMultipleLines() { #if !defined(Q_WS_MAC) - QSKIP("This test can not be run on Mac", SkipAll); + QSKIP("This test can only be run on Mac", SkipAll); #endif QTextLayout layout("first line finish", QFont("Times", 20)); layout.beginLayout(); @@ -1482,7 +1482,7 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() void tst_QTextLayout::xToCursorForLigatures() { #if !defined(Q_WS_MAC) - QSKIP("This test can not be run on Mac", SkipAll); + QSKIP("This test can only be run on Mac", SkipAll); #endif QTextLayout layout("fi", QFont("Times", 20)); layout.beginLayout(); @@ -1508,7 +1508,7 @@ void tst_QTextLayout::cursorInNonStopChars() #if defined(Q_WS_MAC) QSKIP("This test can not be run on Mac", SkipAll); #endif - QTextLayout layout(QString::fromUtf8("\u0924\u094d\u0928")); + QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8")); layout.beginLayout(); QTextLine line = layout.createLine(); layout.endLayout(); -- cgit v0.12