forked from qt-creator/qt-creator
Fix wrong code in list/table model templates
rowCount should return 0 if the parent *is* valid, and return the actual number of rows when queried with an invalid index. Change-Id: I00e3d4ea79e1aaf0be1974da876c5a871d3924e6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -28,7 +28,7 @@ bool %{CN}::setHeaderData(int section, Qt::Orientation orientation, const QVaria
|
||||
|
||||
int %{CN}::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (!parent.isValid())
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
// FIXME: Implement me!
|
||||
|
@@ -29,7 +29,7 @@ bool %{CN}::setHeaderData(int section, Qt::Orientation orientation, const QVaria
|
||||
|
||||
int %{CN}::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (!parent.isValid())
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
// FIXME: Implement me!
|
||||
@@ -37,7 +37,7 @@ int %{CN}::rowCount(const QModelIndex &parent) const
|
||||
|
||||
int %{CN}::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (!parent.isValid())
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
// FIXME: Implement me!
|
||||
|
Reference in New Issue
Block a user