Skip to content

Commit

Permalink
fix: build failed
Browse files Browse the repository at this point in the history
Log:
Change-Id: I22a420f18530fbd7f7291503e0ba5e47e5ff0edf
  • Loading branch information
deepin-mozart committed May 17, 2024
1 parent 4a0cc2f commit 5cb82c4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/plugins/binarytools/widgets/iconcombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include "iconcombobox.h"

#include <DGuiApplicationHelper>
#include <DPaletteHelper>
#ifdef DTKWIDGET_CLASS_DPaletteHelper
# include <DPaletteHelper>
#endif

#include <QHBoxLayout>
#include <QStyledItemDelegate>
Expand All @@ -14,7 +16,9 @@
#include <QStylePainter>

DGUI_USE_NAMESPACE
#ifdef DTKWIDGET_CLASS_DPaletteHelper
DWIDGET_USE_NAMESPACE
#endif

class IconItemDelegate : public QStyledItemDelegate
{
Expand Down Expand Up @@ -84,7 +88,13 @@ void IconItemDelegate::paintItemBackgroundAndGeomerty(QPainter *painter,
painter->save();

bool isSelected = (option.state & QStyle::State_Selected);
DPalette pl(DPaletteHelper::instance()->palette(option.widget));

#ifdef DTKWIDGET_CLASS_DPaletteHelper
const DPalette &pl = DPaletteHelper::instance()->palette(option.widget);
#else
const DPalette &pl = DGuiApplicationHelper::instance()->applicationPalette();
#endif

QColor backgroundColor = pl.color(DPalette::ColorGroup::Active, DPalette::ColorType::ItemBackground);
bool isHover = option.state & QStyle::StateFlag::State_MouseOver;
if (isSelected || isHover)
Expand Down

0 comments on commit 5cb82c4

Please sign in to comment.