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. What about Property animation with GraphicsItem
QtWS25 Last Chance

What about Property animation with GraphicsItem

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 1.5k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello World!

    Have 5.3.0
    @
    class myTextItem: public QObject, public QGraphicsTextItem
    {
    Q_OBJECT
    Q_PROPERTY(QPointF newPos READ pos WRITE setPos)
    Q_PROPERTY(qreal textWidth READ textWidth WRITE setTextWidth)
    }
    @
    and compile
    4x 'QObject' is an ambiguous base of 'myTextItem'

    P.S.0 http://qt-project.org/doc/qt-4.8/animation-overview.html
    P.S.1 i think it posible only 4.8

    have any ideas?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      The animation framework is still valid, and it works in exactly the same way in Qt 5, as it did in Qt 4.

      In this case, instead of subclassing QObject, you can use QVariantAnimation class to animate your properties.

      (Z(:^

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1411976308"]The animation framework is still valid, and it works in exactly the same way in Qt 5, as it did in Qt 4.

        In this case, instead of subclassing QObject, you can use QVariantAnimation class to animate your properties.[/quote]

        xmmm

        you offer subclassing of QVariantAnimation?
        or
        only "public: QGraphicsTextItem"

        and in main instead QPropertyAnimation use QVariantAnimation?

        =D in first case i still get ‘QObject’ is an ambiguous base of ‘myTextItem’
        but now 2x

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I propose to go with the second option: only inherit from QGraphicsTextItem.

          (Z(:^

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            if only “public: QGraphicsTextItem”
            and use macro Q_OBJECT
            clean - rebuild
            all work

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Do not use Q_OBJECT macro in there. Variant animation does not need it. Remove Q_PROPERTY macros, too.

              (Z(:^

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                wherefore QVariantAnimation better?

                if add that macro i can use QPropertyAnimation (i think it simple for use
                and more flexibly if use property)

                but i newbie and i wait you answer =)

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  QPropertyAnimation class, Q_OBJECT and Q_PROPERTY macros are reserved for QObjects. If it works for you without a QObject, well, I am surprised - it shouldn't, but you can probably leave it as it is.

                  (Z(:^

                  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