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; }