-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinesTab.cpp
More file actions
48 lines (39 loc) · 1.43 KB
/
Copy pathLinesTab.cpp
File metadata and controls
48 lines (39 loc) · 1.43 KB
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
#include "LinesTab.h"
#include <QVBoxLayout>
#include "painter.h"
#include "config/config_lines.h"
#include <QRadioButton>
using namespace Lines;
LinesTab::LinesTab(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
Painter *painter = new Painter(this);
mainLayout->addWidget(painter);
setLayout(mainLayout);
// Option widgets
QHBoxLayout *optionsLayout = new QHBoxLayout();
QRadioButton *option1 = new QRadioButton("Draw Broken Line", this);
QRadioButton *option2 = new QRadioButton("Draw Line", this);
optionsLayout->addWidget(option1);
optionsLayout->addWidget(option2);
mainLayout->addLayout(optionsLayout);
// Callback when option changed
QObject::connect(option1, &QRadioButton::toggled, this, [=](bool checked){
if (checked) {
InitializePixelsWhite();
DrawLineBroken(-200, -100, 240, 120, Color(0, 0, 0));
DrawLineBroken(-50, -200, 60, 240, Color(0, 0, 0));
painter->render(pixels);
}
});
QObject::connect(option2, &QRadioButton::toggled, this, [=](bool checked){
if (checked) {
InitializePixelsWhite();
DrawLine(Point(-200, -100), Point(240, 120), Color(0, 0, 0));
DrawLine(Point(-50, -200), Point(60, 240), Color(0, 0, 0));
painter->render(pixels);
}
});
option1->setChecked(true); // Set the first option checked
}