From 7c723d7f81173875d16daed007a5ba7192ee76b7 Mon Sep 17 00:00:00 2001 From: zeljko Date: Fri, 6 Sep 2013 06:14:52 +0000 Subject: [PATCH] Qt: do not crash in TQtPage if parent is TTabControl git-svn-id: trunk@42628 - --- lcl/interfaces/qt/qtwidgets.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 5228cb31b1..c845df61c1 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -15699,6 +15699,9 @@ begin AParent := getTabWidget; if CanReturnIndex or ATextChanging then Result := QTabWidget_indexOf(AParent, Widget) + else + if not QObject_inherits(QWidget_parentWidget(Widget),'QStackedWidget') then + Result := 0 else Result := -1; end; @@ -15709,7 +15712,8 @@ var begin // it is placed to the stack widget and stack widget into tab widget AParent := QWidget_parentWidget(Widget); - if AParent <> nil then + // do not localize ! + if (AParent <> nil) and QObject_inherits(AParent,'QStackedWidget') then Result := QTabWidgetH(QWidget_parentWidget(AParent)) else Result := nil;