MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / insertAction

Method insertAction

src/interface/QMenuEditor.cpp:132–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132bool QMenuEditor::insertAction(QAction *new_action)
133{
134 int act_before = ui->list_target->currentRow();
135
136 for (auto item : std::as_const(mTarget))
137 {
138 if (item->text() == new_action->text() &&
139 !item->isSeparator())
140 {
141 return false;
142 }
143 }
144
145 if ( new_action )
146 {
147 QList<QAction*> &list = mTarget;
148
149 if ( act_before >= 0 && act_before < list.size())
150 {
151 list.insert(act_before + 1, new_action);
152 populateList(mTarget, ui->list_target);
153 ui->list_target->setCurrentRow(act_before + 1);
154 }
155 else
156 {
157 list.push_back(new_action);
158 populateList(mTarget, ui->list_target);
159 ui->list_target->setCurrentRow(list.size() - 1);
160 }
161 }
162
163 return true;
164}
165
166QMenu* QMenuEditor::exportMenu()
167{

Callers

nothing calls this directly

Calls 4

textMethod · 0.80
insertMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected