topic changes are now handled properly
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 12 Mar 2008 15:20:41 +0000 (15:20 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 12 Mar 2008 15:20:41 +0000 (15:20 +0000)
src/qtui/topicwidget.cpp
src/qtui/topicwidget.h

index f5e6c9e..cb646ed 100644 (file)
@@ -33,21 +33,16 @@ TopicWidget::TopicWidget(QWidget *parent)
 
 void TopicWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
   Q_UNUSED(previous);
 
 void TopicWidget::currentChanged(const QModelIndex &current, const QModelIndex &previous) {
   Q_UNUSED(previous);
-  setTopicForIndex(current);
+  setTopic(current.sibling(current.row(), 1).data().toString());
 }
 
 void TopicWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) {
   QItemSelectionRange changedArea(topLeft, bottomRight);
 }
 
 void TopicWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) {
   QItemSelectionRange changedArea(topLeft, bottomRight);
-  QModelIndex currentIndex = selectionModel()->currentIndex();
-  if(changedArea.contains(currentIndex))
-    setTopicForIndex(currentIndex);
+  QModelIndex currentTopicIndex = selectionModel()->currentIndex().sibling(selectionModel()->currentIndex().row(), 1);
+  if(changedArea.contains(currentTopicIndex))
+    setTopic(currentTopicIndex.data().toString());
 };
 
 };
 
-void TopicWidget::setTopicForIndex(const QModelIndex &index) {
-  QModelIndex topicIndex = index.sibling(index.row(), 1);
-  setTopic(topicIndex.data().toString());
-}
-                                  
 void TopicWidget::setTopic(const QString &newtopic) {
   if(_topic == newtopic)
     return;
 void TopicWidget::setTopic(const QString &newtopic) {
   if(_topic == newtopic)
     return;
index 95ceadf..37d2321 100644 (file)
@@ -32,7 +32,6 @@ public:
   TopicWidget(QWidget *parent = 0);
 
   void setTopic(const QString &newtopic);
   TopicWidget(QWidget *parent = 0);
 
   void setTopic(const QString &newtopic);
-  void setTopicForIndex(const QModelIndex &index);
 
   virtual bool eventFilter(QObject *obj, QEvent *event);
 
 
   virtual bool eventFilter(QObject *obj, QEvent *event);