From eef4a621b330e4c331649b103f0a38d680857301 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Sun, 9 Nov 2014 12:04:09 +0100 Subject: [PATCH 1/3] Updated Search Bar Style Please note that I don't feel that the search bar needs to be skinned by users, hence why it is not part of the large css-skinning project. I also feel that given the PR #416 a new search bar with highlight the new search functionality. Updated the look of the search bar: + larger, curved edges + changes color when has focus + search icon built into search - removed "Search For" text in lieu of search icon --- cockatrice/cockatrice.qrc | 1 + cockatrice/resources/icon_search_black.svg | 198 +++++++++++++++++++++ cockatrice/src/tab_deck_editor.cpp | 7 +- cockatrice/src/tab_deck_editor.h | 1 - 4 files changed, 202 insertions(+), 5 deletions(-) create mode 100644 cockatrice/resources/icon_search_black.svg diff --git a/cockatrice/cockatrice.qrc b/cockatrice/cockatrice.qrc index b4d2f05e..34aacb68 100644 --- a/cockatrice/cockatrice.qrc +++ b/cockatrice/cockatrice.qrc @@ -25,6 +25,7 @@ resources/hand.svg resources/pencil.svg resources/icon_search.svg + resources/icon_search_black.svg resources/icon_clearsearch.svg resources/icon_update.png resources/icon_view.svg diff --git a/cockatrice/resources/icon_search_black.svg b/cockatrice/resources/icon_search_black.svg new file mode 100644 index 00000000..05439a12 --- /dev/null +++ b/cockatrice/resources/icon_search_black.svg @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + \ No newline at end of file diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index 82a356d1..8c4e9e8e 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -51,9 +51,10 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) aClearSearch->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearSearch, SIGNAL(triggered()), this, SLOT(actClearSearch())); - searchLabel = new QLabel(); searchEdit = new SearchLineEdit; - searchLabel->setBuddy(searchEdit); + searchEdit->addAction(QIcon(":/resources/icon_search_black.svg"), QLineEdit::LeadingPosition); + searchEdit->setObjectName("searchEdit"); + searchEdit->setStyleSheet("#searchEdit{background:#DFE0E5;border-radius:13px;padding:5px 0px;}#searchEdit:focus{background:#EBEBEB;}"); setFocusProxy(searchEdit); setFocusPolicy(Qt::ClickFocus); @@ -73,7 +74,6 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) QHBoxLayout *searchLayout = new QHBoxLayout; searchLayout->addWidget(deckEditToolBar); - searchLayout->addWidget(searchLabel); searchLayout->addWidget(searchEdit); databaseModel = new CardDatabaseModel(db, this); @@ -293,7 +293,6 @@ void TabDeckEditor::retranslateUi() { aCardTextOnly->setText(tr("Show card text only")); aClearSearch->setText(tr("&Clear search")); - searchLabel->setText(tr("&Search for:")); nameLabel->setText(tr("Deck &name:")); commentsLabel->setText(tr("&Comments:")); diff --git a/cockatrice/src/tab_deck_editor.h b/cockatrice/src/tab_deck_editor.h index dd3b56ac..8db00e73 100644 --- a/cockatrice/src/tab_deck_editor.h +++ b/cockatrice/src/tab_deck_editor.h @@ -85,7 +85,6 @@ private: QTreeView *deckView; KeySignals deckViewKeySignals; CardFrame *cardInfo; - QLabel *searchLabel; SearchLineEdit *searchEdit; KeySignals searchKeySignals; From 33a6e3c5c0233f6d8b1ad60d287f10c5c78d5308 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Mon, 10 Nov 2014 08:49:24 +0100 Subject: [PATCH 2/3] Removed hard coded CSS Hard coded CSS might have a slight chance of not rendering the same across all platforms. More research needs to be performed. Until then I have removed the hard coded search bar customization. --- cockatrice/src/tab_deck_editor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index 8c4e9e8e..c413d134 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -50,11 +50,10 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) aClearSearch = new QAction(QString(), this); aClearSearch->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearSearch, SIGNAL(triggered()), this, SLOT(actClearSearch())); - searchEdit = new SearchLineEdit; searchEdit->addAction(QIcon(":/resources/icon_search_black.svg"), QLineEdit::LeadingPosition); searchEdit->setObjectName("searchEdit"); - searchEdit->setStyleSheet("#searchEdit{background:#DFE0E5;border-radius:13px;padding:5px 0px;}#searchEdit:focus{background:#EBEBEB;}"); + setFocusProxy(searchEdit); setFocusPolicy(Qt::ClickFocus); From f58cc32ef45a7cdfcd5a653cb67a08321a58d6f0 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Mon, 10 Nov 2014 22:14:27 +0100 Subject: [PATCH 3/3] Added version check Added version check, to only include the new Searchbar icon for Users running Qt 5+ --- cockatrice/src/tab_deck_editor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cockatrice/src/tab_deck_editor.cpp b/cockatrice/src/tab_deck_editor.cpp index c413d134..c717d8f3 100644 --- a/cockatrice/src/tab_deck_editor.cpp +++ b/cockatrice/src/tab_deck_editor.cpp @@ -51,7 +51,9 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent) aClearSearch->setIcon(QIcon(":/resources/icon_clearsearch.svg")); connect(aClearSearch, SIGNAL(triggered()), this, SLOT(actClearSearch())); searchEdit = new SearchLineEdit; +#if QT_VERSION >= 0x050000 searchEdit->addAction(QIcon(":/resources/icon_search_black.svg"), QLineEdit::LeadingPosition); +#endif searchEdit->setObjectName("searchEdit"); setFocusProxy(searchEdit);