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