Results 1 to 5 of 5

Thread: How to resize the openfiledialog to 320x240 Screen?

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question How to resize the openfiledialog to 320x240 Screen?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to resize the openfiledialog to 320x240 Screen?

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    augusbas (4th July 2009)

  4. #3
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Re: How to resize the openfiledialog to 320x240 Screen?

    Quote Originally Posted by wysota View Post
    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?

    Qt Code:
    1. QFileDialog *dialog = new QFileDilaog();
    2. dialog->getOpenFilename(this,tr("OpenFile"),tr("/root"),tr("AllFiles(*)"));
    3. dialog->resize(320,240);
    4. dialog->exec();
    To copy to clipboard, switch view to plain text mode 

    Help.
    Last edited by wysota; 4th July 2009 at 12:02. Reason: missing [code] tags

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to resize the openfiledialog to 320x240 Screen?

    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:
    Qt Code:
    1. dlg.resize(320,240);
    2. dlg.exec();
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    augusbas (4th July 2009)

  7. #5
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Re: How to resize the openfiledialog to 320x240 Screen?

    Quote Originally Posted by wysota View Post
    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:
    Qt Code:
    1. dlg.resize(320,240);
    2. dlg.exec();
    To copy to clipboard, switch view to plain text mode 
    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.

    Qt Code:
    1. dlg->setWindowTitle("USB");
    2. dlg->setAcceptMode(QFileDialog::AcceptOpen);
    3. dlg->setLabelText(QFileDialog::LookIn,"OPEN");
    4. dlg->setFileMode(QFileDialog::ExistingFile);
    5. dlg->setViewMode(QFileDialog::List);
    6. dlg->resize(320,200);
    7. if(dlg->exec()==QDialog::Accepted)
    8. {
    9. QStringList fileName=dlg->selectedFiles();
    10. }
    To copy to clipboard, switch view to plain text mode 

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

    Please help.
    Last edited by wysota; 7th July 2009 at 10:03. Reason: missing [code] tags

Similar Threads

  1. How to get screen resize event?
    By kamlesh.sangani in forum Qt Programming
    Replies: 8
    Last Post: 10th March 2010, 08:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.