mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 19:40:24 +00:00
The issue was that editing the text triggers the change of the option, which in turn triggers updateUiState which sets the content of the LineEdit to the changed option causing the cursor to jump to the end. As a workaround only set the LineEdit contet when it's not focused.
33 lines
662 B
C++
33 lines
662 B
C++
#include "lineedit_ui.hpp"
|
|
|
|
LineEditUi::LineEditUi(QLineEdit *line, Settings *settings, const std::string &opt) :
|
|
TextOptUi(settings, opt),
|
|
line(line)
|
|
{
|
|
updateUiState();
|
|
connectSignals();
|
|
}
|
|
|
|
void LineEditUi::connectSignals(){
|
|
connect(line, &QLineEdit::textEdited, this, &LineEditUi::textEdited);
|
|
}
|
|
|
|
void LineEditUi::updateUiState(const std::string &text){
|
|
if(!line->hasFocus())
|
|
line->setText(QString::fromStdString(text));
|
|
}
|
|
|
|
void LineEditUi::updateUiState(){
|
|
updateUiState(getOptValue());
|
|
}
|
|
|
|
void LineEditUi::setEnabled(bool enabled){
|
|
line->setEnabled(enabled);
|
|
}
|
|
|
|
void LineEditUi::setToolTip(const QString& toolTip){
|
|
line->setToolTip(toolTip);
|
|
}
|
|
|
|
|