Improve code style, Wrap code for better readability

This commit is contained in:
Simon De Backer
2020-08-16 14:23:59 +02:00
parent 8144e9b21b
commit 928b56f2bf
22 changed files with 656 additions and 363 deletions

View File

@@ -32,15 +32,15 @@
#include <QUndoCommand>
DynamicElementTextItemEditor::DynamicElementTextItemEditor(Element *element, QWidget *parent) :
AbstractElementPropertiesEditorWidget(parent),
ui(new Ui::DynamicElementTextItemEditor)
AbstractElementPropertiesEditorWidget(parent),
ui(new Ui::DynamicElementTextItemEditor)
{
ui->setupUi(this);
ui->setupUi(this);
ui->m_tree_view->setItemDelegate(new DynamicTextItemDelegate(ui->m_tree_view));
ui->m_tree_view->setItemDelegate(new DynamicTextItemDelegate(ui->m_tree_view));
ui->m_remove_selection->setDisabled(true);
setElement(element);
setElement(element);
}
DynamicElementTextItemEditor::~DynamicElementTextItemEditor()
@@ -50,17 +50,17 @@ DynamicElementTextItemEditor::~DynamicElementTextItemEditor()
void DynamicElementTextItemEditor::setElement(Element *element)
{
if (m_element == element)
return;
m_element = element;
DynamicElementTextModel *old_model = m_model;
m_model = new DynamicElementTextModel(element, ui->m_tree_view);
if (m_element == element)
return;
m_element = element;
DynamicElementTextModel *old_model = m_model;
m_model = new DynamicElementTextModel(element, ui->m_tree_view);
connect(m_model, &DynamicElementTextModel::dataChanged, this, &DynamicElementTextItemEditor::dataEdited);
ui->m_tree_view->setModel(m_model);
if(old_model)
ui->m_tree_view->setModel(m_model);
if(old_model)
delete old_model;
}
@@ -198,10 +198,10 @@ void DynamicElementTextItemEditor::dataEdited()
*/
void DynamicElementTextItemEditor::on_m_add_text_clicked()
{
if (!m_element)
return;
if (!m_element)
return;
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
if (m_element->diagram())
{
m_element->diagram()->undoStack().push(new AddElementTextCommand(m_element, deti));
@@ -219,9 +219,9 @@ void DynamicElementTextItemEditor::on_m_add_text_clicked()
*/
void DynamicElementTextItemEditor::on_m_remove_selection_clicked()
{
DynamicElementTextItem *deti = m_model->textFromIndex(ui->m_tree_view->currentIndex());
if(deti)
{
DynamicElementTextItem *deti = m_model->textFromIndex(ui->m_tree_view->currentIndex());
if(deti)
{
if(m_element->diagram())
{
DiagramContent dc;
@@ -229,7 +229,7 @@ void DynamicElementTextItemEditor::on_m_remove_selection_clicked()
m_element->diagram()->undoStack().push(new DeleteQGraphicsItemCommand(m_element->diagram(), dc));
}
return;
}
}
ElementTextItemGroup *group = m_model->groupFromIndex(ui->m_tree_view->currentIndex());
if(group && m_element.data()->diagram())
m_element.data()->diagram()->undoStack().push(new RemoveTextsGroupCommand(m_element.data(), group));
@@ -259,10 +259,10 @@ void DynamicElementTextItemEditor::on_m_tree_view_clicked(const QModelIndex &ind
void DynamicElementTextItemEditor::on_m_export_pb_clicked()
{
ExportElementTextPattern eetp(m_element);
ExportElementTextPattern eetp(m_element);
}
void DynamicElementTextItemEditor::on_m_import_pb_clicked()
{
ImportElementTextPattern ietp(m_element);
ImportElementTextPattern ietp(m_element);
}