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. Define my own anchor lines?
Forum Updated to NodeBB v4.3 + New Features

Define my own anchor lines?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 951 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.
  • S Offline
    S Offline
    StoneByte
    wrote on last edited by
    #1

    Can i defines my own anchor lines? For example, i have a custom item of a button with an image in it, That image includes a bottom shadow. Now the vertical center line is the center of the image, including the shadow. On the screen it doesn't look centered.
    Now i want to have the center anchor line of my custom item shifted up some pixels. Same applies for the bottom anchor line.
    Can i do that in Qml in my item?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Wouldn't it be easier to modify your image so that the center of the image aligns with the center of the actual button, and you just have some empty (transparent) pixels padding on the sides where you don't have the shadow?

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

        You can shift the anchor using anchor margins:
        @
        Something {
        anchors.leftMargin: 5
        anchors.topMargin: 6
        }
        @

        (Z(:^

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          [quote author="sierdzio" date="1420624791"]You can shift the anchor using anchor margins:
          @
          Something {
          anchors.leftMargin: 5
          anchors.topMargin: 6
          }
          @[/quote]
          True also. Note that the margins can also be negative.

          1 Reply Last reply
          0
          • jerome_isAviableJ Offline
            jerome_isAviableJ Offline
            jerome_isAviable
            wrote on last edited by
            #5

            maybe {
            anchors.margin: auto;
            }

            probably center all margins horizontal and vertical. This is from CSS3.

            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