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. [Resolved] Qt widget design problem

[Resolved] Qt widget design problem

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 2.2k 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.
  • H Offline
    H Offline
    highlandcoffee
    wrote on 29 Oct 2013, 06:21 last edited by
    #1

    Hi,

    I'm quite new with Qt layout and want to have my Qt widget based application designed like this:

    "Please see described image here":http://farm4.staticflickr.com/3710/10549869363_bb7257b566.jpg

    I searched and tried some kinds of layout such as grid layout, vertical layout,... but I cant find any way to do that. Please help me.

    Thank for your help.

    P/S: The described image is not shown event I tried some photo sharing services. Finally, I have to use link instead. Sorry for this.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      IamSumit
      wrote on 29 Oct 2013, 06:42 last edited by
      #2

      For Such Layout You can simply use QTabWidget and QPushButton.

      Be Cute

      1 Reply Last reply
      0
      • H Offline
        H Offline
        highlandcoffee
        wrote on 29 Oct 2013, 06:47 last edited by
        #3

        Thank you IamSumit,

        I think my question is not enough clear to understand. I mean I don't know how to position these widgets(QTabWidget and QPushButton as you told) on QMainWindow like described image. I tried grid layout, vertical layout,... but I cannot.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IamSumit
          wrote on 29 Oct 2013, 06:56 last edited by
          #4

          To do so you can use setGeometry(int x,int y,int w,int h) property of the QTabWidget as well as QPushButton .

          Be Cute

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Tabi
            wrote on 29 Oct 2013, 07:17 last edited by
            #5

            The buttons alligned with tab bar possible only with setting up corner widget in QTabWidget. Make your own widget that have two or more pushbuttons and add it as the cornerwidget or QTabwidget. It will give you expected layout or widget.

            Refer this:
            http://qt-project.org/doc/qt-5.0/qtwidgets/qtabwidget.html#setCornerWidget

            1 Reply Last reply
            0
            • H Offline
              H Offline
              highlandcoffee
              wrote on 29 Oct 2013, 07:18 last edited by
              #6

              Hi IamSumit,

              Yes, you're right. I can do so by Qt designer too but without using layout. Unfortunately, if don't use layout I cannot have my app's GUI expandable or resize when user minimize or maximize app's window .

              Do you have any idea?

              1 Reply Last reply
              0
              • N Offline
                N Offline
                NicuPopescu
                wrote on 29 Oct 2013, 16:25 last edited by
                #7

                I'm afraid by layout and designer you cannot since the widget's bound rectangles overlapp ... but with little piece of code you get what you need:

                @QPushButton* button = new QPushButton(ui->tabWidget);
                button->resize(ui->tabWidget->geometry().width()/4,tabBar->tabRect(0).height());
                button->move(ui->tabWidget->rect().right()-button->width(),0);
                button->setText("Start");@

                buttons can be created by designer and in code just use setParent(tabWidget)

                hope it helps!

                Cheers!

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  highlandcoffee
                  wrote on 30 Oct 2013, 01:18 last edited by
                  #8

                  Hi Tabi and NicuPopescu,

                  Thank you for useful information. I'll try these ways and report back.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    highlandcoffee
                    wrote on 30 Oct 2013, 09:00 last edited by
                    #9

                    Hi Tabi and NicuPopescu,

                    I tried, both of ways resolve my problem. You guys are awesome.

                    Thanks again. :)

                    1 Reply Last reply
                    0

                    1/9

                    29 Oct 2013, 06:21

                    • Login

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