Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QDeclarativeItem modify anchor from C++
Forum Updated to NodeBB v4.3 + New Features

QDeclarativeItem modify anchor from C++

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 4.1k 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.
  • B Offline
    B Offline
    bunjee
    wrote on last edited by
    #1

    Greetings and HNY,

    Is there a way to modify or disable a QDeclarativeItem's anchor from the C++ code ?

    Thanks.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #2

      Is "this":http://bugreports.qt.nokia.com/browse/QTBUG-9677 what you are looking for.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blam
        wrote on last edited by
        #3

        Try using QDeclarativeProperty and QDeclarativeExpression.

        For example, to set an object's 'anchors.bottom' to 'parent.bottom':

        @
        QDeclarativeContext *context = ...
        QObject *myObject = ...

        QDeclarativeExpression expr(context, myObject, "parent.bottom");
        QDeclarativeProperty prop(myObject, "anchors.bottom");
        prop.write(expr.evaluate());
        @

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bunjee
          wrote on last edited by
          #4

          @blam: Thanks man.

          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