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. Default layout alignment

Default layout alignment

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 271 Views
  • 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.
  • 1 Offline
    1 Offline
    1XU7
    wrote on last edited by 1XU7
    #1

    Hi..

    What is the default layout alignment?..
    all four enumerated layouts behave differently as expected... but when you do not set alignment it behave different too.. it looks like the default behaviour is different than the rest..

    QHBoxLayout* lay = new QHBoxLayout(this);
    lay->setAlignment(Qt::AlignLeft); //to left
    
    QHBoxLayout* lay = new QHBoxLayout(this);
    lay->setAlignment(Qt::AlignHCenter); to center
    
    QHBoxLayout* lay = new QHBoxLayout(this);
    lay->setAlignment(Qt::AlignRight); to righ
    
    QHBoxLayout* lay = new QHBoxLayout(this);
    lay->setAlignment(Qt::AlignJustify); //depends on content, generally centered
    
    
    QHBoxLayout* lay = new QHBoxLayout(this);
    //no preferred alignment, it just shows different than others.... 
    
    C 1 Reply Last reply
    0
    • 1 1XU7

      Hi..

      What is the default layout alignment?..
      all four enumerated layouts behave differently as expected... but when you do not set alignment it behave different too.. it looks like the default behaviour is different than the rest..

      QHBoxLayout* lay = new QHBoxLayout(this);
      lay->setAlignment(Qt::AlignLeft); //to left
      
      QHBoxLayout* lay = new QHBoxLayout(this);
      lay->setAlignment(Qt::AlignHCenter); to center
      
      QHBoxLayout* lay = new QHBoxLayout(this);
      lay->setAlignment(Qt::AlignRight); to righ
      
      QHBoxLayout* lay = new QHBoxLayout(this);
      lay->setAlignment(Qt::AlignJustify); //depends on content, generally centered
      
      
      QHBoxLayout* lay = new QHBoxLayout(this);
      //no preferred alignment, it just shows different than others.... 
      
      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @1XU7 Different in what way? You are setting the layout's alignment within its parent. The widgets you put in the layout have their own alignment value.

      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