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. Layout issue in the window.
Forum Updated to NodeBB v4.3 + New Features

Layout issue in the window.

Scheduled Pinned Locked Moved General and Desktop
13 Posts 4 Posters 3.8k Views 3 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.
  • N Offline
    N Offline
    N.Sumi
    wrote on last edited by
    #3

    Hi Mr.Maximus,

    I need a Tabwidget with two tabs, each tab holds different controls. Could you please have a look on my link.'SO that you will get an idea.
    thanks for your advice.
    Please have look on the image attached here.

    https://www.dropbox.com/s/803li7jw83j7kwk/mainlayoutopengl.PNG?dl=0

    thanks,
    Sumi.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maximus
      wrote on last edited by
      #4

      Thank you for the picture.

      You could have a ListView on the left replacing the TabWidget, then 2 QStackWidget on the right.
      Would be best if you could show the interaction with the 3 UI at the bottom so we can understand better what you need. Hand written UI works fine for saving time :)


      Free Indoor Cycling Software - https://maximumtrainer.com

      1 Reply Last reply
      1
      • N Offline
        N Offline
        N.Sumi
        wrote on last edited by N.Sumi
        #5

        Thank you Mr. Maximus,

        In the moment I don't have full stuff to show. But I can explain the whole thing for better understanding of my problem. But approximately I will going to some stuff some like this. Please have a look on controls and visualization window. In my case I also will be having another dock on Right side. Thid right side dock will also make communication Visualization screen,

        https://www.dropbox.com/s/99tf0o2o86u4kte/Mainlayout.PNG?dl=0

        Might after end of the code.It might look this stuff

        https://www.dropbox.com/s/ovepkozf07nw2lc/threeclusters_.bmp?dl=0

        thank in advance,
        Sumi

        1 Reply Last reply
        0
        • N Offline
          N Offline
          N.Sumi
          wrote on last edited by N.Sumi
          #6

          Here is part of my code:
          mainwindow::mainwindow()
          {
          Qwidget *window = new Qwidget;
          size
          title
          creat Actions();
          createmenubar();
          createtoolbar();

          Q**** mainlayout = new Q***; ////////////////////////how to give the layout like in the linkof the above post
          mainlayout->addwidget/layout (tabwidget goes here);
          mainlayout->addlayout(gridodopengldocks);
          mainlayout->addLayout(property_dock);
          windows->setlayout(mainlayout)

          }
          void mainwindow:: createmenubar()
          {
          //menu stuff file edit blah etc
          }
          void mainwindow::createtoolbar()
          {
          fonttoolbar->addaction***** blah
          }
          void mainwindow::create_tabW_widget_container()
          {
          }
          void mainwindow::createdocks_for_opengl()
          {
          Qgridlayout *gridodopengldocks = new QGridlayout;
          Qdockwidget 'dock = new Qdockwidget;
          QOpenGLWidget *glwidget = new QopenglWidget;
          dock->addwidget(glWidget);
          }

          void mainwindow::createporperty()
          {
          Qdockwidget 'prop_ock = new Qdockwidget;
          property_dock->setpositon (Right..)

          }

          1 Reply Last reply
          0
          • M Offline
            M Offline
            maximus
            wrote on last edited by maximus
            #7

            Oh I see now.

            You only need a QHorizontalLayout a the bottom for your 3 QWidgets

            So basically:

            1. Set Main Layout to a Vertical Layout
            2. Insert Menu Bar, Tool, bar, specifiy a maximum height so it doesn't take too much
            3. Create a Horizontal Layout, insert your 3 QWidget there
            4. Insert the Horizontal Layout(3) in the Vertical Layout

            You can do all this in the Designer just for testing
            Good luck,
            Max


            Free Indoor Cycling Software - https://maximumtrainer.com

            1 Reply Last reply
            0
            • N Offline
              N Offline
              N.Sumi
              wrote on last edited by
              #8
              This post is deleted!
              1 Reply Last reply
              0
              • N Offline
                N Offline
                N.Sumi
                wrote on last edited by SGaist
                #9

                Hi Maximus ,

                I was trying this as you told.But it is giving me the crash. I don't know Where I did mistake.
                It is giving error :: QLayout: Cannot add a null layout to QHBoxLayout/

                And here is code clip..

                MainWindow:: MainWindow()
                {
                    QWidget *window = new QWidget();
                    setCentralWidget(window);
                
                
                    QHBoxLayout *HLayout = new QHBoxLayout;
                    HLayout->addLayout(tabbox );
                    HLayout->addLayout(grid);
                    HLayout->addLayout(docks);
                
                    QVBoxLayout *mainLayout = new QVBoxLayout;
                    mainLayout->addLayout(HLayout);
                    window->setLayout(mainLayout);
                
                
                    createActions();
                    createMenus();
                    createToolBar();
                   createPropertyDock();
                    createtabwidget();
                   createDockWidget();
                
                
                    QString message = tr("A context menu is available by right-clicking");
                    statusBar()->showMessage(message);
                
                    setWindowTitle(tr("Mainwindow"));
                    setMinimumSize(160, 160);
                    resize(1200, 800);
                }
                
                void MainWindow :: createPropertyDock()
                {
                   QHBoxLayout *docks =new QHBoxLayout;
                    QDockWidget *dock = new QDockWidget(tr("Properties"), this);
                    docks->addWidget(dock);
                
                    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
                
                    addDockWidget(Qt::RightDockWidgetArea, dock);
                
                }
                 void MainWindow :: createtabwidget()
                  {
                    QHBoxLayout *tabbox = new QHBoxLayout;
                    QTabWidget *tabWidget = new QTabWidget;
                    tabbox->addWidget(tabWidget);
                    tabWidget->setTabPosition(QTabWidget::West);
                
                    tabWidget->setSizePolicy(QSizePolicy ::Fixed , QSizePolicy ::Fixed);
                         //tabWidget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
                    tabWidget->setMinimumSize(256,1160);
                    tabWidget->setMaximumSize(256,1160);
                }
                void MainWindow::createDockWidget()
                {
                   QGridLayout *grid = new QGridLayout;
                    QDockWidget *dw = new QDockWidget;
                    grid->addWidget(dw);
                    dw->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
                        dw->setWidget(new QOpenGLWidget);
                }
                

                thnaks in advance ,
                Sumi

                [edit: Added missing coding tags ``` SGaist]

                1 Reply Last reply
                0
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  @N.Sumi said:
                  Hi, just a question.
                  in
                  void MainWindow :: createtabwidget()
                  you create the local variable:
                  QHBoxLayout *tabbox = new QHBoxLayout;
                  and in
                  MainWindow:: MainWindow()
                  Layout->addLayout(tabbox );

                  If they are the same ?, then tabbox should live in MainWindow class and it should be
                  tabbox = new QHBoxLayout;
                  in createtabwidget()
                  My guess is that you did declare them in .h but made a local var by accident. ?

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    N.Sumi
                    wrote on last edited by
                    #11

                    Hi mrjj,

                    you are right. They both are same. But I have changed them to as you said. But it's stilling not working. I dont know what the mistake am doing here.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      maximus
                      wrote on last edited by
                      #12

                      Good way to find where it crash it put qDebug message here and there, or use the debugger.


                      Free Indoor Cycling Software - https://maximumtrainer.com

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

                        Hi,

                        If it crashes, a simple run through the debugger will tell you where exactly it misbehave

                        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

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved