Changeset 79295 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 24, 2019 7:44:49 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r79281 r79295 38 38 39 39 /* GUI includes: */ 40 #include "UIDesktopWidgetWatchdog.h" 40 41 #include "QIDialogButtonBox.h" 41 42 #include "QIFileDialog.h" … … 48 49 #include "QIToolButton.h" 49 50 #include "VBoxGlobal.h" 51 #ifdef VBOX_WS_MAC 52 # include "VBoxUtils-darwin.h" 53 #endif 50 54 51 55 /* COM includes: */ … … 2747 2751 void UISoftKeyboard::saveSettings() 2748 2752 { 2753 /* Save window geometry to extradata: */ 2754 const QRect saveGeometry = geometry(); 2755 #ifdef VBOX_WS_MAC 2756 /* darwinIsWindowMaximized expects a non-const QWidget*. thus const_cast: */ 2757 QWidget *pw = const_cast<QWidget*>(qobject_cast<const QWidget*>(this)); 2758 gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, ::darwinIsWindowMaximized(pw)); 2759 #else /* !VBOX_WS_MAC */ 2760 gEDataManager->setSoftKeyboardDialogGeometry(saveGeometry, isMaximized()); 2761 #endif /* !VBOX_WS_MAC */ 2762 LogRel2(("GUI: Soft Keyboard: Geometry saved as: Origin=%dx%d, Size=%dx%d\n", 2763 saveGeometry.x(), saveGeometry.y(), saveGeometry.width(), saveGeometry.height())); 2749 2764 } 2750 2765 2751 2766 void UISoftKeyboard::loadSettings() 2752 2767 { 2768 const QRect desktopRect = gpDesktop->availableGeometry(this); 2769 int iDefaultWidth = desktopRect.width() / 2; 2770 int iDefaultHeight = desktopRect.height() * 3 / 4; 2771 QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight); 2772 2773 QWidget *pParentWidget = qobject_cast<QWidget*>(parent()); 2774 if (pParentWidget) 2775 defaultGeometry.moveCenter(pParentWidget->geometry().center()); 2776 2777 /* Load geometry from extradata: */ 2778 QRect geometry = gEDataManager->softKeyboardDialogGeometry(this, defaultGeometry); 2779 2780 /* Restore geometry: */ 2781 LogRel2(("GUI: Soft Keyboard: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n", 2782 geometry.x(), geometry.y(), geometry.width(), geometry.height())); 2783 setDialogGeometry(geometry); 2753 2784 } 2754 2785 … … 2780 2811 } 2781 2812 2813 void UISoftKeyboard::setDialogGeometry(const QRect &geometry) 2814 { 2815 #ifdef VBOX_WS_MAC 2816 /* Use the old approach for OSX: */ 2817 move(geometry.topLeft()); 2818 resize(geometry.size()); 2819 #else /* VBOX_WS_MAC */ 2820 /* Use the new approach for Windows/X11: */ 2821 VBoxGlobal::setTopLevelGeometry(this, geometry); 2822 #endif /* !VBOX_WS_MAC */ 2823 2824 /* Maximize (if necessary): */ 2825 if (gEDataManager->softKeyboardDialogShouldBeMaximized()) 2826 showMaximized(); 2827 } 2828 2829 2782 2830 #include "UISoftKeyboard.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
r79248 r79295 92 92 void updateStatusBarMessage(const QString &strLayoutName); 93 93 void updateLayoutSelector(); 94 void setDialogGeometry(const QRect &geometry); 94 95 CKeyboard& keyboard() const; 95 96
Note:
See TracChangeset
for help on using the changeset viewer.