Important: Please read the Qt Code of Conduct -

How to handle a scalefactor and Designer together

  • Hi Guys,

    have a question to QT-Quick 4.8

    Most of my programming i do in the designer, normally i have a background-picture and positoning my objects one by one with drag and drop. So for me it is very easy and fast to position all my objects.

    Now to the problem. If the qml is runnning, it is possible that the size of the picture is changing. The picture is implemented in that way

    Image {
       id: main
       width: root.width
       height: root.height
       anchors.left: root.left
       source: "images/background_1024_768.png"
       fillMode: Image.PreserveAspectCrop

    now i'm looking for a way that i can change my x and y value of the items with something like a scale factor.
    at the moment i do it manually with:

    property double scaleX: 1135/main.paintedWidth

    and than in the element:

    Item {
       x: 507 / main.scaleX
       y: 428

    But if i do it in that way i cant move it anymore in the designer because the x-value is not "free" anymore.
    I'm looking for a possiblity to move the item in the designer and have the scale factor at the same time.
    i don't want to use Repeater, Grids, Columns or Rows

    Is there a way to do that?

Log in to reply