homescreens/halcyon: Fix some layouting issues and simplify

This commit is contained in:
Devin Lin 2023-04-10 22:16:43 -07:00
parent 6fb0eb6170
commit 2af706d197
5 changed files with 21 additions and 29 deletions

View file

@ -22,9 +22,6 @@ Item {
id: delegate
property int visualIndex: 0
property real leftPadding
property real rightPadding
property real dragFolderAnimationProgress: 0
property list<Kirigami.Action> menuActions
@ -119,8 +116,6 @@ Item {
id: mouseArea
anchors.fill: parent
anchors.leftMargin: delegate.leftPadding
anchors.rightMargin: delegate.rightPadding
property bool inDrag: false

View file

@ -21,8 +21,6 @@ MobileShell.GridView {
required property var searchWidget
// don't set anchors.margins since we want everywhere to be draggable
required property real leftMargin
required property real rightMargin
required property bool twoColumn
signal openConfigureRequested()
@ -64,8 +62,8 @@ MobileShell.GridView {
header: MobileShell.BaseItem {
topPadding: Math.round(root.height * 0.2)
bottomPadding: PlasmaCore.Units.largeSpacing
leftPadding: root.leftMargin
rightPadding: root.rightMargin
// leftPadding: root.leftMargin
// rightPadding: root.rightMargin
implicitWidth: root.width
background: Rectangle {
@ -228,11 +226,6 @@ MobileShell.GridView {
}
]
readonly property bool isLeftColumn: !root.twoColumn || ((visualIndex % 2) === 0)
readonly property bool isRightColumn: !root.twoColumn || ((visualIndex % 2) !== 0)
leftPadding: isLeftColumn ? root.leftMargin : 0
rightPadding: isRightColumn ? root.rightMargin : 0
implicitWidth: root.cellWidth
implicitHeight: visible ? root.cellHeight : 0

View file

@ -22,15 +22,15 @@ Item {
required property bool interactive
required property var searchWidget
readonly property real twoColumnThreshold: PlasmaCore.Units.gridUnit * 10
readonly property real twoColumnThreshold: PlasmaCore.Units.gridUnit * 16
readonly property bool twoColumn: root.width / 2 > twoColumnThreshold
readonly property real cellWidth: twoColumn ? root.width / 2 : root.width
readonly property real cellWidth: twoColumn ? (root.width - leftMargin - rightMargin) / 2 : (root.width - leftMargin - rightMargin)
readonly property real cellHeight: delegateHeight
readonly property real leftMargin: Math.round(parent.width * 0.1)
readonly property real rightMargin: Math.round(parent.width * 0.1)
readonly property real delegateHeight: PlasmaCore.Units.gridUnit * 3
readonly property real leftMargin: Math.round(width * 0.1)
readonly property real rightMargin: Math.round(width * 0.1)
readonly property real delegateHeight: Math.round(PlasmaCore.Units.gridUnit * 3.25)
property bool folderShown: false

View file

@ -252,5 +252,6 @@ Plasma::Applet *PinnedModel::applet()
void PinnedModel::setApplet(Plasma::Applet *applet)
{
m_applet = applet;
Q_EMIT appletChanged();
load();
}

View file

@ -25,7 +25,7 @@
class PinnedModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(Plasma::Applet *applet READ applet WRITE setApplet CONSTANT)
Q_PROPERTY(Plasma::Applet *applet READ applet WRITE setApplet NOTIFY appletChanged)
public:
enum Roles { IsFolderRole = Qt::UserRole + 1, ApplicationRole, FolderRole };
@ -54,6 +54,9 @@ public:
public Q_SLOTS:
void addAppFromFolder(const QString &storageId);
Q_SIGNALS:
void appletChanged();
private:
void load();