Important: Please read the Qt Code of Conduct -

[Resolved] Qt widget design problem

  • 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":

    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.

  • For Such Layout You can simply use QTabWidget and QPushButton.

  • 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.

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

  • 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:

  • 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?

  • 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);

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

    hope it helps!


  • Hi Tabi and NicuPopescu,

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

  • Hi Tabi and NicuPopescu,

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

    Thanks again. :)

Log in to reply