Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/menu.cpp
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | |||||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | void Menu::reload() | 86 | void Menu::reload() | ||
87 | { | 87 | { | ||
88 | Q_D(Menu); | 88 | Q_D(Menu); | ||
89 | clear(); | 89 | clear(); | ||
90 | for(int i=0, c=d->m_model->rowCount(); i != c; ++i) { | 90 | for(int i=0, c=d->m_model->rowCount(); i != c; ++i) { | ||
91 | QModelIndex idx = d->m_model->index(i); | 91 | QModelIndex idx = d->m_model->index(i); | ||
92 | QAction* a = addAction(idx.data(Qt::DisplayRole).toString()); | 92 | QAction* a = addAction(idx.data(Qt::DisplayRole).toString() + QStringLiteral("...")); | ||
93 | a->setToolTip(idx.data(Qt::ToolTipRole).toString()); | 93 | a->setToolTip(idx.data(Qt::ToolTipRole).toString()); | ||
94 | a->setIcon(idx.data(Qt::DecorationRole).value<QIcon>()); | 94 | a->setIcon(idx.data(Qt::DecorationRole).value<QIcon>()); | ||
95 | a->setProperty("pluginId", idx.data(AlternativesModel::PluginIdRole)); | 95 | a->setProperty("pluginId", idx.data(AlternativesModel::PluginIdRole)); | ||
96 | a->setProperty("row", i); | 96 | a->setProperty("row", i); | ||
97 | } | 97 | } | ||
98 | 98 | | |||
99 | setEnabled(!isEmpty()); | 99 | setEnabled(!isEmpty()); | ||
100 | } | 100 | } | ||
101 | 101 | | |||
102 | AlternativesModel* Menu::model() const | 102 | AlternativesModel* Menu::model() const | ||
103 | { | 103 | { | ||
104 | Q_D(const Menu); | 104 | Q_D(const Menu); | ||
105 | return d->m_model.data(); | 105 | return d->m_model.data(); | ||
106 | } | 106 | } | ||
107 | 107 | | |||
108 | #include "menu.moc" | 108 | #include "menu.moc" |