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. QCheckBox, box at the right text at the left, how?
Forum Updated to NodeBB v4.3 + New Features

QCheckBox, box at the right text at the left, how?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 17.5k 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.
  • E Offline
    E Offline
    Evgeniy
    wrote on last edited by
    #1

    I want instead of
    qcheckbox: box text
    qcheckbox: text box.

    I try this:
    @
    auto cb = new QCheckBox(text, this);
    cb->setStyleSheet(QStringLiteral(" QCheckBox { text-align: left top; } QCheckBox::indicator { subcontrol-origin: padding; subcontrol-position: right top; }"));
    @

    Yes, "box" at now placed at the right, but "text" is disappear,
    Looks like it paint at the right of the box, and becase of box placed at the right of widget,
    it is not visible.

    So question, how can I place text at the left of the box, may be without stylesheet usage,
    if stylesheet is buggy.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Buckets
      wrote on last edited by
      #2

      you just need to use the setLayout direction

      ba ba ba
      ba na na na

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Evgeniy
        wrote on last edited by
        #3

        Thanks,

        @cb->setLayoutDirection(Qt::RightToLeft);@

        works.

        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