Mercurial > octave
comparison libgui/src/release-notes.cc @ 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 | 04601f6c47f4 |
comparison
equal
deleted
inserted
replaced
31004:2b4f7287aa3a | 31006:35d37e433532 |
---|---|
25 | 25 |
26 #if defined (HAVE_CONFIG_H) | 26 #if defined (HAVE_CONFIG_H) |
27 # include "config.h" | 27 # include "config.h" |
28 #endif | 28 #endif |
29 | 29 |
30 #include <QDesktopWidget> | 30 #include <QApplication> |
31 #include <QFile> | 31 #include <QFile> |
32 #include <QIcon> | 32 #include <QIcon> |
33 #include <QLayout> | 33 #include <QLayout> |
34 #include <QScreen> | |
34 #include <QTextBrowser> | 35 #include <QTextBrowser> |
35 #include <QTextStream> | 36 #include <QTextStream> |
36 #include <QThread> | 37 #include <QThread> |
37 | 38 |
38 #include "release-notes.h" | 39 #include "release-notes.h" |
40 #include "gui-utils.h" | |
39 #include "gui-preferences-nr.h" | 41 #include "gui-preferences-nr.h" |
40 #include "news-reader.h" | 42 #include "news-reader.h" |
41 #include "octave-qobject.h" | 43 #include "octave-qobject.h" |
42 | 44 |
43 #include "defaults.h" | 45 #include "defaults.h" |
114 | 116 |
115 raise (); | 117 raise (); |
116 activateWindow (); | 118 activateWindow (); |
117 } | 119 } |
118 | 120 |
119 // FIXME: This function is duplicated in main_window.cc. Maybe it | |
120 // should be a utility function? | |
121 | |
122 void release_notes::get_screen_geometry (int& width, int& height) | |
123 { | |
124 QRect screen_geometry = QApplication::desktop ()->availableGeometry (this); | |
125 | |
126 width = screen_geometry.width (); | |
127 height = screen_geometry.height (); | |
128 } | |
129 } | 121 } |