You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

bitgandalf

Beginner

  • "bitgandalf" is male
  • "bitgandalf" started this thread

Posts: 5

Location: Cuba

Occupation: Estudiante

  • Send private message

1

Friday, April 4th 2008, 4:50pm

QFileDialog show before QDialog

Hello i'm working with qt 4.3.4 and i try to make an app that have this functionality.

Save data before load other data, to do this i implement to functions one to load and other to save. In the load function i ask if exist any data to save if this is true y ask if the user want to save this data before load other. If the answer is true y execute the save function before show QFileDialog to load the data, but here is the problem in the save function i create a QDialog to give to user the option to select the data he want to save and the QFileDialog in the load function execute before QDialog (select data).

this more less the code (i dont post the complete code because is extense and make cloudy the problem)

void load()
{
if (existData)
if (QMessageBox::question(this, "Program", "you want to save", QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok)
save();

QString kFileName = QFileDialog::getOpenFileName(this,
tr("load data"), QDir::home().path(), tr("data (*.aa)"));

.....
load data
.....
}

void save()
{
think the dialog show the data to select
QDialog* k = new QDialog(this);
k->setModal(true);
k->show();

...
save data
...
}

please if you know the answer to this problem write me

pd: please excuse my bad english
Haríamos muchas mas cosas si creyéramos que son muchas menos las imposibles

Linux user 446757
Ubuntu user 13464

2

Friday, April 4th 2008, 5:24pm

RE: QFileDialog show before QDialog

use QDialog::exec() in place of QDialog::show() to create a modal QDialog

no need using QDialog::setModal( true )
Nicolas

bitgandalf

Beginner

  • "bitgandalf" is male
  • "bitgandalf" started this thread

Posts: 5

Location: Cuba

Occupation: Estudiante

  • Send private message

3

Saturday, April 5th 2008, 2:40pm

RE: QFileDialog show before QDialog

Thanks, all work properly.
Haríamos muchas mas cosas si creyéramos que son muchas menos las imposibles

Linux user 446757
Ubuntu user 13464