mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
feat(dde-dock):plugin index and prewindow display error for task 12385
This commit is contained in:
parent
3a19c20842
commit
e50f8a2128
@ -283,10 +283,6 @@ void DockItemManager::pluginItemInserted(PluginsItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
if (item->itemType() == DockItem::FixedPlugin) {
|
||||
insertIndex ++;
|
||||
}
|
||||
|
||||
m_itemList.insert(insertIndex, item);
|
||||
emit itemInserted(insertIndex - firstPluginPosition, item);
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <QJsonObject>
|
||||
#include <QCursor>
|
||||
|
||||
#define PLUGIN_MARGEN 10
|
||||
|
||||
Position DockItem::DockPosition = Position::Top;
|
||||
DisplayMode DockItem::DockDisplayMode = DisplayMode::Efficient;
|
||||
QPointer<DockPopupWindow> DockItem::PopupWindow(nullptr);
|
||||
@ -44,7 +46,7 @@ DockItem::DockItem(QWidget *parent)
|
||||
if (PopupWindow.isNull()) {
|
||||
DockPopupWindow *arrowRectangle = new DockPopupWindow(nullptr);
|
||||
arrowRectangle->setShadowBlurRadius(20);
|
||||
arrowRectangle->setRadius(6);
|
||||
arrowRectangle->setRadius(18);
|
||||
arrowRectangle->setShadowYOffset(2);
|
||||
arrowRectangle->setShadowXOffset(0);
|
||||
arrowRectangle->setArrowWidth(18);
|
||||
@ -348,14 +350,40 @@ const QPoint DockItem::popupMarkPoint() const
|
||||
QPoint p(topleftPoint());
|
||||
|
||||
const QRect r = rect();
|
||||
const int offset = 2;
|
||||
switch (DockPosition) {
|
||||
case Top: p += QPoint(r.width() / 2, r.height() + offset); break;
|
||||
case Bottom: p += QPoint(r.width() / 2, 0 - offset); break;
|
||||
case Left: p += QPoint(r.width() + offset, r.height() / 2); break;
|
||||
case Right: p += QPoint(0 - offset, r.height() / 2); break;
|
||||
case Top: {
|
||||
if (itemType() == Plugins) {
|
||||
p += QPoint(r.width() / 2, r.height() + PLUGIN_MARGEN);
|
||||
} else {
|
||||
p += QPoint(r.width() / 2, r.height());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Bottom: {
|
||||
if (itemType() == Plugins) {
|
||||
p += QPoint(r.width() / 2, 0 - PLUGIN_MARGEN);
|
||||
} else {
|
||||
p += QPoint(r.width() / 2, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Left: {
|
||||
if (itemType() == Plugins) {
|
||||
p += QPoint(r.width() + PLUGIN_MARGEN, r.height() / 2);
|
||||
} else {
|
||||
p += QPoint(r.width(), r.height() / 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Right: {
|
||||
if (itemType() == Plugins) {
|
||||
p += QPoint(0 - PLUGIN_MARGEN, r.height() / 2);
|
||||
} else {
|
||||
p += QPoint(0, r.height() / 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,12 @@ void MainPanelControl::insertItem(int index, DockItem *item)
|
||||
|
||||
switch (item->itemType()) {
|
||||
case DockItem::Launcher:
|
||||
addFixedAreaItem(0, item);
|
||||
break;
|
||||
case DockItem::FixedPlugin:
|
||||
if (index == 0) {
|
||||
index += 1;
|
||||
}
|
||||
addFixedAreaItem(index, item);
|
||||
break;
|
||||
case DockItem::App:
|
||||
@ -610,9 +615,13 @@ DockItem *MainPanelControl::dropTargetItem(DockItem *sourceItem, QPoint point)
|
||||
continue;
|
||||
|
||||
QRect rect;
|
||||
rect.setTopLeft(dockItem->pos());
|
||||
rect.setSize(dockItem->size());
|
||||
|
||||
rect.setTopLeft(dockItem->pos());
|
||||
if ((m_position == Position::Top) || (m_position == Position::Bottom)) {
|
||||
rect.setSize(QSize(PLUGIN_MAX_SIZE, height()));
|
||||
} else {
|
||||
rect.setSize(QSize(width(), PLUGIN_MAX_SIZE));
|
||||
}
|
||||
if (rect.contains(point)) {
|
||||
targetItem = dockItem;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user