X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Ftopicwidget.cpp;h=c8c5aaeb21c46d9615538986ebed192b4a12cf37;hb=1d145922198e7e5d727c9bca8a92f95cf40d02ef;hp=ab901fd6193e17d8aa40d21f99eed0e7bb6359b0;hpb=4df7862b00b2113dabdf52342b2c15560313f476;p=quassel.git diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index ab901fd6..c8c5aaeb 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -23,15 +23,20 @@ #include #include "client.h" +#include "iconloader.h" #include "networkmodel.h" TopicWidget::TopicWidget(QWidget *parent) : AbstractItemView(parent) { ui.setupUi(this); + ui.topicEditButton->setPixmap(BarIcon("edit-rename")); + ui.topicLineEdit->hide(); ui.topicLineEdit->installEventFilter(this); ui.topicLabel->show(); + setContentsMargins(0,0,0,0); + parent->setMinimumHeight(layout()->sizeHint().height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin)); } void TopicWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { @@ -49,7 +54,7 @@ void TopicWidget::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot void TopicWidget::setTopic(const QString &newtopic) { if(_topic == newtopic) return; - + _topic = newtopic; ui.topicLabel->setText(newtopic); ui.topicLineEdit->setText(newtopic); @@ -74,6 +79,11 @@ void TopicWidget::switchEditable() { ui.topicEditButton->hide(); ui.topicLineEdit->show(); ui.topicLineEdit->setFocus(); + + setFixedHeight(layout()->sizeHint().height()); + // Update the dock widget too, else it won't resize in all styles... FIXME try to sanitize this + qobject_cast(parent())->setMinimumHeight(height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin)); + qobject_cast(parent())->adjustSize(); } void TopicWidget::switchPlain() { @@ -81,6 +91,10 @@ void TopicWidget::switchPlain() { ui.topicLabel->show(); ui.topicEditButton->show(); ui.topicLineEdit->setText(_topic); + setFixedHeight(layout()->sizeHint().height()); + // Update the dock widget too, else it won't resize in all styles... FIXME try to sanitize this + qobject_cast(parent())->setMinimumHeight(height() + 2*qApp->style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin)); + qobject_cast(parent())->adjustSize(); } // filter for the input widget to switch back to normal mode @@ -99,7 +113,6 @@ bool TopicWidget::eventFilter(QObject *obj, QEvent *event) { switchPlain(); return true; } - + return false; } -