Commit Graph

15 Commits

Author SHA1 Message Date
wmayer
54bb9c9c62 Gui: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
Abdullah Tahiri
48a921d2b7 NotificationBox: Clang format 2023-03-22 19:13:32 +01:00
Abdullah Tahiri
23739bc2d0 NotificationArea: Change Icon color to indicate missed notifications 2023-03-22 19:13:32 +01:00
Abdullah Tahiri
49966ac84d NotificationBox: Add option to hide notification if reference widget is deactivated 2023-03-22 19:13:32 +01:00
Abdullah Tahiri
f0883512d5 NotificationBox: Enable options to not show if reference widget is not active and refactor restricttoarea 2023-03-22 19:13:32 +01:00
Abdullah Tahiri
d9de68334b NotificationBox: Hide notification if FreeCAD is deactivated 2023-03-22 19:13:32 +01:00
Abdullah Tahiri
37eeccf705 NotificationBox/NotificationArea: Restrict rendering area to main frame
========================================================================

The NotificationBox is extended to take the QRect in global coordinates. Then
it will try to dimension the label within this area. If a fixed width is provided, that
is enforced (take precedence).

The NotificationArea passes the QRect of the main window to the NotificationBox.

This is intended to fix:
https://github.com/FreeCAD/FreeCAD/issues/8940
2023-03-20 15:43:42 +01:00
Abdullah Tahiri
9920dff37a NotificationBox: Allow to set a fixed notification width 2023-03-17 11:29:30 +01:00
Abdullah Tahiri
77dc9bba1b NotificationBox: clang-format formatting 2023-03-12 06:06:29 +01:00
Abdullah Tahiri
cd79ea5994 NotificationBox: Fixes
======================

QToolTip removed the Windows specific behaviour of passing a screen widget as parent for QLabel
in 44fb925f50471ebc23dcccfaa4e9d9873b05d205. NotificationBox code is simplified not to use a
parent widget at all.

A inappropriate review fix actually causing a bug is fixed.

https://github.com/FreeCAD/FreeCAD/pull/8352#discussion_r1111342024
2023-03-12 06:06:29 +01:00
Chris Hennes
91d553139d Gui: Fix use of undocumented init() function 2023-02-23 13:26:26 +01:00
Uwe
585de7c8a0 [Gui] second hotfix for NotificationBox.cpp
- #include "PreCompiled.h" is missing, see https://github.com/FreeCAD/FreeCAD/pull/8536#issuecomment-1435782841

- also remove unused headers
2023-02-19 00:43:52 +01:00
Uwe
043b8cf2d6 [Gui] hotfix for NotificationBox.cpp
- master in uncompilable on Windows, see https://github.com/FreeCAD/FreeCAD/pull/8352#issuecomment-1435769625
 and we already got reports about this. Thus a hotfix for the meantime.

- (the formatting change was automatically done by MSVC according to our clang file)
2023-02-18 22:18:46 +01:00
Abdullah Tahiri
c98022e7fd Gui: NotificationBox - review changes
=====================================

Changes consquence of the review by OpenBrain:
- Use smart pointer for NotificationLabel (QT deleteLater compatible)
- Consistent use of measurement units in parameter naming.
- Consistent wording of code documentation.
- Improvements in branching of QTootTip based code.
- Remove redundant stop on singleshot qtimer.
- Improved filtering of click events.
2023-02-18 16:58:43 +01:00
Abdullah Tahiri
6532098308 Gui: NotificationBox - New non-intrusive auto-closing notification box
======================================================================

In short, a "tooltip" alike notification, where the user can continue working without having
to interact with the notification. If the user is interested in the notification, he or she can
stop to read it. If not interested, the user can ignore it and continue working. The notification
will automatically disappear when the timer lapses or before that time, as described below.

A new widget similar to QToolTip, to have a similar look and feel
and interface, while avoiding early closing on user action.

QToolTip is not intended for notifications, but to provide contextual help. While
QToolTip could have been used for part of the functionality (by filtering out events),
other parts required additional changes to the interface

Gui::NotificationBox is a reimplementation intended to provide user notifications. It
relies on the proven code of QToolTip for the wanted behaviour.

Additional functionality:
- A notification box has a minimum time for which it won't close, unless popped out (click inside
the notification).
- After the minimum time, if left mouse button is clicked (anywhere) it auto-closes, as it is
understood the user has continued working.
- After a maximum time, it will automatically close (even in nothing is clicked).
2023-02-18 16:58:43 +01:00