Merge branch 'master' of https://invent.kde.org/frameworks/plasma-framework into work/marginareas

This commit is contained in:
Niccolò Venerandi 2020-11-20 23:23:52 +01:00
commit 09ed402eb7
8 changed files with 23 additions and 77 deletions

View File

@ -252,7 +252,6 @@ IconItem::IconItem(QQuickItem *parent)
m_iconItemSource(new NullSource(this)),
m_status(Plasma::Svg::Normal),
m_active(false),
m_selected(false),
m_animated(true),
m_usesPlasmaTheme(true),
m_roundToIconSize(true),
@ -449,26 +448,6 @@ void IconItem::setActive(bool active)
emit activeChanged();
}
bool IconItem::isSelected() const
{
return m_selected;
}
void IconItem::setSelected(bool selected)
{
if (m_selected == selected) {
return;
}
m_selected = selected;
if (isComponentComplete()) {
m_allowNextAnimation = true;
schedulePixmapUpdate();
}
emit selectedChanged();
}
bool IconItem::isAnimated() const
{
return m_animated;
@ -747,8 +726,6 @@ void IconItem::loadPixmap()
result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::DisabledState);
} else if (m_active) {
result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::ActiveState);
} else if (m_selected) {
result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::SelectedState);
}
const QSize oldPaintedSize = paintedSize();

View File

