summaryrefslogtreecommitdiff
path: root/src/plugins/find/searchresulttreeitems.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-09-29 18:16:13 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2009-09-29 18:19:36 +0200
commit331effc2fd5e25eae4243c517e0047d864fd94a5 (patch)
tree9f8c3ce003b1732c98d1a68635f4f3a7554e4a30 /src/plugins/find/searchresulttreeitems.cpp
parent3d62363fee4e9b0416ab9a9f6e36deeffdaea505 (diff)
downloadqt-creator-331effc2fd5e25eae4243c517e0047d864fd94a5.tar.gz
Introduced checkable results.
Diffstat (limited to 'src/plugins/find/searchresulttreeitems.cpp')
-rw-r--r--src/plugins/find/searchresulttreeitems.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/plugins/find/searchresulttreeitems.cpp b/src/plugins/find/searchresulttreeitems.cpp
index e4ea18539f..b2c19ec9ca 100644
--- a/src/plugins/find/searchresulttreeitems.cpp
+++ b/src/plugins/find/searchresulttreeitems.cpp
@@ -32,7 +32,7 @@
using namespace Find::Internal;
SearchResultTreeItem::SearchResultTreeItem(SearchResultTreeItem::ItemType type, const SearchResultTreeItem *parent)
- : m_type(type), m_parent(parent)
+ : m_type(type), m_parent(parent), m_isUserCheckable(false), m_checkState(Qt::Unchecked)
{
}
@@ -41,6 +41,26 @@ SearchResultTreeItem::~SearchResultTreeItem()
clearChildren();
}
+bool SearchResultTreeItem::isUserCheckable() const
+{
+ return m_isUserCheckable;
+}
+
+void SearchResultTreeItem::setIsUserCheckable(bool isUserCheckable)
+{
+ m_isUserCheckable = isUserCheckable;
+}
+
+Qt::CheckState SearchResultTreeItem::checkState() const
+{
+ return m_checkState;
+}
+
+void SearchResultTreeItem::setCheckState(Qt::CheckState checkState)
+{
+ m_checkState = checkState;
+}
+
void SearchResultTreeItem::clearChildren()
{
qDeleteAll(m_children);
@@ -62,7 +82,7 @@ int SearchResultTreeItem::rowOfItem() const
return (m_parent ? m_parent->m_children.indexOf(const_cast<SearchResultTreeItem*>(this)):0);
}
-const SearchResultTreeItem* SearchResultTreeItem::childAt(int index) const
+SearchResultTreeItem* SearchResultTreeItem::childAt(int index) const
{
return m_children.at(index);
}
@@ -131,5 +151,9 @@ void SearchResultFile::appendResultLine(int index, int lineNumber, const QString
{
SearchResultTreeItem *child = new SearchResultTextRow(index, lineNumber, rowText,
searchTermStart, searchTermLength, this);
+ if (isUserCheckable()) {
+ child->setIsUserCheckable(true);
+ child->setCheckState(Qt::Checked);
+ }
appendChild(child);
}