QElectroTech  0.70
templatecellwidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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_TEMPLATE_CELL_WIDGET_H
19 #define TITLEBLOCK_SLASH_TEMPLATE_CELL_WIDGET_H
20 #include <QtWidgets>
21 #include "qet.h"
23 class TitleBlockTemplate;
24 class TitleBlockCell;
25 class NamesList;
26 
31 class TitleBlockTemplateCellWidget : public QWidget {
32  Q_OBJECT
33 
34  // constructor, destructor
35  public:
36  TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr, QWidget * = nullptr);
38  private:
40 
41  // attributes
42  private:
44  bool read_only_;
46  QComboBox *cell_type_input_;
47 
48  QLabel *empty_label_;
49 
50  QLabel *logo_label_;
51  QComboBox *logo_input_;
52  QPushButton *add_logo_input_;
53 
54  QLabel *name_label_;
55  QLineEdit *name_input_;
56  QCheckBox *label_checkbox_;
57  QLineEdit *label_input_;
58  QPushButton *label_edit_;
59  QLabel *value_label_;
60  QLineEdit *value_input_;
61  QPushButton *value_edit_;
62  QLabel *align_label_;
64  QComboBox *horiz_align_input_;
65  QHash<int, int> horiz_align_indexes_;
67  QComboBox *vert_align_input_;
68  QHash<int, int> vert_align_indexes_;
70  QSpinBox *font_size_input_;
71  QCheckBox *font_adjust_input_;
72  QVBoxLayout *cell_editor_layout_;
76 
78 
79  // methods
80  public:
81  int horizontalAlignment() const;
82  int verticalAlignment() const;
83  int alignment() const;
84  bool isReadOnly() const;
85 
86  protected:
87  void editTranslatableValue(NamesList &, const QString &, const QString &) const;
88  void emitModification(const QString &, const QVariant &) const;
89  QString defaultVariablesString() const;
90  QString labelValueInformationString() const;
91 
92  private:
93  void initWidgets();
94 
95  public slots:
96  void updateFormType(int);
97  void edit(TitleBlockCell *);
98  void editType();
99  void editName();
100  void editLabelDisplayed();
101  void editLabel();
102  void editValue();
103  void editAlignment();
104  void editFontSize();
105  void editAdjust();
106  void editLogo();
108  void setReadOnly(bool);
109 
110  private slots:
111 
112 
113  signals:
114  void logoEditionRequested();
116 };
117 
118 #endif
void emitModification(const QString &, const QVariant &) const
QHBoxLayout * cell_editor_type_and_name_layout_
QHash< int, int > horiz_align_indexes_
QHash< int, int > vert_align_indexes_
void cellModified(ModifyTitleBlockCellCommand *) const
void updateLogosComboBox(const TitleBlockTemplate *)
TitleBlockTemplateCellWidget(TitleBlockTemplate *=nullptr, QWidget *=nullptr)
void editTranslatableValue(NamesList &, const QString &, const QString &) const
bool read_only_
is the template read-only?