diff --git a/src/mainwindow.ui b/src/mainwindow.ui index b3577163c..b7c87e3c5 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -663,7 +663,7 @@ Set your status message that will be shown to others - + Your status diff --git a/src/widget/tool/croppinglabel.cpp b/src/widget/tool/croppinglabel.cpp index 8fcef2878..05a944e65 100644 --- a/src/widget/tool/croppinglabel.cpp +++ b/src/widget/tool/croppinglabel.cpp @@ -85,6 +85,12 @@ void CroppingLabel::setText(const QString& text) setElidedText(); } +void CroppingLabel::setPlaceholderText(const QString& text) +{ + textEdit->setPlaceholderText(text); + setElidedText(); +} + void CroppingLabel::resizeEvent(QResizeEvent* ev) { setElidedText(); @@ -129,8 +135,12 @@ void CroppingLabel::setElidedText() setToolTip(Qt::convertFromPlainText(origText, Qt::WhiteSpaceNormal)); else setToolTip(QString()); - - QLabel::setText(elidedText); + if (!elidedText.isEmpty()) { + QLabel::setText(elidedText); + } else { + // NOTE: it would be nice if the label had custom styling when it was default + QLabel::setText(textEdit->placeholderText()); + } } void CroppingLabel::hideTextEdit() diff --git a/src/widget/tool/croppinglabel.h b/src/widget/tool/croppinglabel.h index 89a7291c8..1c56bfc39 100644 --- a/src/widget/tool/croppinglabel.h +++ b/src/widget/tool/croppinglabel.h @@ -39,6 +39,7 @@ public slots: public slots: void setText(const QString& text); + void setPlaceholderText(const QString& text); void minimizeMaximumWidth(); signals: diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index e345a5c74..c924cbc59 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -909,16 +909,11 @@ void Widget::onStatusMessageChanged(const QString& newStatusMessage) void Widget::setStatusMessage(const QString& statusMessage) { - if (statusMessage.isEmpty()) { - ui->statusLabel->setText(tr("Your status")); - ui->statusLabel->setToolTip(tr("Your status")); - } else { - ui->statusLabel->setText(statusMessage); - // escape HTML from tooltips and preserve newlines - // TODO: move newspace preservance to a generic function - ui->statusLabel->setToolTip("

" + statusMessage.toHtmlEscaped() - + "

"); - } + ui->statusLabel->setText(statusMessage); + // escape HTML from tooltips and preserve newlines + // TODO: move newspace preservance to a generic function + ui->statusLabel->setToolTip("

" + statusMessage.toHtmlEscaped() + + "

"); } void Widget::reloadHistory()