Commit Graph

22 Commits

Author SHA1 Message Date
David Rosca
af2b27d1b8 IconItem: Add roundToIconSize property
Disabling this property makes it possible to show icon of arbitrary size.

Differential Revision: https://phabricator.kde.org/D4689
2017-02-28 11:18:17 +01:00
David Rosca
148ff6311b IconItemTest: Fix loadPixmap and loadImage tests
It only works on CI because data/test_image.png size
is the same as implicitSize of IconItem (KIconLoader::Dialog).

Differential Revision: https://phabricator.kde.org/D4702
2017-02-21 12:04:41 +01:00
Kai Uwe Broulik
8875a04a1b [Icon Item] Fix updating implicit size when icon sizes change
The old code was connecting the KIconLoader signal to implicitWidth/HeightChanged
but never actually set a new implicit size.
Also, while at it use "setImplicitSize" - it's also marked internal but public
like setSize and uses qreal instead of QSizeF.

Differential Revision: https://phabricator.kde.org/D4011
2017-01-08 16:16:59 +01:00
Kai Uwe Broulik
d46a91ea57 [Icon Item] Support non-square icons
BUG: 355592

Differential Revision: https://phabricator.kde.org/D3892
2017-01-05 15:15:14 +01:00
David Rosca
80dcba46b5 IconItemTest: Set plasma theme to default rather than skipping tests if not default
Default plasma theme is installed with plasma-framework, so there
shouldn't be reason to skip tests.

REVIEW: 128408
2016-07-12 10:01:29 +02:00
Harald Sitter
6ad988cb3d force icon themes explicitly via new testing helper function
REVIEW: 127954
2016-05-18 13:50:11 +02:00
Harald Sitter
c9e8c4b38c warn about need for production data, skip tests that depend on them
numerous icon tests expect the actual production plasma theme to be present
it won't however be resolved because we disable qstandardpaths' default
fallbacks by switching it into testing mode. this ultimately means the
test run needs to have XDG_DATA_DIRS in the environment, if it doesn't
test data will not be present

furthermore QSKIP tests that depend on:
- hicolor icon theme to be present
- production plasma themes

this allows the entire test to pass in less than optimal environments by
means of skipping but also gives a reasonable hint as to why tests are
skipped in the first place. also moving forward if a test isn't guarded
we still have the warning about failure potential allowing someone to
quickly figure out why things failed

REVIEW: 127764
2016-04-27 15:29:54 +02:00
Harald Sitter
e8d09dd42b add missing include 2016-04-27 13:37:45 +02:00
Harald Sitter
0a45d9792d reload icon theme for iconitemtest as well 2016-04-27 13:34:43 +02:00
David Rosca
fd46322300 IconItem: Schedule pixmap update when window changes
QQuickItem::polish is not called when window changes.

Regression from 344d04e230

REVIEW: 127342
2016-03-12 13:01:07 +01:00
David Rosca
46a1181587 IconItem: Animate active and enabled change even with animations disabled
animated: false should disable only animation when changing source,
we still want the hover and enabled animations.
Also fix docs.

REVIEW: 127302
2016-03-11 14:10:59 +01:00
Kai Uwe Broulik
344d04e230 [Icon Item] Don't animate from previous pixmap when it has been invisible
We have a lot of reusable singletons that are just hidden when not needed, such
as the OSD. IconItem, however, will always fade from the previous state, even if
the previous action happened minutes ago.

This fixes for example changing the volume and then later changing the brightness
where you could see the OSD animating from the volume icon.

REVIEW: 122859
2016-03-10 13:01:29 +01:00
Kai Uwe Broulik
3b115e6d90 [Icon Item] Don't call loadPixmap in setColorGroup
Changing the color group of an Svg emits repaintNeeded which will then
cause it to schedule a pixmap update anyway. Includes a unittest.

REVIEW: 127313
2016-03-10 12:58:18 +01:00
David Rosca
ab302872d3 Fix iconitem test - second try 2016-03-06 16:13:54 +01:00
David Rosca
fa1ca80281 Fix iconitem test
Icon name for QIcon must be from test-theme
2016-03-05 11:05:52 +01:00
David Rosca
978b8b3b87 IconItem: Don't overwrite source when using QIcon::name()
source should always return the same value as it was assigned.
Also removed duplicated code (empty sourceString is now handled
as if the source couldn't be converted to any type).

REVIEW: 127282
2016-03-04 23:44:57 +01:00
David Edmundson
531b7f3a95 Add unit test for loading QPixmaps and QImages into IconItem
REVIEW: 127269
2016-03-04 00:20:35 +00:00
David Rosca
37fde3974e IconItemTest: Skip when grabToImage fails 2016-02-29 22:29:51 +01:00
David Rosca
30368e1d45 IconItem: Fix changing color of svg icons loaded from icon theme
Connect to repaintNeeded when creating Plasma::Svg.

REVIEW: 127207
2016-02-29 22:28:58 +01:00
Weng Xuetian
066cf0a0d7 Fix svg iconPath resolving in IconItem
This fixes iconPath is not correctly set when its size changes.

REVIEW: 127201
2016-02-29 13:05:48 -08:00
David Rosca
3c8cb82d44 Fix build with Qt < 5.6 2016-02-28 10:36:57 +01:00
David Rosca
526915895b Add autotests for IconItem
Add some tests for IconItem.
Also found one issue in animation when quickly changing source, first frame
will be rendered with wrong icon.

REVIEW: 127103
2016-02-27 21:24:45 +01:00