Files
Sourcetrail/src/app/qt/element/QtEditBox.cpp
T
malte_langkabel c02767362f ui: search view autocompletion
- Implemented autocompletion for the QtSearchView.
- Added: MessageFinishedParsing that will be dispatched by the Project after the parsing step is done.
- Moved the initial MessageActivateToken from the Project to the Application.
- Added getNamesForNodesWithNamePrefix() to GraphAccess.
2014-07-07 11:25:46 +02:00

42 lines
853 B
C++

#include "qt/element/QtEditBox.h"
#include "utility/logging/logging.h"
QtEditBox::QtEditBox(QWidget *parent)
: QLineEdit(parent)
, m_onReturnPressed(nullptr)
, m_onTextEdited(nullptr)
{
connect(this, SIGNAL(returnPressed()), this, SLOT(slotOnReturnPressed()));
connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(slotOnTextEdited(const QString&)));
}
QtEditBox::~QtEditBox()
{
}
void QtEditBox::setCallbackOnReturnPressed(std::function<void(void)> callback)
{
m_onReturnPressed = callback;
}
void QtEditBox::setCallbackOnTextEdited(std::function<void(const std::string&)> callback)
{
m_onTextEdited = callback;
}
void QtEditBox::slotOnReturnPressed()
{
if (m_onReturnPressed)
{
m_onReturnPressed();
}
}
void QtEditBox::slotOnTextEdited(const QString& text)
{
if (m_onTextEdited)
{
m_onTextEdited(text.toStdString());
}
}