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
This commit is contained in:
Abdullah Tahiri
2023-03-19 18:48:18 +01:00
committed by Uwe
parent 431fafc533
commit 37eeccf705
3 changed files with 52 additions and 20 deletions

View File

@@ -54,11 +54,16 @@ public:
* an event, see class documentation above)
* @param minShowTime Time during which the notification can only be made disappear by popping
* it out (clicking inside it).
* @param width Fixes the width of the notification. Default value makes the width to be system determined (dependent on
* the text).
* @param restrictionarea Try to keep the NotificationBox within this area. If this area is not
* provided, the whole screen is used as restriction area. This are must be provided in global
* screen coordinates.
* @param width Fixes the width of the notification. Default value makes the width to be system
* determined (dependent on the text). If a fixed width is provided it is enforced over the
* restrictionarea.
*/
static void showText(const QPoint& pos, const QString& text, int displayTime = -1,
unsigned int minShowTime = 0, int width = 0);
unsigned int minShowTime = 0, const QRect& restrictionarea = {},
int width = 0);
/// Hides a notification.
static inline void hideText()
{