don't put the fullrep in the popup if not collapsed
when preloading, if the applet is not collapsed, the full representationshouldn't be put in the popup reviewed-by: kbroulik
This commit is contained in:
parent
3c4f3ed1b8
commit
3c5d6a9be8
@ -289,6 +289,28 @@ QQuickItem *AppletQuickItemPrivate::createCompactRepresentationExpanderItem()
|
|||||||
return compactRepresentationExpanderItem;
|
return compactRepresentationExpanderItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppletQuickItemPrivate::appletShouldBeExpanded() const
|
||||||
|
{
|
||||||
|
if (applet->isContainment()) {
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (switchWidth > 0 && switchHeight > 0) {
|
||||||
|
return q->width() > switchWidth && q->height() > switchHeight;
|
||||||
|
|
||||||
|
//if a size to switch wasn't set, determine what representation to always chose
|
||||||
|
} else {
|
||||||
|
//preferred representation set?
|
||||||
|
if (preferredRepresentation) {
|
||||||
|
return preferredRepresentation == fullRepresentation;
|
||||||
|
//Otherwise, base on FormFactor
|
||||||
|
} else {
|
||||||
|
return (applet->formFactor() != Plasma::Types::Horizontal && applet->formFactor() != Plasma::Types::Vertical);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppletQuickItemPrivate::preloadForExpansion()
|
void AppletQuickItemPrivate::preloadForExpansion()
|
||||||
{
|
{
|
||||||
qint64 time = 0;
|
qint64 time = 0;
|
||||||
@ -304,7 +326,7 @@ void AppletQuickItemPrivate::preloadForExpansion()
|
|||||||
createCompactRepresentationExpanderItem();
|
createCompactRepresentationExpanderItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compactRepresentationExpanderItem) {
|
if (!appletShouldBeExpanded() && compactRepresentationExpanderItem) {
|
||||||
compactRepresentationExpanderItem->setProperty("fullRepresentation", QVariant::fromValue<QObject*>(createFullRepresentationItem()));
|
compactRepresentationExpanderItem->setProperty("fullRepresentation", QVariant::fromValue<QObject*>(createFullRepresentationItem()));
|
||||||
} else {
|
} else {
|
||||||
fullRepresentationItem->setProperty("parent", QVariant::fromValue<QObject*>(q));
|
fullRepresentationItem->setProperty("parent", QVariant::fromValue<QObject*>(q));
|
||||||
@ -329,32 +351,15 @@ void AppletQuickItemPrivate::compactRepresentationCheck()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool full = false;
|
bool full = appletShouldBeExpanded();
|
||||||
|
|
||||||
if (applet->isContainment()) {
|
if ((full && fullRepresentationItem && fullRepresentationItem == currentRepresentationItem) ||
|
||||||
full = true;
|
(!full && compactRepresentationItem && compactRepresentationItem == currentRepresentationItem)
|
||||||
|
) {
|
||||||
} else {
|
return;
|
||||||
if (switchWidth > 0 && switchHeight > 0) {
|
|
||||||
full = q->width() > switchWidth && q->height() > switchHeight;
|
|
||||||
//if a size to switch wasn't set, determine what representation to always chose
|
|
||||||
} else {
|
|
||||||
//preferred representation set?
|
|
||||||
if (preferredRepresentation) {
|
|
||||||
full = preferredRepresentation == fullRepresentation;
|
|
||||||
//Otherwise, base on FormFactor
|
|
||||||
} else {
|
|
||||||
full = (applet->formFactor() != Plasma::Types::Horizontal && applet->formFactor() != Plasma::Types::Vertical);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((full && fullRepresentationItem && fullRepresentationItem == currentRepresentationItem) ||
|
|
||||||
(!full && compactRepresentationItem && compactRepresentationItem == currentRepresentationItem)
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Expanded
|
//Expanded
|
||||||
if (full) {
|
if (full) {
|
||||||
QQuickItem *item = createFullRepresentationItem();
|
QQuickItem *item = createFullRepresentationItem();
|
||||||
|
@ -80,6 +80,11 @@ public:
|
|||||||
QQuickItem *createCompactRepresentationItem();
|
QQuickItem *createCompactRepresentationItem();
|
||||||
QQuickItem *createFullRepresentationItem();
|
QQuickItem *createFullRepresentationItem();
|
||||||
QQuickItem *createCompactRepresentationExpanderItem();
|
QQuickItem *createCompactRepresentationExpanderItem();
|
||||||
|
|
||||||
|
//true if the applet is at a size in which it should be expanded,
|
||||||
|
//false if is too small and should be an icon
|
||||||
|
bool appletShouldBeExpanded() const;
|
||||||
|
//ensures the popup is preloaded, don't expand yet
|
||||||
void preloadForExpansion();
|
void preloadForExpansion();
|
||||||
|
|
||||||
//look into item, and return the Layout attached property, if found
|
//look into item, and return the Layout attached property, if found
|
||||||
|
Loading…
Reference in New Issue
Block a user