Fixing the layout size



  • 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);
    

    @



  • Try using :

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.