void KreogistCuteStyle::drawControl(ControlElement element,
{
switch(element)
{
case CE_MenuItem:
{
if(_opt_menu_item != nullptr)
{
drawMenuItem(_opt_menu_item,p,w);
}
break;
}
default:
style->drawControl(element,opt,p,w);
break;
}
}
{
switch(opt->menuItemType)
{
{
int iRectX=opt->rect.x(),
iRectY=opt->rect.y(),
iRectW=opt->rect.width(),
iRectH=opt->rect.height();
if(opt->state == State_Selected)
//opt->state == State_HasFocus)
{
p->setBrush(opt->palette.highlight());
p->drawRect(opt->rect);
pen.
setColor(QColor(0xf6,0xcd,0x32
));
p->setPen(pen);
p->fillRect(opt->rect,Qt::BrushStyle::SolidPattern);
qDebug()<<"asdf";
}
else
{
;
}
if(!opt->icon.isNull())
{
p->drawPixmap(13,
iRectY + (iRectH - 30)/2,
30,
30,
opt->icon.pixmap(30, 30));
p->drawText(50,
iRectY,
iRectW,
iRectH,
Qt::AlignVCenter,
opt->text);
}
else
{
p->drawText(50,
iRectY,
iRectW,
iRectH,
Qt::AlignVCenter,
opt->text);
}
p->drawLine(iRectX,iRectY+iRectH-1,iRectX+iRectW,iRectY+iRectH-1);
break;
}
default:
style->drawControl(CE_MenuItem,opt,p,w);
}
}
void KreogistCuteStyle::drawControl(ControlElement element,
const QStyleOption *opt,
QPainter *p,
const QWidget *w) const
{
switch(element)
{
case CE_MenuItem:
{
const QStyleOptionMenuItem *_opt_menu_item=
qstyleoption_cast<const QStyleOptionMenuItem *>(opt);
if(_opt_menu_item != nullptr)
{
drawMenuItem(_opt_menu_item,p,w);
}
break;
}
default:
style->drawControl(element,opt,p,w);
break;
}
}
void KreogistCuteStyle::drawMenuItem(const QStyleOptionMenuItem *opt,
QPainter *p,
const QWidget *w) const
{
switch(opt->menuItemType)
{
case QStyleOptionMenuItem::Normal:
{
int iRectX=opt->rect.x(),
iRectY=opt->rect.y(),
iRectW=opt->rect.width(),
iRectH=opt->rect.height();
QPen pen;
if(opt->state == State_Selected)
//opt->state == State_HasFocus)
{
p->setBrush(opt->palette.highlight());
p->drawRect(opt->rect);
pen.setColor(QColor(0xf6,0xcd,0x32));
p->setPen(pen);
p->fillRect(opt->rect,Qt::BrushStyle::SolidPattern);
qDebug()<<"asdf";
}
else
{
;
}
if(!opt->icon.isNull())
{
p->drawPixmap(13,
iRectY + (iRectH - 30)/2,
30,
30,
opt->icon.pixmap(30, 30));
p->drawText(50,
iRectY,
iRectW,
iRectH,
Qt::AlignVCenter,
opt->text);
}
else
{
p->drawText(50,
iRectY,
iRectW,
iRectH,
Qt::AlignVCenter,
opt->text);
}
pen.setColor(QColor(0,0,0));
p->drawLine(iRectX,iRectY+iRectH-1,iRectX+iRectW,iRectY+iRectH-1);
break;
}
default:
style->drawControl(CE_MenuItem,opt,p,w);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks