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. How to display Widgets in the midle of a Window
Forum Updated to NodeBB v4.3 + New Features

How to display Widgets in the midle of a Window

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

    Following problem:

    I want to display a widget in the middle of a QMdiSubWindow. I also want to use Tabs later. Therefore I add a QStackWidget to a QMdiSubWindow. The first QStackWidget is a Widget I constructed called inAOrifice. Now in the Fullscreenmode the inAOrifice Widget isnt that big and I want to display it in the middle of the QMdiSubWindow, in the QStackWidget respectively. It always appears in the left upper corner. Any suggestions? I have tried a lot already. Cant see my mistake...

    Most common code yet ...

    @MainChild::MainChild(QWidget *parent) : QMdiSubWindow(parent)
    {
    this->setAttribute(Qt::WA_DeleteOnClose);

    inAOrifice = new inputAOrifice(this);
    stackLayout = new QVBoxLayout(this);
    stackWidget = new QStackedWidget;
    
    stackWidget->addWidget(inAOrifice);
    stackLayout->setAlignment(stackWidget,Qt::AlignCenter);
    this->setWidget(stackWidget);
    

    }@

    EDIT:

    isnt it used when I call with parent widget...

    stackLayout = new QVBoxLayout(this);

    I already tried to set the Layout with

    this->setLayout.... no effect. the widget doesnt appear.

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      You didn't use stackLayout.

      Qt Certified Specialist
      www.edalsolutions.be

      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