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. Qtscript - docs and facts
Forum Updated to NodeBB v4.3 + New Features

Qtscript - docs and facts

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.4k 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.
  • P Offline
    P Offline
    parihaaraka
    wrote on last edited by
    #1

    The documentation says that only properties, signals and slots of QObject are accessible from QtScript.
    I was going to write a wrappers around QSqlDatabase and some other classes to make their methods available within QtScript, but many examples (like "this":http://web.archiveorange.com/archive/v/GOQxSicQAGgaqKmnj94B or "this":http://filonenko-mikhail.blogspot.ru/2010/06/pgsql.html) shows that just a public methods are available. I've checked qt sources for addDatabase(), open(), exec(), prepare() and other methods. What does it mean?

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

      i don't think that they have to be public.
      The Qt Meta Object system has to find them and calls them.
      Thus you should either declare them as slots or with Q_INVOKEABLE.
      (Don't forget the Q_OBJECT macro in your class definition).

      That's why they have to be QObject derivatives btw. ;)

      --- 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
      • P Offline
        P Offline
        parihaaraka
        wrote on last edited by
        #3

        I understand Q_INVOKEABLE and so on. But I don't see neither Q_INVOKEABLE, nor slots declaration in qsqldatabase.h and qsqlquery.h.
        Do I miss something?

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

          they just aren't meant to be used this way, thus they don't have such declarations...

          You will need to write a wrapper class which forwards the calls to the actual object. Depending on your needs this may impossible or just awkward work ;)

          --- 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
          • P Offline
            P Offline
            parihaaraka
            wrote on last edited by
            #5

            It looks like I'am confused by effect of QtScript Bindings Generator. It's clear now.
            raven-worx, thanks for your help!

            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