ui: fixed SearchView style on mac and aligned it at top

This commit is contained in:
Eberhard Graether
2014-07-21 20:32:20 +02:00
parent 5d201b9880
commit 4262be133a
4 changed files with 26 additions and 21 deletions
+2
View File
@@ -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()));
}
+2
View File
@@ -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&)));
}
+6 -3
View File
@@ -1,6 +1,9 @@
#include "qt/view/QtSearchView.h"
#include <QtWidgets>
#include <QAbstractItemView>
#include <QCompleter>
#include <QFrame>
#include <QHBoxLayout>
#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);