Skip to content
  • 0 Votes
    3 Posts
    219 Views
    J

    @Jammin44fm

    OK I've solved it.

    The entire application has a Stylesheet applied, including settings for a QMenu, and QMenu item, with custom padding.
    By overriding the padding for the specific Menu in question I am setting the left padding to be the check icon size smaller than the normal padding size.
    Now when the menu is draw it is consistent in padding size with all other menu's.

    I still dont think i should have to do it this way, but it's working.

  • 0 Votes
    2 Posts
    292 Views
    SGaistS

    Hi,

    Please provide a minimal compilable example to reproduce your issue.

  • 0 Votes
    4 Posts
    755 Views
    ndiasN

    Hi @Kyeiv ,
    I didn't realize that you wanted the elements of each line to line up with each other. In this case you can use GridLayout:

    import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts Window { GridLayout { anchors.fill: parent columns: 3 //rows: 5 Text { Layout.fillWidth: true text: "Text1a Looooooooog" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text1b" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text1c" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Item { Layout.columnSpan: 3 Layout.fillWidth: true height: 10 Rectangle { height: 1 width: parent.width anchors.centerIn: parent color: "grey" } } Text { Layout.fillWidth: true text: "Text2a" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text2b Looooooooog" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text2c" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } ´ Item { Layout.columnSpan: 3 Layout.fillWidth: true height: 10 Rectangle { height: 1 width: parent.width anchors.centerIn: parent color: "grey" } } Text { Layout.fillWidth: true text: "Text3a" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text3b" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } Text { Layout.fillWidth: true text: "Text3c Looooooooog" horizontalAlignment : Text.AlignHCenter elide: Text.ElideRight } } }

    80bb60b9-e0d8-4200-9aff-b91995e3daf7-image.png
    da6d1565-5132-45f8-bd56-95be08ea8f2f-image.png

  • 0 Votes
    9 Posts
    6k Views
    SGaistS

    Use QScreen::availableGeometry. It provides the geometry excluding window manager reserved areas.

  • 0 Votes
    6 Posts
    723 Views
    L

    My sampleColor function was called from the QScrollArea::mouseMoveEvent and the QPoint mousePos was pass in from the mouseEvent there.

    What I'm suspecting is that when the image was loaded, the default alignment AlignTop & AlignLeft kicked in, then the mouseMoveEvent followed and the sampleColor function somehow took a snapshot of the imageLabel, before the AlignCenter setting in the constructor. That's why my mouse was still seeing the image at the pre-aligncenter position in the snapshot.

  • 1 Votes
    6 Posts
    2k Views
    Y

    @Maikkannan said in How to fix scaling issue in Qt desktop application.:

    increased

    Do you run it on a 2K screen?

  • 0 Votes
    7 Posts
    2k Views
    K

    Thanks everyone for help.
    For me solution is using QGraphicsSimpleTextItem and translate by value calculate by QFontMetricsF::tightBoundingRect / QFontMetricsF::boundingRect.
    0_1534407229176_Screen Shot 2018-08-16 at 10.13.05.png
    Now yellow is QGraphicsSimpleTextItem::boundingRect.

  • 0 Votes
    8 Posts
    11k Views
    S

    QComboBox {background-color:rgb(190,190,190);color:black;padding-left: 10px;padding-right: 30px;border-style: solid;border-width: 0px;}

    "padding-left: 10px;"

    the padding will shift the combo-box displayed content form the left edge

    QComboBox::drop-down {subcontrol-origin: padding; subcontrol-position: top right;width: 40px;border: 0px ;}

    "subcontrol-position: top right;"

    and the above will position wot text to the right.

    Hopefully this helps.