@ -61,12 +61,6 @@ class IconItem : public QQuickItem
*/
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
/**
* Apply a visual indication that this icon is selected.
* @since 5.77
*/
Q_PROPERTY(bool selected READ isSelected WRITE setSelected NOTIFY selectedChanged)
/**
* Sets the image in a selected status.
* Svgs can be colored with system color themes, if the status is selected,
@ -130,9 +124,6 @@ public:
bool isActive() const;
void setActive(bool active);
bool isSelected() const;
void setSelected(bool selected);
bool isAnimated() const;
void setAnimated(bool animated);
@ -165,7 +156,6 @@ public:
Q_SIGNALS:
void overlaysChanged();
void activeChanged();
void selectedChanged();
void sourceChanged();
void animatedChanged();
void usesPlasmaThemeChanged();
@ -197,7 +187,6 @@ private:
Plasma::Svg::Status m_status;
bool m_active;
bool m_selected;
bool m_animated;
bool m_usesPlasmaTheme;
bool m_roundToIconSize;

View File

@ -49,7 +49,7 @@ T.TabButton {
colorGroup: control.PlasmaCore.ColorScope.colorGroup
visible: source.length > 0 && control.display !== T.AbstractButton.TextOnly
source: control.icon ? (control.icon.name || control.icon.source) : ""
selected: control.visualFocus
active: control.visualFocus
}
Label {
id: label

View File

@ -97,7 +97,7 @@ PlasmoidHeading {
}
}
PlasmaComponents.ToolTip {
text: actionsButton.singleAction ? actionsButton.singleAction.text : i18n("More actions")
text: actionsButton.singleAction ? actionsButton.singleAction.text : i18nd("libplasma5", "More actions")
}
PC2.Menu {
id: configMenu

View File

@ -55,12 +55,13 @@ public:
* This enumeration lists the various hints that an applet can pass to its
* constraint regarding the way that it is represented
*/
enum ConstraintHints {
enum ConstraintHints { //TODO KF6 ConstraintHints -> ConstraintHint
NoHint = 0,
CanFillArea = 1, /**< The applet can fill the area and ignore constraint margins*/
CanFillArea = 1, /**< The CompactRepresentation can fill the area and ignore constraint margins*/ // (TODO: KF6 CanFillArea -> CompactRepresentationFillArea)
MarginAreasSeparator = CanFillArea | 2, /**< The applet acts as a separator between the standard and slim panel margin areas*/
};
Q_ENUM(ConstraintHints)
Q_DECLARE_FLAGS(ConstraintFlags, ConstraintHints)
Q_FLAG(ConstraintFlags)
/**
* The FormFactor enumeration describes how a Plasma::Applet should arrange
@ -325,6 +326,7 @@ PLASMA_EXPORT Types::Direction locationToInverseDirection(Types::Location locati
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::ContainmentDisplayHints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::ConstraintFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::ComponentTypes)
Q_DECLARE_OPERATORS_FOR_FLAGS(Types::BackgroundFlags)

View File

@ -486,15 +486,10 @@ void DialogPrivate::updateLayoutParameters()
q->resize(finalSize);
}
if (q->backgroundHints().testFlag(Dialog::DiscardBackgroundMargins)) {
mainItem->setPosition(QPointF(0, 0));
mainItem->setSize(QSizeF(q->width(), q->height()));
} else {
mainItem->setPosition(QPointF(margin->left(),
mainItem->setPosition(QPointF(margin->left(),
margin->top()));
mainItem->setSize(QSizeF(q->width() - margin->left() - margin->right(),
mainItem->setSize(QSizeF(q->width() - margin->left() - margin->right(),
q->height() - margin->top() - margin->bottom()));
}
frameSvgItem->setSize(QSizeF(q->width(),
q->height()));
@ -642,12 +637,8 @@ void DialogPrivate::syncToMainItemSize()
q->resize(s);
}
if (q->backgroundHints().testFlag(Dialog::DiscardBackgroundMargins)) {
mainItem->setPosition(QPointF(0, 0));
} else {
mainItem->setPosition(QPointF(frameSvgItem->fixedMargins()->left(),
mainItem->setPosition(QPointF(frameSvgItem->fixedMargins()->left(),
frameSvgItem->fixedMargins()->top()));
}
updateTheme();
}
@ -665,15 +656,9 @@ void DialogPrivate::slotWindowPositionChanged()
if (mainItem) {
auto margin = frameSvgItem->fixedMargins();
if (q->backgroundHints().testFlag(Dialog::DiscardBackgroundMargins)) {
mainItem->setPosition(QPointF(0, 0));
mainItem->setSize(QSizeF(q->width(), q->height()));
} else {
mainItem->setPosition(QPointF(margin->left(),
margin->top()));
mainItem->setSize(QSizeF(q->width() - margin->left() - margin->right(),
q->height() - margin->top() - margin->bottom()));
}
mainItem->setPosition(QPoint(margin->left(), margin->top()));
mainItem->setSize(QSize(q->width() - margin->left() - margin->right(),
q->height() - margin->top() - margin->bottom()));
}
}
@ -1132,15 +1117,11 @@ void Dialog::resizeEvent(QResizeEvent* re)
d->frameSvgItem->setSize(QSizeF(re->size().width(),
re->size().height()));
auto margin = d->frameSvgItem->fixedMargins();
if (backgroundHints().testFlag(Dialog::DiscardBackgroundMargins)) {
d->mainItem->setPosition(QPointF(0, 0));
d->mainItem->setSize(QSizeF(re->size().width(), re->size().height()));
} else {
d->mainItem->setPosition(QPointF(margin->left(),
margin->top()));
d->mainItem->setSize(QSizeF(re->size().width() - margin->left() - margin->right(),
re->size().height() - margin->top() - margin->bottom()));
}
d->mainItem->setPosition(QPointF(margin->left(),
margin->top()));
d->mainItem->setSize(QSize(re->size().width() - margin->left() - margin->right(),
re->size().height() - margin->top() - margin->bottom()));
QObject::connect(d->mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged()));
QObject::connect(d->mainItem, SIGNAL(heightChanged()), this, SLOT(slotMainItemSizeChanged()));

View File

@ -150,13 +150,11 @@ public:
};
Q_ENUM(WindowType)
enum BackgroundHint {
enum BackgroundHints {
NoBackground = 0, /**< Not drawing a background under the applet, the dialog has its own implementation */
StandardBackground = 1, /**< The standard background from the theme is drawn */
DiscardBackgroundMargins = 2 /**< Don't constrain dialogs main QML item within dialogs margins. */
StandardBackground = 1 /**< The standard background from the theme is drawn */
};
Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
Q_FLAG(BackgroundHints)
Q_ENUM(BackgroundHints)
explicit Dialog(QQuickItem *parent = nullptr);
~Dialog() override;
@ -246,8 +244,6 @@ private:
Q_PRIVATE_SLOT(d, void slotMainItemSizeChanged())
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Dialog::BackgroundHints)
}
#endif

View File

@ -247,7 +247,8 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
Q_PROPERTY(bool loading MEMBER m_loading NOTIFY isLoadingChanged)
/**
* When false the plasmoid will ignore the margins when contained in a panel
* The hints that the applet gives to its constraint,
* such as asking to fill all the available space ignoring margins.
*/
Q_PROPERTY(Plasma::Types::ConstraintHints constraintHints READ constraintHints WRITE setConstraintHints NOTIFY constraintHintsChanged)