Slightly faster version of hasChildren
parent
796f5a87b6
commit
ae4d9fc89d
|
@ -164,6 +164,11 @@ int Directory::columnCount(const QModelIndex &parent) const
|
|||
return (parent.isValid()) ? 0 : 3;
|
||||
}
|
||||
|
||||
bool Directory::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
return rowCount(parent) > 0;
|
||||
}
|
||||
|
||||
int Directory::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return (parent.isValid()) ? 0 : directory_row_count(d);
|
||||
|
@ -303,6 +308,11 @@ int TestTree::columnCount(const QModelIndex &) const
|
|||
return 3;
|
||||
}
|
||||
|
||||
bool TestTree::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
return rowCount(parent) > 0;
|
||||
}
|
||||
|
||||
int TestTree::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid() && parent.column() != 0) {
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
bool canFetchMore(const QModelIndex &parent) const;
|
||||
void fetchMore(const QModelIndex &parent);
|
||||
|
@ -80,6 +81,7 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
bool canFetchMore(const QModelIndex &parent) const;
|
||||
void fetchMore(const QModelIndex &parent);
|
||||
|
|
|
@ -109,6 +109,11 @@ int Tree::columnCount(const QModelIndex &) const
|
|||
return 5;
|
||||
}
|
||||
|
||||
bool Tree::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
return rowCount(parent) > 0;
|
||||
}
|
||||
|
||||
int Tree::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid() && parent.column() != 0) {
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
bool canFetchMore(const QModelIndex &parent) const;
|
||||
void fetchMore(const QModelIndex &parent);
|
||||
|
|
|
@ -276,6 +276,7 @@ void writeHeaderItemModel(QTextStream& h, const Object&) {
|
|||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
bool canFetchMore(const QModelIndex &parent) const;
|
||||
void fetchMore(const QModelIndex &parent);
|
||||
|
@ -315,6 +316,11 @@ int %1::columnCount(const QModelIndex &parent) const
|
|||
return (parent.isValid()) ? 0 : %3;
|
||||
}
|
||||
|
||||
bool %1::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
return rowCount(parent) > 0;
|
||||
}
|
||||
|
||||
int %1::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return (parent.isValid()) ? 0 : %2_row_count(d);
|
||||
|
@ -358,6 +364,11 @@ int %1::columnCount(const QModelIndex &) const
|
|||
return %3;
|
||||
}
|
||||
|
||||
bool %1::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
return rowCount(parent) > 0;
|
||||
}
|
||||
|
||||
int %1::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid() && parent.column() != 0) {
|
||||
|
|
Loading…
Reference in New Issue