Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Resolved] Pb using getSaveFileName and getOpenFileName dialog boxes
Forum Updated to NodeBB v4.3 + New Features

[Resolved] Pb using getSaveFileName and getOpenFileName dialog boxes

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 881 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lucas S.
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved