X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Ftopicwidget.cpp;h=cb646eda090a06bd369a76d1b2d1dd513701df90;hp=f5e6c9e1ae93ed2c853aa659f3d5b1c67c1d92f7;hb=b68ffc844fc7504ecceeaa9348107ca5c249bd51;hpb=858c7dbcbfa84deda9a71b4f4d25b1555bae3cc1;ds=sidebyside diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index f5e6c9e1..cb646eda 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -33,21 +33,16 @@ TopicWidget::TopicWidget(QWidget *parent) void TopicWidget::currentChanged(const QModelIndex ¤t, 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); - 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;