QElectroTech  0.8-dev
dimensionwidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef TITLEBLOCK_SLASH_DIMENSION_WIDGET_H
19 #define TITLEBLOCK_SLASH_DIMENSION_WIDGET_H
20 #include <QtWidgets>
21 #include "dimension.h"
22 
27 class TitleBlockDimensionWidget : public QDialog {
28  Q_OBJECT
29 
30  // constructors, destructor
31  public:
32  TitleBlockDimensionWidget(bool, QWidget * parent = nullptr);
33  ~TitleBlockDimensionWidget() override;
34  private:
36 
37  // methods
38  public:
39  bool isComplete() const;
40  QLabel *label() const;
41  QSpinBox *spinbox() const;
42  TitleBlockDimension value() const;
43  void setValue(const TitleBlockDimension &);
44  bool isReadOnly() const;
45  void setReadOnly(bool);
46 
47  private:
48  void initWidgets();
49  void initLayouts();
50 
51  private slots:
52  void updateSpinBoxSuffix();
53 
54  // attributes
55  private:
56  bool complete_;
57  QSpinBox *spinbox_;
58  QLabel *spinbox_label_;
59  QRadioButton *absolute_button_;
60  QRadioButton *relative_button_;
61  QRadioButton *remaining_button_;
62  QButtonGroup *dimension_type_;
63  QDialogButtonBox *buttons_;
64  bool read_only_;
65 };
66 #endif
TitleBlockDimensionWidget::initWidgets
void initWidgets()
Definition: dimensionwidget.cpp:116
TitleBlockDimensionWidget::label
QLabel * label() const
Definition: dimensionwidget.cpp:53
TitleBlockDimensionWidget::relative_button_
QRadioButton * relative_button_
Radio button to indicate the length is relative to the total length.
Definition: dimensionwidget.h:60
QET::RelativeToTotalLength
@ RelativeToTotalLength
the length is just a fraction of the total available length
Definition: qet.h:147
TitleBlockDimensionWidget::spinbox_
QSpinBox * spinbox_
Spinbox displaying the length.
Definition: dimensionwidget.h:57
TitleBlockDimension::value
int value
Numeric value.
Definition: dimension.h:34
TitleBlockDimension::type
QET::TitleBlockColumnLength type
Kind of length.
Definition: dimension.h:33
QET::TitleBlockColumnLength
TitleBlockColumnLength
enum used to specify the type of a length
Definition: qet.h:145
dimension.h
TitleBlockDimensionWidget::TitleBlockDimensionWidget
TitleBlockDimensionWidget(bool, QWidget *parent=nullptr)
Definition: dimensionwidget.cpp:27
TitleBlockDimensionWidget::~TitleBlockDimensionWidget
~TitleBlockDimensionWidget() override
Definition: dimensionwidget.cpp:39
TitleBlockDimensionWidget::isComplete
bool isComplete() const
Definition: dimensionwidget.cpp:45
TitleBlockDimension
Definition: dimension.h:26
TitleBlockDimensionWidget::dimension_type_
QButtonGroup * dimension_type_
QButtonGroup for the three radio buttons.
Definition: dimensionwidget.h:62
TitleBlockDimensionWidget::setValue
void setValue(const TitleBlockDimension &)
Definition: dimensionwidget.cpp:79
TitleBlockDimensionWidget::read_only_
bool read_only_
Whether or not this widget allow edition of the displayed dimension.
Definition: dimensionwidget.h:64
QET::Absolute
@ Absolute
the length is absolute and should be applied as is
Definition: qet.h:146
TitleBlockDimensionWidget::complete_
bool complete_
Whether or not this dialog is required to be complete, i.e. displaying also.
Definition: dimensionwidget.h:56
TitleBlockDimensionWidget::isReadOnly
bool isReadOnly() const
Definition: dimensionwidget.cpp:93
TitleBlockDimensionWidget::initLayouts
void initLayouts()
Definition: dimensionwidget.cpp:147
TitleBlockDimensionWidget::absolute_button_
QRadioButton * absolute_button_
Radio button to indicate the length is absolute.
Definition: dimensionwidget.h:59
TitleBlockDimensionWidget::TitleBlockDimensionWidget
TitleBlockDimensionWidget(const TitleBlockDimensionWidget &)
TitleBlockDimensionWidget::setReadOnly
void setReadOnly(bool)
Definition: dimensionwidget.cpp:101
TitleBlockDimensionWidget::remaining_button_
QRadioButton * remaining_button_
Radio button to indicate the length is relative to the remaining length.
Definition: dimensionwidget.h:61
TitleBlockDimensionWidget::value
TitleBlockDimension value() const
Definition: dimensionwidget.cpp:68
TitleBlockDimensionWidget::spinbox_label_
QLabel * spinbox_label_
Label shown right before the spinbox.
Definition: dimensionwidget.h:58
TitleBlockDimensionWidget::buttons_
QDialogButtonBox * buttons_
Buttons to validate the dialog.
Definition: dimensionwidget.h:63
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
TitleBlockDimensionWidget
Definition: dimensionwidget.h:27
QET::Icons::Cancel
QIcon Cancel
Definition: qeticons.cpp:34
TitleBlockDimensionWidget::updateSpinBoxSuffix
void updateSpinBoxSuffix()
Definition: dimensionwidget.cpp:165
QET::RelativeToRemainingLength
@ RelativeToRemainingLength
the length is just a fraction of the length that is still available when other types of lengths have ...
Definition: qet.h:148
TitleBlockDimensionWidget::spinbox
QSpinBox * spinbox() const
Definition: dimensionwidget.cpp:61
dimensionwidget.h