Results 1 to 3 of 3

Thread: Returning Values from a Custom FileOpen Dialog

  1. #1
    Join Date
    Jun 2010
    Posts
    30
    Thanks
    7

    Default Returning Values from a Custom FileOpen Dialog

    Hi,

    In another thread<http://www.qtcentre.org/threads/42858-Creating-a-Custom-FileOpen-Dialog> I asked about how to create a FileOpen dialog with additional controls. I've managed to get the dialog working and I've also been able to get the values from the custom controls. However, I can't figure out how to return the name of the file (from the standard FileOpen widget).

    Here's what I've tried:

    Qt Code:
    1. MyFileDialog *fd = new MyFileDialog;
    2. fd->show();
    3.  
    4. if(fd->exec() == QDialog::Accepted) {
    5.  
    6. QString s1 = fd->trackLineEdit->text();
    7. bool b;
    8. unsigned int track = s1.toInt(&b, 10);
    9. std::cout << "Track: " << track << std::endl;
    10.  
    11. QString s2 = fd->startTimeLineEdit->text();
    12. unsigned int startTime = s2.toInt(&b, 10);
    13. std::cout << "Start Time: " << startTime << std::endl;
    14.  
    15. QString fileName = fd-> ?? What goes here??
    16. if (fileName.isEmpty()) {
    17. return 1;
    18. } else {
    19. std::cout << fileName.toStdString() << std::endl;
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 

    The problem is in the third section - what do I have to do to return the file name?

    Cheers,

    Chris
    Last edited by cpsmusic; 6th July 2011 at 14:03. Reason: Missing link!

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Returning Values from a Custom FileOpen Dialog


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

    cpsmusic (6th July 2011)

  4. #3
    Join Date
    Jun 2010
    Posts
    30
    Thanks
    7

    Default Re: Returning Values from a Custom FileOpen Dialog

    Thanks for the help!

Similar Threads

  1. Creating a Custom FileOpen Dialog
    By cpsmusic in forum Newbie
    Replies: 14
    Last Post: 31st March 2014, 16:34
  2. Replies: 6
    Last Post: 4th May 2011, 14:36
  3. One dialog for several lcdnumber values?
    By ssaguiar in forum Newbie
    Replies: 7
    Last Post: 27th April 2011, 21:49
  4. Replies: 3
    Last Post: 26th February 2010, 22:37
  5. Replies: 3
    Last Post: 18th October 2007, 08:07

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.