Is there a way to customize/Replace QMdiArea's QTabBar which shows opened Tabs list like in FireFox?
I am not able to figure it out customizing/replace the QTabBar inside QMdiArea.
Can we replace QTabBar with custom QTabBar ? I want to add more widgets to the QTabBar, so that it will display custom widgets (QPushButtons,QCheckBox....) right after the QTabBar's scrollbars. The reason for this is QMdiArea/QTabBar doesn't have a way to list opened Tabs in ContextMenu. When you have more Tabs open its hard to select the desired /specific one instead of scrolling all the way to that one.
can any one please tell me how to achieve this?
A QMdiArea doesn't have a tab bar.
You can add whatever widget you want to the MDI subwindows, including your own subclasses of a tab widget or a tab bar.
What did you do exactly?
Well i am not trying to add any widget to the Mdi Subwindows and I know that QMdiArea doesn't have an ability to set/get QTabBar directly. we can get the TabBar by searching QMdiArea's children like,
I am actually exploring whether can we create/replace QTabBar inside QMdiArea with the one like in Mozilla FireFox ,
[<][tab1] [tab2] [tab3] [tab4] [tab5] [...] [>] [+] [/]
left scroll| Tabs...................................|right scroll | add new Tab| show Tabs list
I can create a custom TabBar with all these features though but how to embed/replace QTabbar inside QMdiArea?
Is there a way to create Mozilla Firefox kind of TabBar?
There is no easy way to do that. You might get close by using a combination of:
- style sheets to modify rendering and create some additional room
- inserting additional widgets into the tabbar (and manually controlling their layout).
I think there would be plenty of interest in something like that, especially if it does not require subclassing QTabBar as that would make it usable with QTabWidget and QMdiArea as well.
I still do not get the relation of that tab bar to a [[Doc:QMdiArea]]. The latter is supposed to be a container for arbitrarily sized and positioned MDI sub windows. Your idea looks much more like an advanced [[Doc:QTabWidget]].
QMdiArea has a "tab":http://developer.qt.nokia.com/doc/qt-4.8/qmdiarea.html#viewMode-prop mode, so the question is relevant.
[quote author="Andre" date="1326178521"]QMdiArea has a "tab":http://developer.qt.nokia.com/doc/qt-4.8/qmdiarea.html#viewMode-prop mode, so the question is relevant. [/quote]
OMG - I never realized that this sneaked in. I take back everything - sorry for the confusion, please.
What could be the reason for
- QMdiArea not having setTabBar() method which allows us to customize the TabBar
- QTabBar not having setCornerWidget() method which allows us to insert any widget
and allow user to set scrollbars as left scrollbar on left side rightscrollbar on right side
i mean seriously why do they have to control these features?
For the first, I guess 'encapsulation'. For the second, I guess it is deemed up to the style to determine how they render the tabs.
Thanks for the explanation. I have some other doubts i can't figure it out myself, Can you please explain,
Why does QMdiArea returns the activeSubWindow() as None(0) when it lost the focus?
even when QMdiArea gains the focus back it still returns the activeSubWindow() as None(0)
but only when you switch between windows QMdiArea returns the activeSubWindow() as QMdiSubWindow
Thanks in advance
Hi, much time passed since the topic was started but I think I have figured out the solution (I have the same question at stackoverflow).
If you can get QTabBar you can hide it! Then you can make your own widget with QMdiArea and a custom tab bar layed out vertically connecting signals/slots of each other. The custom class may have all the public members of both QMdiArea and custom sidebar.
I haven't tried it yet but I think it worth a try.