-void TopicBar::setContents(QString t, bool _oneshot) {
- text = t; oneshot = _oneshot;
+void TopicBar::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
+ Q_UNUSED(previous);
+ setContents(current.sibling(current.row(), 1).data().toString());
+}
+
+void TopicBar::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) {
+ QItemSelectionRange changedArea(topLeft, bottomRight);
+ QModelIndex currentTopicIndex = _selectionModel->currentIndex().sibling(_selectionModel->currentIndex().row(), 1);
+ if(changedArea.contains(currentTopicIndex))
+ setContents(currentTopicIndex.data().toString());
+};
+
+void TopicBar::resizeEvent(QResizeEvent *event) {
+ QPushButton::resizeEvent(event);
+ calcTextMetrics();
+}
+
+void TopicBar::calcTextMetrics() {