X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Ftopicbutton.cpp;h=f2f60af199422fcb671e29c18500c203052fb741;hp=fd1d86a77c476acff342da227481a472e76f88c1;hb=21bae45824145c256bdca18b84b34e31aa2f668d;hpb=3031af9e62dc2e88dad257f08d5c0b542c7b4add diff --git a/src/qtui/topicbutton.cpp b/src/qtui/topicbutton.cpp index fd1d86a7..f2f60af1 100644 --- a/src/qtui/topicbutton.cpp +++ b/src/qtui/topicbutton.cpp @@ -36,7 +36,7 @@ TopicButton::TopicButton(QWidget *parent) : QAbstractButton(parent) { setFixedHeight(QFontMetrics(qApp->font()).height()); - setToolTip("Click to edit!"); + setToolTip(tr("Click to edit!")); } void TopicButton::paintEvent(QPaintEvent *event) { @@ -45,17 +45,20 @@ void TopicButton::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setBackgroundMode(Qt::OpaqueMode); + // FIXME re-enable topic painting +#ifndef SPUTDEV QRect drawRect = rect(); QRect brect; QString textPart; - foreach(QTextLayout::FormatRange fr, styledText.formats) { - textPart = styledText.text.mid(fr.start, fr.length); + foreach(QTextLayout::FormatRange fr, styledContents.formatList) { + textPart = styledContents.plainText.mid(fr.start, fr.length); painter.setFont(fr.format.font()); painter.setPen(QPen(fr.format.foreground(), 0)); painter.setBackground(fr.format.background()); painter.drawText(drawRect, Qt::AlignLeft|Qt::TextSingleLine, textPart, &brect); drawRect.setLeft(brect.right()); } +#endif } void TopicButton::setAndStyleText(const QString &text) { @@ -64,9 +67,10 @@ void TopicButton::setAndStyleText(const QString &text) { setText(text); // this triggers a repaint event - styledText = QtUi::style()->styleString(Message::mircToInternal(text)); +#ifndef SPUTDEV + styledContents = QtUi::style()->styleString(Message::mircToInternal(text)); int height = 1; - foreach(QTextLayout::FormatRange fr, styledText.formats) { + foreach(QTextLayout::FormatRange fr, styledContents.formatList) { height = qMax(height, QFontMetrics(fr.format.font()).height()); } @@ -75,5 +79,8 @@ void TopicButton::setAndStyleText(const QString &text) { height = QFontMetrics(qApp->font()).height(); setFixedHeight(height); +#endif + // show topic in tooltip + setToolTip(tr("%1\n\nClick to edit!").arg(QAbstractButton::text())); }