Manually calling lineEdit's textChanged
How to force call of lineEdit's textChanged at startup?
The workaround is:
@MainWindow::MainWindow(QWidget *parent) :
QString s = ui->vectorEdit->text()+" ";
How to do it properly? And without adding a space.
-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!
And how to use such subclasses in Designer? If there is no way of inheritance?
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
MainWindow(QWidget *parent) : QWidget(parent)
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!