Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AppletItemButton {

padding: 0

visible: !Drag.active
visible: !Drag.active && itemVisible
hoverEnabled: inputEventsEnabled

function updatePluginMargins()
Expand Down
2 changes: 1 addition & 1 deletion panels/dock/tray/package/ActionShowStashDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.deepin.ds.dock.tray 1.0 as DDT

AppletItemButton {
id: root
property bool isDropHover: model.visualIndex === dropHoverIndex && dropHoverIndex !== -1
property bool isDropHover: model.visualIndex === dropHoverIndex && dropHoverIndex !== -1 && Panel.contextDragging

icon.name: {
switch (Panel.position) {
Expand Down
3 changes: 2 additions & 1 deletion panels/dock/tray/package/StashedItemPositioner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import QtQuick
import QtQuick.Controls
import org.deepin.ds.dock.tray 1.0 as DDT

Control {
id: root
property bool itemVisible: true
property bool itemVisible: !DDT.TraySortOrderModel.isUpdating

spacing: 0
padding: 0
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/tray/package/TrayItemPositioner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import org.deepin.ds.dock.tray 1.0 as DDT
Control {
id: root
property bool itemVisible: {
if (DDT.TraySortOrderModel.isUpdating) {
return false
}
if (model.sectionType === "collapsable") return !collapsed && model.visibility
return model.sectionType !== "stashed" && model.visibility
}
Expand Down
6 changes: 6 additions & 0 deletions panels/dock/tray/traysortordermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ QStandardItem *TraySortOrderModel::createTrayItem(const QString &name,

void TraySortOrderModel::updateVisualIndexes()
{
m_isUpdating = true;
emit isUpdatingChanged(true);

for (int i = 0; i < rowCount(); i++) {
item(i)->setData(-1, TraySortOrderModel::VisualIndexRole);
}
Expand Down Expand Up @@ -440,6 +443,9 @@ void TraySortOrderModel::updateVisualIndexes()

// update visible item count property
setProperty("visualItemCount", currentVisualIndex);

m_isUpdating = false;
emit isUpdatingChanged(false);

qDebug() << "update" << m_visualItemCount << currentVisualIndex;
}
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/tray/traysortordermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class TraySortOrderModel : public QStandardItemModel
Q_PROPERTY(bool collapsed MEMBER m_collapsed NOTIFY collapsedChanged)
Q_PROPERTY(bool isCollapsing MEMBER m_isCollapsing NOTIFY isCollapsingChanged)
Q_PROPERTY(bool actionsAlwaysVisible MEMBER m_actionsAlwaysVisible NOTIFY actionsAlwaysVisibleChanged)
Q_PROPERTY(bool isUpdating MEMBER m_isUpdating NOTIFY isUpdatingChanged)
Q_PROPERTY(QList<QVariantMap> availableSurfaces MEMBER m_availableSurfaces NOTIFY availableSurfacesChanged)
public:
// enum SectionTypes {
Expand Down Expand Up @@ -67,6 +68,7 @@ class TraySortOrderModel : public QStandardItemModel
void collapsedChanged(bool);
void isCollapsingChanged(bool);
void actionsAlwaysVisibleChanged(bool);
void isUpdatingChanged(bool);
void visualItemCountChanged(int);
void availableSurfacesChanged(const QList<QVariantMap> &);

Expand All @@ -75,6 +77,7 @@ class TraySortOrderModel : public QStandardItemModel
bool m_collapsed = false;
bool m_isCollapsing = false;
bool m_actionsAlwaysVisible = false;
bool m_isUpdating = false;
std::unique_ptr<Dtk::Core::DConfig> m_dconfig;
// this is for the plugins that currently available.
QList<QVariantMap> m_availableSurfaces;
Expand Down