Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel alignment
Qt 6.12 LTS is out! See what's new in the release blog

QLabel alignment

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.3k 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.
  • J Offline
    J Offline
    jss193
    wrote on last edited by
    #1

    Hello,
    I have created a program where I add QLabels dynamically into a horizontal layout as:

     ui->horizontalLayout_2->insertWidget(i,ReactiveLabels[ReactiveLabels.size()-1]);
    

    My problem is that QLabels are added in left from previous Label ,
    How can I create the new QLabel in right from initial (or previous) QLabel?

    Thank you very much in advance

    JonBJ 1 Reply Last reply
    0
    • J jss193

      Hello,
      I have created a program where I add QLabels dynamically into a horizontal layout as:

       ui->horizontalLayout_2->insertWidget(i,ReactiveLabels[ReactiveLabels.size()-1]);
      

      My problem is that QLabels are added in left from previous Label ,
      How can I create the new QLabel in right from initial (or previous) QLabel?

      Thank you very much in advance

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @jss193
      Depends on what the value of your i is.

      1 Reply Last reply
      3
      • J Offline
        J Offline
        jss193
        wrote on last edited by
        #3

        The value is 1, if I change it to 0 the QLabels generated still added left not right side respect the previous QLabel generated.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Then why not just use addWidget ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          3
          • SGaistS SGaist

            Hi,

            Then why not just use addWidget ?

            J Offline
            J Offline
            jss193
            wrote on last edited by
            #5

            @sgaist
            Thank you, it is solved by using addWidget.

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved