Skip to content

Drop icon properties in UI files with Designer's broken normaloff injection

Qt Designer (accidentally) injected "." file names as fallback when setting theme icon names.

<property name="icon">
 <iconset theme="format-text-superscript">

With theme icon names set, it results in generated code like:

    QIcon icon;
    QString iconThemeName = QString::fromUtf8("format-text-superscript");
    if (QIcon::hasThemeIcon(iconThemeName)) {
        icon = QIcon::fromTheme(iconThemeName);
    } else {
        icon.addFile(QString::fromUtf8("."), QSize(), QIcon::Normal, QIcon::Off);

Such a "." file name is not documented to serve any purpose, just results in failing icon lookup.

For empty string icon properties like

<property name="icon">

it results in generated code that sets a bogus icon:

    QIcon icon;
    icon.addFile(QString::fromUtf8(""), QSize(), QIcon::Normal, QIcon::Off);

For the given UI elements the icons will be replaced in manual code later, with more special code, so the properties can just be dropped.

Merge request reports