MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / populateList

Method populateList

src/interface/QMenuEditor.cpp:96–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void QMenuEditor::populateList(QList<QAction*> menu,
97 QListWidget *list)
98{
99 list->clear();
100
101 for (auto action : menu)
102 {
103 QString desc = "";
104
105 if (action->menu() != nullptr)
106 {
107 desc = "List";
108 }
109
110 if (desc.isEmpty())
111 {
112 desc = action->text().replace('&', "");
113 }
114 else
115 {
116 desc = QString("%1 (%2)").arg(action->text().replace('&', "")).arg(desc);
117 }
118
119 QListWidgetItem *item = new QListWidgetItem(action->isSeparator() ? "--Separator--" :
120 desc);
121
122 if (action->isSeparator())
123 {
124 item->setForeground(palette().color(QPalette::Disabled, QPalette::ColorRole::Text));
125 }
126
127 item->setData(Qt::UserRole, QVariant::fromValue<QAction*>(action));
128 list->addItem(item);
129 }
130}
131
132bool QMenuEditor::insertAction(QAction *new_action)
133{

Callers

nothing calls this directly

Calls 7

textMethod · 0.80
addItemMethod · 0.80
QStringClass · 0.50
clearMethod · 0.45
isEmptyMethod · 0.45
colorMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected