aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickiconlabel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Minor performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | * Add const & to function parameters * Add const & to variables assigned from functions that return const & Change-Id: Ibf35e54ffb78f164493222125411f2ba279cb861 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIcon: Add support to cache a pixmapMikhail Svetkin2019-01-221-0/+2
| | | | | | | [ChangeLog][Controls] Added cache property to icon. Change-Id: I9b3410e74ab8962d039939a8e005a2aff8e026cb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix QQuickIconLabel's baselineOffsetMitch Curtis2018-12-031-0/+3
| | | | | | | | | Set it to the bottom of the text if there is text. Change-Id: I03e14ec587e0868e1f2104dd464591b243ea9264 Fixes: QTBUG-71554 Reviewed-by: Pierre-Yves Siret <gr3cko@gmail.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Controls: use C++11 default member initializationJ-P Nurmi2018-05-041-14/+0
| | | | | Change-Id: Ief81868a8d314f7e7722fc0cb6670ae0dc4da50f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: fix alignmentJ-P Nurmi2017-11-151-0/+16
| | | | | | | | | | | | QQuickIconLabel is a wrapper around QQuickText & QQuickImage. While the alignment is mostly handled by layouting the internal QQuickText and QQuickImage instances, it must also propagate the alignment so that the text and image elements themselves also apply the correct content alignment. Task-number: QTBUG-64492 Change-Id: Ieb9d26fce703247bc6e2e61fa38e44c29937d1ad Reviewed-by: Liang Qi <liang.qi@qt.io>
* Visualize mnemonicsJ-P Nurmi2017-11-021-1/+2
| | | | | | | | | | | | | | | | | Unfortunately this comes a bit late in the 5.10 cycle, but this should be released together with the rest of the mnemonics stuff going out in 5.10, because it affects the value of AbstractButton/Menu(Bar)Item::text. As the removed TODO comments and altered tests indicate, previously the ampersand was blatantly stripped out. It would be worse to change it later once people have already started using mnemonics and rely on the behavior in custom styles. The necessary modifications to QQuickText were added in qtdeclarative commit 65ef4ba. Task-number: QTBUG-61422 Change-Id: Iaa73da8c012e9a6019743cf98f5bdc02527064e5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: ensure that icon color changes are respectedMitch Curtis2017-05-151-9/+2
| | | | | | | | | | | updateIcon() is no longer called, so we can move its contents into syncImage(), which is called by updateOrSyncImage(), which is called by QQuickIconLabel::setIcon().. which is called each time any of the icon properties change (now that it's a value type). Task-number: QTBUG-60807 Change-Id: Id1ff875e0855bd76755d49466f82c2eac36ffd09 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Make QQuickIcon a value typeJ-P Nurmi2017-05-101-31/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickIcon no longer inherits QObject, but becomes a light-weight implicitly shared Q_GADGET-type, that is passed by value the same way fonts and colors are. Before: SUB: OS: Fedora 25 (Workstation Edition) SUB: QPA: xcb SUB: GL_VENDOR: Intel Open Source Technology Center SUB: GL_RENDERER: Mesa DRI Intel(R) Haswell Desktop SUB: GL_VERSION: 3.0 Mesa 13.0.4 SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 110 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: 109 frames SUB: Average: SUB: 109.2 frames; using samples; MedianAll=109; StdDev=0.447214, CoV=0.00409536 After: [...] SUB: running: benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml SUB: 123 frames SUB: 124 frames SUB: 124 frames SUB: 122 frames SUB: 125 frames SUB: Average: SUB: 123.6 frames; using samples; MedianAll=124; StdDev=1.14018, CoV=0.00922472 Change-Id: I604532204fb94fc0726d0c9b8b6097f9ebc265e8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconImage: fix file selectors for named theme iconsJ-P Nurmi2017-04-261-0/+1
| | | | | | | | | QQuickIconImage needs to be associated with a QML context to be able to call QQmlContext::resolvedUrl(), which in turn passes it to the URL interceptor aka. QQmlFileSelector. Change-Id: Iff34fb8316c765ac0ff04d5d7a6ab23002b31385 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: reduce the amount of implicit size re-calculationJ-P Nurmi2017-04-121-7/+13
| | | | | | | | | | | | | | Before: Average: 124.6 frames; using samples; MedianAll=125; StdDev=0.894427, CoV=0.00717839 After: Average: 134 frames; using samples; MedianAll=134; StdDev=0.707107, CoV=0.00527692 Task-number: QTBUG-59746 Change-Id: I67dac9e51aba908e2a22f64a2b2c906d4a6b573b Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickIconLabel: use QStringLiteral instead of QLatin1StringJ-P Nurmi2017-04-121-2/+2
| | | | | Change-Id: I4028890dafcd4c79b26a9592045d5e2825dd100d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickIconLabel: create icon and label items lazilyJ-P Nurmi2017-04-111-61/+234
| | | | | | | | | | | | | | Before: Average: 120.2 frames; using samples; MedianAll=120; StdDev=0.447214, CoV=0.00372058 After: Average: 129.8 frames; using samples; MedianAll=130; StdDev=0.447214, CoV=0.00344541 Task-number: QTBUG-59746 Change-Id: I44b521688cd60e7e287968828f9d4062cc642a0d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Implement QQuickIconLabel::TextUnderIconJ-P Nurmi2017-04-111-3/+41
| | | | | | | This will be the default for TabButton and RoundButton. Change-Id: I9ccb0d35f33a80fe7e3da26617ed6f42232afe17 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add QQuickIconLabel::alignmentJ-P Nurmi2017-04-111-29/+71
| | | | | | | | The contents of menu items and item delegates must be aligned to the left in left-to-right UIs, or to the right in right-to-left UIs. Change-Id: Ib4064f6a8162306d446189cadebb80e12d3cd35d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickIconLabel: don't post-pone implicit size calculationJ-P Nurmi2017-04-101-4/+0
| | | | | | | | | | | | | QQuickText is optimized to avoid unnecessary implicit size calcuation. It can make a big difference whether QQuickText::implicitWidth() is called while the text element is complete. "Bind" to QQuickText's implicit size directly to let it apply the optimization tricks. This way QQuickTextPrivate::setupTextLayout() is called only once during the construction of QQuickIconLabel. Only layouting is post-poned until component completion anymore. Change-Id: Ide6bbddadf7d36ab908064b8545e1b4ed9474455 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: use setSize() and setPosition()J-P Nurmi2017-04-101-16/+16
| | | | | | | | | Calling setWidth() & setHeight() or setX() & setY() calls the virtual geometryChanged() method twice. Calling setSize() or setPosition() does the move/resize operation in one go. Change-Id: I136b9be1443e6ec11407081010aadc493417c627 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Micro-optimize QQuickIconLabelJ-P Nurmi2017-04-101-15/+12
| | | | | | | | | | | | Reduce indirection between the public and private objects. Things like width, height, and componentComplete can be accessed directly in the private object instead of asking them from the public object, which in turn asks them from the private object. Furthermore, when direct access is available on the stack, reference directly instead of repeatedly via the d-ptr. Change-Id: Idbb40bc86ebff7b7b22e21050941afd6f0027bfe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickIconLabel: rename text property to labelMitch Curtis2017-04-081-34/+34
| | | | | | | | In preparation for the next patch which adds a "QString text" property to the API. Change-Id: Ie904108353c37a02cbc992c067f3e09aed9c2497 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickIconLabel: remove change signalsMitch Curtis2017-04-081-11/+0
| | | | | | | No QML code relies on these. Change-Id: I9311d80b8d53914e1db7aa37ed9388c279f0563a Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Rename QQuickDisplayLayout to QQuickIconLabelMitch Curtis2017-04-071-0/+417
There are some performance improvements planned that require changes to the class, resulting in it no longer being a layout "container". Change-Id: Ie29f2f95eebb64b3b018746f93763fdbe79625f0 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>