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

Method QMenuEditor

src/interface/QMenuEditor.cpp:6–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <QMessageBox>
5
6QMenuEditor::QMenuEditor(QWidget *parent) :
7 QWidget(parent),
8 ui(new Ui::menueditor)
9{
10 ui->setupUi(this);
11 connect(ui->button_remove, &QToolButton::clicked, [this] {
12 int toBeRemoved = ui->list_target->currentRow();
13 QList<QAction*> &list = mTarget;
14
15 if ( toBeRemoved >= 0 && toBeRemoved < list.size())
16 {
17 list.removeAt(toBeRemoved);
18 populateList(mTarget, ui->list_target);
19 ui->list_target->setCurrentRow(toBeRemoved - 1);
20 }
21
22 emit targetChanged();
23 });
24
25 connect(ui->button_insert, &QToolButton::clicked, [this] {
26 if (ui->list_source->currentItem() == nullptr)
27 {
28 return;
29 }
30
31 bool success = insertAction(ui->list_source->currentItem()->data(Qt::UserRole).value<QAction*>());
32
33 if (!success)
34 {
35 QMessageBox::warning(this, "Error", "Item already inserted");
36 }
37
38 emit targetChanged();
39 });
40
41 connect(ui->button_up, &QToolButton::clicked, [this] {
42 int curr_index = ui->list_target->currentRow();
43
44 QList<QAction*> &list = mTarget;
45
46 if ( curr_index < 1 || curr_index >= list.size())
47 {
48 return;
49 }
50
51 qSwap(list[curr_index], list[curr_index - 1]);
52
53 populateList(mTarget, ui->list_target);
54 ui->list_target->setCurrentRow(curr_index - 1);
55 emit targetChanged();
56 });
57
58 connect(ui->button_down, &QToolButton::clicked, [this] {
59 int curr_index = ui->list_target->currentRow();
60
61 QList<QAction*> &list = mTarget;
62
63 if ( curr_index < 0 || curr_index >= list.size() - 1 )

Callers

nothing calls this directly

Calls 4

connectFunction · 0.85
sizeMethod · 0.45
removeAtMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected