Important: Please read the Qt Code of Conduct -

[SOLVED] Help on QTabWidget

  • I want to resize the QTabWidget Control at runtime( Like what we do in Qt Desinger...),
    which is placed in right hand side of my main window.

  • Yes? So? What did you try already? What did you get? Where did you get stuck?

  • As you say "like in designer",. do you mean by catching an edge with the mouse and resize it?

  • Yes the same... i want to do the same thing from my main window at runtime..

  • Then you have to fully inmplement it on your own. customize the widgets (create derived classes) or install event filter (from the main window to the TabWidget) and overwrite the mouse press, mouse release and mouse move events.

    There is no build in mechanism to achieve this.

  • Thank you for your valuable input..

  • The widget used by QMainWindow is a QSizeGrip. Probably the best and easiest way to use it is to actually have your QTabWidget inside a QMainWindow with its status bar shown and setSizeGripEnabled(true) on the status bar.

  • Would it not be enough to use QSplitter?

  • Wait a second, they're quite different controls :-)
    Now I'm not sure which one exactly we're talking about.

  • this would only move one part of it, but not make it resizable in all directions like in designer...

  • No, true, but then again, I don' t know the exact requirements of M_31 :-) Perhaps two QSplitters would also be enough. It all depends on what he needs to achieve (as opposed to the description of how he currently tries to achieve it.) It may be that he actually needs the kind of resize handles that you have in Designer, but I honestly doubt it. You don't see such a UI in many end-user applications. If M_31 only wanted to achieve resizing the tab widget, and only knew of the way Qt Designer presents that, then suggesting alternatives may be valuable. QSizeGrip may be what he needs, but then again: it may not be.

    Anyway, lets hear from M_31 what he is up to really.

  • Thanks to all for your advice.
    Now i finally used QSplitter to achive my task..
    I have used 2 splitter to work like tabwidget ( with 2 tabs)..& even now i can resize the same with the help of QSplitter control.

    Instead of tab buttons, i have used Toolbar on the top of Splitter Window..

    Finally i achived my task...

  • Moderators

    Please be so kind to add [Solved] to the beginning of the thread title if you've got it working.

Log in to reply