Hi
i am having problem with Qt 4.7 "QDeclrativeView" component which comes with Qt
4.7
following are the files of my test application
///////////////////////////////////////////////////// project
file/////////////////////////////////////////////////
QT += core gui
QT += declarative
TARGET = untitled7
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h \
test.h
FORMS += mainwindow.ui
OTHER_FILES += \
vaibhav.qml
///////////////////////////////////////////////////////// mainwindow.h
file/////////////////////////////
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
///////////////////////////////////////////////
test.h////////////////////////////////////////////
#ifndef TEST_H
#define TEST_H
#include<QDebug>
#include <QObject>
class testheader : public QObject
{
Q_OBJECT
Q_INVOKABLE void callfromqml()
{
qDebug()<<"function called";
}
};
#endif // TEST_H
////////////////////////////////////////////////////////////mainwindow.cpp///////////////////////////////////
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
///////////////////////////////////////////////
main.cpp//////////////////////////////////////////
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
/////////////////////////////////////////////////
vaibhav.qml//////////////////////////////////////////
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml