Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Copied some example code but getting an error
Qt 6.11 is out! See what's new in the release blog

Copied some example code but getting an error

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amir734jj
    wrote on last edited by
    #1

    I knew I am asking too many questions today but I promise this is the last one.

    I got the calculator code from "here":http://www.trinitydesktop.org/docs/qt4/script-calculator.html
    and made a project and put .js and .ui file in to that directory and copied main.cpp and qrc files

    But in main.cpp some includes could not be found so I changed from :

    then and there is no warning they are found or not

    @ #include <QApplication>
    #include <QUiLoader>
    #include <QtScript>
    #include <QWidget>
    #include <QFile>
    #include <QMainWindow>
    #include <QLineEdit>

    #ifndef QT_NO_SCRIPTTOOLS
    #include <QScriptEngineDebugger>
    #endif@

    to :

    @ #include <QApplication>
    #include <QtUiTools/QUiLoader>
    #include <QtScript/QtScript>
    #include <QWidget>
    #include <QFile>
    #include <QMainWindow>
    #include <QLineEdit>

    #ifndef QT_NO_SCRIPTTOOLS
    #include <QtScriptTools/QScriptEngineDebugger>
    #endif@

    But I when I try to run it , I get this error ; I don't what does it mean.

    @D:\qt\owo\main.cpp:45: error: C2065: 'qFindChild' : undeclared identifier

    D:\qt\owo\main.cpp:45: error: C2059: syntax error : '>'@

    also "here ":http://s10.postimg.org/nmb239w6h/Scrshot13.pngis the screen shot

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      hmmm.... i can't find the method qFindChild in the docs?! Only qFindChildren()
      You could change the line to this though:
      @
      QLineEdit* lineEdit = qFindChildren<QLineEdit*>(ui, "display").first(); // #include <QObject>
      @

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved