From 4262be133a011150de09698a8650e4b18cc7c1ff Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 21 Jul 2014 20:32:20 +0200 Subject: [PATCH] ui: fixed SearchView style on mac and aligned it at top --- bin/app/data/gui/search_view/search_view.css | 34 +++++++++----------- src/app/qt/element/QtButton.cpp | 2 ++ src/app/qt/element/QtEditBox.cpp | 2 ++ src/app/qt/view/QtSearchView.cpp | 9 ++++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/bin/app/data/gui/search_view/search_view.css b/bin/app/data/gui/search_view/search_view.css index fa142692..48ece17b 100644 --- a/bin/app/data/gui/search_view/search_view.css +++ b/bin/app/data/gui/search_view/search_view.css @@ -1,47 +1,45 @@ #search_view { - background: rgb(255, 255, 255); + background: rgb(255, 255, 255); } QLineEdit#search_box { background: rgb(204, 204, 204); - border: 0px; - height: 26px; + border: none; + font-family: "Source Code Pro"; + font-size: 16px; + font-weight: bold; padding: 0 4px; + height: 26px; selection-background-color: rgb(51, 51, 51); - font-family: "Source Code Pro"; - font-size: 16px; - font-weight: bold; } QAbstractItemView#search_box_popup { + font-family: "Source Code Pro"; + font-size: 14px; selection-background-color: rgb(51, 51, 51); - font-family: "Source Code Pro"; - font-size: 14px; - font-weight: bold; } QPushButton#search_button { - border: 0px; + border: none; border-image: url(data/gui/search_view/images/button_search.png); height: 26px; - height: 26px; + width: 26px; } QPushButton#case_sensitive_button { - border-image: url(data/gui/search_view/images/button_case_sensitive_inactive.png); - border: 0px; - height: 26px; + border: none; + border-image: url(data/gui/search_view/images/button_case_sensitive_inactive.png); height: 26px; + width: 26px; margin-left: 4px; - margin-right: 4px; } QPushButton#case_sensitive_button:checked { - border-image: url(data/gui/search_view/images/button_case_sensitive_active.png); + border-image: url(data/gui/search_view/images/button_case_sensitive_active.png); } QToolTip { - color: rgb(0, 0, 0); - border: 1px solid rgb(0, 0, 0); background-color: rgb(204, 204, 204); + border: 1px solid rgb(0, 0, 0); + color: rgb(0, 0, 0); } diff --git a/src/app/qt/element/QtButton.cpp b/src/app/qt/element/QtButton.cpp index 4c16f151..b07d0e9d 100644 --- a/src/app/qt/element/QtButton.cpp +++ b/src/app/qt/element/QtButton.cpp @@ -4,6 +4,8 @@ QtButton::QtButton(QWidget *parent) : QPushButton(parent) , m_onClick(nullptr) { + setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + connect(this, SIGNAL(clicked()), this, SLOT(slotOnClick())); } diff --git a/src/app/qt/element/QtEditBox.cpp b/src/app/qt/element/QtEditBox.cpp index 9669bacc..9e945747 100644 --- a/src/app/qt/element/QtEditBox.cpp +++ b/src/app/qt/element/QtEditBox.cpp @@ -6,6 +6,8 @@ QtEditBox::QtEditBox(QWidget *parent) , m_onReturnPressed(nullptr) , m_onTextEdited(nullptr) { + setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac + connect(this, SIGNAL(returnPressed()), this, SLOT(slotOnReturnPressed())); connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(slotOnTextEdited(const QString&))); } diff --git a/src/app/qt/view/QtSearchView.cpp b/src/app/qt/view/QtSearchView.cpp index 7cffc59f..e49a66f7 100644 --- a/src/app/qt/view/QtSearchView.cpp +++ b/src/app/qt/view/QtSearchView.cpp @@ -1,6 +1,9 @@ #include "qt/view/QtSearchView.h" -#include +#include +#include +#include +#include #include "component/controller/SearchController.h" #include "qt/element/QtButton.h" @@ -32,9 +35,9 @@ void QtSearchView::initView() QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); widget->setObjectName("search_view"); - QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight); + QBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(0); - //layout->setContentsMargins(3, 3, 3, 3); + layout->setAlignment(Qt::AlignTop); widget->setLayout(layout); m_searchButton = new QtButton(widget);