summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Port from devicePixelRatioF() to devicePixelRatio()Morten Johan Sørvig2020-09-101-3/+3
| | | | | | | This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix compiler issues when qreal is floatMichal Klocek2020-08-051-2/+2
| | | | | Change-Id: Ide3b5a3b0f2d93708409edac8aa999eb25c3ab54 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-9/+9
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QPainter: replace manual memory management [1/5]: dummyStateMarc Mutz2020-06-021-1/+0
| | | | | | | Use a unique_ptr to indicate ownership. Change-Id: I15e8c48fac1424d5605e869adcfba6965b16c218 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Specify QTextOption behavior in drawTextPaul Wicking2020-05-121-1/+2
| | | | | | | | | | Be more specific about overriding behavior when using the drawText overload that takes a QTextOption argument. Fixes: QTBUG-41894 Pick-to: 5.15 Change-Id: I8b38cb383005f1a07f4c6d70050e0d2cbb551521 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QtGui: fix deprecated QChar conversionsMarc Mutz2020-05-111-1/+1
| | | | | | | | | Conversions from non-char-types to QChar are going to be deprecated. Use QChar::fromUcs2(), fromUcs4(), QLatin1Char(), or convert the constructor argument to char16_t. Change-Id: Ib45ebd5560aa3a2bc460037ab09773607485c6e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove a bunch of deprecated members from src/gui/painting classesVolker Hilsheimer2020-05-061-170/+0
| | | | | | | | Also remove dead code that isn't compiled anymore in Qt 6 builds. Change-Id: I7a7ae35e61fb2ad9cc21180fb7224357ade1505f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use qsizetype for size related methods in QVarlengthArrayLars Knoll2020-03-141-2/+1
| | | | | Change-Id: Ib94b9a4e6e17da21f592e71a36fd1b97d42dfe62 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Get rid of QMatrixJarek Kobus2020-02-281-227/+3
| | | | | | Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace the QMatrix field of QTransform with qreal[3][3]Jarek Kobus2020-02-071-3/+3
| | | | | | | | | | | Remove temporarily the reference returned by QTransform::toAffine() since we don't keep the QMatrix object internally anymore. This is done in order to compile the rest of the code. The follow-up patch is going to remove that method completely. Task-number: QTBUG-81628 Change-Id: If7140eedb7582d81ac8da529017cf792174e86ab Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make text decorations consistent between ways of drawing textEskil Abrahamsen Blomfeldt2020-02-071-80/+71
| | | | | | | | | | | | | | | | | | | | | | | | | The drawGlyphRun() and drawStaticText() functions would calculate the horizontal origin of the decorations based on the left-most edge of the left-most glyph, in practice including the left bearing of that glyph in the position. But in drawText()/QTextLayout it will always be drawn from the position given as input by the user of the function. The inconsistency was detected in an upgrade of Harfbuzz NG, where the tests on macOS would get a -0.05 left bearing, and as a result the decorations would be painted one pixel to the left in drawGlyphRun()/drawStaticText() compared to QTextLayout. It is not a big deal in practice, but in order to get the Harfbuzz update in, we fix the inconsistency now, by passing the user-input position into the decoration function. This was also an opportunity to consolidate the two code paths, and to unexport the qt_draw_decoration_for_glyphs() symbol, which was exported in Qt 4 only to be usable by Qt Quick 1. Change-Id: I243404b2710ae378e84d7587efae719da3879944 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate all methods that use QMatrixJarek Kobus2020-01-281-3/+5
| | | | | | | | | | | Don't use QMatrix in implementation classes anymore. Task-number: QTBUG-46653 Fixes: QTBUG-81627 Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-181-2/+1
|\ | | | | | | Change-Id: I12148e7b20bcdb72d9b328035d528c99633b1e92
| * Doc: Fix qdoc compilation errors qtbaseNico Vertriest2020-01-171-2/+1
| | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I5a39525e3e735415ba96e2d585c5de754deb15de Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-27/+27
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Avoid initializing QFlags with 0 or nullptr in further casesFriedemann Kleint2019-11-221-9/+2
| | | | | | | | | | | | | | | | | | Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Where applicable, port over to member initialization, thus also fixing nullptr warnings. Change-Id: Iaaf2dbbbcf2952253390b8839fd15a1b17be32c0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-8/+8
|/ | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-231-1/+1
|\ | | | | | | | | | | | | Conflicts: src/widgets/styles/qstylesheetstyle.cpp Change-Id: If11da7799075cc2d5768da5603c5fc46773c4eae
| * QPainter: Avoid leaking memory on unbalanced save/restoreEirik Aavitsland2019-09-201-1/+1
| | | | | | | | | | | | | | | | | | If a QPainter ended without all saved states having been restored, the state stack would leak memory. Fixes: QTBUG-77843 Change-Id: I760904d6391de24a4867be54fa1bebf76be14ba7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Replace QPainter::initFrom() with begin()Christian Ehrlicher2019-06-131-11/+17
|/ | | | | | | | | | | | | | | | | | | It's deprecated since e56401818b1aae9856a5334f530c4eda33788429 but still needed for QWidget rendering - therefore move it to QPainterPrivate. Change-Id: I35880ffa22830c2921c6675b1acf7e4ca38601db Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix some QPainter-related deprecation warningsFriedemann Kleint2019-02-081-3/+3
| | | | | | | | | | | | | | | | text/qtextdocument.cpp:2666:48: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] text/qtextdocumentfragment.cpp:545:87: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] text/qtextdocumentfragment.cpp:546:68: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] painting/qpainterpath.cpp:3321:34: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] painting/qpainterpath.cpp:3342:48: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] painting/qpainterpath.cpp:3366:47: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] painting/qpainter.cpp:4233:49: warning: ‘void QPainter::drawRoundRect(const QRectF&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] painting/qpainter.cpp:8349:27: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations] painting/qpdf.cpp:1545:28: warning: ‘void QDataStream::unsetDevice()’ is deprecated: Use QDataStream::setDevice(nullptr) instead [-Wdeprecated-declarations] widgets/qtabbar.cpp:2096:17: warning: ‘void QPainter::initFrom(const QPaintDevice*)’ is deprecated: Use begin(QPaintDevice*) instead [-Wdeprecated-declarations] Change-Id: I76d98ea8146e7586d3763a5610781c7736d37204 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Add deprecation exclusion around deprecated calls in deprecated codeFriedemann Kleint2019-02-061-0/+3
| | | | | | | | | | | | Fix: io/qdir.cpp:1087:16: warning: ‘static void QResource::addSearchPath(const QString&)’ is deprecated: Use QDir::addSearchPath() instead [-Wdeprecated-declarations] io/qprocess.cpp:1178:34: warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations] image/qpixmap.cpp:997:48: warning: ‘static QPixmap QPixmap::grabWidget(QObject*, const QRect&)’ is deprecated: Use QWidget::grab() instead [-Wdeprecated-declarations] text/qfont.cpp:2218:29: warning: ‘QString QFont::lastResortFamily() const’ is deprecated [-Wdeprecated-declarations] itemviews/qitemdelegate.cpp:1008:41: warning: ‘static QPixmap* QPixmapCache::find(const QString&)’ is deprecated: Use bool find(const QString &, QPixmap *) instead [-Wdeprecated-declarations] Change-Id: I51259edc175b1f55f61ded3af50ebfffd8c304a8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QtGui: replace 0 with \nullptr in documentationChristian Ehrlicher2019-02-021-1/+1
| | | | | | | | | Replace 0 with \nullptr in the documentation. As a drive-by also replace some 0 with nullptr in the corresponding code. Change-Id: Ieffbfffa76e3018257b667a3e8ad6e3b88486cde Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtGui/QPainter: mark obsolete functions as deprecatedChristian Ehrlicher2019-02-021-2/+20
| | | | | | | | | | | | | | Mark some long obsolete functions as deprecated so the can be removed with Qt6: - initFrom() - setMatrix()/matrix()/deviceMatrix()/resetMatrix() - setWorldMatrix()/worldMatrix()/combinedMatrix() - setMatrixEnabled()/matrixEnabled() - drawRoundRect() - setRedirected()/redirected()/restoreRedirected() Change-Id: I0daed72c0ef06c192309f02366a7201154e75ac9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QtGui: mark obsolete QPixmapCache::find() functions as deprecatedChristian Ehrlicher2019-02-021-1/+1
| | | | | | | | | QPixmapCache::find(QString) and QPixmapCache::find(QString, QPixmap&) are deprecated since Qt4 times. Explicit mark them as deprecated so they can be removed with Qt6. Change-Id: Iaf185f69afe02203559a1c812fbb4a95c9049a1d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add support for generating PDFs with losslessly encoded imagesAndre de la Rocha2018-10-251-0/+7
| | | | | | | | | | | | This patch adds the QPainter::LosslessImageRendering flag to QPainter::RenderHints and allows QPdfEngine to recognize it and encode images using a lossless data compression algorithm provided by zlib instead of using lossy JPEG compression, which can produce artifacts with some images. Task-number: QTBUG-54809 Change-Id: If9e2bc64da3bf3afcd5d6c74f0ee82336ef05a19 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Fix typo and add precision to method descriptionPaul Wicking2018-09-121-2/+3
| | | | | | | | | As transform() returns worldTransform(), point out that it is an alias in its description. Fixes: QTBUG-18117 Change-Id: I0eb1f78c6955b499906024105f9969cdccf13303 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Add ObjectMode coordinate mode to QGradientEirik Aavitsland2018-06-221-7/+11
| | | | | | | | | | | | | | | | | | | | | | The ObjectBoundingMode coordinate mode of QGradient allows specifying the gradient coordinates relative to the object being painted. But if the gradient brush also has a transformation, that transformation is applied in the logical, not object, coordinate space. That behavior is counterintuitive. However, changing it now would break existing code. Instead, we introduce a new coordinate mode enum with the expected behavior, and document the old one as deprecated. This prepares to fix the bugs below in qtsvg, by making it possible to specify the same behavior in Qt as SVG has. [ChangeLog][QtGui][QGradient] Add ObjectMode coordinate mode [ChangeLog][Important Behavior Changes] QDataStream version bumped up to 18 to account for changes in the serialization of QGradient. Task-number: QTBUG-59978 Task-number: QTBUG-67995 Change-Id: I8820a2555359812f3e1a46e37d6ac2cc29a2091d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Provide presets for QGradientTor Arne Vestbø2018-05-311-0/+31
| | | | | | | | | | | | | Similar to Qt::GlobalColor, the presets allow the user to create brushes based on predefined gradients, quickly getting pretty pixels on screen. The presets are based on the linear gradients from WebGradients, a free collection of gradients, hosted at https://webgradients.com/. The few radial and blended gradient presets have been excluded. Change-Id: I1ce8f2210a6045c9edb8829ab3eddcc313549127 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* High-dpi drawTiledPixmap (raster paint engine)Morten Johan Sørvig2018-04-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement more consistent behavior for drawTiledPixmap(), which should produce the same visual tiling pattern independent of display devicePixelRatio Consider the following pixmaps and draw calls: QPixmap px32; // 32x32 QPixmap px64; // 64x64 drawTiledPixmap(QRect(0, 0, 128, 128), px32); drawTiledPixmap(QRect(0, 0, 128, 128), px64); On 1x displays this will produce 4x4 and 2x2 tiles, respectively. On 2x displays this would previously produce a different tiling pattern, where the paint engine would tile in the device pixel coordinate system. Change this to tile in the device independent coordinate system, producing the same visual tiling pattern as the 1x case. It is possible to produce a 4x4 tiling pattern with high-resolution output from the 64x64 pixmap by setting the devicePixelRatio: QPixmap px64; px64.setDevicePixelRatio(2); drawTiledPixmap(QRect(0, 0, 128, 128), px64); This change adds an inverse scale to the image filler transform that accounts for the pixmap devicePixelRatio. [ChangeLog][QtGui] QPainter::drawTiledPixmap() now tiles in the device independent coordinate system. Change-Id: I4918d274192967f222f181b374571c7c597dcd76 Reviewed-by: Jonathan Courtois <jonathan.courtois@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: 石博文 <sbw@sbw.so> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix drawTiledPixmap() and texture-brush painting with high-DPR imagesEirik Aavitsland2018-04-251-0/+7
| | | | | | | | | | | | | | Although QPainter::drawImage()/drawPixmap() would render images scaled according to their devicePixelRatio(), that would not happen for drawTiledPixmap() and when using a textured brush. Implemented here, in combination with the pending "High-dpi drawTiledPixmap (raster paint engine)" commit. [ChangeLog][QtGui] Fix drawTiledPixmap() and texture-brush painting with high-DPR images Task-number: QTBUG-67248 Change-Id: I037e3f897fa708038a0222d3b0c61c7842d87961 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Silence a GCC 8 warning in qpainterVille Voutilainen2018-02-281-2/+2
| | | | | | | | qtbase/src/gui/painting/qpainter.cpp:5625:68: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct QFixed’; use assignment or value-initialization instead [-Werror=class-memaccess] memset(advances.data(), 0, advances.size() * sizeof(QFixed)); Change-Id: I563b1b0c5dfaf381a9521bc9a4dc3197f0f38d11 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use QColor(0, 0, 0, 0) to mark body text in QStaticTextIgor Mironchik2018-01-201-4/+9
| | | | | | | | | | | | | | | | | | | QStaticTextPrivate::paintText() now uses QColor(0, 0, 0, 0) to mark body text. QPainter's pen color was used before this commit (that was always black) that leads to different colors of body text if, for example, links are in body (first block painted with correct color set by QPainter::setPen() but after link body text was always black). Now QPainter::drawStaticText() will draw body text with set pen in any case. [ChangeLog][QtGui][Important Behavior Changes] Fixed a bug where QStaticText would not use the QPainter's pen color for text when other text colors were also in use. Internally this reserves QColor(0, 0, 0, 0) for use with QStaticText. Task-number: QTBUG-45957 Change-Id: If3e180e3083cdac1b4236e738acd15572f19ab69 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* doc: Add missing return types to \fn commandsMartin Smith2018-01-181-5/+5
| | | | | | | | | Added void return type to several \fn commands. The return type should always be included with the \fn command in clang-qdoc. Change-Id: Ie751eb1430eff668f33f8d86e0b1454bd1d2f582 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Paint text decoration where the text isAllan Sandfeld Jensen2017-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | For multi text-item texts we should render the text decoration at the same position as the text-item part is, and not always from the beginning of the line. Task-number: QTBUG-60422 Change-Id: I9aa58fc164122ad1fae9716b8b18bdfbbbd778a9 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Update usage of QFontMetrics::width() to new APIEskil Abrahamsen Blomfeldt2017-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QFontMetrics(F)::width() has been deprecated and is replaced by horizontalAdvance(). This updates all usage of it in tests and documentation. It is worth noting that many or most of the usages of QFontMetrics::width() probably intended to use boundingRect().width(), but since it currently works, I have not looked into that, just replaced the function name mechanically. Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add QFontMetrics(F)::horizontalAdvance() functionEskil Abrahamsen Blomfeldt2017-11-141-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | A source of constant confusion is the QFontMetrics::width() function, which does not return the bounding width of the text, but the advance width. We deprecate this and add horizontalAdvance() instead, to avoid the confusion in the future. Note that there was an internal width() overload which was only there for the purpose of supporting the Qt::TextBypassShaping flag. This flag has already been replaced by public API, so no such overload is added. Instead, we deprecate the TextBypassShaping flag as well, which makes sense, since a replacement has been made. Also note that there was a consistency problem with QFontMetrics and QFontMetricsF, which are supposed to be interchangeable. The QFontMetrics::width() functions for strings took an optional int length argument, while the floating point version did not. This error is corrected in the advance() functions. [ChangeLog][QtGui][Text] Added QFontMetrics::horizontalAdvance() and QFontMetricsF::horizontalAdvance() to replace the confusingly named width() function. The latter has now been deprecated. Change-Id: I0dfda43aa65c8235be32c62fade82cae05b29c79 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-161-0/+2
|\ | | | | | | Change-Id: I3cf73c53cf131d0babfb558c2507bed0e0fc5f08
| * QPainter: fix invalid pen style when drawing misspelled wordsDavid Faure2017-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code asks the platform theme to resolve SpellCheckUnderline to an actual pen style (wave, solid, dash, etc.) but if there's no theme, or if the default implementation in QPlatformTheme is used, the value is still SpellCheckUnderline, which then casted to a PenStyle below in qpainter.cpp: pen.setStyle((Qt::PenStyle)(underlineStyle)); The value 7 is an invalid PenStyle, which leads to random behavior when drawing the underline. Make it WaveUnderline if the platform theme had no opinion on how to draw it. Change-Id: I4f02f9b58f10582cee5aefce7a4d5cd300133140 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance propertyEskil Abrahamsen Blomfeldt2017-08-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt, we have QTextOption::tabStop, QTextEdit::tabStopWidth and QPlainTextEdit::tabStopWidth. Neither are very good names, since the tab stop is neither a numerical value as in the former, nor does it have any dimensions that can be measured, as in the latter. Vertical text advances may also be supported by Qt at some point in the future, at which point the name would make even less sense. At the same time, we expose the actual type of the tab stop distance as floating point in the QTextEdit and QPlainTextEdit API instead of always rounding it to an int. To avoid duplicating either of these APIs in Qt Quick, we introduce tabStopDistance as the common term instead and deprecate the old names. [ChangeLog][Text] Introduced tabStopDistance property in QTextOption, QTextEdit and QPlainTextEdit as replacement for the inconsistently named tabStop and tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth and QPlainTextEdit::tabStopWidth have subsequently been deprecated. Change-Id: Ib7e01387910cddb58adaaaadcd56c0e69edc4bc2 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add API to disable text shaping on fontsEskil Abrahamsen Blomfeldt2017-07-261-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | In the past, we had an undocumented text flag that worked with one of the QPainter::drawText() overloads. This was never intended as public API and served a specific cause in Qt WebKit at one point. But there is a general need for such API, as disabling shaping features easily gives 25% performance improvement on text rendering even for fairly short strings. This patch adds a new style strategy flag to disable shaping and will just uses the CMAP and HDMX tables to get glyph indices and advances for the characters. In Qt 6, the TextBypassShaping flag can be removed completely and be replaced by the style strategy. [ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support improvements to performance at the expense of some cosmetic font features. Task-number: QTBUG-56728 Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix documentation typosChristian Gagneraud2017-02-251-1/+1
| | | | | | | | | | This patch fixes 2 simple typos in QGraphicsItem and QPainter documentation and a copy/paste error between QAbstractItemModel's beginRemoveColumns and beginRemoveRows documentation. Change-Id: I32bdc4dc69154a40fe30a5b8c08d0c3a001853f8 Reviewed-by: Harri Porten <porten@froglogic.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix clipping error on some RTL textEskil Abrahamsen Blomfeldt2017-01-311-1/+0
| | | | | | | | | | | | | | | | | | There was a false assumption that the bidi level of text is only used for visualizing the text, not for calculating its bounding box. But the bidi level is required for shaping (indeed many OpenType rules check for reading direction) and the glyphs used to represent a given text may be different based on its directionality. The effect would be that the bounding rect we calculated for text would sometimes be too small for RTL text, and we would end up clipping pixels. [ChangeLog][QtGui][Text] Fixed clipping errors and too small bounding rects for some right-to-left text. Task-number: QTBUG-48005 Change-Id: Idd12ae1b0033d518034b582204ba47ae41795293 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix decorated text in extra-selectionsEskil Abrahamsen Blomfeldt2016-10-241-1/+2
| | | | | | | | | | | | | Change ddef89b323e8507ea5f451cb53ed151e29a110b3 broke decorations set using setExtraSelections(), because these decorations are drawn with a second drawTextItem() call where numGlyphs is set to 0. When the drawTextDecoration() call was moved into the branches for multi/no-multi font engines, the call for the cut-off when numGlyphs == 0 was unintentionally removed. Task-number: QTBUG-54626 Change-Id: Ieb9fc23099a9d7daf87cc364d3fc9da128ec516d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-6/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-5/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| | * Correct compositionMode documentationAllan Sandfeld Jensen2016-05-231-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Most composition modes require an alpha-channel to be meaningful, but not all, and there is no requirements of specific formats. Change-Id: I11e930ccc07e9ff5df06dbda6745e4afb79f5e08 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
| * | Gui: use const (and const APIs) moreAnton Kudryavtsev2016-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-231-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/wince80colibri-armv7-msvc2012/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/corelib/global/qnamespace.h src/corelib/global/qnamespace.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/tools/tools.pri src/network/ssl/qsslconfiguration_p.h src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/plugins/platforms/windows/windows.pri src/src.pro src/tools/bootstrap/bootstrap.pro src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/dialogs/qfilesystemmodel.cpp tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5