Add XDG theme file for example icons
Allows easy use from the examples. Change-Id: I731ea5641e247db2937aa1b12d1e91dd7dcb2848 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e27841c2fb6b953ec9fda95bfc34d873801e51d8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e63c51c7de
commit
03b1ade31c
@ -8,6 +8,7 @@ qt_internal_add_module(ExampleIconsPrivate
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(icons_resource_files
|
set(icons_resource_files
|
||||||
|
index.theme
|
||||||
16x16/document-new.png
|
16x16/document-new.png
|
||||||
16x16/document-open.png
|
16x16/document-open.png
|
||||||
16x16/document-print.png
|
16x16/document-print.png
|
||||||
@ -165,7 +166,7 @@ set(icons_resource_files
|
|||||||
|
|
||||||
qt_internal_add_resource(ExampleIconsPrivate "example_icons"
|
qt_internal_add_resource(ExampleIconsPrivate "example_icons"
|
||||||
PREFIX
|
PREFIX
|
||||||
"/qt-project.org/examples/icons/"
|
"/qt-project.org/icons/example_icons"
|
||||||
FILES
|
FILES
|
||||||
${icons_resource_files}
|
${icons_resource_files}
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,13 @@ Setting up a project for using Example icon library
|
|||||||
)
|
)
|
||||||
...
|
...
|
||||||
|
|
||||||
2. Create image resource in your application code:
|
2. Load the theme
|
||||||
...
|
...
|
||||||
bool success = img->load(":/qt-project.org/examples/icons/32x32/document-new.png");
|
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << u":/qt-project.org/icons"_s);
|
||||||
|
QIcon::setFallbackThemeName(u"example_icons"_s);
|
||||||
|
...
|
||||||
|
|
||||||
|
3. Use the icons
|
||||||
|
...
|
||||||
|
const QIcon openIcon = QIcon::fromTheme("document-open");
|
||||||
...
|
...
|
||||||
|
46
src/assets/icons/index.theme
Normal file
46
src/assets/icons/index.theme
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
[Icon Theme]
|
||||||
|
Name=example_icons
|
||||||
|
|
||||||
|
Directories=16x16,16x16@2,32x32,32x32@2,128x128,128x128@2,256x256,256x256@2,scalable
|
||||||
|
|
||||||
|
[16x16]
|
||||||
|
Size=16
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[16x16@2]
|
||||||
|
Size=16
|
||||||
|
Scale=2
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[32x32]
|
||||||
|
Size=32
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[32x32@2]
|
||||||
|
Size=32
|
||||||
|
Scale=2
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[128x128]
|
||||||
|
Size=128
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[128x128@2]
|
||||||
|
Size=128
|
||||||
|
Scale=2
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[256x256]
|
||||||
|
Size=256
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[256x256@2]
|
||||||
|
Size=256
|
||||||
|
Scale=2
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
[scalable]
|
||||||
|
Size=512
|
||||||
|
Type=Scalable
|
||||||
|
MinSize=16
|
||||||
|
MaxSize=512
|
Loading…
x
Reference in New Issue
Block a user