PDA

View Full Version : code for new project



rk0747
17th February 2010, 10:07
hi,


Can anybody know what is the code to create a new project in Qt.( using filename and path) .

qtlinuxnewbie
17th February 2010, 10:10
what kind of project u want to create?

be specific in, what you are asking.

ramsarvan
17th February 2010, 10:13
qmake -project

Lykurg
17th February 2010, 10:26
Create the path, create a standard main.cpp, and add a pro where you put in whatever you want. You could also have a look at the sources of Qt Creator to see how they implement their "new project dialog".

rk0747
17th February 2010, 10:32
when we create a new project in Qt. it will ask filename and path , when you click on finish button a Qt project is created in a folder with newproject.pro, main, mainwindow.cpp, mainwindow.h window will displaying in a Qt window.
What is code written in the Finish button.

In the Same way when i click on finish button in my project(not Qt project ) an xmlfile should be created with zero element, when i make changes in the project the value(element) must be save in the xml file.

Lykurg
17th February 2010, 10:34
when we create a new project in Qt. it will ask filename and path , when you click on finish button a Qt project is created in a folder with newproject.pro, main, mainwindow.cpp, mainwindow.h window will displaying in a Qt window.
What is code written in the Finish button.

In the Same way when i click on finish button in my project(not Qt project ) an xmlfile should be created with zero element, when i make changes in the project the value(element) must be save in the xml file.
Fine, so do it. Where is the problem? I don't get your point.

rk0747
17th February 2010, 11:04
i am not getting an idea what to write in Finish button.

And, Is it possible to create a project only with xmlfile?

rk0747
18th February 2010, 06:55
pLZ GO THROUGH THE UI FILE WHICH I ATTACHED FILE, AND GO THROUGH THE BELOW CODE

// WRITE FILE NAME IN lineEdit as (kk.xml) and choose path in (lineEdit_2) and then click on OK button than the kk.xml have to create // in particular location........


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()));
//createNewMenu();
connect(ui.pushButton,SIGNAL(clicked()),this, SLOT(setLastDir()));
// eclogic=new ECLogic();
}

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

void newproject::setLastDir()
{
//! set last directory to ImportExport class

ui.lineEdit_2->setText(QFileDialog::getExistingDirectory(this, msg_head_lastDirDialog,
"/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks) + "/");
}

void newproject::on_okButton_clicked()
{
HOW TO WRITE THIS CODE ,...................

}




Please go through the attached file and code ,and plz reply me how to write the code ........

thanks

aamer4yu
18th February 2010, 07:20
HOW TO WRITE THIS CODE ,...................
How can we tell ? Are you not sure what your program will do ?

Lykurg
18th February 2010, 07:21
pLZ GO THROUGH THE UI FILE WHICH I ATTACHED FILE, AND GO THROUGH THE BELOW CODE
Hey, YOU want that programm, not me! And till now it's a miracle to me what you really want. If you don't know how to work with XML read the docs about QDomDocument, QDomElement and the examples about XML.
If you then have a specific question, come back.

pitonyak
18th February 2010, 20:44
Take a look at some of these classes in this order:

http://qt.nokia.com/doc/4.6/qtextstream.html
http://qt.nokia.com/doc/4.6/qfile.html
http://qt.nokia.com/doc/4.6/qdatastream.html

This contains examples for creating and writing files. Your code demonstrates that you already understand how to access the controls.