@@ -48,6 +48,7 @@ func notifyOptionArg(b []*NotifyButton) NotifyOptionArg {
48
48
49
49
func newNotification (l NotifyLevel , p int , message string , options ... NotifyOptionArg ) * Notification {
50
50
e := editor
51
+ e .isDisplayNotifications = true
51
52
52
53
widget := widgets .NewQWidget (nil , 0 )
53
54
layout := widgets .NewQVBoxLayout ()
@@ -307,22 +308,6 @@ func (n *Notification) hideNotification() {
307
308
}
308
309
}
309
310
310
- func (e * Editor ) showNotifications () {
311
- e .notifyStartPos = core .NewQPoint2 (e .width - e .notificationWidth - 10 , e .height - 30 )
312
- var x , y int
313
- var newNotifications []* Notification
314
- for _ , item := range e .notifications {
315
- x = e .notifyStartPos .X ()
316
- y = e .notifyStartPos .Y () - item .widget .Height () - 4
317
- item .widget .Move2 (x , y )
318
- item .statusReset ()
319
- e .notifyStartPos = core .NewQPoint2 (x , y )
320
- newNotifications = append (newNotifications , item )
321
- }
322
- e .notifications = newNotifications
323
- e .isDisplayNotifications = true
324
- }
325
-
326
311
func (e * Editor ) hideNotifications () {
327
312
var newNotifications []* Notification
328
313
for _ , item := range e .notifications {
@@ -335,6 +320,24 @@ func (e *Editor) hideNotifications() {
335
320
e .isDisplayNotifications = false
336
321
}
337
322
323
+ func (e * Editor ) relocateNotifications () {
324
+ if ! e .isDisplayNotifications {
325
+ return
326
+ }
327
+
328
+ geometry := e .window .Geometry ()
329
+ width := geometry .Width ()
330
+ height := geometry .Height ()
331
+ e .notifyStartPos = core .NewQPoint2 (width - e .notificationWidth - 10 , height - 30 )
332
+ var x , y int
333
+ for _ , item := range e .notifications {
334
+ x = e .notifyStartPos .X ()
335
+ y = e .notifyStartPos .Y () - item .widget .Height () - 5
336
+ item .widget .Move2 (x , y )
337
+ e .notifyStartPos = core .NewQPoint2 (x , y )
338
+ }
339
+ }
340
+
338
341
func (n * Notification ) statusReset () {
339
342
n .isHide = false
340
343
n .isMoved = false
0 commit comments