mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-06 13:10:01 +01:00
Wrap code for better readability
This commit is contained in:
@@ -43,7 +43,8 @@ DynamicTextFieldEditor::DynamicTextFieldEditor(
|
||||
fillInfoComboBox();
|
||||
}
|
||||
|
||||
DynamicTextFieldEditor::~DynamicTextFieldEditor() {
|
||||
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||
{
|
||||
delete ui;
|
||||
if(!m_connection_list.isEmpty()) {
|
||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
||||
@@ -108,11 +109,13 @@ bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
|
||||
@return The current edited part, note they can return nullptr if
|
||||
there is not a currently edited part.
|
||||
*/
|
||||
CustomElementPart *DynamicTextFieldEditor::currentPart() const {
|
||||
CustomElementPart *DynamicTextFieldEditor::currentPart() const
|
||||
{
|
||||
return m_text_field.data();
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
|
||||
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const
|
||||
{
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
@@ -120,7 +123,8 @@ QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
|
||||
return parts;
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::updateForm() {
|
||||
void DynamicTextFieldEditor::updateForm()
|
||||
{
|
||||
if(m_text_field) {
|
||||
ui -> m_x_sb -> setValue(m_text_field.data() -> x());
|
||||
ui -> m_y_sb -> setValue(m_text_field.data() ->y ());
|
||||
@@ -152,7 +156,8 @@ void DynamicTextFieldEditor::updateForm() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setUpConnections() {
|
||||
void DynamicTextFieldEditor::setUpConnections()
|
||||
{
|
||||
assert(m_connection_list.isEmpty());
|
||||
//Setup the connection
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged,
|
||||
@@ -177,7 +182,8 @@ void DynamicTextFieldEditor::setUpConnections() {
|
||||
[this](){this -> updateForm();});
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::disconnectConnections() {
|
||||
void DynamicTextFieldEditor::disconnectConnections()
|
||||
{
|
||||
//Remove previous connection
|
||||
if(!m_connection_list.isEmpty())
|
||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
||||
@@ -190,7 +196,8 @@ void DynamicTextFieldEditor::disconnectConnections() {
|
||||
@brief DynamicTextFieldEditor::fillInfoComboBox
|
||||
Fill the combo box "element information"
|
||||
*/
|
||||
void DynamicTextFieldEditor::fillInfoComboBox() {
|
||||
void DynamicTextFieldEditor::fillInfoComboBox()
|
||||
{
|
||||
ui -> m_elmt_info_cb -> clear();
|
||||
|
||||
QStringList strl;
|
||||
@@ -212,7 +219,8 @@ void DynamicTextFieldEditor::fillInfoComboBox() {
|
||||
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
|
||||
{
|
||||
double value = ui -> m_x_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i] -> x(), value);
|
||||
@@ -222,7 +230,8 @@ void DynamicTextFieldEditor::on_m_x_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_y_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_y_sb_editingFinished()
|
||||
{
|
||||
double value = ui -> m_y_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i] -> y(), value);
|
||||
@@ -232,7 +241,8 @@ void DynamicTextFieldEditor::on_m_y_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished()
|
||||
{
|
||||
int value = ui -> m_rotation_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i] -> rotation(), value);
|
||||
@@ -242,7 +252,8 @@ void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished()
|
||||
{
|
||||
QString text = ui -> m_user_text_le -> text();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i] -> text(), text);
|
||||
@@ -251,7 +262,8 @@ void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_size_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_size_sb_editingFinished()
|
||||
{
|
||||
QFont font_ = m_text_field -> font();
|
||||
font_.setPointSize(ui -> m_size_sb -> value());
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -261,7 +273,8 @@ void DynamicTextFieldEditor::on_m_size_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
||||
{
|
||||
bool frame = ui -> m_frame_cb -> isChecked();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -273,7 +286,8 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
||||
{
|
||||
qreal width = (qreal)ui -> m_width_sb -> value();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -335,7 +349,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||
{
|
||||
CompositeTextEditDialog ctd(m_text_field.data() -> compositeText(), this);
|
||||
if(ctd.exec()) {
|
||||
QString ct = ctd.plainText();
|
||||
@@ -349,7 +364,8 @@ void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_alignment_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_alignment_pb_clicked()
|
||||
{
|
||||
AlignmentTextDialog atd(m_text_field.data() -> alignment(), this);
|
||||
atd.exec();
|
||||
|
||||
@@ -364,7 +380,8 @@ void DynamicTextFieldEditor::on_m_alignment_pb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_font_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QFont font_ = QFontDialog::getFont(&ok, m_text_field -> font(), this);
|
||||
if (ok && font_ != this -> font()) {
|
||||
|
||||
@@ -48,7 +48,8 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor,
|
||||
/**
|
||||
@brief PolygonEditor::~PolygonEditor
|
||||
*/
|
||||
PolygonEditor::~PolygonEditor() {
|
||||
PolygonEditor::~PolygonEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -115,11 +116,13 @@ bool PolygonEditor::setPart(CustomElementPart *new_part)
|
||||
@brief PolygonEditor::currentPart
|
||||
@return the curent edited part
|
||||
*/
|
||||
CustomElementPart *PolygonEditor::currentPart() const {
|
||||
CustomElementPart *PolygonEditor::currentPart() const
|
||||
{
|
||||
return m_part;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> PolygonEditor::currentParts() const {
|
||||
QList<CustomElementPart*> PolygonEditor::currentParts() const
|
||||
{
|
||||
return m_style->currentParts();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ RectangleEditor::RectangleEditor(QETElementEditor *editor, PartRectangle *rect,
|
||||
/**
|
||||
@brief RectangleEditor::~RectangleEditor
|
||||
*/
|
||||
RectangleEditor::~RectangleEditor() {
|
||||
RectangleEditor::~RectangleEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -112,11 +113,13 @@ bool RectangleEditor::setParts(QList <CustomElementPart *> parts)
|
||||
@brief RectangleEditor::currentPart
|
||||
@return
|
||||
*/
|
||||
CustomElementPart *RectangleEditor::currentPart() const {
|
||||
CustomElementPart *RectangleEditor::currentPart() const
|
||||
{
|
||||
return m_part;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> RectangleEditor::currentParts() const {
|
||||
QList<CustomElementPart*> RectangleEditor::currentParts() const
|
||||
{
|
||||
return m_style->currentParts();
|
||||
}
|
||||
|
||||
@@ -124,7 +127,8 @@ QList<CustomElementPart*> RectangleEditor::currentParts() const {
|
||||
@brief RectangleEditor::topLeft
|
||||
@return The edited topLeft already mapped to part coordinate
|
||||
*/
|
||||
QPointF RectangleEditor::editedTopLeft() const {
|
||||
QPointF RectangleEditor::editedTopLeft() const
|
||||
{
|
||||
return m_part->mapFromScene(ui->m_x_sb->value(), ui->m_y_sb->value());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *paren
|
||||
/**
|
||||
@brief TextEditor::~TextEditor
|
||||
*/
|
||||
TextEditor::~TextEditor() {
|
||||
TextEditor::~TextEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -79,14 +80,16 @@ void TextEditor::setUpChangeConnection(QPointer<PartText> part) {
|
||||
m_change_connection << connect(part, &PartText::colorChanged, this, &TextEditor::updateForm);
|
||||
}
|
||||
|
||||
void TextEditor::disconnectChangeConnection() {
|
||||
void TextEditor::disconnectChangeConnection()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connection) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connection.clear();
|
||||
}
|
||||
|
||||
void TextEditor::disconnectEditConnection() {
|
||||
void TextEditor::disconnectEditConnection()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_edit_connection) {
|
||||
disconnect(c);
|
||||
}
|
||||
@@ -150,11 +153,13 @@ bool TextEditor::setParts(QList <CustomElementPart *> parts) {
|
||||
@brief TextEditor::currentPart
|
||||
@return The current part
|
||||
*/
|
||||
CustomElementPart *TextEditor::currentPart() const {
|
||||
CustomElementPart *TextEditor::currentPart() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> TextEditor::currentParts() const {
|
||||
QList<CustomElementPart*> TextEditor::currentParts() const
|
||||
{
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
@@ -167,7 +172,8 @@ QList<CustomElementPart*> TextEditor::currentParts() const {
|
||||
Setup the connection between the widgets of this editor and the undo command
|
||||
use to apply the change to the edited text.
|
||||
*/
|
||||
void TextEditor::setUpEditConnection() {
|
||||
void TextEditor::setUpEditConnection()
|
||||
{
|
||||
disconnectEditConnection();
|
||||
|
||||
m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::editingFinished, [this]() {
|
||||
@@ -236,7 +242,8 @@ void TextEditor::setUpEditConnection() {
|
||||
/**
|
||||
@brief TextEditor::on_m_font_pb_clicked
|
||||
*/
|
||||
void TextEditor::on_m_font_pb_clicked() {
|
||||
void TextEditor::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QFont font_ = QFontDialog::getFont(&ok, m_text -> font(), this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user