-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathDualLists.h
60 lines (52 loc) · 1.61 KB
/
DualLists.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QListWidget>
#include <QListWidgetItem>
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
class DualLists : public QWidget
{
Q_OBJECT
public:
// Constructors
explicit DualLists(QWidget *parent = 0);
// Lists manipulation (adding for now. We don't need deletion or other things for now)
void addItemToLeftList(QString itemString);
void addItemToRightList(QString itemString);
// Getters
QList<QListWidgetItem *> itemsOnRightList();
private:
// Members
// Lists
QListWidget *mpLeftList;
QListWidget *mpRightList;
// Buttons
QPushButton *mpMoveOneRightBtn;
QPushButton *mpMoveAllRightBtn;
QPushButton *mpMoveOneLeftBtn;
QPushButton *mpMoveAllLeftBtn;
// Lists of buttons
QVector<QPushButton*> mpLeftToRightBtns;
QVector<QPushButton*> mpRightToLeftBtns;
// Layouts
QHBoxLayout *mpMainLayout;
QVBoxLayout *mpBtnsLayout;
// General auxs
void moveItemInIndexFromListToList(int itemIndex,QListWidget *fromList,QListWidget *toList,QVector<QPushButton*> fromListButtons);
void moveAllItemsFromListToList(QListWidget *fromList,QListWidget *toList,QVector<QPushButton*> fromListButtons);
// Constructor auxs
void initializeMembers();
void setupConnections();
void organizeLayout();
private slots:
void moveOneItemRight();
void moveOneItemLeft();
void enableLeftToRightBtns();
void enableRightToLeftBtns();
void moveAllItemsRight();
void moveAllItemsLeft();
void updateBtnsStatus();
};
#endif // MAINWINDOW_H