Manually calling lineEdit's textChanged
-
-You can subclass the QLineEdit and make it emit the signal in its constructor-
Edit: Sorry, I just realized you can't emit signals in a constructor, because you don't have time to connect it to a slot first!
-
You can "promote" your custom widget to use it in Designer (see http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html#promoting-widgets ). You can't see it in Designer though; there will be a blank space.
Without using inheritance, you can create a signal in your QMainWindow, connect that signal to QLineEdit::textChanged(), and make your QMainWindow emit that signal.
@
MainWindow : public QMainWindow
{
...
signals:
void started(QString);public:
MainWindow(QWidget *parent) : QWidget(parent)
{
connect(this, SIGNAL(started(QString)),
ui->vectorEdit, SIGNAL(textChanged(QString)));emit started(ui->vectorEdit->text()); }
};
@ -
Sorry, I just realized you can’t emit signals in a constructor, because you don’t have time to connect it to a slot first!