File: templatecellwidget.h

package info (click to toggle)
qelectrotech 1%3A0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 91,680 kB
  • sloc: cpp: 62,335; xml: 750; sh: 264; perl: 258; makefile: 6
file content (118 lines) | stat: -rw-r--r-- 3,289 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
	Copyright 2006-2019 The QElectroTech Team
	This file is part of QElectroTech.
	
	QElectroTech is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 2 of the License, or
	(at your option) any later version.
	
	QElectroTech is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TITLEBLOCK_SLASH_TEMPLATE_CELL_WIDGET_H
#define TITLEBLOCK_SLASH_TEMPLATE_CELL_WIDGET_H
#include <QtWidgets>
#include "qet.h"
class ModifyTitleBlockCellCommand;
class TitleBlockTemplate;
class TitleBlockCell;
class NamesList;

/**
	This class implements an edition widget for cells that compose a title
	block template.
*/
class TitleBlockTemplateCellWidget : public QWidget {
	Q_OBJECT
	
	// constructor, destructor
	public:
	TitleBlockTemplateCellWidget(TitleBlockTemplate * = nullptr, QWidget * = nullptr);
	~TitleBlockTemplateCellWidget() override;
	private:
	TitleBlockTemplateCellWidget(const TitleBlockTemplateCellWidget &);
	
	// attributes
	private:
	/// is the template read-only?
	bool read_only_;
	QLabel    *cell_type_label_;
	QComboBox *cell_type_input_;
	
	QLabel *empty_label_;
	
	QLabel      *logo_label_;
	QComboBox   *logo_input_;
	QPushButton *add_logo_input_;
	
	QLabel        *name_label_;
	QLineEdit     *name_input_;
	QCheckBox     *label_checkbox_;
	QLineEdit     *label_input_;
	QPushButton   *label_edit_;
	QLabel        *value_label_;
	QLineEdit     *value_input_;
	QPushButton   *value_edit_;
	QLabel        *align_label_;
	QLabel        *horiz_align_label_;
	QComboBox     *horiz_align_input_;
	QHash<int, int> horiz_align_indexes_;
	QLabel        *vert_align_label_;
	QComboBox     *vert_align_input_;
	QHash<int, int> vert_align_indexes_;
	QLabel        *font_size_label_;
	QSpinBox      *font_size_input_;
	QCheckBox     *font_adjust_input_;
	QVBoxLayout   *cell_editor_layout_;
	QHBoxLayout   *cell_editor_type_and_name_layout_;
	QGridLayout   *cell_editor_text_layout_;
	QHBoxLayout   *cell_editor_image_layout_;
	
	TitleBlockCell *edited_cell_;
	
	// methods
	public:
	int horizontalAlignment() const;
	int verticalAlignment() const;
	int alignment() const;
	bool isReadOnly() const;
	
	protected:
	void editTranslatableValue(NamesList &, const QString &, const QString &) const;
	void emitModification(const QString &, const QVariant &) const;
	QString defaultVariablesString() const;
	QString labelValueInformationString() const;
	
	private:
	void initWidgets();
	
	public slots:
	void updateFormType(int);
	void edit(TitleBlockCell *);
	void editType();
	void editName();
	void editLabelDisplayed();
	void editLabel();
	void editValue();
	void editAlignment();
	void editFontSize();
	void editAdjust();
	void editLogo();
	void updateLogosComboBox(const TitleBlockTemplate *);
	void setReadOnly(bool);
	
	private slots:
	
	
	signals:
	void logoEditionRequested();
	void cellModified(ModifyTitleBlockCellCommand *) const;
};

#endif