Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Checklist
ChecklistGuidePage.cpp
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3
* under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4
* LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5
******************************************************************************************************/
6
7
#include "
ChecklistGuidePage.h
"
8
#include "
ChecklistLineEdit.h
"
9
#include "
Logger.h
"
10
#include <QGridLayout>
11
#include <QLabel>
12
#include <QPalette>
13
#include <QRadioButton>
14
#include <QVBoxLayout>
15
16
ChecklistGuidePage::ChecklistGuidePage
(
const
QString &title) :
17
m_row (0),
18
m_checklineLineEditContainer (nullptr),
19
m_checklineLineEditLayout (nullptr)
20
{
21
setTitle (title);
22
23
m_layout =
new
QGridLayout;
24
m_layout->setColumnStretch (0, 0);
25
m_layout->setColumnStretch (1, 1);
26
setLayout (m_layout);
27
}
28
29
void
ChecklistGuidePage::addHtml
(
const
QString &html)
30
{
31
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePage::addHtml"
;
32
33
QLabel *label =
new
QLabel (html);
34
label->setWordWrap (
true
);
35
36
m_layout->addWidget (label, m_row++, 0, 1, 2, Qt::AlignTop);
37
}
38
39
QRadioButton *
ChecklistGuidePage::addLabelAndRadioButton
(
const
QString &label,
40
const
QString &whatsThis)
41
{
42
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePage::addLabelAndRadioButton"
;
43
44
QRadioButton *button =
new
QRadioButton;
45
button->setWhatsThis (whatsThis);
46
m_layout->addWidget (button, m_row, 0, 1, 1, Qt::AlignTop);
47
48
QLabel *lbl =
new
QLabel (label);
49
lbl->setWordWrap(
true
);
50
m_layout->addWidget (lbl, m_row++, 1, 1, 1, Qt::AlignTop);
51
52
return
button;
53
}
54
55
void
ChecklistGuidePage::addLineEdit
(
ChecklistLineEdit
*edit,
56
const
QString &whatsThis)
57
{
58
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePage::addLineEdit"
;
59
60
bool
isFirst =
false
;
61
62
if
(m_checklineLineEditContainer ==
nullptr
) {
63
64
isFirst =
true
;
65
66
// This is the first ChecklistLineEdit, so we create a container for it and any more that get added
67
m_checklineLineEditLayout =
new
QVBoxLayout;
68
m_checklineLineEditLayout->setSpacing (0);
// This is the whole reason we wrap the ChecklineLineEdits in a container
69
70
m_checklineLineEditContainer =
new
QWidget;
71
m_checklineLineEditContainer->setLayout (m_checklineLineEditLayout);
72
m_layout->addWidget (m_checklineLineEditContainer, m_row++, 0, 1, 2, Qt::AlignTop);
73
}
74
75
edit->setWhatsThis (whatsThis);
76
m_checklineLineEditLayout->addWidget (edit);
77
78
// Windows border is missing on left side so border is made complete here
79
QString style = QString (
"QLineEdit { "
80
"border-left : 1px solid gray; "
81
"border-right: 1px solid gray; "
82
"border-top: %1px solid gray; "
83
"border-bottom:1px solid gray; }"
)
84
.arg (isFirst ? 1 : 0);
85
edit->setStyleSheet (style);
86
}
ChecklistGuidePage.h
ChecklistLineEdit.h
Logger.h
ChecklistGuidePage::addLabelAndRadioButton
QRadioButton * addLabelAndRadioButton(const QString &label, const QString &whatsThis)
Insert radio button and corresponding label.
Definition
ChecklistGuidePage.cpp:39
ChecklistGuidePage::addLineEdit
void addLineEdit(ChecklistLineEdit *edit, const QString &whatsThis)
Insert line edit.
Definition
ChecklistGuidePage.cpp:55
ChecklistGuidePage::ChecklistGuidePage
ChecklistGuidePage(const QString &title)
Single constructor.
Definition
ChecklistGuidePage.cpp:16
ChecklistGuidePage::addHtml
void addHtml(const QString &html)
Insert html for display.
Definition
ChecklistGuidePage.cpp:29
ChecklistLineEdit
Adds key event handling to QLineEdit.
Definition
ChecklistLineEdit.h:14
Generated on
for Engauge Digitizer by
1.17.0