How to catch the moment when the QComboBox editor is created?

Writing component on the basis of QComboBox. Try to make it a little generic — but it needs to register the installation events. Including event lineEdit()->textEdited. Initially this lineEdit is not, it appears when the combo box becomes editable. As is better to solve?
March 23rd 20 at 19:32
1 answer
March 23rd 20 at 19:34
Solution
Again we have to answer on their own.
void TimedWideComboBox::connectToEditor()
{
 if (!lineEdit())
return;
 connect(lineEdit(), &QLineEdit::textEdited, this, &This::origDataChanged);
}

bool TimedWideComboBox::event(QEvent* ev)
{
 bool b = Super::event(ev);
 switch (ev->type()) {
 case QEvent::ChildAdded: {
 auto ev1 = static_cast<QChildEvent*>(ev);
 if (ev1->child() == lineEdit()) {
connectToEditor();
 return true;
}
 } break;
default:;
}
 return b;
}
But the combobox is, isn't it?
Why not connect to the signal: https://doc.qt.io/qt-5/qcombobox.html#editTextChanged ? I believe he was made in.

Event filtering -- such heavy artillery. But if you really need, the rule of etiquette is to create a separate QObject'and implementing his method, event, and setting the desired component using installEventFiler. - anthony_Halvorson commented on March 23rd 20 at 19:37
@anthony_Halvorson, Need it for editing: any editing operation is a timer which after a second or two will perform some "heavy" action. Which is not necessary to perform, if the content was changed programmatically. - jace_Jacobson19 commented on March 23rd 20 at 19:40

Find more questions by tags Qt