Skip to content
Open
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
32 changes: 20 additions & 12 deletions src/dde-control-center/plugin/SearchBar.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Window 2.15
import org.deepin.dtk 1.0
import QtQuick.Layouts 1.15

Expand Down Expand Up @@ -101,10 +102,28 @@ Rectangle {
}
Popup {
id: popup
y: 35
popupType: Popup.Window
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent

PopupHandle.enableBlurWindow: true

width: searchEdit.width > 308 ? searchEdit.width : 308
height: (view.count > 7 ? 7 : view.count) * 32 + 15
padding: 5

function positionWindow() {
var globalPos = searchEdit.mapToGlobal(0, 0)
var w = Window.window
if (w) {
var localPos = w.mapFromGlobal(globalPos.x, globalPos.y)
x = localPos.x
y = localPos.y + searchEdit.height
}
}

onOpened: {
positionWindow()
Comment on lines +114 to +125

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (broader_impact): The independent popup window is positioned only once in onOpened; when the main control-center window moves or the SearchBar is repositioned while the results popup remains open, the popup stays at its old screen coordinates instead of following searchEdit.

Triggers: When the user moves or reflows the main window while search results are open.

Suggested fix: Reposition the popup when the parent window or SearchBar position changes, or close and reopen it when the anchor moves.

}
ListView {
id: view
clip: true
Expand Down Expand Up @@ -145,12 +164,6 @@ Rectangle {
to: 1.0
duration: 150
}
NumberAnimation {
property: "scale"
from: 0.0
to: 1.0
duration: 150
}
}

exit: Transition {
Expand All @@ -159,11 +172,6 @@ Rectangle {
to: 0.0
duration: 150
}
NumberAnimation {
property: "scale"
to: 0.0
duration: 150
}
}
}
}
Loading