"QtMaterialStyle" renamed to "Style" and moved to "md" namespace.
This commit is contained in:
parent
803bce5281
commit
0c7dc7544d
|
@ -110,7 +110,7 @@ QColor AppBar::foregroundColor() const
|
||||||
Q_D(const AppBar);
|
Q_D(const AppBar);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->foregroundColor.isValid()) {
|
if (d->useThemeColors || !d->foregroundColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
} else {
|
} else {
|
||||||
return d->foregroundColor;
|
return d->foregroundColor;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ QColor AppBar::backgroundColor() const
|
||||||
Q_D(const AppBar);
|
Q_D(const AppBar);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
} else {
|
} else {
|
||||||
return d->backgroundColor;
|
return d->backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ void AutoComplete::updateResults(QString text)
|
||||||
|
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
for (int c = 0; c < diff; c++) {
|
for (int c = 0; c < diff; c++) {
|
||||||
QtMaterialFlatButton *item = new QtMaterialFlatButton;
|
FlatButton *item = new FlatButton;
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
item->setTextAlignment(Qt::AlignLeft);
|
item->setTextAlignment(Qt::AlignLeft);
|
||||||
item->setCornerRadius(0);
|
item->setCornerRadius(0);
|
||||||
|
@ -138,8 +138,8 @@ void AutoComplete::updateResults(QString text)
|
||||||
|
|
||||||
for (int i = 0; i < results.count(); ++i) {
|
for (int i = 0; i < results.count(); ++i) {
|
||||||
QWidget *widget = d->menuLayout->itemAt(i)->widget();
|
QWidget *widget = d->menuLayout->itemAt(i)->widget();
|
||||||
QtMaterialFlatButton *item;
|
FlatButton *item;
|
||||||
if ((item = static_cast<QtMaterialFlatButton *>(widget))) {
|
if ((item = static_cast<FlatButton *>(widget))) {
|
||||||
QString text = results.at(i);
|
QString text = results.at(i);
|
||||||
QRect rect = fm->boundingRect(text);
|
QRect rect = fm->boundingRect(text);
|
||||||
d->maxWidth = qMax(d->maxWidth, rect.width());
|
d->maxWidth = qMax(d->maxWidth, rect.width());
|
||||||
|
@ -228,8 +228,8 @@ bool AutoComplete::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
case QEvent::MouseButtonPress: {
|
case QEvent::MouseButtonPress: {
|
||||||
emit d->stateMachine->shouldFade();
|
emit d->stateMachine->shouldFade();
|
||||||
QtMaterialFlatButton *widget;
|
FlatButton *widget;
|
||||||
if ((widget = static_cast<QtMaterialFlatButton *>(watched))) {
|
if ((widget = static_cast<FlatButton *>(watched))) {
|
||||||
QString text(widget->text());
|
QString text(widget->text());
|
||||||
setText(text);
|
setText(text);
|
||||||
emit itemSelected(text);
|
emit itemSelected(text);
|
||||||
|
|
|
@ -122,7 +122,7 @@ QColor Avatar::textColor() const
|
||||||
Q_D(const Avatar);
|
Q_D(const Avatar);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->textColor.isValid()) {
|
if (d->useThemeColors || !d->textColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("canvas");
|
return Style::instance().themeColor("canvas");
|
||||||
} else {
|
} else {
|
||||||
return d->textColor;
|
return d->textColor;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ QColor Avatar::backgroundColor() const
|
||||||
Q_D(const Avatar);
|
Q_D(const Avatar);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
} else {
|
} else {
|
||||||
return d->backgroundColor;
|
return d->backgroundColor;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ void Avatar::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
brush.setStyle(Qt::SolidPattern);
|
brush.setStyle(Qt::SolidPattern);
|
||||||
brush.setColor(QtMaterialStyle::instance().themeColor("disabled"));
|
brush.setColor(Style::instance().themeColor("disabled"));
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
painter.setBrush(brush);
|
painter.setBrush(brush);
|
||||||
painter.drawEllipse(QRectF((width()-d->size)/2, (height()-d->size)/2,
|
painter.drawEllipse(QRectF((width()-d->size)/2, (height()-d->size)/2,
|
||||||
|
|
|
@ -176,7 +176,7 @@ QColor CircularProgress::color() const
|
||||||
Q_D(const CircularProgress);
|
Q_D(const CircularProgress);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->color.isValid()) {
|
if (d->useThemeColors || !d->color.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
} else {
|
} else {
|
||||||
return d->color;
|
return d->color;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ void CircularProgress::paintEvent(QPaintEvent *event)
|
||||||
QPen pen;
|
QPen pen;
|
||||||
pen.setCapStyle(Qt::RoundCap);
|
pen.setCapStyle(Qt::RoundCap);
|
||||||
pen.setWidthF(d->penWidth);
|
pen.setWidthF(d->penWidth);
|
||||||
pen.setColor(QtMaterialStyle::instance().themeColor("border"));
|
pen.setColor(Style::instance().themeColor("border"));
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
painter.drawLine(rect().center()-QPointF(20, 20), rect().center()+QPointF(20, 20));
|
painter.drawLine(rect().center()-QPointF(20, 20), rect().center()+QPointF(20, 20));
|
||||||
painter.drawLine(rect().center()+QPointF(20, -20), rect().center()-QPointF(20, -20));
|
painter.drawLine(rect().center()+QPointF(20, -20), rect().center()-QPointF(20, -20));
|
||||||
|
|
|
@ -56,7 +56,7 @@ void FlatButtonPrivate::init()
|
||||||
useFixedRippleRadius = false;
|
useFixedRippleRadius = false;
|
||||||
haloVisible = true;
|
haloVisible = true;
|
||||||
|
|
||||||
q->setStyle(&QtMaterialStyle::instance());
|
q->setStyle(&Style::instance());
|
||||||
q->setAttribute(Qt::WA_Hover);
|
q->setAttribute(Qt::WA_Hover);
|
||||||
q->setMouseTracking(true);
|
q->setMouseTracking(true);
|
||||||
|
|
||||||
|
@ -177,17 +177,17 @@ QColor FlatButton::foregroundColor() const
|
||||||
if (d->useThemeColors || !d->foregroundColor.isValid())
|
if (d->useThemeColors || !d->foregroundColor.isValid())
|
||||||
{
|
{
|
||||||
if (Qt::OpaqueMode == d->bgMode) {
|
if (Qt::OpaqueMode == d->bgMode) {
|
||||||
return QtMaterialStyle::instance().themeColor("canvas");
|
return Style::instance().themeColor("canvas");
|
||||||
}
|
}
|
||||||
switch (d->role)
|
switch (d->role)
|
||||||
{
|
{
|
||||||
case Material::Primary:
|
case Material::Primary:
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
case Material::Secondary:
|
case Material::Secondary:
|
||||||
return QtMaterialStyle::instance().themeColor("accent1");
|
return Style::instance().themeColor("accent1");
|
||||||
case Material::Default:
|
case Material::Default:
|
||||||
default:
|
default:
|
||||||
return QtMaterialStyle::instance().themeColor("text");
|
return Style::instance().themeColor("text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d->foregroundColor;
|
return d->foregroundColor;
|
||||||
|
@ -212,12 +212,12 @@ QColor FlatButton::backgroundColor() const
|
||||||
switch (d->role)
|
switch (d->role)
|
||||||
{
|
{
|
||||||
case Material::Primary:
|
case Material::Primary:
|
||||||
return QtMaterialStyle::instance().themeColor("primary1");
|
return Style::instance().themeColor("primary1");
|
||||||
case Material::Secondary:
|
case Material::Secondary:
|
||||||
return QtMaterialStyle::instance().themeColor("accent1");
|
return Style::instance().themeColor("accent1");
|
||||||
case Material::Default:
|
case Material::Default:
|
||||||
default:
|
default:
|
||||||
return QtMaterialStyle::instance().themeColor("text");
|
return Style::instance().themeColor("text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return d->backgroundColor;
|
return d->backgroundColor;
|
||||||
|
@ -260,7 +260,7 @@ QColor FlatButton::disabledForegroundColor() const
|
||||||
Q_D(const FlatButton);
|
Q_D(const FlatButton);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->disabledColor.isValid()) {
|
if (d->useThemeColors || !d->disabledColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("disabled");
|
return Style::instance().themeColor("disabled");
|
||||||
} else {
|
} else {
|
||||||
return d->disabledColor;
|
return d->disabledColor;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ QColor FlatButton::disabledBackgroundColor() const
|
||||||
Q_D(const FlatButton);
|
Q_D(const FlatButton);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->disabledBackgroundColor.isValid()) {
|
if (d->useThemeColors || !d->disabledBackgroundColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("disabled3");
|
return Style::instance().themeColor("disabled3");
|
||||||
} else {
|
} else {
|
||||||
return d->disabledBackgroundColor;
|
return d->disabledBackgroundColor;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ void FlatButton::mousePressEvent(QMouseEvent *event)
|
||||||
radiusEndValue = static_cast<qreal>(width())/2;
|
radiusEndValue = static_cast<qreal>(width())/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
QtMaterialRipple *ripple = new QtMaterialRipple(pos);
|
Ripple *ripple = new Ripple(pos);
|
||||||
|
|
||||||
ripple->setRadiusEndValue(radiusEndValue);
|
ripple->setRadiusEndValue(radiusEndValue);
|
||||||
ripple->setOpacityStartValue(0.35);
|
ripple->setOpacityStartValue(0.35);
|
||||||
|
|
|
@ -44,10 +44,10 @@ FlatButtonStateMachine::FlatButtonStateMachine(FlatButton *parent)
|
||||||
|
|
||||||
m_checkableState->setInitialState(parent->isChecked() ? m_checkedState
|
m_checkableState->setInitialState(parent->isChecked() ? m_checkedState
|
||||||
: m_uncheckedState);
|
: m_uncheckedState);
|
||||||
QtMaterialStateTransition *transition;
|
StateTransition *transition;
|
||||||
QPropertyAnimation *animation;
|
QPropertyAnimation *animation;
|
||||||
|
|
||||||
transition = new QtMaterialStateTransition(FlatButtonCheckedTransition);
|
transition = new StateTransition(FlatButtonCheckedTransition);
|
||||||
transition->setTargetState(m_checkedState);
|
transition->setTargetState(m_checkedState);
|
||||||
m_uncheckedState->addTransition(transition);
|
m_uncheckedState->addTransition(transition);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ FlatButtonStateMachine::FlatButtonStateMachine(FlatButton *parent)
|
||||||
animation->setDuration(200);
|
animation->setDuration(200);
|
||||||
transition->addAnimation(animation);
|
transition->addAnimation(animation);
|
||||||
|
|
||||||
transition = new QtMaterialStateTransition(FlatButtonUncheckedTransition);
|
transition = new StateTransition(FlatButtonUncheckedTransition);
|
||||||
transition->setTargetState(m_uncheckedState);
|
transition->setTargetState(m_uncheckedState);
|
||||||
m_checkedState->addTransition(transition);
|
m_checkedState->addTransition(transition);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ FlatButtonStateMachine::FlatButtonStateMachine(FlatButton *parent)
|
||||||
addTransition(m_button, QEvent::FocusIn, m_hoveredState, m_hoveredFocusedState);
|
addTransition(m_button, QEvent::FocusIn, m_hoveredState, m_hoveredFocusedState);
|
||||||
addTransition(m_button, QEvent::FocusOut, m_hoveredFocusedState, m_hoveredState);
|
addTransition(m_button, QEvent::FocusOut, m_hoveredFocusedState, m_hoveredState);
|
||||||
|
|
||||||
transition = new QtMaterialStateTransition(FlatButtonPressedTransition);
|
transition = new StateTransition(FlatButtonPressedTransition);
|
||||||
transition->setTargetState(m_pressedState);
|
transition->setTargetState(m_pressedState);
|
||||||
m_hoveredState->addTransition(transition);
|
m_hoveredState->addTransition(transition);
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ void FlatButtonStateMachine::updateCheckedStatus()
|
||||||
if (m_wasChecked != checked) {
|
if (m_wasChecked != checked) {
|
||||||
m_wasChecked = checked;
|
m_wasChecked = checked;
|
||||||
if (checked) {
|
if (checked) {
|
||||||
postEvent(new QtMaterialStateTransitionEvent(FlatButtonCheckedTransition));
|
postEvent(new StateTransitionEvent(FlatButtonCheckedTransition));
|
||||||
} else {
|
} else {
|
||||||
postEvent(new QtMaterialStateTransitionEvent(FlatButtonUncheckedTransition));
|
postEvent(new StateTransitionEvent(FlatButtonUncheckedTransition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ bool FlatButtonStateMachine::eventFilter(QObject *watched,
|
||||||
if (QEvent::FocusIn == event->type()) {
|
if (QEvent::FocusIn == event->type()) {
|
||||||
QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);
|
QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);
|
||||||
if (focusEvent && Qt::MouseFocusReason == focusEvent->reason()) {
|
if (focusEvent && Qt::MouseFocusReason == focusEvent->reason()) {
|
||||||
postEvent(new QtMaterialStateTransitionEvent(FlatButtonPressedTransition));
|
postEvent(new StateTransitionEvent(FlatButtonPressedTransition));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ void IconButtonPrivate::init()
|
||||||
|
|
||||||
rippleOverlay->installEventFilter(q);
|
rippleOverlay->installEventFilter(q);
|
||||||
|
|
||||||
q->setStyle(&QtMaterialStyle::instance());
|
q->setStyle(&Style::instance());
|
||||||
|
|
||||||
QSizePolicy policy;
|
QSizePolicy policy;
|
||||||
policy.setWidthForHeight(true);
|
policy.setWidthForHeight(true);
|
||||||
|
@ -106,7 +106,7 @@ QColor IconButton::color() const
|
||||||
Q_D(const IconButton);
|
Q_D(const IconButton);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->color.isValid()) {
|
if (d->useThemeColors || !d->color.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("text");
|
return Style::instance().themeColor("text");
|
||||||
}
|
}
|
||||||
return d->color;
|
return d->color;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ QColor IconButton::disabledColor() const
|
||||||
Q_D(const IconButton);
|
Q_D(const IconButton);
|
||||||
|
|
||||||
if (d->useThemeColors || !d->disabledColor.isValid()) {
|
if (d->useThemeColors || !d->disabledColor.isValid()) {
|
||||||
return QtMaterialStyle::instance().themeColor("disabled");
|
return Style::instance().themeColor("disabled");
|
||||||
}
|
}
|
||||||
return d->disabledColor;
|
return d->disabledColor;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue