summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp5
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index 963ce72..e88e1bb 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -22,7 +22,7 @@
namespace Swift {
-QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent) {
+QtTreeWidget::QtTreeWidget(UIEventStream* eventStream, QWidget* parent) : QTreeView(parent), editable_(false) {
eventStream_ = eventStream;
model_ = new RosterModel(this);
setModel(model_);
@@ -76,6 +76,9 @@ void QtTreeWidget::handleItemActivated(const QModelIndex& index) {
}
void QtTreeWidget::contextMenuEvent(QContextMenuEvent* event) {
+ if (!editable_) {
+ return;
+ }
QModelIndex index = indexAt(event->pos());
if (!index.isValid()) {
return;
diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h
index 3430f7e..ce2351b 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.h
+++ b/Swift/QtUI/Roster/QtTreeWidget.h
@@ -23,6 +23,8 @@ class QtTreeWidget : public QTreeView{
QtTreeWidgetItem* getRoot();
void setRosterModel(Roster* roster);
Roster* getRoster() {return roster_;}
+ void setEditable(bool b) { editable_ = b; }
+
private slots:
void handleItemActivated(const QModelIndex&);
void handleModelItemExpanded(const QModelIndex&, bool expanded);
@@ -39,6 +41,7 @@ class QtTreeWidget : public QTreeView{
RosterDelegate* delegate_;
QtTreeWidgetItem* treeRoot_;
UIEventStream* eventStream_;
+ bool editable_;
};
}