mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Fix crash
This commit is contained in:
@@ -512,6 +512,10 @@ int QetGraphicsTableItem::displayNRowOffset() const
|
||||
*/
|
||||
int QetGraphicsTableItem::displayedRowCount() const
|
||||
{
|
||||
if (!m_model) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Calcule the number of rows to display.
|
||||
auto row_count = m_model->rowCount();
|
||||
|
||||
@@ -524,12 +528,12 @@ int QetGraphicsTableItem::displayedRowCount() const
|
||||
return row_count;
|
||||
}
|
||||
|
||||
QetGraphicsTableItem *QetGraphicsTableItem::previousTable() const
|
||||
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::previousTable() const
|
||||
{
|
||||
return m_previous_table;
|
||||
}
|
||||
|
||||
QetGraphicsTableItem *QetGraphicsTableItem::nextTable() const
|
||||
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::nextTable() const
|
||||
{
|
||||
return m_next_table;
|
||||
}
|
||||
@@ -1088,15 +1092,15 @@ void QetGraphicsTableItem::previousTableDisplayRowChanged()
|
||||
*/
|
||||
void QetGraphicsTableItem::removeUselessNextTable(bool recursive)
|
||||
{
|
||||
if (!m_next_table) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_next_table)
|
||||
{
|
||||
if (recursive) {
|
||||
m_next_table->removeUselessNextTable();
|
||||
}
|
||||
if (m_next_table->displayedRowCount() <= 0) {
|
||||
delete m_next_table;
|
||||
m_next_table = nullptr;
|
||||
if (m_next_table->displayedRowCount() <= 0)
|
||||
{
|
||||
m_next_table.data()->deleteLater();
|
||||
m_next_table.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
||||
QString tableName() const;
|
||||
int displayNRowOffset() const;
|
||||
int displayedRowCount() const;
|
||||
QetGraphicsTableItem *previousTable() const;
|
||||
QetGraphicsTableItem *nextTable() const;
|
||||
QPointer<QetGraphicsTableItem> previousTable() const;
|
||||
QPointer<QetGraphicsTableItem> nextTable() const;
|
||||
void setToMinimumHeight();
|
||||
void initLink();
|
||||
QUuid uuid() const {return m_uuid;}
|
||||
@@ -141,9 +141,8 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
||||
QetGraphicsHandlerItem m_handler_item;
|
||||
QetGraphicsHeaderItem *m_header_item = nullptr;
|
||||
|
||||
QetGraphicsTableItem
|
||||
*m_previous_table = nullptr,
|
||||
*m_next_table = nullptr;
|
||||
QPointer<QetGraphicsTableItem> m_previous_table,
|
||||
m_next_table;
|
||||
|
||||
QString m_name;
|
||||
QUuid
|
||||
|
||||
Reference in New Issue
Block a user