Skip to content

Commit aafe7c1

Browse files
committed
fix: Pop-up window position was obscured
log: In TimeAndDate.qml, instead of using the built-in showAlert method of D.LineEdit (whose AlertToolTip pops up from the bottom and gets obscured), a separate D.AlertToolTip is placed inside the addr element, with the y value set to a negative value so that it pops up from the top; this prevents it from being obscured by the system time zone displayed below. pms: bug-352961
1 parent 7b89523 commit aafe7c1

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

src/plugin-datetime/qml/TimeAndDate.qml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,21 @@ DccObject {
225225
pageType: DccObject.Editor
226226
page: Item {
227227
id: item
228-
implicitHeight: addrErrorTip.visible ? 40 + addrErrorTip.height + 4 : 40
228+
implicitHeight: 40
229229
implicitWidth: 300
230230

231231
D.LineEdit {
232232
id: addr
233233
implicitWidth: 200
234234
text: dateAndTimeSettings.customAddr
235235
placeholderText: qsTr("Required")
236-
showAlert: false
236+
alertText: qsTr("The ntp server address cannot be empty")
237+
alertDuration: 3000
237238
horizontalAlignment: background.visible ? TextInput.AlignLeft : TextInput.AlignRight
238239
anchors{
239240
rightMargin: 5
240241
right: editBtn.left
241-
top: parent.top
242-
topMargin: (40 - addr.height) / 2
242+
verticalCenter: parent.verticalCenter
243243
}
244244
rightPadding: (!addr.readOnly && addr.text.length > 0 ? addr.clearButton.width : 5)
245245
onReadOnlyChanged: {
@@ -248,28 +248,19 @@ DccObject {
248248
addr.focus = !addr.readOnly
249249
}
250250
onTextChanged: {
251-
if (addr.text.length > 0) {
251+
if (addr.showAlert && addr.text.length > 0) {
252252
addr.showAlert = false
253-
addrErrorTip.visible = false
254253
}
255254
}
256255
Component.onCompleted: {
257256
Qt.callLater( function(){ addr.forceActiveFocus() } )
258257
addr.readOnly = text.length > 0
259258
}
260-
261-
D.AlertToolTip {
262-
id: addrErrorTip
263-
target: addr
264-
text: qsTr("The ntp server address cannot be empty")
265-
visible: false
266-
timeout: 3000
267-
}
268259
}
269260
D.IconButton {
270261
id: editBtn
271262
anchors.right: parent.right
272-
anchors.verticalCenter: addr.verticalCenter
263+
anchors.verticalCenter: parent.verticalCenter
273264
hoverEnabled: true
274265
background: Rectangle {
275266
anchors.fill: parent
@@ -295,13 +286,12 @@ DccObject {
295286
}
296287
onClicked: {
297288
if (addr.text.length === 0) {
289+
addr.showAlert = false
298290
addr.showAlert = true
299-
addrErrorTip.visible = true
300291
return
301292
}
302293

303294
addr.showAlert = false
304-
addrErrorTip.visible = false
305295

306296
if (!addr.readOnly) {
307297
dccData.ntpServerAddress = addr.text

0 commit comments

Comments
 (0)