From 0cdb0788f00afdcae3fc7b0bdfcd9aa4971c3ada Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Tue, 30 Jun 2009 21:35:19 +0200 Subject: [PATCH] Hide "Recnet keywords" label when there is none --- src/SearchView.cpp | 10 ++++++---- src/SearchView.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) 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; -- 2.39.5