QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
texteditor.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 TEXTEDITOR_H
19#define TEXTEDITOR_H
20
21#include "../elementitemeditor.h"
22
23#include <QPointer>
24#include <QWidget>
25#include <QSpinBox>
26#include <QLineEdit>
27#include <QPushButton>
28#ifdef BUILD_WITHOUT_KF5
29#else
30#include <KColorButton>
31#endif
32class PartText;
33
35 Q_OBJECT
36
37 public:
38 explicit TextEditor(QETElementEditor *editor, PartText *text = nullptr, QWidget *parent = nullptr);
39 ~TextEditor() override;
40
41 void updateForm() override;
42 bool setPart(CustomElementPart *part) override;
43 bool setParts(QList <CustomElementPart *>) override;
44 CustomElementPart *currentPart() const override;
45 QList<CustomElementPart*> currentParts() const override;
46
47 private slots:
49 void on_m_color_pb_changed(const QColor &newColor);
50 private:
51 void setUpWidget(QWidget* parent = nullptr);
53 void setUpChangeConnection(QPointer<PartText> part);
56
57 private:
58 QPointer <PartText> m_text;
59 QList<PartText*> m_parts;
60 QList <QMetaObject::Connection> m_edit_connection;
61 QList <QMetaObject::Connection> m_change_connection;
62 QSpinBox *m_y_sb;
63 QSpinBox *m_rotation_sb;
64 QSpinBox *m_x_sb;
65 QSpinBox *m_size_sb;
66 QLineEdit *m_line_edit;
67 QPushButton *m_font_pb;
68#ifdef BUILD_WITHOUT_KF5
69#else
70 KColorButton *m_color_pb;
71#endif
72};
73
74#endif // TEXTEDITOR_H
The CustomElementPart class This abstract class represents a primitive of the visual representation o...
Definition customelementpart.h:40
Definition elementitemeditor.h:34
Definition parttext.h:31
Definition qetelementeditor.h:39
Definition texteditor.h:34
QPointer< PartText > m_text
Definition texteditor.h:58
void updateForm() override
TextEditor::updateForm Update the gui.
Definition texteditor.cpp:51
QLineEdit * m_line_edit
Definition texteditor.h:66
void disconnectEditConnection()
Definition texteditor.cpp:93
void setUpWidget(QWidget *parent=nullptr)
Definition texteditor.cpp:293
KColorButton * m_color_pb
Definition texteditor.h:70
void setUpChangeConnection(QPointer< PartText > part)
Definition texteditor.cpp:73
QSpinBox * m_rotation_sb
Definition texteditor.h:63
QList< QMetaObject::Connection > m_edit_connection
Definition texteditor.h:60
QList< PartText * > m_parts
Definition texteditor.h:59
QList< CustomElementPart * > currentParts() const override
Definition texteditor.cpp:162
CustomElementPart * currentPart() const override
TextEditor::currentPart.
Definition texteditor.cpp:157
QList< QMetaObject::Connection > m_change_connection
Definition texteditor.h:61
void disconnectChangeConnection()
Definition texteditor.cpp:85
QPushButton * m_font_pb
Definition texteditor.h:67
void on_m_color_pb_changed(const QColor &newColor)
TextEditor::on_m_color_pb_changed.
Definition texteditor.cpp:281
QSpinBox * m_size_sb
Definition texteditor.h:65
void on_m_font_pb_clicked()
TextEditor::on_m_font_pb_clicked.
Definition texteditor.cpp:254
bool setPart(CustomElementPart *part) override
TextEditor::setPart Set the current text to edit. Set part to nullptr to clear the current text.
Definition texteditor.cpp:108
~TextEditor() override
TextEditor::~TextEditor.
Definition texteditor.cpp:45
void setUpEditConnection()
TextEditor::setUpEditConnection Setup the connection between the widgets of this editor and the undo ...
Definition texteditor.cpp:176
QSpinBox * m_x_sb
Definition texteditor.h:64
bool setParts(QList< CustomElementPart * >) override
Definition texteditor.cpp:127
QSpinBox * m_y_sb
Definition texteditor.h:62