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. Programatically Layout
Forum Updated to NodeBB v4.3 + New Features

Programatically Layout

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 964 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.
  • E Offline
    E Offline
    epalmero
    wrote on last edited by
    #1

    Dear All:

    I have an stupid question, I am trying to create a layout similar to the QCreator but I don't arrive to do it correctly. I think that for the Project and OpenDocument they use Docking but what I don't understand is how they do to create the Bar at the left size of the OpenDocument and Open Documents?

    If someone know how to create a similar layout programatically that will be great.

    All the best
    Ernesto

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

      Hi,

      You can grab the Qt Creator sources and get some inspiration from there

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

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        This is not the actual layout from Creator but it will give you similar results. You can then go on splitting stuff up. The important thing is that if you also use dock widgets you should disallow them to dock on the left.
        @
        auto everything = new QWidget();
        auto leftBar = new QWidget();
        auto leftWindowStack = new QSplitter(Qt::Vertical);
        auto rightWindowStack = new QWidget();

        auto everythingLayout = new QHBoxLayout();
        everythingLayout->setContentsMargins(0,0,0,0);
        everythingLayout->setSpacing(0);
        everything->setLayout(everythingLayout);
        setCentralWidget(everything);

        leftBar->setFixedWidth(70);
        everythingLayout->addWidget(leftBar);

        auto rightSideLayout = new QVBoxLayout();
        everythingLayout->addLayout(rightSideLayout);

        auto mainSplitter = new QSplitter(Qt::Horizontal);
        rightSideLayout->addWidget(mainSplitter);
        mainSplitter->addWidget(leftWindowStack);
        mainSplitter->addWidget(rightWindowStack);

        auto statusBar = new QStatusBar();
        statusBar->setFixedHeight(15);
        rightSideLayout->addWidget(statusBar);

        for(int i = 0 ; i < 3; ++i)
        {
        auto window = new QWidget();
        window->setStyleSheet("background: yellow");
        leftWindowStack->addWidget(window);
        }

        //the ugly colors are just to see where stuff is
        mainSplitter->setStyleSheet("background: cyan");
        leftBar->setStyleSheet("background: green");
        leftWindowStack->setStyleSheet("background: red");
        rightWindowStack->setStyleSheet("background: blue");
        @
        This is what it looks like. The red and cyan bars are movable splitter handles.
        !http://i296.photobucket.com/albums/mm188/crossblades666/Layout.jpg(QtCreator layout)!

        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