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 : https://bugreports.qt.io/browse/QTBUG-36212 , 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:
http://s21.postimg.org/ijydxhllj/Screen_Shot_2015_01_29_at_11_53_21.pngSecond time onwards the file name is always displayed as "Untitled":
http://s22.postimg.org/wn3gzuz01/Issue.pngMy code is quite straight forward:
@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QPushButton>
#include <QLayout>MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QPushButton *pButton = new QPushButton( "Save As..", this );
connect( pButton,SIGNAL(clicked()),this,SLOT(OnClicked()));
setCentralWidget( pButton );
}MainWindow::~MainWindow()
{
}void MainWindow::OnClicked()
{
QFileDialog *pFile = new QFileDialog
(
this,
"TestApplication",
"BoomBoom",
".jpg"
);
pFile->setAcceptMode( QFileDialog::AcceptSave );
pFile->setWindowModality( Qt::WindowModal );
int statusCode = pFile->exec();
}@
Edit: please use code tags around code sections; Andre