Results 1 to 1 of 1

Thread: Need help on QFileDialog pleasee

  1. #1
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    2

    Default Need help on QFileDialog pleasee

    Hi all, I was creating an application. My application will open a folder and process all of the images in that folder.
    I used the method QFileDialog::getExistingDirectory to let the user choose the directory. But when I execute the
    program the file dialog look like this



    as you can see that nothing appear, there is no directory list to let the user choose. And I don't know why ?
    Anybody know why is this happen ???

    PS:: I use Qt 4.4.3 with eclipse integration. Earlier in the code I used QFileDialog::getOpenFileName it was successfully open the file dialog. But the QFileDialog::getExistingDirectory does not success.

    Here is the code

    Qt Code:
    1. // This slot is call when user open file.--------------------------------------
    2. void DR_GUI_NEW::screenFile(){
    3.  
    4. // Get user selected file path
    5. fileName = QFileDialog::getOpenFileName(this, tr("Open image file for screening"),
    6. QDir::currentPath(),
    7. tr("Images (*.bmp *.jpg *.tiff *.png *.tif)"));
    8.  
    9. // filename is not empty
    10. if (!fileName.isEmpty()) {
    11.  
    12. image.load(fileName);
    13. // Load input image
    14. if (image.isNull()) {
    15. QMessageBox::information(this, tr("Diabetic Retinopathy"), tr("Cannot load \"%1\"").arg(fileName));
    16. return ;
    17. }
    18. ui.radioButton_IP_1->setEnabled(true);
    19.  
    20. // Show input Image
    21. ui.mainImageLabel->setPixmap(QPixmap::fromImage(image));
    22.  
    23. // Enable Processing Algorithms
    24. ui.actionOld_Algorithms->setEnabled(true);
    25. ui.actionNew_Algorithm->setEnabled(true);
    26.  
    27. }
    28. //file name is empty
    29. else{
    30. // If filename is empty
    31. // Only empty when user press cancel
    32. // No need to catch error Here ??
    33. }
    34.  
    35. }// end screenFile slot
    36.  
    37.  
    38.  
    39. // screenDirectory slot -------------------------------------------------------
    40. void DR_GUI_NEW::screenDirectory(){
    41. QMessageBox::information(this, tr("Directory Mode"), tr("Welcom to Directory Mode"));
    42.  
    43. dirPath = QFileDialog::getExistingDirectory(this,
    44. tr("Please select directory to screen"),
    45. QDir::currentPath(),
    46. QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    47. }
    48. //-----------------------------------------------------------------------------
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

Similar Threads

  1. Check for invalid file name in QFileDialog
    By darren in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 14:43
  2. QFileDialog and file sequences
    By peterhillman in forum Qt Programming
    Replies: 5
    Last Post: 24th November 2007, 10:16
  3. QFileDialog in Qt designer
    By tpf80 in forum Qt Tools
    Replies: 1
    Last Post: 17th May 2007, 00:41
  4. QFileDialog Mac / PC
    By hey in forum Qt Programming
    Replies: 3
    Last Post: 26th April 2007, 18:23
  5. copy file/s from QFileDialog
    By raphaelf in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 14:26

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.