diff options
-rw-r--r-- | src/gui/kernel/qevent.cpp | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglengineshadersource_p.h | 4 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 4 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadersource_p.h | 4 | ||||
-rw-r--r-- | tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp | 36 |
5 files changed, 46 insertions, 4 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 88f132b877..131f1863a5 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2278,6 +2278,7 @@ QTabletEvent::~QTabletEvent() #endif // QT_NO_TABLETEVENT +#ifndef QT_NO_GESTURES /*! \class QNativeGestureEvent \since 5.2 @@ -2392,6 +2393,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin Returns the position of the gesture as a QPointF, relative to the window that received the event. */ +#endif // QT_NO_GESTURES #ifndef QT_NO_DRAGANDDROP /*! diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h index 869bd057f2..ba72de3fb0 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qopenglslPositionWithRadialGradientBrushVertexShader = uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qopenglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 6345ed7682..08b0491ddc 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2878,6 +2878,10 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (item.position > tabSectionEnd || item.position <= si.position) continue; shape(i); // first, lets make sure relevant text is already shaped + if (item.analysis.flags == QScriptAnalysis::Object) { + length += item.width; + continue; + } QGlyphLayout glyphs = this->shapedGlyphs(&item); const int end = qMin(item.position + item.num_glyphs, tabSectionEnd) - item.position; for (int i=0; i < end; i++) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 65fbada48f..05d923ca17 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\n\ uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ diff --git a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp index 2d122125e0..3c5ba884f7 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp +++ b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp @@ -74,6 +74,7 @@ private slots: void inlineImage(); void clippedTableCell(); void floatingTablePageBreak(); + void imageAtRightAlignedTab(); private: QTextDocument *doc; @@ -283,6 +284,41 @@ void tst_QTextDocumentLayout::floatingTablePageBreak() QCOMPARE(doc->pageCount(), 2); } +void tst_QTextDocumentLayout::imageAtRightAlignedTab() +{ + doc->clear(); + + QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); + fmt.setMargin(0); + doc->rootFrame()->setFrameFormat(fmt); + + QTextCursor cursor(doc); + QTextBlockFormat blockFormat; + QList<QTextOption::Tab> tabs; + QTextOption::Tab tab; + tab.position = 300; + tab.type = QTextOption::RightTab; + tabs.append(tab); + blockFormat.setTabPositions(tabs); + + // First block: text, some of it right-aligned + cursor.insertBlock(blockFormat); + cursor.insertText("first line\t"); + cursor.insertText("right-aligned text"); + + // Second block: text, then right-aligned image + cursor.insertBlock(blockFormat); + cursor.insertText("second line\t"); + QImage img(48, 48, QImage::Format_RGB32); + const QString name = QString::fromLatin1("image"); + doc->addResource(QTextDocument::ImageResource, QUrl(name), img); + QTextImageFormat imgFormat; + imgFormat.setName(name); + cursor.insertImage(imgFormat); + + // Everything should fit into the 300 pixels + QCOMPARE(doc->idealWidth(), 300.0); +} QTEST_MAIN(tst_QTextDocumentLayout) #include "tst_qtextdocumentlayout.moc" |