Files
Sourcetrail/src/lib_gui/qt/view/QtSearchView.cpp
T
Eberhard Graether 166d82b44f ui: made icon buttons self updating on color scheme change
* fixed hatching not replaced in single file view title bar on color scheme change
2018-03-19 22:44:45 +01:00

88 lines
1.5 KiB
C++

#include "qt/view/QtSearchView.h"
#include "utility/ResourcePaths.h"
#include "qt/element/QtSearchBar.h"
#include "qt/utility/utilityQt.h"
#include "qt/view/QtViewWidgetWrapper.h"
QtSearchView::QtSearchView(ViewLayout* viewLayout)
: SearchView(viewLayout)
{
m_widget = new QtSearchBar();
}
QtSearchView::~QtSearchView()
{
}
void QtSearchView::createWidgetWrapper()
{
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(m_widget));
}
void QtSearchView::initView()
{
}
void QtSearchView::refreshView()
{
m_onQtThread([this]()
{
setStyleSheet();
m_widget->refreshStyle();
});
}
std::wstring QtSearchView::getQuery() const
{
return m_widget->query().toStdWString();
}
void QtSearchView::setMatches(const std::vector<SearchMatch>& matches)
{
m_onQtThread([=]()
{
m_widget->setMatches(matches);
});
}
void QtSearchView::setFocus()
{
m_onQtThread([this]()
{
getViewLayout()->showView(this);
m_widget->setFocus();
});
}
void QtSearchView::findFulltext()
{
m_onQtThread([this]()
{
getViewLayout()->showView(this);
m_widget->findFulltext();
});
}
void QtSearchView::setAutocompletionList(const std::vector<SearchMatch>& autocompletionList)
{
m_onQtThread([=]()
{
m_widget->setAutocompletionList(autocompletionList);
setStyleSheet();
});
}
void QtSearchView::setStyleSheet()
{
const std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"search_view/search_view.css"));
m_widget->setStyleSheet(css.c_str());
if (m_widget->getCompleterPopup())
{
m_widget->getCompleterPopup()->setStyleSheet(css.c_str());
}
}