From 5cf9988fb0e4f1f0a5fdfe1be8d281f35346adc5 Mon Sep 17 00:00:00 2001 From: Xiao YaoBing Date: Sat, 7 Oct 2023 14:52:46 +0800 Subject: [PATCH] fix: qapitrace open file crash use qapitrace to open apitrace tracking result, crashes at typeid. Log: --- styleplugins/chameleon/chameleonstyle.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 7dec8429..710de9a1 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -209,9 +209,8 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti //QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理 if (qobject_cast(w)) { - const auto &delegate = *qobject_cast(w)->itemDelegate(); //如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角) - if (typeid(delegate) != typeid(QStyledItemDelegate)) { + if (!qobject_cast(qobject_cast(w)->itemDelegate())) { break; } @@ -577,9 +576,8 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti } //这里QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理 if (qobject_cast(w)) { - const auto &delegate = *qobject_cast(w)->itemDelegate(); //如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角) - if (typeid(delegate) != typeid(QStyledItemDelegate)) { + if (!qobject_cast(qobject_cast(w)->itemDelegate())) { break; }