mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:20:06 +00:00
Hiding some properties of TreeItem
This commit is contained in:
parent
1ab0d62b1f
commit
f24aa78b50
2 changed files with 14 additions and 3 deletions
|
|
@ -12,6 +12,8 @@ namespace qt
|
|||
namespace model
|
||||
{
|
||||
|
||||
class TreeModel;
|
||||
|
||||
class TreeItem
|
||||
{
|
||||
public:
|
||||
|
|
@ -36,14 +38,18 @@ public:
|
|||
int row() const;
|
||||
const TreeItem* parent_item() const;
|
||||
|
||||
void AppendChild(TreeItem* child);
|
||||
TreeItem* FindChild(int column, const QVariant& data);
|
||||
bool InsertChildren(int position, int count, int columns);
|
||||
bool SetData(int column, const QVariant& value);
|
||||
|
||||
protected:
|
||||
void AppendChild(TreeItem* child);
|
||||
bool InsertChildren(int position, int count, int columns);
|
||||
bool SetData(int column, const QVariant& value);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
|
||||
friend class TreeModel;
|
||||
};
|
||||
|
||||
} // namespace model
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@ TreeItem* TreeModel::root_item()
|
|||
|
||||
int TreeModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (parent.isValid() && parent.column() > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const TreeItem* parentItem = p->item(parent);
|
||||
return parentItem ? parentItem->child_count() : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue