}
void TopicButton::setAndStyleText(const QString &text) {
+ if(QAbstractButton::text() == text)
+ return;
+ setText(text); // this triggers a repaint event
+
styledText = QtUi::style()->styleString(Message::mircToInternal(text));
- setText(styledText.text);
int height = 1;
foreach(QTextLayout::FormatRange fr, styledText.formats) {
height = qMax(height, QFontMetrics(fr.format.font()).height());
}
void TopicWidget::setTopic(const QString &newtopic) {
+ if(_topic == newtopic)
+ return;
+
+ _topic = newtopic;
ui.topicButton->setAndStyleText(newtopic);
ui.topicLineEdit->setText(newtopic);
switchPlain();
if(keyEvent->key() == Qt::Key_Escape) {
switchPlain();
+ ui.topicLineEdit->setText(_topic);
return true;
}