mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +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);
|
m_itemList.insert(insertIndex, item);
|
||||||
emit itemInserted(insertIndex - firstPluginPosition, item);
|
emit itemInserted(insertIndex - firstPluginPosition, item);
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
|
||||||
|
#define PLUGIN_MARGEN 10
|
||||||
|
|
||||||
Position DockItem::DockPosition = Position::Top;
|
Position DockItem::DockPosition = Position::Top;
|
||||||
DisplayMode DockItem::DockDisplayMode = DisplayMode::Efficient;
|
DisplayMode DockItem::DockDisplayMode = DisplayMode::Efficient;
|
||||||
QPointer<DockPopupWindow> DockItem::PopupWindow(nullptr);
|
QPointer<DockPopupWindow> DockItem::PopupWindow(nullptr);
|
||||||
@ -44,7 +46,7 @@ DockItem::DockItem(QWidget *parent)
|
|||||||
if (PopupWindow.isNull()) {
|
if (PopupWindow.isNull()) {
|
||||||
DockPopupWindow *arrowRectangle = new DockPopupWindow(nullptr);
|
DockPopupWindow *arrowRectangle = new DockPopupWindow(nullptr);
|
||||||
arrowRectangle->setShadowBlurRadius(20);
|
arrowRectangle->setShadowBlurRadius(20);
|
||||||
arrowRectangle->setRadius(6);
|
arrowRectangle->setRadius(18);
|
||||||
arrowRectangle->setShadowYOffset(2);
|
arrowRectangle->setShadowYOffset(2);
|
||||||
arrowRectangle->setShadowXOffset(0);
|
arrowRectangle->setShadowXOffset(0);
|
||||||
arrowRectangle->setArrowWidth(18);
|
arrowRectangle->setArrowWidth(18);
|
||||||
@ -348,14 +350,40 @@ const QPoint DockItem::popupMarkPoint() const
|
|||||||
QPoint p(topleftPoint());
|
QPoint p(topleftPoint());
|
||||||
|
|
||||||
const QRect r = rect();
|
const QRect r = rect();
|
||||||
const int offset = 2;
|
|
||||||
switch (DockPosition) {
|
switch (DockPosition) {
|
||||||
case Top: p += QPoint(r.width() / 2, r.height() + offset); break;
|
case Top: {
|
||||||
case Bottom: p += QPoint(r.width() / 2, 0 - offset); break;
|
if (itemType() == Plugins) {
|
||||||
case Left: p += QPoint(r.width() + offset, r.height() / 2); break;
|
p += QPoint(r.width() / 2, r.height() + PLUGIN_MARGEN);
|
||||||
case Right: p += QPoint(0 - offset, r.height() / 2); break;
|
} 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;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,12 @@ void MainPanelControl::insertItem(int index, DockItem *item)
|
|||||||
|
|
||||||
switch (item->itemType()) {
|
switch (item->itemType()) {
|
||||||
case DockItem::Launcher:
|
case DockItem::Launcher:
|
||||||
|
addFixedAreaItem(0, item);
|
||||||
|
break;
|
||||||
case DockItem::FixedPlugin:
|
case DockItem::FixedPlugin:
|
||||||
|
if (index == 0) {
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
addFixedAreaItem(index, item);
|
addFixedAreaItem(index, item);
|
||||||
break;
|
break;
|
||||||
case DockItem::App:
|
case DockItem::App:
|
||||||
@ -610,9 +615,13 @@ DockItem *MainPanelControl::dropTargetItem(DockItem *sourceItem, QPoint point)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QRect rect;
|
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)) {
|
if (rect.contains(point)) {
|
||||||
targetItem = dockItem;
|
targetItem = dockItem;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user