stfl_query_widget.cpp 1.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#include "stfl_query_widget.hpp"


namespace cvv
{
namespace qtutil
{

STFLQueryWidget::STFLQueryWidget()
{
	lineEdit = new STFLQueryWidgetLineEdit(this);
	auto *layout = new QHBoxLayout;
	layout->addWidget(lineEdit);
	auto helpButton = new QPushButton("Help", this);
	layout->addWidget(helpButton);
	setLayout(layout);
	connect(helpButton, SIGNAL(released()), this, SLOT(helpRequested()));
	connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
	connect(lineEdit, SIGNAL(textChanged(QString)), this,
	        SLOT(textChanged()));
	connect(lineEdit, SIGNAL(requestSuggestions(QString)), this,
	        SIGNAL(requestSuggestions(QString)));
}

void STFLQueryWidget::showSuggestions(const QStringList &suggestions)
{
	lineEdit->showSuggestions(suggestions);
}

void STFLQueryWidget::returnPressed()
{
	filterSignal(lineEdit->text());
}

void STFLQueryWidget::textChanged()
{
	userInputUpdate(lineEdit->text());
	requestSuggestions(lineEdit->text());
}

void STFLQueryWidget::helpRequested()
{
	showHelp("filterquery");
}
}
}