VirtualBox

Changeset 79024 in vbox


Ignore:
Timestamp:
Jun 6, 2019 1:53:50 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131176
Message:

FE/Qt: bugref:9434: Update UIFormEditorWidget with icons for Import Appliance wizard (not Export for now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.cpp

    r79008 r79024  
    3535#include "QIWithRetranslateUI.h"
    3636#include "UIFormEditorWidget.h"
     37#include "UIIconPool.h"
    3738#include "UIMessageCenter.h"
    3839
     
    441442private:
    442443
     444    /** Prepares all. */
     445    void prepare();
     446
    443447    /** Return the parent table-view reference. */
    444448    QITableView *parentTable() const;
     
    447451    void updateGeneration();
    448452
     453    /** Returns icon hint for specified @a strItemName. */
     454    QIcon iconHint(const QString &strItemName) const;
     455
    449456    /** Holds the Form Editor row list. */
    450457    QList<UIFormEditorRow*>  m_dataList;
     458
     459    /** Holds the hardcoded icon name map. */
     460    QMap<QString, QIcon>  m_icons;
    451461};
    452462
     
    935945    : QAbstractTableModel(pParent)
    936946{
     947    prepare();
    937948}
    938949
     
    11151126    switch (iRole)
    11161127    {
     1128        /* Decoration role: */
     1129        case Qt::DecorationRole:
     1130        {
     1131            /* Switch for different columns: */
     1132            switch (index.column())
     1133            {
     1134                case UIFormEditorDataType_Name: return iconHint(m_dataList[index.row()]->nameToString());
     1135                default: return QVariant();
     1136            }
     1137        }
    11171138        /* Checkstate role: */
    11181139        case Qt::CheckStateRole:
     
    12421263}
    12431264
     1265void UIFormEditorModel::prepare()
     1266{
     1267    /* Prepare hardcoded icons map: */
     1268    m_icons["Name"]        = UIIconPool::iconSet(":/name_16px.png");
     1269    m_icons["OS"]          = UIIconPool::iconSet(":/os_type_16px.png");
     1270    m_icons["CPU"]         = UIIconPool::iconSet(":/cpu_16px.png");
     1271    m_icons["Memory"]      = UIIconPool::iconSet(":/ram_16px.png");
     1272    m_icons["Description"] = UIIconPool::iconSet(":/description_16px.png");
     1273}
     1274
    12441275QITableView *UIFormEditorModel::parentTable() const
    12451276{
     
    12591290        }
    12601291    }
     1292}
     1293
     1294QIcon UIFormEditorModel::iconHint(const QString &strItemName) const
     1295{
     1296    return m_icons.value(strItemName, UIIconPool::iconSet(":/session_info_16px.png"));
    12611297}
    12621298
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette