Ref T345, clear model function

This commit is contained in:
Klaus Basan
2018-09-17 18:22:49 +02:00
parent 5378db0e70
commit 15a563058f
2 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QAbstractItemModel>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
@@ -412,6 +413,15 @@ namespace BlackGui
return rows;
}
int CGuiUtility::clearModel(QAbstractItemModel *model)
{
if (!model) { return 0; }
const int count = model->rowCount();
if (count < 1) { return 0; }
model->removeRows(0, count);
return count;
}
bool CGuiUtility::isTopLevelWidget(QWidget *widget)
{
if (!widget) { return false; }