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
+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