I got the widgets to display. When I originally created the dialog in the designer, the dialog was was named by Object
as Dialog. But no dialog.h was created. So I used uic in the Qt bin folder to create it. In the resulting dialog.h the
class is called Ui_Dialog, with a namespace declaration at the bottom of it called Ui, specifying the Dialog class.
So in my class .cpp that's calling the dialog, I added:
using namespace Ui;
Then in my class calling procedure I used the following code:
Ui::Dialog ui_d1;
Dialog D1;
ui_d1.setupUi(&D1);
{
Temp1 = D1.lineEdit->text();
// Some following code
}
Ui::Dialog ui_d1;
Dialog D1;
ui_d1.setupUi(&D1);
if(D1.exec() == QDialog::Accepted)
{
Temp1 = D1.lineEdit->text();
// Some following code
}
To copy to clipboard, switch view to plain text mode
But now the program crashes when using the text() function to return the text of the lineEdit. Temp1 is a QString
declared variable and the program runs when I use a valid value of "2", commenting out the lineEdit->text() line.
Any ideas what could be causing that?
Bookmarks