Issue
I’m trying to connect a Slider and LineEdit widget together so that when one is changed the other will match this value.
I’m struggling since lineEdit takes strings and Slider takes ints. I already used setValidator on the lineEdit so that only ints can be entered.
I tried using the old signals and slots syntax with no luck using a couple different methods from a quick Google search.
connect(textbox, SIGNAL(textEdited(QString)),slider,
SLOT((QString)));
Should I be using a different widget entirely than LineEdit?
Solution
Use the lineEdit()
method of QSpinBox()
:
connect(textbox, &QLineEdit::textEdited, slider->lineEdit(), &QLineEdit::setText);
Answered By – eyllanesc
Answer Checked By – Candace Johnson (BugsFixing Volunteer)