Fixed a bug in the new topic widget where no repaint event was triggered if only...
[quassel.git] / src / qtui / topicwidget.cpp
index 8adb0b6..511d275 100644 (file)
@@ -32,6 +32,10 @@ TopicWidget::TopicWidget(QWidget *parent)
 }
 
 void TopicWidget::setTopic(const QString &newtopic) {
+  if(_topic == newtopic)
+    return;
+  
+  _topic = newtopic;
   ui.topicButton->setAndStyleText(newtopic);
   ui.topicLineEdit->setText(newtopic);
   switchPlain();
@@ -49,6 +53,7 @@ void TopicWidget::on_topicButton_clicked() {
 void TopicWidget::switchEditable() {
   ui.topicButton->hide();
   ui.topicLineEdit->show();
+  ui.topicLineEdit->setFocus();
 }
 
 void TopicWidget::switchPlain() {
@@ -64,6 +69,7 @@ bool TopicWidget::eventFilter(QObject *obj, QEvent *event) {
 
   if(keyEvent->key() == Qt::Key_Escape) {
     switchPlain();
+    ui.topicLineEdit->setText(_topic);
     return true;
   }