]> git.lyx.org Git - features.git/commitdiff
Simplify GuiWorkarea::Private constructor
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 1 Dec 2020 10:26:01 +0000 (11:26 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 1 Dec 2020 10:26:01 +0000 (11:26 +0100)
Also use the newly introduced platformName() for Qt4.

src/frontends/qt/GuiWorkArea.cpp
src/frontends/qt/GuiWorkArea_Private.h

index 8bb0bfc68267efdcbe699f4cd758f7b0cb4b03b0..3a2a362f09021584510199bf3df63b2c78f933e3 100644 (file)
@@ -130,26 +130,15 @@ SyntheticMouseEvent::SyntheticMouseEvent()
 
 
 GuiWorkArea::Private::Private(GuiWorkArea * parent)
-: p(parent), buffer_view_(nullptr), lyx_view_(nullptr),
-  caret_visible_(false), need_resize_(false), preedit_lines_(1),
-  last_pixel_ratio_(1.0), completer_(new GuiCompleter(p, p)),
-  dialog_mode_(false), shell_escape_(false), read_only_(false),
-  clean_(true), externally_modified_(false), needs_caret_geometry_update_(true)
-{
-/* Qt on macOS and Wayland does not respect the
- * Qt::WA_OpaquePaintEvent attribute and resets the widget backing
- * store at each update. Therefore, we use our own backing store in
- * these two cases. */
-#if QT_VERSION >= 0x050000
+       : p(parent), completer_(new GuiCompleter(p, p))
+{
+       /* Qt on macOS and Wayland does not respect the
+        * Qt::WA_OpaquePaintEvent attribute and resets the widget backing
+        * store at each update. Therefore, we use our own backing store
+        * in these two cases.
+        */
        use_backingstore_ = guiApp->platformName() == "cocoa"
                || guiApp->platformName().contains("wayland");
-#else
-#  ifdef Q_OS_MAC
-       use_backingstore_ = true;
-#  else
-       use_backingstore_ = false;
-#  endif
-#endif
 
        int const time = QApplication::cursorFlashTime() / 2;
        if (time > 0) {
index c97485a464319d2cb0b6fde175eea3da96ae95cd..6acd9886ddabf51f25dd1cef5420000e4db775eb 100644 (file)
@@ -110,19 +110,21 @@ struct GuiWorkArea::Private
        void updateScreen(QRectF const & rc);
 
        ///
-       GuiWorkArea * p;
+       GuiWorkArea * p = nullptr;
        ///
-       BufferView * buffer_view_;
+       BufferView * buffer_view_ = nullptr;
        ///
-       GuiView * lyx_view_;
+       GuiView * lyx_view_ = nullptr;
 
        /// Do we need an intermediate image when painting (for now macOS and Wayland)
-       bool use_backingstore_;
+       bool use_backingstore_ = false;
        ///
        QImage screen_;
 
        /// is the caret currently displayed
-       bool caret_visible_;
+       bool caret_visible_ = false;
+       ///
+       bool needs_caret_geometry_update_ = true;
        ///
        QTimer caret_timeout_;
 
@@ -132,25 +134,25 @@ struct GuiWorkArea::Private
        DoubleClick dc_event_;
 
        ///
-       bool need_resize_;
+       bool need_resize_ = false;
 
        /// the current preedit text of the input method
        docstring preedit_string_;
        /// Number of lines used by preedit text
-       int preedit_lines_;
+       int preedit_lines_ = 1;
        /// the attributes of the preedit text
        QList<QInputMethodEvent::Attribute> preedit_attr_;
 
        /// Ratio between physical pixels and device-independent pixels
        /// We save the last used value to detect changes of the
        /// current pixel_ratio of the viewport.
-       double last_pixel_ratio_;
+       double last_pixel_ratio_ = 1.0;
        ///
        GuiCompleter * completer_;
 
        /// Special mode in which Esc and Enter (with or without Shift)
        /// are ignored
-       bool dialog_mode_;
+       bool dialog_mode_ = false;
        /// store the name of the context menu when the mouse is
        /// pressed. This is used to get the correct context menu
        /// when the menu is actually shown (after releasing on Windows)
@@ -161,17 +163,15 @@ struct GuiWorkArea::Private
        ///
        support::FileName file_name_;
        ///
-       bool shell_escape_;
+       bool shell_escape_ = false;
        ///
-       bool read_only_;
+       bool read_only_ = false;
        ///
        docstring vc_status_;
        ///
-       bool clean_;
-       ///
-       bool externally_modified_;
+       bool clean_ = true;
        ///
-       bool needs_caret_geometry_update_;
+       bool externally_modified_ = false;
 
 }; // GuiWorkArea