Source Generator vom QT UI file... Fertig...
Verfasst: 19. April 2006 15:03
Mit dem UI file ist ein projekt noch lange nicht fertig.... aber ein XSLT file kann wenigstens viel ... arbeit abnehmen.. das Ui ist ja einfach ein XML und mit dem xslt file von http://ciz.ch/svnciz/xls2sql/ui_generator.xsl kann der header und der source sowie die main.cpp bereits fertig sein.....
Auf Mac / Linux:
im terminal:
# xsltproc ui_generator.xsl meinfile.ui > main.cpp
oder grafisch den source => http://ciz.ch/svnciz/dialog_qt/qt4_a/current/ compilieren ...
Auf Window:
im cmd geht es auch , oder fertige programm holen auf...
http://ppk.ciz.ch/win_build/vxsltproc_win32_0.2.tar.bz2
und das ui file als xml setzen und remote das file http://ciz.ch/svnciz/xls2sql/ui_generator.xsl als xsl
naturlich kann jeder seine vorlagen gestalten im file ui_generator.xsl und aendern... ob Qmainwindow oder qdialog entscheidet das ui file...
das resultat ist etwa so je nach ui file...:
Auf Mac / Linux:
im terminal:
# xsltproc ui_generator.xsl meinfile.ui > main.cpp
oder grafisch den source => http://ciz.ch/svnciz/dialog_qt/qt4_a/current/ compilieren ...
Auf Window:
im cmd geht es auch , oder fertige programm holen auf...
http://ppk.ciz.ch/win_build/vxsltproc_win32_0.2.tar.bz2
und das ui file als xml setzen und remote das file http://ciz.ch/svnciz/xls2sql/ui_generator.xsl als xsl
naturlich kann jeder seine vorlagen gestalten im file ui_generator.xsl und aendern... ob Qmainwindow oder qdialog entscheidet das ui file...
das resultat ist etwa so je nach ui file...:
Code: Alles auswählen
/* ################################################################## */
#ifndef GUI_QUERY_CHECK_H
#define GUI_QUERY_CHECK_H
#include "ui_gui_query_check.h"
/* Save file as gui_query_check.h */
/* Gui_Query_Check */
#include <QPointer>
class Gui_Query_Check : public QWidget, public Ui::Gui_Query_Check
{
Q_OBJECT
public:
static Gui_Query_Check* self( QWidget* = 0 );
protected:
void closeEvent( QCloseEvent* );
private:
Gui_Query_Check( QWidget* = 0 );
static QPointer<QWidget>_self;
/* public slots: */
};
#endif GUI_QUERY_CHECK_H
/* On your ui file found:
class name : Gui_Query_Check type : QWIDGET
class name : groupBox type : QGROUPBOX
class name : querytext type : QLINEEDIT
class name : querygo type : QPUSHBUTTON
class name : pushButton type : QPUSHBUTTON
class name : queryresult type : QTEXTEDIT
*/
/* ################################################################## */
/* ################################################################## */
#include "gui_query_check.h"
/* Save file as gui_query_check.cpp */
/* Gui_Query_Check */
#include <QPointer>
#include <QCloseEvent>
QPointer<Gui_Query_Check>::_self = 0L;
Gui_Query_Check* Gui_Query_Check::self( QWidget* parent )
{
if ( !_self )
_self = new Gui_Query_Check( parent );
return _self;
}
Gui_Query_Check::Gui_Query_Check( QWidget* parent )
: QWidget( parent )
{
setupUi( this );
}
void Gui_Query_Check::closeEvent( QCloseEvent* e )
{
e->accept();
}
/* On your ui file found:
class name : Gui_Query_Check type : QWIDGET
class name : groupBox type : QGROUPBOX
class name : querytext type : QLINEEDIT
class name : querygo type : QPUSHBUTTON
class name : pushButton type : QPUSHBUTTON
class name : queryresult type : QTEXTEDIT
*/
/* ################################################################## */
/* ################################################################## */
/* Save file as main.cpp */
#include <QApplication>
int main(int argc, char *argv[]) {
QApplication a( argc, argv );
Gui_Query_Check::self()->show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
};
/* ################################################################## */