Results 1 to 17 of 17

Thread: tvtenniss.qml

  1. #1
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question tvtenniss.qml

    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?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: tvtenniss.qml

    Do you have QT += declarative into your .pro file?

  3. The following user says thank you to Zlatomir for this useful post:

    s.bolboli (17th April 2012)

  4. #3
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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

  5. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: tvtenniss.qml

    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?

  6. The following user says thank you to Zlatomir for this useful post:

    s.bolboli (17th April 2012)

  7. #5
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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:
    1. #include <QtGui/QApplication>
    2. #include<QPushButton.h>
    3. #include<qfont.h>
    4. #include<qapplication.h>
    5. #include<qslider.h>
    6. #include<qlcdnumber.h>
    7. #include<QApplication>
    8. #include<QDeclarativeView>
    9. #include<QDeclarativeContext>
    10.  
    11. #include"tvtennis.h"
    12.  
    13.  
    14. class MyWidget : public QWidget
    15. {
    16. public:
    17. MyWidge(QWidget *parent=0,const char *name=0);
    18. };
    19. MyWidget::MyWidget(QWidget *parent,const char *name):QWidget(parent,name)
    20.  
    21. {
    22.  
    23. QPushButton *reset("Reset",0);
    24. reset.resize(70,30);
    25. reset.setFont(QFont("Times",18,QFont::Bold))
    26. QObject::connect(&reset,SIGNAL(clicked()),this ,SLOT(reset()));
    27. //app.setMainWidget(&reset);
    28. QLCDNumber *lcd1 =new QLCDNumber(2,this,"lcdNumber1");
    29. QLCDNumber:: connect(QLCDNumber,SIGNAL(valueChanged(int),lcdNumber1,SLOT(display(int))));
    30.  
    31. QLCDNumber *lcd2=new QLCDNumber(2,this,"lcdNumber2");
    32. QLCDNumber::connect(QLCDNumber,SIGNAL(valueChanged(int),lcdNumber2,SLOT(display(int))));
    33.  
    34. reset->show();
    35. lcd1->show();
    36. lcd2->show();
    37. }
    38. int main(int argc, char *argv[]) {
    39. QApplication app(argc, argv);
    40. QDeclarativeView view;
    41. QDeclarativeContext *context=view.rootContext();
    42. view.setScene(QUrl::fromLocalFile("tvtennis.qml"));
    43. //Mywidget w;
    44.  
    45. view.show();
    46.  
    47. return app.exec();
    48. };
    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

  8. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: tvtenniss.qml

    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

  9. The following user says thank you to Zlatomir for this useful post:

    s.bolboli (17th April 2012)

  10. #7
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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?

  11. #8
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: tvtenniss.qml

    Quote Originally Posted by s.bolboli View Post
    project properties>Build>Qt same as above link...
    Did you checked "declarative" there and then "Rebuild All" - or whatever "Rebuild all" might be called in Netbeans?
    Quote Originally Posted by s.bolboli View Post
    what shall I do?
    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.

  12. The following user says thank you to Zlatomir for this useful post:

    s.bolboli (17th April 2012)

  13. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: tvtenniss.qml

    Is this some kind of homework or school project?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #10
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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?

  15. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: tvtenniss.qml

    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #12
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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

  17. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: tvtenniss.qml

    Did you rerun qmake after adding the declarative module to the .pro file? The proper line is QT+=declarative and not QT+=QDeclarativeView
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  18. The following user says thank you to wysota for this useful post:

    s.bolboli (17th April 2012)

  19. #14
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    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>

  20. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: tvtenniss.qml

    Do you have a file called qmlapplication anywhere?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  21. #16
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tvtenniss.qml

    I have qmlapplicationviewer

  22. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: tvtenniss.qml

    So if you don't have a qmlapplication file, then obviously including that file will fail.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.