It sounds like you need to inherit from QDialog and make your own dialog box with a line edit. Then you create a method within your main window called showDialog() or something. You don't want to use show() as QWidget already has a method called show(); Then inside showDialog() you would either create the Dialog object as a non-modal or modal dialog. Does that make sense? I'm not sure I'm explaining it well.
Also, Qt provides a handful of standard pre-built dialogues that you may not be aware of: QFileDialog, QInputDialog, QProgressDialog, QFontDialog, QColorDialog
So inside showDialog() you could do this:
MyGui::showDialog()
{
QDir::home().
dirName(),
&ok
);
//do something with text...
}
MyGui::showDialog()
{
QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("User name:"), QLineEdit::Normal,
QDir::home().dirName(), &ok);
//do something with text...
}
To copy to clipboard, switch view to plain text mode
I just took that from the documentation example.
Bookmarks