5
5
#include < QButtonGroup>
6
6
#include < QPushButton>
7
7
#include < QLabel>
8
+ #include < QDebug>
9
+ #include < QFileDialog>
8
10
9
11
Card::Card (QString title, QString subtitle, QWidget *parent): QFrame(parent) {
10
12
setFrameShape (QFrame::StyledPanel);
@@ -15,7 +17,7 @@ Card::Card(QString title, QString subtitle, QWidget *parent): QFrame(parent) {
15
17
QObject::connect (button, SIGNAL (clicked ()), this , SLOT (click ()));
16
18
button->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
17
19
18
- setStyleSheet (" QPushButton { font-size: 24px; }" );
20
+ setStyleSheet (" QPushButton { font-size: 24px; padding:20px }" );
19
21
20
22
layout->addWidget (button);
21
23
layout->addSpacing (30 );
@@ -25,11 +27,24 @@ Card::Card(QString title, QString subtitle, QWidget *parent): QFrame(parent) {
25
27
}
26
28
27
29
LightsFrame::LightsFrame () {
28
- this ->addWidget (createLightsChoice ());
30
+ addWidget (createChoiceFrame ());
31
+ lp = new LpFrame ();
32
+ addWidget (lp);
33
+ sphere = new SphereFrame ();
34
+ addWidget (sphere);
35
+ dome = new DomeFrame ();
36
+ addWidget (dome);
29
37
}
30
- QFrame *LightsFrame::createLightsChoice () {
38
+
39
+ void LightsFrame::init () {
40
+ lp->init ();
41
+ sphere->init ();
42
+ dome->init ();
43
+ }
44
+
45
+ QFrame *LightsFrame::createChoiceFrame () {
31
46
QFrame *lights_choice = new QFrame ();
32
- lights_choice->setObjectName (" lights_choice" );
47
+ // lights_choice->setObjectName("lights_choice");
33
48
34
49
QVBoxLayout *content = new QVBoxLayout (lights_choice);
35
50
@@ -42,45 +57,88 @@ QFrame *LightsFrame::createLightsChoice() {
42
57
buttons->addStretch (1 );
43
58
44
59
Card *lp = new Card (" LP" , " <p>Load a file (.lp) containging the light directions.</p>" );
45
-
60
+ connect (lp, SIGNAL ( clicked ()), this , SLOT ( showLp ()));
46
61
buttons->addWidget (lp, 1 );
47
62
48
- QPushButton *sphere =new QPushButton (" Sphere: \n identify reflective spheres" );
63
+ Card *sphere = new Card (" Sphere" , " <p>Identify one or more reflective spheres</p> " );
49
64
connect (sphere, SIGNAL (clicked ()), this , SLOT (showSphere ()));
50
- sphere->setSizePolicy (QSizePolicy::Fixed , QSizePolicy::Fixed );
51
- buttons->addWidget (sphere, 0 );
65
+ buttons->addWidget (sphere, 1 );
52
66
53
- QPushButton *dome = new QPushButton (" Dome: \n select a preconfigured dome" );
67
+ Card *dome = new Card (" Dome" , " <p>Select a preconfigure dome</p> " );
54
68
connect (dome, SIGNAL (clicked ()), this , SLOT (showDome ()));
55
- dome->setSizePolicy (QSizePolicy::Fixed , QSizePolicy::Fixed );
56
- buttons->addWidget (dome, 0 );
69
+ buttons->addWidget (dome, 1 );
57
70
58
71
buttons->addStretch (1 );
59
72
60
73
content->addStretch (2 );
61
74
return lights_choice;
62
75
}
63
76
64
- QFrame *LightsFrame::createLp () {
65
- QFrame *lp_frame = new QFrame ();
66
- return lp_frame;
77
+ void LightsFrame::showChoice () {
78
+
79
+ setCurrentIndex (0 );
80
+ }
81
+ void LightsFrame::showLp () {
82
+ setCurrentWidget (lp);
67
83
}
68
84
69
- QFrame *LightsFrame::createSphere () {
70
- QFrame *sphere_frame = new QFrame ();
71
- return sphere_frame;
85
+ void LightsFrame::showSphere () {
86
+ setCurrentIndex (2 );
72
87
}
73
88
74
- QFrame *LightsFrame::createDome () {
75
- QFrame *dome_frame = new QFrame ();
76
- return dome_frame;
89
+ void LightsFrame::showDome () {
90
+ setCurrentIndex (3 );
77
91
}
78
92
79
- void LightsFrame::showLp () {
93
+
94
+
95
+ LpFrame::LpFrame (QWidget *parent): QFrame(parent) {
96
+ QVBoxLayout *content = new QVBoxLayout (this );
97
+ content->setContentsMargins (31 , 31 , 31 , 31 );
98
+ this ->setLayout (content);
99
+
100
+ QLabel *title = new QLabel (" <h2>LP light directions</h2>" );
101
+ content->addWidget (title);
102
+ content->addSpacing (30 );
103
+ QHBoxLayout *filebox = new QHBoxLayout ();
104
+ QPushButton *load = new QPushButton (" Load LP file..." );
105
+ connect (load, SIGNAL (clicked ()), this , SLOT (loadLP ()));
106
+ load->setMaximumWidth (300 );
107
+ filebox->addWidget (load);
108
+ QLabel *filename = new QLabel ();
109
+ filebox->addWidget (filename);
110
+
111
+ content->addLayout (filebox);
112
+ content->addStretch ();
80
113
}
81
114
82
- void LightsFrame::showSphere () {
115
+ void LpFrame::init () {
83
116
}
84
117
85
- void LightsFrame::showDome () {
118
+ void LpFrame::loadLP () {
119
+
120
+ QFileDialog::getOpenFileName (this , " Load an LP file" , )
121
+ }
122
+
123
+ SphereFrame::SphereFrame (QWidget *parent): QFrame(parent) {
124
+ QVBoxLayout *content = new QVBoxLayout (this );
125
+ this ->setLayout (content);
126
+
127
+ QLabel *title = new QLabel (" <h2>Sphere light directions</h2>" );
128
+ content->addWidget (title);
129
+ }
130
+
131
+ void SphereFrame::init () {
132
+ }
133
+
134
+ DomeFrame::DomeFrame (QWidget *parent): QFrame(parent) {
135
+ QVBoxLayout *content = new QVBoxLayout (this );
136
+ this ->setLayout (content);
137
+
138
+ QLabel *title = new QLabel (" <h2>Dome light directions</h2>" );
139
+ content->addWidget (title);
86
140
}
141
+
142
+ void DomeFrame::init () {
143
+ }
144
+
0 commit comments