buttonbox.h

Thu, 25 Apr 2013 01:54:25 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 25 Apr 2013 01:54:25 +0300
changeset 136
13db97be14cb
child 140
2e8c1626aef7
permissions
-rw-r--r--

Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')

136
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef BUTTONBOX_H
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define BUTTONBOX_H
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "common.h"
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <qwidget.h>
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <qbuttongroup.h>
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include <qgroupbox.h>
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include <qboxlayout.h>
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 // =============================================================================
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 // ButtonBox<R>
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 //
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 // Convenience widget - is a groupbox of buttons. Mainly useful for quick creation
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 // of radio button groups.
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // =============================================================================
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 template<class R> class ButtonBox : public QGroupBox {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 private:
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 std::vector<R*> objects;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 std::vector<QBoxLayout*> layouts;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 QBoxLayout* coreLayout;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 QBoxLayout* currentLayout;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 QBoxLayout::Direction dir;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 int currentId;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 int defaultId;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 public:
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 QButtonGroup* buttonGroup;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 QBoxLayout::Direction makeDirection (Qt::Orientation orient, bool invert = false) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 return (orient == (invert ? Qt::Vertical : Qt::Horizontal)) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 void init (Qt::Orientation orient) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 dir = makeDirection (orient);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 buttonGroup = new QButtonGroup;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 currentId = 0;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 coreLayout = null;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 // Ensure we have buttons and not lists or timers or cows or
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 // anything like that.
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 R* test = new R;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 assert (test->inherits ("QAbstractButton"));
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 delete test;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 coreLayout = new QBoxLayout (makeDirection (orient, true));
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 setLayout (coreLayout);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 // Init the first row with a break
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 rowBreak ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 explicit ButtonBox (QWidget* parent = null) : QGroupBox (parent) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 init (Qt::Vertical);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 explicit ButtonBox (const QString& title, QWidget* parent = null) : QGroupBox (title, parent) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 init (Qt::Vertical);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 explicit ButtonBox (const QGroupBox& box) : QGroupBox (box) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 init (Qt::Vertical);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 explicit ButtonBox (const QString& title, initlist<char const*> entries, int const defaultId,
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null) :
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 QGroupBox (title, parent), defaultId (defaultId)
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 init (orient);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 for (char const* entry : entries) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 addButton (entry);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 void rowBreak () {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 QBoxLayout* newLayout = new QBoxLayout (dir);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 currentLayout = newLayout;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 layouts.push_back (newLayout);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 coreLayout->addLayout (newLayout);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 void setCurrentRow (uint row) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 currentLayout = layouts[row];
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 void addButton (const char* entry) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 R* button = new R (entry);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 addButton (button);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 void addButton (R* button) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 bool const selectThis = (currentId == defaultId);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 objects.push_back (button);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 buttonGroup->addButton (button, currentId++);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 currentLayout->addWidget (button);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 if (selectThis)
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 button->setChecked (true);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 ButtonBox<R>& operator<< (R* button) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 addButton (button);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 return *this;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 ButtonBox<R>& operator<< (const char* entry) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 addButton (entry);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 return *this;
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 int value () {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 return buttonGroup->checkedId ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 R* const& begin () {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 return objects.begin ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140 R* const& end () {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 return objects.end ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 R* operator[] (uint n) const {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 return objects[n];
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 bool exclusive () const {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 return buttonGroup->exclusive ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 void setExclusive (bool val) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 buttonGroup->setExclusive (val);
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156 bool isChecked (uint n) {
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157 return objects[n]->checked ();
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158 }
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
159 };
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160
13db97be14cb Converted combo boxes in add object and new part dialogs to radio buttons. Added a convenience widget which makes it easier for me to add groups of radio buttons. My first widget.. :')
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
161 #endif // BUTTONBOX_H

mercurial