99 lines
3.6 KiB
Diff
99 lines
3.6 KiB
Diff
Index: src/frontends/qt4/GuiApplication.cpp
|
|
===================================================================
|
|
--- src/frontends/qt4/GuiApplication.cpp (revision dc5eda84b8bb4d4eed09047d1c55a33a8173e746)
|
|
+++ src/frontends/qt4/GuiApplication.cpp (revision d418b6f4c8207cc84c7a3b890de5aec2c837a672)
|
|
@@ -1112,4 +1112,27 @@
|
|
|
|
|
|
+#if QT_VERSION < 0x050000
|
|
+// Emulate platformName() for Qt4
|
|
+
|
|
+// FIXME: when ditching this method, remove all tests
|
|
+// platformName() == "qt4x11"
|
|
+// in the code
|
|
+QString GuiApplication::platformName() const
|
|
+{
|
|
+# if defined(Q_WS_X11)
|
|
+ // Note that this one does not really exist
|
|
+ return "qt4x11";
|
|
+# elif defined(Q_OS_MAC)
|
|
+ return "cocoa";
|
|
+# elif defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
|
+ return "windows";
|
|
+# else
|
|
+ LYXERR0("Unknown platform!");
|
|
+ return "unknown";
|
|
+# endif
|
|
+}
|
|
+#endif
|
|
+
|
|
+
|
|
double GuiApplication::pixelRatio() const
|
|
{
|
|
Index: src/frontends/qt4/GuiApplication.h
|
|
===================================================================
|
|
--- src/frontends/qt4/GuiApplication.h (revision b9116e8b81f55ee795ea444ee02ff921bf82606a)
|
|
+++ src/frontends/qt4/GuiApplication.h (revision d418b6f4c8207cc84c7a3b890de5aec2c837a672)
|
|
@@ -155,4 +155,9 @@
|
|
GuiView & view(int id) const;
|
|
|
|
+#if (QT_VERSION < 0x050000)
|
|
+ /// Emulate platformName() for Qt4
|
|
+ QString platformName() const;
|
|
+#endif
|
|
+
|
|
/// Current ratio between physical pixels and device-independent pixels
|
|
double pixelRatio() const;
|
|
Index: src/frontends/qt4/GuiView.cpp
|
|
===================================================================
|
|
--- src/frontends/qt4/GuiView.cpp (revision 1ae510b6287d5c96c3f106909c1cc8b0711b6d57)
|
|
+++ src/frontends/qt4/GuiView.cpp (revision d418b6f4c8207cc84c7a3b890de5aec2c837a672)
|
|
@@ -751,10 +751,9 @@
|
|
settings.beginGroup("views");
|
|
settings.beginGroup(QString::number(id_));
|
|
-#if defined(Q_WS_X11) || defined(QPA_XCB)
|
|
- settings.setValue("pos", pos());
|
|
- settings.setValue("size", size());
|
|
-#else
|
|
- settings.setValue("geometry", saveGeometry());
|
|
-#endif
|
|
+ if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
|
|
+ settings.setValue("pos", pos());
|
|
+ settings.setValue("size", size());
|
|
+ } else
|
|
+ settings.setValue("geometry", saveGeometry());
|
|
settings.setValue("layout", saveState(0));
|
|
settings.setValue("icon_size", toqstr(d.iconSize(iconSize())));
|
|
@@ -796,17 +795,18 @@
|
|
setIconSize(d.iconSize(settings.value(icon_key).toString()));
|
|
|
|
-#if defined(Q_WS_X11) || defined(QPA_XCB)
|
|
- QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
|
- QSize size = settings.value("size", QSize(690, 510)).toSize();
|
|
- resize(size);
|
|
- move(pos);
|
|
-#else
|
|
- // Work-around for bug #6034: the window ends up in an undetermined
|
|
- // state when trying to restore a maximized window when it is
|
|
- // already maximized.
|
|
- if (!(windowState() & Qt::WindowMaximized))
|
|
- if (!restoreGeometry(settings.value("geometry").toByteArray()))
|
|
- setGeometry(50, 50, 690, 510);
|
|
-#endif
|
|
+ if (guiApp->platformName() == "qt4x11" || guiApp->platformName() == "xcb") {
|
|
+ QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
|
|
+ QSize size = settings.value("size", QSize(690, 510)).toSize();
|
|
+ resize(size);
|
|
+ move(pos);
|
|
+ } else {
|
|
+ // Work-around for bug #6034: the window ends up in an undetermined
|
|
+ // state when trying to restore a maximized window when it is
|
|
+ // already maximized.
|
|
+ if (!(windowState() & Qt::WindowMaximized))
|
|
+ if (!restoreGeometry(settings.value("geometry").toByteArray()))
|
|
+ setGeometry(50, 50, 690, 510);
|
|
+ }
|
|
+
|
|
// Make sure layout is correctly oriented.
|
|
setLayoutDirection(qApp->layoutDirection());
|