Showing the changes to interface/src/ui/HMDToolsDialog.cpp (1 of 2 files). Show all
Unified · Split
| @@ -108,9 +108,11 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : · 107 unmodified lines | ||
| 108 | 108 | updateUi(); |
| 109 | 109 | }); |
| 110 | 110 | |
| 111 | + | |
| 111 | 112 | // keep track of changes to the number of screens |
| 112 | − connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged, this, &HMDToolsDialog::screenCountChanged); | |
| 113 | − | |
| 113 | + connect(qApp, &QGuiApplication::screenAdded, this, &HMDToolsDialog::screenCountChanged); | |
| 114 | + connect(qApp, &QGuiApplication::screenRemoved, this, &HMDToolsDialog::screenCountChanged); | |
| 115 | + | |
| 114 | 116 | updateUi(); |
| 115 | 117 | } |
| 116 | 118 | |
| @@ -130,14 +132,13 @@ QString HMDToolsDialog::getDebugDetails() const { · 13 unmodified lines | ||
| 130 | 132 | results += "HMD Screen Name: N/A\n"; |
| 131 | 133 | } |
| 132 | 134 | |
| 133 | − int desktopPrimaryScreenNumber = QApplication::desktop()->primaryScreen(); | |
| 134 | − QScreen* desktopPrimaryScreen = QGuiApplication::screens()[desktopPrimaryScreenNumber]; | |
| 135 | + QScreen* desktopPrimaryScreen = QGuiApplication::primaryScreen(); | |
| 135 | 136 | results += "Desktop's Primary Screen: " + desktopPrimaryScreen->name() + "\n"; |
| 136 | 137 | |
| 137 | 138 | results += "Application Primary Screen: " + QGuiApplication::primaryScreen()->name() + "\n"; |
| 138 | 139 | QScreen* mainWindowScreen = qApp->getWindow()->windowHandle()->screen(); |
| 139 | 140 | results += "Application Main Window Screen: " + mainWindowScreen->name() + "\n"; |
| 140 | − results += "Total Screens: " + QString::number(QApplication::desktop()->screenCount()) + "\n"; | |
| 141 | + results += "Total Screens: " + QString::number(QGuiApplication::screens().count()) + "\n"; | |
| 141 | 142 | |
| 142 | 143 | return results; |
| 143 | 144 | } |
| @@ -196,7 +197,7 @@ void HMDToolsDialog::hideEvent(QHideEvent* event) { · 52 unmodified lines | ||
| 196 | 197 | centerCursorOnWidget(qApp->getWindow()); |
| 197 | 198 | } |
| 198 | 199 | |
| 199 | −void HMDToolsDialog::screenCountChanged(int newCount) { | |
| 200 | +void HMDToolsDialog::screenCountChanged() { | |
| 200 | 201 | int hmdScreenNumber = -1; |
| 201 | 202 | const auto& displayPlugins = PluginManager::getInstance()->getDisplayPlugins(); |
| 202 | 203 | for(const auto& dp : displayPlugins) { |
| @@ -256,7 +257,7 @@ void HMDWindowWatcher::windowGeometryChanged(int arg) { · 53 unmodified lines | ||
| 256 | 257 | void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { |
| 257 | 258 | // if we have more than one screen, and a known hmdScreen then try to |
| 258 | 259 | // keep our dialog off of the hmdScreen |
| 259 | − if (QApplication::desktop()->screenCount() > 1) { | |
| 260 | + if (QGuiApplication::screens().count() > 1) { | |
| 260 | 261 | int hmdScreenNumber = _hmdTools->_hmdScreenNumber; |
| 261 | 262 | // we want to use a local variable here because we are not necesarily in HMD mode |
| 262 | 263 | if (hmdScreenNumber >= 0) { |
| @@ -283,8 +284,7 @@ void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { · 20 unmodified lines | ||
| 283 | 284 | betterScreen = lastApplicationScreen; |
| 284 | 285 | } else { |
| 285 | 286 | // last, if we can't use the previous screen the use the primary desktop screen |
| 286 | − int desktopPrimaryScreenNumber = QApplication::desktop()->primaryScreen(); | |
| 287 | − QScreen* desktopPrimaryScreen = QGuiApplication::screens()[desktopPrimaryScreenNumber]; | |
| 287 | + QScreen* desktopPrimaryScreen = QGuiApplication::primaryScreen(); | |
| 288 | 288 | betterScreen = desktopPrimaryScreen; |
| 289 | 289 | } |
| 290 | 290 | |