QElectroTech  0.8-dev
texteditor.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 TEXTEDITOR_H
19 #define TEXTEDITOR_H
20 
21 #include "elementitemeditor.h"
22 
23 #include <QWidget>
24 #include <QPointer>
25 
26 class PartText;
27 
28 namespace Ui {
29 class TextEditor;
30 }
31 
32 class TextEditor : public ElementItemEditor {
33  Q_OBJECT
34 
35  public:
36  explicit TextEditor(QETElementEditor *editor, PartText *text = nullptr, QWidget *parent = nullptr);
37  ~TextEditor() override;
38 
39  void updateForm() override;
40  bool setPart(CustomElementPart *part) override;
41  bool setParts(QList <CustomElementPart *>) override;
42  CustomElementPart *currentPart() const override;
43  QList<CustomElementPart*> currentParts() const override;
44 
45  private slots:
46  void on_m_font_pb_clicked();
47  void on_m_color_pb_changed(const QColor &newColor);
48  private:
49  void setUpEditConnection();
50  void setUpChangeConnection(QPointer<PartText> part);
53 
54  private:
55  Ui::TextEditor *ui;
56 
57  QPointer <PartText> m_text;
58  QList<PartText*> m_parts;
59  QList <QMetaObject::Connection> m_edit_connection;
60  QList <QMetaObject::Connection> m_change_connection;
61 };
62 
63 #endif // TEXTEDITOR_H
elementitemeditor.h
TextEditor::setUpChangeConnection
void setUpChangeConnection(QPointer< PartText > part)
Definition: texteditor.cpp:72
TextEditor::m_change_connection
QList< QMetaObject::Connection > m_change_connection
Definition: texteditor.h:60
TextEditor
Definition: texteditor.h:32
texteditor.h
TextEditor::currentPart
CustomElementPart * currentPart() const override
TextEditor::currentPart.
Definition: texteditor.cpp:153
TextEditor::~TextEditor
~TextEditor() override
TextEditor::~TextEditor.
Definition: texteditor.cpp:45
TextEditor::updateForm
void updateForm() override
TextEditor::updateForm Update the gui.
Definition: texteditor.cpp:53
PartText::fontChanged
void fontChanged(const QFont &font)
TextEditor::setUpEditConnection
void setUpEditConnection()
TextEditor::setUpEditConnection Setup the connection between the widgets of this editor and the undo ...
Definition: texteditor.cpp:170
TextEditor::disconnectChangeConnection
void disconnectChangeConnection()
Definition: texteditor.cpp:82
TextEditor::disconnectEditConnection
void disconnectEditConnection()
Definition: texteditor.cpp:89
TextEditor::currentParts
QList< CustomElementPart * > currentParts() const override
Definition: texteditor.cpp:157
TextEditor::setParts
bool setParts(QList< CustomElementPart * >) override
Definition: texteditor.cpp:122
ElementItemEditor
Definition: elementitemeditor.h:34
TextEditor::m_parts
QList< PartText * > m_parts
Definition: texteditor.h:58
parttext.h
TextEditor::on_m_font_pb_clicked
void on_m_font_pb_clicked()
TextEditor::on_m_font_pb_clicked.
Definition: texteditor.cpp:239
qpropertyundocommand.h
TextEditor::on_m_color_pb_changed
void on_m_color_pb_changed(const QColor &newColor)
TextEditor::on_m_color_pb_changed.
Definition: texteditor.cpp:265
Ui
Definition: autonumberingdockwidget.h:25
TextEditor::TextEditor
TextEditor(QETElementEditor *editor, PartText *text=nullptr, QWidget *parent=nullptr)
TextEditor::TextEditor Default constructor.
Definition: texteditor.cpp:31
CustomElementPart
The CustomElementPart class This abstract class represents a primitive of the visual representation o...
Definition: customelementpart.h:40
TextEditor::ui
Ui::TextEditor * ui
Definition: texteditor.h:55
PartText::colorChanged
void colorChanged(const QColor &color)
TextEditor::m_edit_connection
QList< QMetaObject::Connection > m_edit_connection
Definition: texteditor.h:59
PartText::plainTextChanged
void plainTextChanged(const QString &text)
PartText
Definition: parttext.h:30
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
TextEditor::m_text
QPointer< PartText > m_text
Definition: texteditor.h:57
QETElementEditor
Definition: qetelementeditor.h:33
TextEditor::setPart
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:103
ElementItemEditor::undoStack
virtual QUndoStack & undoStack() const
Definition: elementitemeditor.cpp:44