summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make QStaticText honor QPainter::pen() for rich text on X11 w/rasterEskil Abrahamsen Blomfeldt2010-09-201-1/+4
| | | | | | | | | | | The document layou will call setPen() with the PaintContext's text color. If this is different from the current painter settings, the pen will be passed on to the paint engine. The result was that, on X11 using the raster (or opengl) engine, QStaticText would record the pen as changed even when it hadn't explicitly been changed by the document. Task-number: QTBUG-13740 Reviewed-by: Samuel
* Fix crash when using unprintable chars in QStaticTextEskil Abrahamsen Blomfeldt2010-09-101-2/+1
| | | | | | | | | The assumption that the output glyph array and input glyph array is of equal size is wrong when unprintable characters are used (and discarded in getGlyphPositions()) Task-number: QTBUG-12614 Reviewed-by: Jiang Jiang
* Fix QStaticText copy constructor to also copy text option propertyEskil Abrahamsen Blomfeldt2010-09-031-3/+3
| | | | | | | | | The text option property of QStaticText was not copied in the copy constructor, so when the text was detached, the property would be reset to the default. Task-number: QTBUG-13368 Reviewed-by: Gunnar
* doc: Clarify documentation of QStaticTextEskil Abrahamsen Blomfeldt2010-08-091-4/+12
| | | | | | | | | There has been some confusion concerning what HTML tags can be used when using the rich text format with QStaticText. This patch attempts to make it clearer in the documentation that the tags have to be text related. Reviewed-by: Samuel
* Fix crash when setting font decorations on text drawn with QStaticTextEskil Abrahamsen Blomfeldt2010-08-021-1/+6
| | | | | | | | | | Qt has a run-time assert for implementing drawPolygon() in any subclass of QPaintEngine, which will be hit if set font decorations on the font used by QStaticText. Since we don't care about line decorations or any other shapes drawn in the QTextLayout, we simply leave the implementation empty. Reviewed-by: Gunnar
* doc: Fix qdoc errors for text related filesEskil Abrahamsen Blomfeldt2010-07-201-3/+1
| | | | | | | | QTextBlock::layoutDirection() doesn't exist, and the QStaticText constructor no longer takes a size argument. Task-number: QTBUG-12072 Reviewed-by: Fabien Freling
* Remove qMemCopy() usage from all .cpp files of Qt itself.Robin Burchell2010-07-181-6/+6
| | | | | | | | This is (supposedly) more efficient as the compiler can optimise it to a builtin, per Thiago. Merge-request: 2430 Reviewed-by: Andreas Kling <andreas.kling@nokia.com>
* Fix compiler warnings in QtGui (text,painting).Friedemann Kleint2010-06-211-5/+4
| | | | Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Add QTextOption API to QStaticTextEskil Abrahamsen Blomfeldt2010-06-141-4/+30
| | | | | | | | | | | To allow more control over the layout process for a QStaticText, introduce a QTextOption API. This will allow you to, e.g., set an alignment for the text layout. Patch also contains a couple of bug fixes to make right alignment work correctly when you set a text width on the QStaticText. Task-number: QTBUG-9031 Reviewed-by: Samuel
* Speed up QStaticText with affine transformation on GL2 engineEskil Abrahamsen Blomfeldt2010-06-011-14/+23
| | | | | | | | | | | | | | | | | | | | Since the OpenGL2 paint engine supports transforming the prerendered glyphs rather than rasterizing the glyphs with the transformation applied, we don't need to recalculate the QStaticText layout whenever the transformation changes. This means that we can do fast animated transforms for QStaticText on this paint engine. A quick test yields something like 100x speed-up on Windows. This also give visually better results, as we previously would animate the hinting of the glyphs, thus causing jittering. The autotest has been updated to reflect the fact that drawText() and drawStaticText() now go through identical paths on GL, also when transforms are set on the painter. However, the scale was changed in one test, because it was so great that drawText() would fall back to paths. With QStaticText the idea is speed, so you'll get a poor, but fast result instead, which is better than tricking people. Reviewed-by: Samuel
* Replace memmove with memcpyEskil Abrahamsen Blomfeldt2010-05-271-6/+6
| | | | | | | qMemCopy is faster than memmove, and there's no chance of overlapping source and destination memory in these cases. Reviewed-by: Samuel
* Optimize initialization of QStaticTextEskil Abrahamsen Blomfeldt2010-05-271-77/+86
| | | | | | | | | | Since QStaticText would be created once and used often, not much thought was put into optimizing its initialization. For simplicity, the code would do two drawText() passes. Since this was an unnecessary overhead, the extra pass has been removed and replaced by memmoves instead. Initialization is now twice as fast. Reviewed-by: Samuel
* Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-04-181-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (71 commits) Autotest: increase wait time to 3s on Windows to bypass 2s-granularity limitation Autotest: update to the new values for the locale do not expand variables in read()'s file name remove ability to use break() a block outside any loop don't add -unix to the qmake command line Increase the timeout for the QNAM getter test to 30 seconds Remove unstable hosts from the list qdoc: Output TOC for more class ref pages. Other fixes to the remote network stresstester Fix SSL connection problem. Make sure we don't try URLs that aren't HTTP or HTTPS Fix menu bar visibility. Add SSL remote host tests Split the remote and the local tests in two, in preparation for SSL tests Add tests for remote hosts Change the way we calculate the average transfer rates. Finish renaming Move these tests to tests/manual. Add a QNetworkAccessManager stresstest Add a non-blocking native function too ...
| * Fix building of corelib, network and gui with qconfig minimal.Aaron McCarthy2010-04-161-0/+2
| | | | | | | | | | | | | | | | The bearer management code, which this bug is for, was fixed by MR 517 previously. Task-number: QTBUG-9493 Reviewed-by: alex
* | Further RVCT4 fixes for SymbianIain2010-04-161-2/+2
|/ | | | | | | More corrections to declarations to ensure symbol visibility is correct Task-number: QTBUG-9998 Reviewed-by: TrustMe
* Fix gcc compile warning in qstatictext.cppEskil Abrahamsen Blomfeldt2010-04-141-1/+1
| | | | | | Synchronize order of initialization with order of declaration. Reviewed-by: TrustMe
* Merge remote branch 'origin/4.7' into 4.7Olivier Goffart2010-04-011-0/+4
|\ | | | | | | | | Conflicts: src/gui/text/qstatictext.cpp
| * Fix compile error with QT_NO_TEXTHTMLPARSER in QtGuiTasuku Suzuki2010-03-261-1/+4
| | | | | | | | | | Merge-request: 528 Reviewed-by: Zeno Albisser
* | Support the pen set on the painter in QStaticText when using rich textEskil Abrahamsen Blomfeldt2010-03-301-0/+5
| | | | | | | | | | | | | | | | | | When using rich text, QStaticText should still respect the painter's pen color as the default. Since QTextDocument does not respect the pen set on the painter, we need to set its default style sheet to include the pen color as well. Reviewed-by: Olivier
* | Make QStaticText layout lazyEskil Abrahamsen Blomfeldt2010-03-291-27/+37
| | | | | | | | | | | | | | | | | | | | | | | | To avoid the unnecessary overhead of doing the text layout every time a part of the QStaticText object is changed, we mark it as invalid instead and do the layout when we have to. This means an overhead on the first paint event for most users. The overhead can be avoided by using the QStaticText::prepare() function and will probably not be noticable anyway, since it's a one-time thing. Task-number: QTBUG-9030 Reviewed-by: Gunnar
* | Change QStaticText::setMaximumSize() to setTextWidth()Eskil Abrahamsen Blomfeldt2010-03-291-37/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid having to precalculate the height of the laid out text, we now only supply a maximum text width to QStaticText. The only usage of the maximum height would be to clip the results, and clipping should be set separately from the QStaticText call, since this has no impact on the layout of the glyphs. The tests have been updated to reflect the change in logic. We also need a consistent way of specifying the position of the text. Before, the position meant "baseline position" for unbroken text and "top left position" for text with a specified layout width. We want to be consistent, and since baseline position makes no sense for multiline text, we standardize on top left position. Task-number: QTBUG-9029 Reviewed-by: Gunnar
* | Respect QPainter::pen() in QPainter::drawStaticText()Eskil Abrahamsen Blomfeldt2010-03-291-3/+12
| | | | | | | | | | | | | | | | | | | | QStaticText needs to support changing the pen on the painter to support rich text, but it should not override the pen unless it has been explicitly set in the rich text. We do this by marking the pen as dirty in updateState() when we record the text items. Task-number: QTBUG-8908 Reviewed-by: Gunnar
* | Synchronize rich text and plain text code paths in QStaticTextEskil Abrahamsen Blomfeldt2010-03-261-2/+4
|/ | | | | | | | | | | Drawing a string as plain text and rich text should have identical results unless special formatting information is added in the html. This means we should not have any implicit margin on the QTextDocument used to paint the text, and we should make up for the fact that the drawStaticText() call currently takes the position of the baseline and QTextDocument::drawContents() takes the top-left corner. Reviewed-by: Gunnar
* doc: Fixed several qdoc errors.Martin Smith2010-03-091-2/+4
|
* Avoid always detaching QStaticTextEskil Abrahamsen Blomfeldt2010-02-241-2/+0
| | | | | | | | | | As a left over from when the d pointer was a plain pointer and not a QExplicitlySharedPointer, we were setting the reference count to 1 on construction. Since QExplicitlySharedPointer handles the ref count, a newly constructed QStaticText would have a ref count of 2, and thus would always detach upon modification. Reviewed-by: Gunnar
* Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2Eskil Abrahamsen Blomfeldt2010-02-221-9/+12
|\
| * Fix fallback for QStaticText when it's unsupported in paint engineEskil Abrahamsen Blomfeldt2010-02-191-6/+9
| | | | | | | | | | | | | | | | When the paint engine does not support QStaticText, we fall back to regular drawText() calls. This fallback would previously paint all text to (0, 0). This fixes the qstatictext autotest on Linux. Reviewed-by: Olivier
| * Fix warnings on gccEskil Abrahamsen Blomfeldt2010-02-181-3/+3
| | | | | | | | | | | | Gcc warns if declaration and initialization order are different. Reviewed-by: Samuel
* | Copy useBackendOptimization setting when QStaticText is detachedEskil Abrahamsen Blomfeldt2010-02-221-1/+1
|/ | | | | | | | When the QStaticText is detached, we would previously reset the value of useBackendOptimizations rather than copy it into the new data. Reviewed-by: Gunnar
* Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2Jason McDonald2010-02-161-32/+43
|\
| * Rename QStaticText::setUseBackendOptimizations to setPerformanceHint()Eskil Abrahamsen Blomfeldt2010-02-161-20/+27
| | | | | | | | | | | | | | Make the API more general and more readable by using a PerformanceHint enum instead of an on/off-trigger for the OpenGL-specific caching. Reviewed-by: Samuel
| * doc: Update documentation for QStaticTextEskil Abrahamsen Blomfeldt2010-02-161-12/+16
| | | | | | | | | | | | | | | | Make some smaller modifications, fixes and additions. Remove \internal because the API is public now, and add documentation for QPainter::drawStaticText() since this was missing. Reviewed-by: TrustMe
* | Fix license headers.Jason McDonald2010-02-161-18/+18
|/ | | | Reviewed-by: Trust Me
* Separate out textFormat property from setText() function and removeEskil Abrahamsen Blomfeldt2010-02-151-20/+35
| | | | | | | | | isEmpty() function in QStaticText To make the return value of text() more intuitively clearer, and to make the API more readable, I've separated out the text format into a separate property. The isEmpty() function seemed out-of-place in the API, as suggested by reviews, so it has been removed.
* Add API for rich text and getting actual size of QStaticTextEskil Abrahamsen Blomfeldt2010-02-141-22/+58
| | | | | | Required for several use cases, support for some html tags to change font, color and do advanced text layouts, as well as getting the bounds of the text when drawn.
* Make QStaticText public API againEskil Abrahamsen Blomfeldt2010-02-101-1/+1
| | | | | QStaticText was previously made private API to support inclusion in Qt 4.6.x. This change turns it back into public API for Qt 4.7.0.
* Temporarily remove QPainter::drawStaticText() for Qt 4.6.x integrationEskil Abrahamsen Blomfeldt2010-02-051-38/+44
| | | | | | | | | | | We can't add new symbols to QPainter for Qt 4.6.x, as we would not be able to remove them again if we regretted the API. Hence, I've made removable symbols instead, a private global function and a drawStaticText() in QPainterPrivate. In order to tie things together, I needed a static private-getter in QPainterPrivate, and hence it had to be a friend of QPainter. Reviewed-by: Trond
* Make QStaticText private APIEskil Abrahamsen Blomfeldt2010-02-011-1/+2
| | | | | | | | Turns QStaticText into private API in preparation for Qt 4.6.x. The related functions in QPainter are marked as internal in the docs. There are already internal functions in QPainter, so this seemed like a reasonable solution. Since the functions require QStaticText they will not be accessible to anyone who does not include private API.
* Don't compare bool to char (avoid warning on MSVC)Eskil Abrahamsen Blomfeldt2010-02-011-1/+2
| | | | Remove unsafe comparison since true is defined as non-zero only.
* doc: Add \since to QStaticTextEskil Abrahamsen Blomfeldt2010-02-011-0/+1
| | | | | QStaticText will be added as public API in Qt 4.7, and as private API in Qt 4.6.
* Improve performance of QStaticText on OpenGL by caching data on GPUEskil Abrahamsen Blomfeldt2010-01-291-0/+43
| | | | | | | | There's a big improvement to be seen in the OpenGL engine by caching the vertex data for the QStaticText in VBOs. In order to have the buffers properly disposed, I've implemented a userdata concept for QStaticTextItem. By default, the optimizations will be turned off, and can be turned on by using the useBackendOptimizations flag.
* Remove unused constructor in QStaticTextPrivateEskil Abrahamsen Blomfeldt2010-01-291-10/+0
| | | | The copy constructor for QStaticTextPrivate was never called.
* Initialize member variables in QStaticTextPrivate constructorEskil Abrahamsen Blomfeldt2010-01-291-0/+1
| | | | Avoid crash when copying a QStaticTextPrivate object
* CompileEskil Abrahamsen Blomfeldt2010-01-201-1/+1
| | | | | Compile QStaticText and also use font object in QPaintBuffer since it's now available
* Add font object to QStaticTextEskil Abrahamsen Blomfeldt2010-01-201-0/+1
| | | | This will be needed by OpenVG paint engine, and is useful elsewhere.
* doc: Add some performance hints to the documentationEskil Abrahamsen Blomfeldt2010-01-151-4/+11
|
* Fix crash when wrapping textEskil Abrahamsen Blomfeldt2010-01-151-1/+1
| | | | | | | | The two runs (counting the number of items and then storing the information) needs to be identical, so they need to have the same text flags set. Otherwise we would count more items than we actually generated and crash later when we tried to access an uninitialized item.
* Optimize drawStaticText() with rectangle destinationEskil Abrahamsen Blomfeldt2010-01-141-4/+11
| | | | | | | In order to be feature consistent with drawText(), we have to clip the text whenever the text expands beyond its borders. This is a performance hit, but luckily we can detect the cases where it's necessary before-hand.
* Add prepare() function to QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-0/+23
| | | | | | Allow the QStaticText layout to be completely defined prior to painting by introducing a function for setting the font and transform on the object ahead of using it with a QPainter.
* Implement drawStaticTextItem() in OpenGL paint enginesEskil Abrahamsen Blomfeldt2010-01-141-0/+2
| | | | | | | | | | | | The OpenGL and OpenGL2 engines now have support for static text, as well as the QEmulationPaintEngine. Also contains an optimization: Instead of passing both the position and glyph positions to drawStaticTextItem() we add the position into the glyph position and update it only when it changes. Otherwise we would have to do this work in all engines for every call. This means we have to cache the position in QStaticTextPrivate as well, but it seems like a small price to pay, since it's a per-text overhead and only 16 bytes.