PDA

View Full Version : new project



rk0747
16th February 2010, 08:16
hi,
i used getsavefiledialog and getopenfiledialog toopen and save the project , Is there getnewfiledialog in Qt?
i want the following requirement:
1. when i click new project menu, a dialog window should open to write filename and specify path.
2. After creating the project , whatever changes we did in that must save(with same filename).

Is this possible in Qt? is there any example in qt manual?

spirit
16th February 2010, 08:39
doesn't QFileDialog::getSaveFileName do that?
"This is a convenience static function that will return a file name selected by the user. The file does not have to exist."

rk0747
17th February 2010, 05:22
doesn't QFileDialog::getSaveFileName do that?
"This is a convenience static function that will return a file name selected by the user. The file does not have to exist."


But, in savefileName dialog it is asking filename once again , but i already mentioned in new project window,.
Best example is creating a new Qt application . Same requirement i need . Is it possible in Qt.

Please help me it is very urgent to me.

bismitapadhy
17th February 2010, 05:51
You need to create a dialog.on clicking the newproject the dialog will open.Enter two text box and Browse button, Ok/Finish button.
1. Project Name
2. Project path , browse button, on clicking brose button the browse dialog box will open and you can select your path.
3. On clicking Finish button your prject name should saved in the project path.

You problem solved.:)

rk0747
17th February 2010, 09:34
You need to create a dialog.on clicking the newproject the dialog will open.Enter two text box and Browse button, Ok/Finish button.
1. Project Name
2. Project path , browse button, on clicking brose button the browse dialog box will open and you can select your path.
3. On clicking Finish button your prject name should saved in the project path.

You problem solved.:)

Thank you for replying.

Exactly i did the same , but i am not getting how to cancatenate the projectname and projectpath to save the project. (Just like \Desktop\savenewproject.xml) Here savenew project is projectname and desktop/ is project path.


I wrote like this:

newproject::newproject(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.okButton,SIGNAL(clicked()),this,SLOT(on _okButton_clicked()));
connect(ui.cancelButton,SIGNAL(clicked()),this,SLO T(close()));

connect(ui.pushButton,SIGNAL(clicked()),this, SLOT(setLastDir()));

}

newproject::~newproject()
{
//delete ui;
}

void newproject::setLastDir()
{

ui.lineEdit_2->setText(QFileDialog::getExistingDirectory(this, msg_head_lastDirDialog,
"/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks) + "/");
Projectname=ui.lineEdit->text();
Projectpath=ui.lineEdit2->Text();


}

void newproject::on_okButton_clicked()
{

}

Here i have to combine the projectname with projectpath.

Lykurg
17th February 2010, 09:53
Projectpath=ui.lineEdit2->Text();
has to be
Projectpath=ui.lineEdit2->text();

EDIT: It has to be
Projectpath=ui.lineEdit_2->text();! Oh man, get better names for your elements...