feat: 搭建重写QStyle的框架
This commit is contained in:
parent
788e560190
commit
d3349c16b3
@ -6,7 +6,6 @@ ExCustomStyle::ExCustomStyle()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//静态static的函数+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//静态static的函数+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
void ExCustomStyle::drawPrimitive(const QStyle *style, ExCustomStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w)
|
void ExCustomStyle::drawPrimitive(const QStyle *style, ExCustomStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w)
|
||||||
{
|
{
|
||||||
@ -56,6 +55,58 @@ inline QRect ExCustomStyle::subElementRect(ExCustomStyle::SubElement subElement,
|
|||||||
proxy()->subElementRect(static_cast<QStyle::SubElement>(subElement), option, widget);
|
proxy()->subElementRect(static_cast<QStyle::SubElement>(subElement), option, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
//静态static的函数+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
void ExCustomStyle::drawPrimitive(const QStyle *style, ExCustomStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w)
|
||||||
|
{
|
||||||
|
// DStyleHelper dstyle(style);
|
||||||
|
|
||||||
|
switch (pe) {
|
||||||
|
// case value:
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExCustomStyle::drawControl(const QStyle *style, ExCustomStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect ExCustomStyle::subElementRect(const QStyle *style, ExCustomStyle::SubElement subElement, const QStyleOption *option, const QWidget *widget)
|
||||||
|
{
|
||||||
|
return QRect();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ExCustomStyle::sizeFromContents(const QStyle *style, ExCustomStyle::ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w)
|
||||||
|
{
|
||||||
|
return QSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon ExCustomStyle::standardIcon(const QStyle *style, ExCustomStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget)
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
//内联inline的函数+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
//实际上,只需要在实现处添加inline,声明出不需要写inline
|
||||||
|
inline void ExCustomStyle::drawPrimitive(ExCustomStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
|
||||||
|
{
|
||||||
|
proxy()->drawPrimitive(static_cast<QStyle::PrimitiveElement>(pe), opt, p, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ExCustomStyle::drawControl(ExCustomStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const
|
||||||
|
{
|
||||||
|
proxy()->drawControl(static_cast<QStyle::ControlElement>(element), opt, p, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QRect ExCustomStyle::subElementRect(ExCustomStyle::SubElement subElement, const QStyleOption *option, const QWidget *widget) const
|
||||||
|
{
|
||||||
|
proxy()->subElementRect(static_cast<QStyle::SubElement>(subElement), option, widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> Stashed changes
|
||||||
inline int ExCustomStyle::pixelMetric(ExCustomStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
inline int ExCustomStyle::pixelMetric(ExCustomStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
proxy()->pixelMetric(static_cast<QStyle::PixelMetric>(metric), option, widget);
|
proxy()->pixelMetric(static_cast<QStyle::PixelMetric>(metric), option, widget);
|
||||||
|
Loading…
Reference in New Issue
Block a user