]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiView.cpp
Initialize class members to please coverity
[lyx.git] / src / frontends / qt4 / GuiView.cpp
index a6a96e269c2ffc0ef146f0d161cbdbea1b303899..c4f6b5724ddc92ea84d314285eaf2fe44e4d2547 100644 (file)
@@ -227,7 +227,7 @@ private:
        /// Current ratio between physical pixels and device-independent pixels
        double pixelRatio() const {
 #if QT_VERSION >= 0x050000
-               return devicePixelRatio();
+               return qt_scale_factor * devicePixelRatio();
 #else
                return 1.0;
 #endif
@@ -385,7 +385,7 @@ public:
 
        QSize iconSize(docstring const & icon_size)
        {
-               int size;
+               unsigned int size;
                if (icon_size == "small")
                        size = smallIconSize;
                else if (icon_size == "normal")
@@ -416,7 +416,7 @@ public:
 
                static string icon_size;
 
-               int size = qsize.width();
+               unsigned int size = qsize.width();
 
                if (size < smallIconSize)
                        size = smallIconSize;
@@ -1341,7 +1341,7 @@ void GuiView::resetCommandExecute()
 double GuiView::pixelRatio() const
 {
 #if QT_VERSION >= 0x050000
-       return devicePixelRatio();
+       return qt_scale_factor * devicePixelRatio();
 #else
        return 1.0;
 #endif
@@ -1652,6 +1652,10 @@ void GuiView::updateTocItem(string const & type, DocIterator const & dit)
 
 void GuiView::structureChanged()
 {
+       // This is called from the Buffer, which has no way to ensure that cursors
+       // in BufferView remain valid.
+       if (documentBufferView())
+               documentBufferView()->cursor().sanitize();
        // FIXME: This is slightly expensive, though less than the tocBackend update
        // (#9880). This also resets the view in the Toc Widget (#6675).
        d.toc_models_.reset(documentBufferView());
@@ -3365,7 +3369,7 @@ bool GuiView::goToFileRow(string const & argument)
 }
 
 
-void GuiView::toolBarPopup(const QPoint & pos)
+void GuiView::toolBarPopup(const QPoint & /*pos*/)
 {
        QMenu * menu = new QMenu;
        menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
@@ -3544,14 +3548,17 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        else
                                target_dir = doc_buffer->fileName().onlyPath();
 
+                       string const format = argument.empty() ?
+                               doc_buffer->params().getDefaultOutputFormat() : argument;
+
                        if ((dest.empty() && doc_buffer->isUnnamed())
                            || !target_dir.isDirWritable()) {
-                               exportBufferAs(*doc_buffer, cmd.argument());
+                               exportBufferAs(*doc_buffer, from_utf8(format));
                                break;
                        }
                        /* TODO/Review: Is it a problem to also export the children?
                                        See the update_unincluded flag */
-                       d.asyncBufferProcessing(argument,
+                       d.asyncBufferProcessing(format,
                                                doc_buffer,
                                                _("Exporting ..."),
                                                &GuiViewPrivate::exportAndDestroy,