Skip to content

Commit

Permalink
Fixed a rare issue in warning bar geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Aug 29, 2023
1 parent bacdc96 commit 38ac201
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ V1.1.1
* Protect the file type filters of file dialogs from bad translations.
* Don't insert garbage when an image can't be loaded.
* Start searching in node names when Slash is pressed inside the side-pane.
* Fixed a rare issue in the geometry of a warning bar animated during window resizing.
* Changed "Qt5" to "Qt" in the meta-info file (the Qt5 support cannot last indefinitely).

V1.1.0
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Latest version:

15 Aug 2023, V1.1.1
29 Aug 2023, V1.1.1

See "ChangeLog" for changes.
17 changes: 13 additions & 4 deletions feathernotes/warningbar.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) Pedram Pourang (aka Tsu Jan) 2022 <[email protected]>
* Copyright (C) Pedram Pourang (aka Tsu Jan) 2022-2023 <[email protected]>
*
* FeatherNotes is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -78,7 +78,7 @@ class WarningBar : public QWidget

if (parent)
{ // compress the bar vertically and show it with animation
QTimer::singleShot (anotherBar ? DURATION + 10 : 0, this, [=]() {
QTimer::singleShot (anotherBar ? DURATION + 10 : 0, this, [this, parent]() {
parent->installEventFilter (this);
int h = grid_->minimumHeightForWidth (parent->width()) + grid_->contentsMargins().bottom();
QRect g (0, parent->height() - h, parent->width(), h);
Expand Down Expand Up @@ -133,7 +133,17 @@ class WarningBar : public QWidget
if (QWidget *w = qobject_cast<QWidget*>(o))
{
if (w == parentWidget())
{ // compress the bar as far as its text is shown completely
{
if (animation_)
{
animation_->stop();
if (isClosing_)
{
this->deleteLater();
return false;
}
}
/* compress the bar as far as its text is shown completely */
int h = grid_->minimumHeightForWidth (w->width()) + grid_->contentsMargins().bottom();
setGeometry (QRect (0, w->height() - h, w->width(), h));
}
Expand All @@ -157,7 +167,6 @@ public slots:
if (!isClosing_)
{
isClosing_ = true;
parentWidget()->removeEventFilter (this); // no movement on closing
animation_->stop();
animation_->setStartValue (geometry());
animation_->setEndValue (QRect (0, parentWidget()->height(), parentWidget()->width(), 0));
Expand Down

0 comments on commit 38ac201

Please sign in to comment.