diff --git a/components/flatbutton.cpp b/components/flatbutton.cpp index c686f24..f155192 100644 --- a/components/flatbutton.cpp +++ b/components/flatbutton.cpp @@ -75,6 +75,21 @@ void FlatButton::setRippleStyle(RippleStyle style) d->rippleStyle = style; } +void FlatButton::setCornerRadius(qreal radius) +{ + Q_D(FlatButton); + + d->cornerRadius = radius; + update(); +} + +qreal FlatButton::cornerRadius() const +{ + Q_D(const FlatButton); + + return d->cornerRadius; +} + void FlatButton::setRole(Material::Role role) { Q_D(FlatButton); @@ -129,13 +144,14 @@ void FlatButton::paintEvent(QPaintEvent *event) painter.setRenderHint(QPainter::Antialiasing); if (isEnabled() && bgOpacity > 0) { + const qreal cr = d->cornerRadius; QBrush brush; brush.setStyle(Qt::SolidPattern); brush.setColor(d->delegate->backgroundColor()); painter.setOpacity(bgOpacity); painter.setBrush(brush); painter.setPen(Qt::NoPen); - painter.drawRoundedRect(rect(), 3, 3); + painter.drawRoundedRect(rect(), cr, cr); } if (isEnabled() && haloOpacity > 0) { diff --git a/components/flatbutton.h b/components/flatbutton.h index 253cb63..38fbd6e 100644 --- a/components/flatbutton.h +++ b/components/flatbutton.h @@ -11,6 +11,8 @@ class FlatButton : public QPushButton { Q_OBJECT + Q_PROPERTY(qreal cornerRadius WRITE setCornerRadius READ cornerRadius) + public: enum RippleStyle { CenteredRipple, @@ -26,6 +28,9 @@ public: void setRippleStyle(RippleStyle style); + void setCornerRadius(qreal radius); + qreal cornerRadius() const; + protected: FlatButton(FlatButtonPrivate &d, QWidget *parent = 0); diff --git a/components/flatbutton_p.h b/components/flatbutton_p.h index 30c8b91..86aa22c 100644 --- a/components/flatbutton_p.h +++ b/components/flatbutton_p.h @@ -18,7 +18,8 @@ public: FlatButtonPrivate(FlatButton *q) : q_ptr(q), role(Material::Default), - rippleStyle(FlatButton::PositionedRipple) + rippleStyle(FlatButton::PositionedRipple), + cornerRadius(3) {} void init(); @@ -29,6 +30,7 @@ public: FlatButtonDelegate *delegate; Material::Role role; FlatButton::RippleStyle rippleStyle; + qreal cornerRadius; }; #endif // FLATBUTTON_P_H diff --git a/components/raisedbutton.cpp b/components/raisedbutton.cpp index d84c4dd..f61738d 100644 --- a/components/raisedbutton.cpp +++ b/components/raisedbutton.cpp @@ -149,13 +149,15 @@ void RaisedButton::paintEvent(QPaintEvent *event) QBrush brush; + const qreal cr = d->cornerRadius; + brush.setStyle(Qt::SolidPattern); brush.setColor(isEnabled() ? palette().color(QPalette::Active, QPalette::Background) : palette().color(QPalette::Disabled, QPalette::Background)); painter.setBrush(brush); painter.setPen(Qt::NoPen); - painter.drawRoundedRect(rect(), 3, 3); + painter.drawRoundedRect(rect(), cr, cr); if (isEnabled()) { const qreal hs = static_cast(width())*d->delegate->focusHaloSize()/2; diff --git a/components/tabs_internal.cpp b/components/tabs_internal.cpp new file mode 100644 index 0000000..e69de29 diff --git a/components/tabs_internal.h b/components/tabs_internal.h new file mode 100644 index 0000000..596f49f --- /dev/null +++ b/components/tabs_internal.h @@ -0,0 +1,4 @@ +#ifndef TABS_INTERNAL_H +#define TABS_INTERNAL_H + +#endif // TABS_INTERNAL_H diff --git a/components/tabs_p.h b/components/tabs_p.h new file mode 100644 index 0000000..a9d2354 --- /dev/null +++ b/components/tabs_p.h @@ -0,0 +1,4 @@ +#ifndef TABS_P_H +#define TABS_P_H + +#endif // TABS_P_H