projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made the core connects faster
[quassel.git]
/
src
/
qtui
/
topicbutton.cpp
diff --git
a/src/qtui/topicbutton.cpp
b/src/qtui/topicbutton.cpp
index
a83779e
..
fd1d86a
100644
(file)
--- a/
src/qtui/topicbutton.cpp
+++ b/
src/qtui/topicbutton.cpp
@@
-35,6
+35,8
@@
TopicButton::TopicButton(QWidget *parent)
: QAbstractButton(parent)
{
TopicButton::TopicButton(QWidget *parent)
: QAbstractButton(parent)
{
+ setFixedHeight(QFontMetrics(qApp->font()).height());
+ setToolTip("Click to edit!");
}
void TopicButton::paintEvent(QPaintEvent *event) {
}
void TopicButton::paintEvent(QPaintEvent *event) {
@@
-59,6
+61,7
@@
void TopicButton::paintEvent(QPaintEvent *event) {
void TopicButton::setAndStyleText(const QString &text) {
if(QAbstractButton::text() == text)
return;
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(text); // this triggers a repaint event
styledText = QtUi::style()->styleString(Message::mircToInternal(text));
@@
-66,5
+69,11
@@
void TopicButton::setAndStyleText(const QString &text) {
foreach(QTextLayout::FormatRange fr, styledText.formats) {
height = qMax(height, QFontMetrics(fr.format.font()).height());
}
foreach(QTextLayout::FormatRange fr, styledText.formats) {
height = qMax(height, QFontMetrics(fr.format.font()).height());
}
+
+ // ensure the button is editable (height != 1) if there is no text to show
+ if(text.isEmpty())
+ height = QFontMetrics(qApp->font()).height();
+
setFixedHeight(height);
}
setFixedHeight(height);
}
+