mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Fix bug 244
I was thinking that the commit 5a51f6bace3115bb597ba472eb8938566c9d0fcf fix the bug 244, but not they only fix this bug : https://qelectrotech.org/forum/viewtopic.php?pid=16022#p16022 This commit really fix the bug 244
This commit is contained in:
parent
5a51f6bace
commit
ce21a812c0
@ -137,15 +137,20 @@ Diagram::~Diagram()
|
|||||||
delete m_event_interface;
|
delete m_event_interface;
|
||||||
|
|
||||||
// list removable items
|
// list removable items
|
||||||
QList<QGraphicsItem *> deletable_items;
|
QVector<QGraphicsItem *> deletable_items;
|
||||||
for(QGraphicsItem *qgi : items())
|
for(const auto &qgi : items())
|
||||||
{
|
{
|
||||||
if (qgi -> parentItem()) continue;
|
if (qgi->parentItem())
|
||||||
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
continue;
|
||||||
deletable_items << qgi;
|
if (qgraphicsitem_cast<Conductor *>(qgi))
|
||||||
|
continue;
|
||||||
|
deletable_items.append(qgi);
|
||||||
|
}
|
||||||
|
for (const auto &item : qAsConst(deletable_items))
|
||||||
|
{
|
||||||
|
removeItem(item);
|
||||||
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDeleteAll (deletable_items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ class QetGraphicsHeaderItem : public QGraphicsObject
|
|||||||
|
|
||||||
QRect m_current_rect;
|
QRect m_current_rect;
|
||||||
QRectF m_bounding_rect;
|
QRectF m_bounding_rect;
|
||||||
QAbstractItemModel *m_model = nullptr;
|
QPointer<QAbstractItemModel> m_model;
|
||||||
|
|
||||||
QVector<int>
|
QVector<int>
|
||||||
m_sections_minimum_width,
|
m_sections_minimum_width,
|
||||||
|
@ -185,7 +185,7 @@ void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
|||||||
this, &QetGraphicsTableItem::modelReseted);
|
this, &QetGraphicsTableItem::modelReseted);
|
||||||
}
|
}
|
||||||
m_model = model;
|
m_model = model;
|
||||||
m_header_item->setModel(model);
|
m_header_item->setModel(m_model);
|
||||||
|
|
||||||
setUpColumnAndRowMinimumSize();
|
setUpColumnAndRowMinimumSize();
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@ -210,7 +210,7 @@ void QetGraphicsTableItem::setModel(QAbstractItemModel *model)
|
|||||||
*/
|
*/
|
||||||
QAbstractItemModel *QetGraphicsTableItem::model() const
|
QAbstractItemModel *QetGraphicsTableItem::model() const
|
||||||
{
|
{
|
||||||
return m_model;
|
return m_model.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -599,7 +599,7 @@ QDomElement QetGraphicsTableItem::toXml(QDomDocument &dom_document) const
|
|||||||
{
|
{
|
||||||
//Add model
|
//Add model
|
||||||
auto dom_model = dom_document.createElement("model");
|
auto dom_model = dom_document.createElement("model");
|
||||||
auto project_db_model = static_cast<ProjectDBModel *>(m_model);
|
auto project_db_model = static_cast<ProjectDBModel *>(m_model.data());
|
||||||
dom_model.appendChild(project_db_model->toXml(dom_document));
|
dom_model.appendChild(project_db_model->toXml(dom_document));
|
||||||
dom_table.appendChild(dom_model);
|
dom_table.appendChild(dom_model);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
void previousTableDisplayRowChanged();
|
void previousTableDisplayRowChanged();
|
||||||
void removeUselessNextTable(bool recursive = true);
|
void removeUselessNextTable(bool recursive = true);
|
||||||
|
|
||||||
QAbstractItemModel *m_model= nullptr;
|
QPointer<QAbstractItemModel> m_model;
|
||||||
|
|
||||||
QVector<int> m_minimum_column_width;
|
QVector<int> m_minimum_column_width;
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user