mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 07:05:48 +00:00
fix: 优化应用程序预览界面显示方式
优化应用程序预览界面显示方式 Log: 优化应用程序预览界面显示方式 Task: https://pms.uniontech.com/zentao/task-view-79863.html Influence: 优化应用程序预览界面显示方式 Change-Id: Ia4975b3b8e09fc4fc08ae54a0451e259b6463ef3
This commit is contained in:
parent
4067bfe337
commit
9c8ac3d800
@ -654,9 +654,8 @@ void AppItem::showPreview()
|
||||
|
||||
m_appPreviewTips = new PreviewContainer;
|
||||
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos, m_itemEntryInter->GetAllowedCloseWindows().value());
|
||||
m_appPreviewTips->updateSnapshots();
|
||||
m_appPreviewTips->updateLayoutDirection(DockPosition);
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos, m_itemEntryInter->GetAllowedCloseWindows().value());
|
||||
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestActivateWindow, this, &AppItem::requestActivateWindow, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestPreviewWindow, this, &AppItem::requestPreviewWindow, Qt::QueuedConnection);
|
||||
|
@ -372,6 +372,12 @@ bool AppSnapshot::eventFilter(QObject *watched, QEvent *e)
|
||||
return false;
|
||||
}
|
||||
|
||||
void AppSnapshot::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
fetchSnapshot();
|
||||
}
|
||||
|
||||
SHMInfo *AppSnapshot::getImageDSHM()
|
||||
{
|
||||
const auto display = Utils::IS_WAYLAND_DISPLAY ? XOpenDisplay(nullptr) : QX11Info::display();
|
||||
|
@ -98,6 +98,7 @@ private:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
bool eventFilter(QObject *watched, QEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
SHMInfo *getImageDSHM();
|
||||
XImage *getImageXlib();
|
||||
QRect rectRemovedShadow(const QImage &qimage, unsigned char *prop_to_return_gtk);
|
||||
|
@ -95,12 +95,6 @@ void PreviewContainer::setWindowInfos(const WindowInfoMap &infos, const WindowLi
|
||||
adjustSize(m_wmHelper->hasComposite());
|
||||
}
|
||||
|
||||
void PreviewContainer::updateSnapshots()
|
||||
{
|
||||
for (AppSnapshot *snap : m_snapshots)
|
||||
snap->fetchSnapshot();
|
||||
}
|
||||
|
||||
void PreviewContainer::setTitleDisplayMode(int mode)
|
||||
{
|
||||
m_titleMode = static_cast<TitleDisplayMode>(mode);
|
||||
@ -164,7 +158,7 @@ void PreviewContainer::adjustSize(bool composite)
|
||||
const int padding = 20;
|
||||
const bool horizontal = m_windowListLayout->direction() == QBoxLayout::LeftToRight;
|
||||
if (horizontal) {
|
||||
count = qMin(count, screenWidth *2 / SNAP_WIDTH);
|
||||
count = qMin(count, screenWidth * 2 / SNAP_WIDTH);
|
||||
|
||||
const int h = SNAP_HEIGHT + MARGIN * 2;
|
||||
const int w = SNAP_WIDTH * count + MARGIN * 2 + SPACING * (count - 1);
|
||||
@ -172,7 +166,7 @@ void PreviewContainer::adjustSize(bool composite)
|
||||
setFixedHeight(h);
|
||||
setFixedWidth(qMin(w, screenWidth - padding));
|
||||
} else {
|
||||
count = qMin(count, screenWidth *2 / SNAP_HEIGHT);
|
||||
count = qMin(count, screenWidth * 2 / SNAP_HEIGHT);
|
||||
|
||||
const int w = SNAP_WIDTH + MARGIN * 2;
|
||||
const int h = SNAP_HEIGHT * count + MARGIN * 2 + SPACING * (count - 1);
|
||||
|
@ -58,7 +58,6 @@ signals:
|
||||
|
||||
public:
|
||||
void setWindowInfos(const WindowInfoMap &infos, const WindowList &allowClose);
|
||||
void updateSnapshots();
|
||||
void setTitleDisplayMode(int mode);
|
||||
|
||||
public slots:
|
||||
|
@ -57,7 +57,6 @@ TEST_F(Test_PreviewContainer, coverage_test)
|
||||
container->previewEntered(id);
|
||||
container->m_waitForShowPreviewTimer->start();
|
||||
|
||||
container->updateSnapshots();
|
||||
container->updateLayoutDirection(Dock::Position::Bottom);
|
||||
ASSERT_EQ(container->m_windowListLayout->direction(), container->m_wmHelper->hasComposite() ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom);
|
||||
container->updateLayoutDirection(Dock::Position::Top);
|
||||
|
Loading…
x
Reference in New Issue
Block a user