Accesing mainWindow variable in a Dialog Window
-
I am a newbie in qt and c++ and i took the input filename in the MainWindow,but i wanted to access the filename in the dialog Window as well . I am having problems in doing so.I have included the MainWindow header file.
I tried using
@ui->lineEdit->insert(parent->fileName);@But i get a error saying:
Class QWidget has no member named fileName.
So how can i access the fileName.? -
One way to share something with a dialog would be to pass it in as an argument to the constructor for the dialog. The dialog can then use the passed argument, rather than trying to reference an object in the main window.
-
bq. tanny007 wrote: i took the input filename in the MainWindow,but i wanted to access the filename in the dialog Window as well
How did you get the file name? If it isn't a property of Parent (that too a public property), then I guess you might not access as you did
@ui->lineEdit->insert(parent->fileName);@Easiest way would be to pass the file name to Dialog
~veeraps