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. Fixing the layout size
Qt 6.11 is out! See what's new in the release blog

Fixing the layout size

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

    want to set fixed size 1920 by 254.
    Not been successful fixing the layout size
    Below is my code
    Widget install on being maximize

    @
    QPalette pal=palette();
    pal.setColor(QPalette::Background,Qt::white);
    setPalette(pal);
    setAutoFillBackground(false);
    setGeometry(QRect(1,1,1920,254));
    this->setFixedSize(1920,254);

    m_pPalette = new QPalette();
    m_pPixmap  = new QPixmap(":/file/leftp.png");
    m_pPalette->setBrush(QPalette::Background,QBrush(*m_pPixmap));
    setPalette(*m_pPalette);
    QWidget *centralWidget = new QWidget(this);
    QHBoxLayout *layout = new QHBoxLayout();
    centralWidget->setLayout(layout);
    

    @

    1 Reply Last reply
    0
    • E Offline
      E Offline
      euchkatzl
      wrote on last edited by
      #2

      Try using :

      @layout.setContentsMargins(0,0,0,0);@

      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