Results 1 to 2 of 2

Thread: QFileDialog::getOpenFileName return nothing where executed from another computer.

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QFileDialog::getOpenFileName return nothing where executed from another computer.

    Hi there guys, my program has a function that imports a picture into the program. this function works fine when i run it on my machine (i.e. the machine I used to write the program) but when I package the program with all the dll to run it on a different machine then all of a sudden QFileDialog::getOpenFileName does not return the file path in that machine. here is my code below.
    Qt Code:
    1. void MainWindow::on_actionOpen_triggered()
    2. {
    3. QString file = QFileDialog::getOpenFileName(this, "Import Picture", "/home", tr("Images (*.jpg *.png *.xpm)"));
    4.  
    5. photo = new Picture(QRectF(201,225,152,200));
    6.  
    7. if(!file.isEmpty()){
    8. photo->setParentItem(pagesList.at(pageIterator));
    9. photo->setPicDir(file);
    10. photo->setPainterID(1);
    11.  
    12. for(int i = 0; i < 4; i++){
    13. QModelIndex index = photoModel->index(i, 0, QModelIndex());
    14. item = new QStandardItem();
    15. QPixmap pic(file);
    16. item->setData(pic, Qt::DecorationRole);
    17. photoModel->setData(index, pic, Qt::DecorationRole);
    18. }
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,305
    Thanks
    243
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFileDialog::getOpenFileName return nothing where executed from another computer.

    QFileDialog::getOpenFileName does not return the file path in that machine.
    How do you know it doesn't return the file path? Did you actually debug it on the other machine and verify that the file path is empty? Or did you assume that because you don't get the image you expected?

    Sounds more like you haven't correctly deployed the image dlls you need to import the formats you are trying to open.

    And don't reply to this with "How do I do that?" Do some independent research - use the Qt documentation, use Google, search this forum - instead of expecting everyone to spoon-feed you the answers every time you run across a problem. A good start would be to simply Google "Qt deployment" and then start reading.

Similar Threads

  1. QFileDialog::getOpenFileName in DLL
    By OverTheOCean in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2011, 10:31
  2. Replies: 1
    Last Post: 19th March 2010, 14:59
  3. Why QFileDialog::getOpenFileName is not centered?
    By ricardo in forum Qt Programming
    Replies: 20
    Last Post: 31st August 2009, 00:08
  4. Replies: 2
    Last Post: 10th January 2008, 13:52
  5. Problem with QFileDialog::getOpenFileName()
    By spud in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2007, 23:31

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.