Warning, file /office/calligra/KoIcon.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*  This file is part of the Calligra project, made within the KDE community.
0002 
0003     SPDX-FileCopyrightText: 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KOICON_H
0009 #define KOICON_H
0010 
0011 // Qt
0012 #include <QIcon>
0013 
0014 /**
0015  * Macros to support collecting the icons in use.
0016  *
0017  * After any change to this list of macros the file /CheckIcons.sh needs to be
0018  * updated accordingly, to ensure that the icon names of the affected macros are
0019  * still considered in the extraction.
0020  *
0021  * The naming pattern of the macros is like this:
0022  * * koIcon* returns a QIcon object
0023  * * koIconFallback* returns a QIcon object for given name or fallback name
0024  * * koIconName* returns a QLatin1String (aligned with usual API where "iconName" property is of type QString)
0025  * * koIconNameCStr* returns a const char*
0026  */
0027 
0028 /// Use these macros for icons without any issues
0029 #define koIcon(name) (QIcon::fromTheme(QStringLiteral(name)))
0030 #define koIconFallback(name, fallbackName) (QIcon::fromTheme(QStringLiteral(name), QIcon::fromTheme(QStringLiteral(fallbackName))))
0031 #define koIconName(name) (QStringLiteral(name))
0032 #define koIconNameCStr(name) (name)
0033 /// Use these definitions in files where needed:
0034 // #define koSmallIcon(name) (SmallIcon(QStringLiteral(name)))
0035 // #define koDesktopIcon(name) (DesktopIcon(QStringLiteral(name)))
0036 // Also #include <kiconloader.h>
0037 
0038 /// Use these macros if there is a proper icon missing
0039 #define koIconNeeded(comment, neededName) (QIcon::fromTheme(QStringLiteral(neededName)))
0040 #define koIconNeededWithSubs(comment, neededName, substituteName) (QIcon::fromTheme(QStringLiteral(substituteName)))
0041 #define koIconNameNeeded(comment, neededName) (QStringLiteral(neededName))
0042 #define koIconNameNeededWithSubs(comment, neededName, substituteName) (QStringLiteral(substituteName))
0043 #define koIconNameCStrNeeded(comment, neededName) (neededName)
0044 #define koIconNameCStrNeededWithSubs(comment, neededName, substituteName) (substituteName)
0045 
0046 /// Use these macros if the UI is okay without any icon, but would be better with one.
0047 #define koIconWanted(comment, wantedName) (QIcon())
0048 #define koIconNameWanted(comment, wantedName) (QString())
0049 
0050 #endif