Hi Guys,
Hopefully I have a simple Question about Signals and Slot's. I wrote a little program with two buttons(A and B). So button A is an openfiledialog, which open the current dir and allows to select a file. Button B should get the filename from A and reads that file on clicked() into a string.
At this moment I dont know how to pass the filename or position to B. I guess it should be possible with the connect() function?!? Or maybe set some global value?
My code looks like this:
void Mainwindow:: on_A_clicked()
{
QString file=QFiledialog::getOpenFileName(
this,
("select a file"),
"c:/qt/",
("All files (*.*)"));
}
void Mainwindow:: on_B_clicked()
{
QFile file; // <--- how to get "file" accepted here?
file.open(QIODevice::Readonly);
...
}
Best regards,
Olli
Bookmarks