Save as File dialog for Mac 10.9 using Qt 5.3

  • In my application i want the Save as dialog as a sheet dialog ,so i make an instance of QFileDialog instead of using the static method getSaveFileName. When i create the instance of QFileDialog i pass all the required parameters correctly, but still when the dialog is display only the first time correct file name is displayed,there after Qt only displays "Untitled" as the file name.Even though i am providing the correct file name.
    I am using Qt 5.3
    Has anybody faced this issue?
    I already saw similar issue mentioned here : , but here again the static method is getting used.

    I did some more testing by creating a project in Qt Creator (5.3.1 Clang 5.0 ( Apple ),64 bit ),this project just has QPushButton which on clicked displays the Save as dialog box.

    The first time the output is correct:

    Second time onwards the file name is always displayed as "Untitled":

    My code is quite straight forward:
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QFileDialog>
    #include <QPushButton>
    #include <QLayout>

    MainWindow::MainWindow(QWidget *parent) :
    QPushButton *pButton = new QPushButton( "Save As..", this );
    connect( pButton,SIGNAL(clicked()),this,SLOT(OnClicked()));
    setCentralWidget( pButton );


    void MainWindow::OnClicked()
    QFileDialog *pFile = new QFileDialog
    pFile->setAcceptMode( QFileDialog::AcceptSave );
    pFile->setWindowModality( Qt::WindowModal );
    int statusCode = pFile->exec();


    Edit: please use code tags around code sections; Andre

Log in to reply

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