2019-03-10 17:58:33 +00:00
|
|
|
|
/*
|
2024-03-29 10:09:48 +01:00
|
|
|
|
Copyright 2006-2024 The QElectroTech Team
|
2007-12-01 10:47:15 +00:00
|
|
|
|
This file is part of QElectroTech.
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
|
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.
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
|
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.
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
2007-12-01 10:47:15 +00:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2019-03-10 17:58:33 +00:00
|
|
|
|
#ifndef TEXTEDITOR_H
|
|
|
|
|
#define TEXTEDITOR_H
|
2015-07-24 12:56:27 +00:00
|
|
|
|
|
2020-12-10 18:44:03 +01:00
|
|
|
|
#include "../elementitemeditor.h"
|
2015-07-24 12:56:27 +00:00
|
|
|
|
|
2019-03-10 17:58:33 +00:00
|
|
|
|
#include <QPointer>
|
2020-12-10 18:44:03 +01:00
|
|
|
|
#include <QWidget>
|
2020-12-18 17:39:00 +01:00
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#ifdef BUILD_WITHOUT_KF5
|
|
|
|
|
#else
|
|
|
|
|
#include <KColorButton>
|
|
|
|
|
#endif
|
2007-06-30 17:41:07 +00:00
|
|
|
|
class PartText;
|
2015-07-24 12:56:27 +00:00
|
|
|
|
|
2020-08-05 08:09:13 +01:00
|
|
|
|
class TextEditor : public ElementItemEditor {
|
|
|
|
|
Q_OBJECT
|
2015-07-24 12:56:27 +00:00
|
|
|
|
|
2007-06-30 17:41:07 +00:00
|
|
|
|
public:
|
2019-03-10 17:58:33 +00:00
|
|
|
|
explicit TextEditor(QETElementEditor *editor, PartText *text = nullptr, QWidget *parent = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
|
~TextEditor() override;
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
2021-03-11 19:52:50 +01:00
|
|
|
|
void updateForm() override;
|
2019-03-10 17:58:33 +00:00
|
|
|
|
bool setPart(CustomElementPart *part) override;
|
2020-08-05 08:09:13 +01:00
|
|
|
|
bool setParts(QList <CustomElementPart *>) override;
|
2019-03-10 17:58:33 +00:00
|
|
|
|
CustomElementPart *currentPart() const override;
|
2020-08-05 08:09:13 +01:00
|
|
|
|
QList<CustomElementPart*> currentParts() const override;
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void on_m_font_pb_clicked();
|
|
|
|
|
void on_m_color_pb_changed(const QColor &newColor);
|
2007-08-25 03:43:05 +00:00
|
|
|
|
private:
|
2020-12-18 17:39:00 +01:00
|
|
|
|
void setUpWidget(QWidget* parent = nullptr);
|
2019-03-10 17:58:33 +00:00
|
|
|
|
void setUpEditConnection();
|
2020-08-05 08:09:13 +01:00
|
|
|
|
void setUpChangeConnection(QPointer<PartText> part);
|
|
|
|
|
void disconnectChangeConnection();
|
|
|
|
|
void disconnectEditConnection();
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPointer <PartText> m_text;
|
2020-08-05 08:09:13 +01:00
|
|
|
|
QList<PartText*> m_parts;
|
2019-03-10 17:58:33 +00:00
|
|
|
|
QList <QMetaObject::Connection> m_edit_connection;
|
2020-08-05 08:09:13 +01:00
|
|
|
|
QList <QMetaObject::Connection> m_change_connection;
|
2020-12-18 17:39:00 +01:00
|
|
|
|
QSpinBox *m_y_sb;
|
|
|
|
|
QSpinBox *m_rotation_sb;
|
|
|
|
|
QSpinBox *m_x_sb;
|
|
|
|
|
QSpinBox *m_size_sb;
|
|
|
|
|
QLineEdit *m_line_edit;
|
|
|
|
|
QPushButton *m_font_pb;
|
|
|
|
|
#ifdef BUILD_WITHOUT_KF5
|
|
|
|
|
#else
|
|
|
|
|
KColorButton *m_color_pb;
|
|
|
|
|
#endif
|
2007-06-30 17:41:07 +00:00
|
|
|
|
};
|
2019-03-10 17:58:33 +00:00
|
|
|
|
|
|
|
|
|
#endif // TEXTEDITOR_H
|