From: Flavio Tordini Date: Tue, 30 Jun 2009 19:35:19 +0000 (+0200) Subject: Hide "Recnet keywords" label when there is none X-Git-Tag: 0.4~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0cdb0788f00afdcae3fc7b0bdfcd9aa4971c3ada;p=minitube Hide "Recnet keywords" label when there is none --- diff --git a/src/SearchView.cpp b/src/SearchView.cpp index 0569bea..96e26b3 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -66,10 +66,11 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) { recentKeywordsLayout = new QVBoxLayout(); recentKeywordsLayout->setAlignment(Qt::AlignTop); - QLabel *label = new QLabel(tr("Recent keywords").toUpper(), this); - label->setForegroundRole(QPalette::Dark); - label->setFont(smallerFont); - recentKeywordsLayout->addWidget(label); + recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this); + recentKeywordsLabel->hide(); + recentKeywordsLabel->setForegroundRole(QPalette::Dark); + recentKeywordsLabel->setFont(smallerFont); + recentKeywordsLayout->addWidget(recentKeywordsLabel); otherLayout->addLayout(recentKeywordsLayout); @@ -118,6 +119,7 @@ void SearchView::updateRecentKeywords() { // load QSettings settings; QStringList keywords = settings.value(recentKeywordsKey).toStringList(); + recentKeywordsLabel->setVisible(!keywords.isEmpty()); foreach (QString keyword, keywords) { QLabel *itemLabel = new QLabel("" diff --git a/src/SearchView.h b/src/SearchView.h index 16865ee..519c666 100644 --- a/src/SearchView.h +++ b/src/SearchView.h @@ -46,6 +46,7 @@ private: void checkForUpdate(); SearchLineEdit *queryEdit; + QLabel *recentKeywordsLabel; QVBoxLayout *recentKeywordsLayout; QLabel *message;