QFileDialog



  • Hi,

    i'm doing

        QString homePath = QDir::currentPath();
        QString filename = QFileDialog::getSaveFileName(this, "Enregistrer sous...", homePath, "Configuration (*.xml)");
    
        saveConf(filename);  //which create a XML etc... (this function is working)
    
    

    But here, if I manually close the QFileDialog, what happen ?

    I would like to do something like :

    if( myQFileDialogIsClosedOrFailedOrWhateverYouWant ){
        QMessageBox::warning(......);
    else
        saveConf(filename);
    }
    

    is it possible to do that ?

    By the way, is there a problem with QFileDialog on W10 ?

    When I use it there's warning like

    shell\comdlg32\fileopensave.cpp(9456)\comdlg32.dll!74260750: (caller: 74253458) ReturnHr[PreRelease](1) tid(2b88) 80070490 Élément introuvable.
        CallContext:[\PickerModalLoop\InitDialog\FileDialogInitEnterpriseData]
    


  • Test this:

    if(filename.isEmpty())
    QMessageBox::warning(....)
    


  • @HenrikSt.

    It's working thanks !

    What about warnings ?



  • Hi. Good news...

    What about warnings?
    I don't know what you mean but you can you QMessageBox...



  • @HenrikSt.

    Sorry I was busy..

    these warnings :

    shell\comdlg32\fileopensave.cpp(9456)\comdlg32.dll!74260750: (caller: 74253458) ReturnHr[PreRelease](3) tid(5f4) 80070490 Élément introuvable.
        CallContext:[\PickerModalLoop\InitDialog\FileDialogInitEnterpriseData] 
    shell\comdlg32\fileopensave.cpp(9456)\comdlg32.dll!74260750: (caller: 74253458) ReturnHr[PreRelease](4) tid(5f4) 80070490 Élément introuvable.
        CallContext:[\PickerModalLoop\InitDialog\FileDialogInitEnterpriseData] 
    

    When I use getSaveFileName(...);


  • Qt Champions 2016

    @Punt
    My French is pretty rudimentary, but "Élément introuvable" is a bit confusing. I don't understand what element can't be found, and somehow this comes from comdlg32 ...
    I think you're safe to ignore these warnings for now, but if you find any strange effects do tell.



  • Maybe you cab post your completely code here for understanding the error ?



  • @HenrikSt.

    void myClass::on_pushSaveCom_clicked(){ //On click QPushButton (save my configuration)
          
          //set some variable according to my UI
                
          QString homePath = QDir::currentPath();
          QString path = QFileDialog::getSaveFileName(this, "Enregistrer sous...", homePath, "Configuration (*.xml)");
          if(path.isEmpty())
                return;
    
          saveConf(path); //which create the new XML according to my new value set earlier in this function
    }
    

  • Qt Champions 2016

    @Punt
    Your code looks fine to me. So as I said, I think it's safe to ignore those warnings for now. If you observe some side effect, report it here again so we could attempt to track it down.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.