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
|
int QetGraphicsTableItem::displayedRowCount() const
|
||||||
{
|
{
|
||||||
|
if (!m_model) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//Calcule the number of rows to display.
|
//Calcule the number of rows to display.
|
||||||
auto row_count = m_model->rowCount();
|
auto row_count = m_model->rowCount();
|
||||||
|
|
||||||
@@ -524,12 +528,12 @@ int QetGraphicsTableItem::displayedRowCount() const
|
|||||||
return row_count;
|
return row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
QetGraphicsTableItem *QetGraphicsTableItem::previousTable() const
|
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::previousTable() const
|
||||||
{
|
{
|
||||||
return m_previous_table;
|
return m_previous_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
QetGraphicsTableItem *QetGraphicsTableItem::nextTable() const
|
QPointer<QetGraphicsTableItem> QetGraphicsTableItem::nextTable() const
|
||||||
{
|
{
|
||||||
return m_next_table;
|
return m_next_table;
|
||||||
}
|
}
|
||||||
@@ -1088,15 +1092,15 @@ void QetGraphicsTableItem::previousTableDisplayRowChanged()
|
|||||||
*/
|
*/
|
||||||
void QetGraphicsTableItem::removeUselessNextTable(bool recursive)
|
void QetGraphicsTableItem::removeUselessNextTable(bool recursive)
|
||||||
{
|
{
|
||||||
if (!m_next_table) {
|
if (m_next_table)
|
||||||
return;
|
{
|
||||||
}
|
if (recursive) {
|
||||||
|
m_next_table->removeUselessNextTable();
|
||||||
if (recursive) {
|
}
|
||||||
m_next_table->removeUselessNextTable();
|
if (m_next_table->displayedRowCount() <= 0)
|
||||||
}
|
{
|
||||||
if (m_next_table->displayedRowCount() <= 0) {
|
m_next_table.data()->deleteLater();
|
||||||
delete m_next_table;
|
m_next_table.clear();
|
||||||
m_next_table = nullptr;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
QString tableName() const;
|
QString tableName() const;
|
||||||
int displayNRowOffset() const;
|
int displayNRowOffset() const;
|
||||||
int displayedRowCount() const;
|
int displayedRowCount() const;
|
||||||
QetGraphicsTableItem *previousTable() const;
|
QPointer<QetGraphicsTableItem> previousTable() const;
|
||||||
QetGraphicsTableItem *nextTable() const;
|
QPointer<QetGraphicsTableItem> nextTable() const;
|
||||||
void setToMinimumHeight();
|
void setToMinimumHeight();
|
||||||
void initLink();
|
void initLink();
|
||||||
QUuid uuid() const {return m_uuid;}
|
QUuid uuid() const {return m_uuid;}
|
||||||
@@ -141,9 +141,8 @@ class QetGraphicsTableItem : public QetGraphicsItem
|
|||||||
QetGraphicsHandlerItem m_handler_item;
|
QetGraphicsHandlerItem m_handler_item;
|
||||||
QetGraphicsHeaderItem *m_header_item = nullptr;
|
QetGraphicsHeaderItem *m_header_item = nullptr;
|
||||||
|
|
||||||
QetGraphicsTableItem
|
QPointer<QetGraphicsTableItem> m_previous_table,
|
||||||
*m_previous_table = nullptr,
|
m_next_table;
|
||||||
*m_next_table = nullptr;
|
|
||||||
|
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QUuid
|
QUuid
|
||||||
|
|||||||
Reference in New Issue
Block a user