Skip to content

Commit

Permalink
Scripting: Allow referencing built-in icons from Tool.icon
Browse files Browse the repository at this point in the history
For example ":images/22/stock-tool-bucket-fill.png" to refer to the
Bucket Fill tool icon.

Note that these icons may change at will, there's no compatibility
guarantee. There is also no icon reference, these icons can currently be
found in the repository at 'src/tiled/resources/images'.
  • Loading branch information
bjorn committed Jul 4, 2023
1 parent 00be12d commit 4b3ef42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tiled/scriptedtool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void ScriptedTool::setIconFileName(const QString &fileName)
QString iconFile = fileName;

const QString ext = QStringLiteral("ext:");
if (!iconFile.startsWith(ext))
if (!iconFile.startsWith(ext) && !iconFile.startsWith(QLatin1String(":")))
iconFile.prepend(ext);

setIcon(QIcon { iconFile });
Expand Down

0 comments on commit 4b3ef42

Please sign in to comment.