PDA

View Full Version : How to resize the openfiledialog to 320x240 Screen?



augusbas
4th July 2009, 10:54
Hi,

I am working with Open and Save File dialog and i need to set the size of the fileDialog to fit the LCD Screen 320x240 ?

How do i do it? Please help me

wysota
4th July 2009, 11:04
You won't be able to use the static call if you want to resize the dialog. But if you use the regular QFileDialog class with exec() then before calling exec you can call resize() to resize the dialog to the size you want.

augusbas
4th July 2009, 11:21
You won't be able to use the static call if you want to resize the dialog. But if you use the regular QFileDialog class with exec() then before calling exec you can call resize() to resize the dialog to the size you want.


Hi Wyotsa,

My thanks for your reply.

i tried using resize(320,240) but it didnt worked out

I will put my code just help me, how do i go ahead?


QFileDialog *dialog = new QFileDilaog();
dialog->getOpenFilename(this,tr("OpenFile"),tr("/root"),tr("AllFiles(*)"));
dialog->resize(320,240);
dialog->exec();

Help.

wysota
4th July 2009, 12:05
You can't call getOpenFileName() - it's a static method which you should avoid. You need to setup the dialog properly using the QFileDialog class methods and then call exec().

Here is a minimal example:

QFileDialog dlg;
dlg.resize(320,240);
dlg.exec();

augusbas
7th July 2009, 09:13
You can't call getOpenFileName() - it's a static method which you should avoid. You need to setup the dialog properly using the QFileDialog class methods and then call exec().

Here is a minimal example:

QFileDialog dlg;
dlg.resize(320,240);
dlg.exec();

Hi Wysota,

I had a problem with the above file dialog operation.

I am trying to get the file name using "selected file" function when user Opens a file using Open file dialog.


QFileDialog *dlg=new QFileDialog;
dlg->setWindowTitle("USB");
dlg->setAcceptMode(QFileDialog::AcceptOpen);
dlg->setLabelText(QFileDialog::LookIn,"OPEN");
dlg->setFileMode(QFileDialog::ExistingFile);
dlg->setViewMode(QFileDialog::List);
dlg->resize(320,200);
if(dlg->exec()==QDialog::Accepted)
{
QStringList fileName=dlg->selectedFiles();
}

The above code gets compiled and executed but it doesn't give the file name whatever been selected through file dialog.

Please help.