hi
I wanna run tvteniss qt example in neatbeans>c++>qapplication
I know I should use QDeclarativeView for binding qml to c++ but the out put is: QDclarativeview: No such file or directory
what can I do?
how can I run this example in qapplication?
hi
I wanna run tvteniss qt example in neatbeans>c++>qapplication
I know I should use QDeclarativeView for binding qml to c++ but the out put is: QDclarativeview: No such file or directory
what can I do?
how can I run this example in qapplication?
Do you have QT += declarative into your .pro file?
s.bolboli (17th April 2012)
yes I add it to C:\Qt\4.8.0\examples\declarative\toys\tvtennis.pro
and also in my own program.
I should do this project in C++>qapplication?and then I have three file main.cpp,tvtennis.cpp,tvtennis.h?
plz answer my question as soon as possible
I checked that example and it seems that it is just shows you exactly what you need (if i correctly understood what you need - to show that qml file in an Qt application - it just does much more stuff and has a "wrapper-class" that manages screen orientation and other stuff).
Anyway in netbeans you need to add Qt modules by checking them in:
- project's Properties in the Qt category: check Declarative there (it may require a rebuild all)
But why are you using Netbeans and not Creator?
s.bolboli (17th April 2012)
thank u so mush for ur help.
I should make tvtennis with c++ and with qapplication.
I add QDeclarativeView inMyproject>properties>linker>library but unfortunately nothing change
my code in main.cpp is these:
Qt Code:
#include <QtGui/QApplication> #include<QPushButton.h> #include<qfont.h> #include<qapplication.h> #include<qslider.h> #include<qlcdnumber.h> #include<QApplication> #include<QDeclarativeView> #include<QDeclarativeContext> #include"tvtennis.h" { public: }; { reset.resize(70,30); //app.setMainWidget(&reset); reset->show(); lcd1->show(); lcd2->show(); } int main(int argc, char *argv[]) { QDeclarativeView view; QDeclarativeContext *context=view.rootContext(); //Mywidget w; view.show(); return app.exec(); };To copy to clipboard, switch view to plain text mode
and error is: fatal error: QDeclarativeView: No such file or directory
Last edited by wysota; 16th April 2012 at 22:23. Reason: missing [code] tags
I was talking about this: http://netbeans.org/images_www/artic...properties.png
not only linker/library (since you need the headers too - that is what you are missing now)
BTW why are you including both QtGui/QApplication and qapplication.h?
LE: The qml is loaded to the view with setSource
s.bolboli (17th April 2012)
project properties>Build>Qt same as above link.
As same as setSource represent first of all I should add #include <QDeclarativeView> but my program doesn't know that.
now my problem is declare #include <QDeclarativeView> to main.cpp.
added QT +=QDeclarativeView in .pro didn't change anything
I couldn't find any solution in google and Qt assistant
what shall I do?
Did you checked "declarative" there and then "Rebuild All" - or whatever "Rebuild all" might be called in Netbeans?
If you did the above check - i'm out of ideas... maybe use Creator and stop using Java tools for C++... Netbeans might be good for Java coding, but i never heard anyone recommend it for C++ development.
s.bolboli (17th April 2012)
Like this,but there isn't any force to do it but because working whit qt & netbeans together is interesting for me i wanna to solve it
what's the problem?
There is no problem. It's just we can't give complete solutions for homeworks, only hints.
Are you using qmake to compile your program?
if it's mean that i enter QDeclarative in intermediate file>UI Directory I do this and Rebuild project (However in ur link isn't it) and the output is:
nbproject/Makefile-variables.mk:15: *** missing separator. Stop.
BUILD FAILED (exit value 2, total time: 53ms)
and still #include<QDeclarativeView> , #include<QDeclarativeContext> are unknown
yes I do and I do this but I don't know why netbeans doesn't know #include<QDeclarativeView>,#include<QDeclarativeCo ntext>
i didn't want a code for tennis program
yes I use qmake to compile it
Did you rerun qmake after adding the declarative module to the .pro file? The proper line is QT+=declarative and not QT+=QDeclarativeView
s.bolboli (17th April 2012)
If it's mean that rerun it in C:\Qt\4.8.0\bin\qmake I do it,
I add QT+=declarative and not QT+=QDeclarativeView
I run the project in c++>qapplication>main.cpp and also I have 3 file(main.cpp,tvtennis.cpp,tvtennis.h) it's true?
it also doesn't know #include<qmlapplication>
I have qmlapplicationviewer
So if you don't have a qmlapplication file, then obviously including that file will fail.
Bookmarks