How to capture TabView tabs order change event
-
Hello!
I would to know which signal is emitted when the user drags a tab within a tabview and changes its order.
Thanks!
I'm not exactly sure what a
TabViewis but as it's a view it has to have aQAbstractItemModelsomewhere.
TheQAbstractItemModelprovides the signals that you are looking for:QAbstractItemModel::columnsMoved()QAbstractItemModel::rowsMoved()- ...
The documentation lists all the available signals: https://doc.qt.io/qt-5/qabstractitemmodel.html#signals
Hope that helps.
-
Thank you for your reply! It's actually a normal TabWidget, I missed that, as I named the component tabview, sorry about that.
Is your response still valid for a tabwidget?The
QTabWidgetcontains aQTabBarthat you can retrieve withQTabWidget::tabBar(). TheQTabBarhas a signaltabMoved(int from, int to)that you can use.
Therefore, you'd end up with something like this:connect(_myTabWidget->tabBar(), SIGNAL(tabMoved(int, int)), this, SLOT( .... -
You're welcome!
Please mark this topic as solved if you feel that your problem/question has been solved.
Guide on that: https://forum.qt.io/topic/62700/hitchhiker-s-visual-guide-to-the-qt-forum