[Resolved] Pb using getSaveFileName and getOpenFileName dialog boxes



  • Hi,

    I get a weird problem using the QFileDialog static members. When I try to open a getSaveFileName dialog box, the box opens but the "Save" pushbutton doesn't work (clicking it doesn't do anything). And when I try to open a getOpenFileName dialog box, the box doesn't even show itself and return a empty QString. I don't know what's wrong with my program. I'm using Qt 4.8.6 with Windows 7 64bits, and developping on VS2008 (native compiler).

    This is how I use the static members (OnSaveMotion and OnLoadMotion are public slots well connected to menu buttons) :

    @void MotionControl::OnSaveMotion()
    {
    QString l_FileName = QFileDialog::getSaveFileName(this, tr("Save file"), "C:\untitled.md", tr("Exercise (.md)"));
    QFile
    l_File = new QFile(l_FileName);
    if(l_File->open(QIODevice::WriteOnly|QIODevice::Text))
    {
    // doing stuff
    l_File->close();
    }
    else QMessageBox::critical(0, "Error", "Cannot save the file", QMessageBox::Close);
    }@

    @void MotionControl::OnLoadMotion()
    {
    QString l_FileName = QFileDialog::getOpenFileName(this, tr("Open Motion Data"), "C:\", tr("Motion Datas (.md)"));
    QFile
    l_File = new QFile(l_FileName);
    if(l_File->open(QIODevice::ReadOnly|QIODevice::Text))
    {
    // doing stuff
    l_File->close();
    }
    else QMessageBox::critical(0, "Error", "Cannot open the file", QMessageBox::Close);
    }@

    Thanks for help,

    Lucas


Log in to reply
 

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