ui: Added home button left of search bar to return to overview

bug id = 40
This commit is contained in:
Eberhard Graether
2016-04-13 13:05:02 +02:00
parent fcc39f4a77
commit ad8abd9182
4 changed files with 38 additions and 7 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

+10 -5
View File
@@ -16,6 +16,7 @@ QWidget#search_box_container {
border: none;
border-bottom-left-radius: 12px;
border-top-left-radius: 12px;
margin-left: 5px;
margin-right: 2px;
}
@@ -41,19 +42,23 @@ QAbstractItemView#search_box_popup {
selection-background-color: <color:search/popup/highlight>;
}
QPushButton#search_button {
#search_button, #home_button {
background: <color:search/button/normal>;
border: none;
border-bottom-right-radius: 12px;
border-top-right-radius: 12px;
border-radius: 12px;
background-position: 15px 5px;
width: 30px;
}
#search_button:hover {
#search_button {
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
}
#search_button:hover, #home_button:hover {
background: <color:search/button/hover>;
}
#search_button:pressed {
#search_button:pressed, #home_button:pressed {
background: <color:search/button/press>;
}
+24 -2
View File
@@ -4,13 +4,14 @@
#include <QHBoxLayout>
#include <QPushButton>
#include "utility/messaging/type/MessageSearch.h"
#include "utility/ResourcePaths.h"
#include "qt/element/QtSmartSearchBox.h"
#include "qt/utility/utilityQt.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
#include "utility/ResourcePaths.h"
QtSearchBar::QtSearchBar()
{
setObjectName("search_bar");
@@ -21,6 +22,13 @@ QtSearchBar::QtSearchBar()
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
m_homeButton = new QPushButton(this);
m_homeButton->setObjectName("home_button");
m_homeButton->setToolTip("show overview");
m_homeButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
layout->addWidget(m_homeButton);
connect(m_homeButton, SIGNAL(clicked()), this, SLOT(homeButtonClicked()));
m_searchBoxContainer = new QWidget(this);
m_searchBoxContainer->setObjectName("search_box_container");
m_searchBoxContainer->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
@@ -87,10 +95,24 @@ void QtSearchBar::refreshStyle()
{
m_searchBox->setFixedHeight(std::max(ApplicationSettings::getInstance()->getFontSize() + 11, 25));
m_searchButton->setFixedHeight(m_searchBox->height() + 5);
m_homeButton->setFixedHeight(m_searchBox->height() + 5);
std::string map = ResourcePaths::getGuiPath() + "search_view/images/search.png";
m_searchButton->setIcon(utility::colorizePixmap(
QPixmap(map.c_str()),
ColorScheme::getInstance()->getColor("search/button/icon").c_str()
));
map = ResourcePaths::getGuiPath() + "search_view/images/home.png";
m_homeButton->setIcon(utility::colorizePixmap(
QPixmap(map.c_str()),
ColorScheme::getInstance()->getColor("search/button/icon").c_str()
));
}
void QtSearchBar::homeButtonClicked()
{
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ALL);
MessageSearch msg(std::vector<SearchMatch>(1, match));
msg.dispatch();
}
+4
View File
@@ -30,10 +30,14 @@ public:
void refreshStyle();
private slots:
void homeButtonClicked();
private:
QWidget* m_searchBoxContainer; // used for correct clipping inside the search box
QtSmartSearchBox* m_searchBox;
QPushButton* m_searchButton;
QPushButton* m_homeButton;
};
#endif // QT_SEARCH_BAR_H