Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if a tabified QDockWidget is the active tab

Tags:

c++

qt

qt5

I have multiple dock widgets tabified in my Qt 5.1 application. I want to know which tab is currently active (whether or not it currently has focus), but I don't see how to get that information programmatically.

I've tried QWidget::IsVisible(), QWidget::IsVisibleTo(), and examining the list returned by QMainWindow::tabifiedDockWidgets(), which excludes the widget sent in as a param and so cannot provide the order.

Any ideas?

like image 354
metal Avatar asked Mar 06 '14 16:03

metal


1 Answers

You can check if some part of dock widget is visible using the following code:

bool really_visible = !widget->visibleRegion().isEmpty();

I tested that result value depends on which dock widget tab is active.

like image 101
Pavel Strakhov Avatar answered Nov 15 '22 03:11

Pavel Strakhov