View Full Version : QDockWidget: Check tabified visibility?
youkai
18th July 2009, 22:11
Hi.
Obviously, a dock widget can have different states when it is visible:
floating
docked
tabified
Unfortunately I see no possibility to check the visibility if the dock widget is tabified. Any ideas?
Bye
Lykurg
19th July 2009, 07:50
Hi, see QMainWindow::tabifiedDockWidgets().
SABROG
19th July 2009, 08:29
You can use something like this (http://vingrad.ru/blogs/sabrog/2008/12/26/qt-44-opredelyaem-vidimyie-qdockwidgetyi/)
youkai
19th July 2009, 09:29
The trick with "visibilityChanged" does not work, because it will be emitted if you just browse the tabs. I mean, all tabified docks are visible to me.
"tabifiedDockWidgets" seems not helpful to me because it needs a parameter from which I want to know if it is tabified or not. Well I could iterate over all dock widgets and so on...
Bye
Lykurg
19th July 2009, 09:34
"tabifiedDockWidgets" seems not helpful to me because it needs a parameter from which I want to know if it is tabified or not. Well I could iterate over all dock widgets and so on...
Then I don't get you. What exactly do you want achieve?
QDockWidget *myDock = //...
if (tabifiedDockWidgets(myDock).isEmpty())
// myDock is not tabbed
else
// myDock is tabbed
youkai
19th July 2009, 09:44
Hi.
Ups. :) I could make two operations: check visibility and check if it is tabified with other widgets. I will try this.
I restore the main window state from the registry and want to check some toolbuttons according to the dock widgets' visibility.
Bye
Edit: Thanks! It worked. =) Here the pattern I used now:
...
restoreState(settings.value("windowState").toByteArray());
toolBtn1->setChecked(dock1->isVisible() || !tabifiedDockWidgets(dock1).isEmpty());
toolBtn2->setChecked(dock2->isVisible() || !tabifiedDockWidgets(dock2).isEmpty());
toolBtn3->setChecked(dock3->isVisible() || !tabifiedDockWidgets(dock3).isEmpty());
...
Wow! The solution is quite simple. I have no idea why I didn't get that by myself. :D
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.