Skip to content

Commit

Permalink
Solves mapToItem bug in Qt 6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
boutinb authored and JorisGoosen committed Oct 9, 2024
1 parent cc33481 commit d96a35d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Desktop/components/JASP/Widgets/VariablesWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ FocusScope
color: jaspTheme.uiBackground

property var currentTabButton
property real currentTabX: currentTabButton ? currentTabButton.mapToItem(tabView, 0, 0).x : 0
// Be careful with https://bugreports.qt.io/browse/QTBUG-129500: the currentTabButton is set with onCheckedChanged but the tabView is not yet initialized, so the mapToItem may crash
// As workaround the index is used: during the initialization, the first tabButton is checked, and its x is anyway 0.
property real currentTabX: currentTabButton && currentTabButton.index > 0 ? currentTabButton.mapToItem(tabView, 0, 0).x : 0
property real currentTabWidth: currentTabButton ? currentTabButton.width : 0

QTC.TabBar
Expand All @@ -143,7 +145,7 @@ FocusScope
required property int index

onCheckedChanged: if (checked)
tabView.currentTabButton = tabButton;
tabView.currentTabButton = tabButton;

background: Rectangle
{
Expand Down

0 comments on commit d96a35d

Please sign in to comment.