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. Creating the concrete main window with items.
QtWS25 Last Chance

Creating the concrete main window with items.

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 640 Views
  • 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.
  • V Offline
    V Offline
    Vadim Chernetsov
    wrote on last edited by Vadim Chernetsov
    #1

    Hello!

    I want to create the concrete Qt main window filled by items.

    There is a part of the main window of a some program.
    PlumaPicture1.jpg

    When I choose the menu "View" and press on the action "Side Pane"
    PlumaPicture2.jpg

    then a side pane appers.
    PlumaPicture3.jpg

    As you can see that side pane has two tabs: a first tab shows the file system and a second tab shows current opened tabs with text editors.
    PlumaPicture4.jpg

    When I press on the action "Side Pane" at the second time then that pane disappears.

    I have the next questions:

    1. Help me to create the "Side Pane". How can I make this? And how to insert there tabs with the file system and with current opened text editors?
    2. The last picture has a status bar with some text in the right part and with tabs "Plain Text" and "Tab Width". How to create such tabs on that status bar?

    Thank You.

    mrjjM Chris KawaC 2 Replies Last reply
    0
    • V Vadim Chernetsov

      Hello!

      I want to create the concrete Qt main window filled by items.

      There is a part of the main window of a some program.
      PlumaPicture1.jpg

      When I choose the menu "View" and press on the action "Side Pane"
      PlumaPicture2.jpg

      then a side pane appers.
      PlumaPicture3.jpg

      As you can see that side pane has two tabs: a first tab shows the file system and a second tab shows current opened tabs with text editors.
      PlumaPicture4.jpg

      When I press on the action "Side Pane" at the second time then that pane disappears.

      I have the next questions:

      1. Help me to create the "Side Pane". How can I make this? And how to insert there tabs with the file system and with current opened text editors?
      2. The last picture has a status bar with some text in the right part and with tabs "Plain Text" and "Tab Width". How to create such tabs on that status bar?

      Thank You.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to the forums
      1
      Well you would use layouts and TabWidget.
      And then code the logic to expand the SideBar area. when it should be shown.
      Maybe this can be the inspiration.
      https://github.com/chrisaverage/burger-menu

      2
      You can use
      https://doc.qt.io/qt-5/qstatusbar.html
      and its
      https://doc.qt.io/qt-5/qstatusbar.html#addWidget
      with https://doc.qt.io/qt-5/qtabbar.html
      to make something like that.

      V 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi and welcome to the forums
        1
        Well you would use layouts and TabWidget.
        And then code the logic to expand the SideBar area. when it should be shown.
        Maybe this can be the inspiration.
        https://github.com/chrisaverage/burger-menu

        2
        You can use
        https://doc.qt.io/qt-5/qstatusbar.html
        and its
        https://doc.qt.io/qt-5/qstatusbar.html#addWidget
        with https://doc.qt.io/qt-5/qtabbar.html
        to make something like that.

        V Offline
        V Offline
        Vadim Chernetsov
        wrote on last edited by Vadim Chernetsov
        #3

        @mrjj Hello!

        I have watched the links you have offered and I can say only they don't correspond to that I want. Unfortunately but it is so.

        Can I use QStackedWidget or QSplitter instead of any layouts?

        How is about the content filling the side pane: the file system and an amount of opened empty tabs inserted into two tabs?

        mrjjM 1 Reply Last reply
        0
        • V Vadim Chernetsov

          @mrjj Hello!

          I have watched the links you have offered and I can say only they don't correspond to that I want. Unfortunately but it is so.

          Can I use QStackedWidget or QSplitter instead of any layouts?

          How is about the content filling the side pane: the file system and an amount of opened empty tabs inserted into two tabs?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Vadim-Chernetsov

          Hello
          Well Stacked is good with any concept of pages. It can take the role of a TabWQidget if
          you provide the means of navigation.

          And yes, a splitter can be used To Allow resize the "Sidebar"
          Note that a splitter is also a layout.

          But you should use layout internally in the Stacked if you wish the elements should follow the size of the stacked.
          Layouts are used most of the time to make the app able to scale to different screens.

          V 1 Reply Last reply
          0
          • mrjjM mrjj

            @Vadim-Chernetsov

            Hello
            Well Stacked is good with any concept of pages. It can take the role of a TabWQidget if
            you provide the means of navigation.

            And yes, a splitter can be used To Allow resize the "Sidebar"
            Note that a splitter is also a layout.

            But you should use layout internally in the Stacked if you wish the elements should follow the size of the stacked.
            Layouts are used most of the time to make the app able to scale to different screens.

            V Offline
            V Offline
            Vadim Chernetsov
            wrote on last edited by
            #5

            @mrjj

            I have watched the links you have offered and I can say only they don't correspond to that I want. Unfortunately but it is so.

            How is about the content filling the side pane: the file system and an amount of opened empty tabs inserted into two tabs?

            1 Reply Last reply
            0
            • V Vadim Chernetsov

              Hello!

              I want to create the concrete Qt main window filled by items.

              There is a part of the main window of a some program.
              PlumaPicture1.jpg

              When I choose the menu "View" and press on the action "Side Pane"
              PlumaPicture2.jpg

              then a side pane appers.
              PlumaPicture3.jpg

              As you can see that side pane has two tabs: a first tab shows the file system and a second tab shows current opened tabs with text editors.
              PlumaPicture4.jpg

              When I press on the action "Side Pane" at the second time then that pane disappears.

              I have the next questions:

              1. Help me to create the "Side Pane". How can I make this? And how to insert there tabs with the file system and with current opened text editors?
              2. The last picture has a status bar with some text in the right part and with tabs "Plain Text" and "Tab Width". How to create such tabs on that status bar?

              Thank You.

              Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Vadim-Chernetsov It looks like a classic QMainWindow + QDockWidget layout. Here's something that does more or less what's in your pictures:

                  QTabWidget* main_tabs = new QTabWidget();
                  main_tabs->addTab(new QWidget(), "Unsaved Document 1");
                  main_tabs->addTab(new QWidget(), "Unsaved Document 2");
              
                  QDockWidget* documents_panel = new QDockWidget("Documents");
                  QDockWidget* file_browser_panel = new QDockWidget("File Browser");
              
                  QLabel* status_text = new QLabel("Ln 1, Col 1 INS");
              
                  QTabBar* status_tabs = new QTabBar();
                  status_tabs->addTab("                               ");
                  status_tabs->addTab("Plain Text");
                  status_tabs->addTab("Tab width: 4");
              
                  QStatusBar* sb = new QStatusBar();
                  sb->addPermanentWidget(status_text);
                  sb->addWidget(status_tabs);
              
                  QMainWindow mw;
                  mw.setCentralWidget(main_tabs);
                  mw.addDockWidget(Qt::LeftDockWidgetArea, documents_panel);
                  mw.tabifyDockWidget(documents_panel, file_browser_panel);
                  mw.setStatusBar(sb);
              
              1 Reply Last reply
              2
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                It really does look close :)
                alt text

                1 Reply Last reply
                2
                • V Offline
                  V Offline
                  Vadim Chernetsov
                  wrote on last edited by Vadim Chernetsov
                  #8

                  How to show in the tab "Documents" opened tabs with text edits and in another tab "File Browser" the current file system?

                  And as you can see there are arrows "Left", "Right", "Up", a falling down menu "Bookmarks", and a some item with the name "Match Filename" in the tab "File Browser". How to add mentioned above components in the concrete tab?

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

                    QDockWidget has a setWidget() method to set its contents. For the documents dock you can use QListWidget to list all the documents and for the File Browser see QTreeView and QFileSystemModel.

                    1 Reply Last reply
                    1

                    • Login

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