comparison libgui/src/gui-utils.h @ 31006:35d37e433532 stable

replace use of depreciated QDesktopWidget in GUI * gui-utils.cc: include QApplication, QRect and QScreen; (get_screen_geometry): return QRect with geometry of primary screen; (adjust_to_screen): adjust given QRect to be completely on the screen that contains the largest part of the QRect, use a default geometry if no part is on an available screen * gui-utils.h: include QRect; new function get_screen_geometry and adjust_to_screen * community-news.cc: do not include QDesktopWidget, but gui-utils.h; (get_screen_geometry); move function to gui-utils.cc; * community-news.h: move get_screen_geometry to gui-utils.h * find-dialog.cc: do not include QDesktopWidget, but gui-utils.h; (restore_settings): use new function adjust_to_screen * main-window.cc: do not include QDesktopWidget, but gui-utils.h; (get_screen_geometry: move function to gui-utils.cc * main-window.h: move function get_screen_geometry to gui.utils.h; * octave-dock-widget.cc: do not include QDesktopWidget, but gui-utils.h QScreen and QWindow; (handle_settings): use adjust_to_screen and QGuiApplication->primaryScreen * release-notes.cc: do not include QDesktopWidget, but gui-utils.h and QScreen; (get_screen_geometry): move to gui-utils.cc; * release-notes.h: move get:screen_geometry to gui-utils.h * terminal-dock-widget.cc: do not include QDesktopWidget but QScreen; (terminal_dock_widget): use QGuiApplication->primaryScreen instead of QDesktopWidget->screenGeometry * welcome-wizard.cc: remove include of QDesktopWidget
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 30 Jan 2022 16:41:44 +0100
parents 796f54d4ddbf
children c6d54dd31a7e
comparison
equal deleted inserted replaced
31004:2b4f7287aa3a 31006:35d37e433532
27 #define octave_gui_utils_h 1 27 #define octave_gui_utils_h 1
28 28
29 #include "octave-config.h" 29 #include "octave-config.h"
30 30
31 #include <QColor> 31 #include <QColor>
32 #include <QRect>
32 33
33 namespace octave 34 namespace octave
34 { 35 {
35 36
36 /*! 37 /*!
53 54
54 extern OCTGUI_API QColor 55 extern OCTGUI_API QColor
55 interpolate_color (const QColor& col1, const QColor& col2, 56 interpolate_color (const QColor& col1, const QColor& col2,
56 double fs, double fv); 57 double fs, double fv);
57 58
59
60 /*!
61 Get the screen geometry of the actual screen.
62
63 @param width integer variable for storing the screen width
64 @param height integer variable for storing the screen height
65 */
66
67 extern OCTGUI_API void
68 get_screen_geometry (int& width, int& height);
69
70
71 /*!
72 Adjust geometry to be completely on a screen
73
74 @param actual_geometry QRect with actual widget geometry; this is
75 changed to the updated geometry which is on the screen.
76 @param default_geometry the default geometry that is used in case
77 the actual geometry os on no available screen.
78 */
79 extern OCTGUI_API void
80 adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry);
58 } 81 }
59 82
60 #endif 83 #endif