]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
A first batch of potential bugs spotted by llvm/clang
[features.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 5a91a6cca4a7a3c42187f1b26d5e91e9d91fdf11..adfaf4a1cc0fcea82320a5599eb0831670baf51a 100644 (file)
@@ -55,7 +55,9 @@
 #include "frontends/WorkAreaManager.h"
 
 #include <QContextMenuEvent>
+#if (QT_VERSION < 0x050000)
 #include <QInputContext>
+#endif
 #include <QDrag>
 #include <QHelpEvent>
 #ifdef Q_WS_MACX
@@ -674,7 +676,9 @@ void GuiWorkArea::scrollTo(int value)
        }
        // Show the cursor immediately after any operation.
        startBlinkingCursor();
+#ifdef Q_WS_X11
        QApplication::syncX();
+#endif
 }
 
 
@@ -794,7 +798,9 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e)
                return;
        }
 
+#if (QT_VERSION < 0x050000)
        inputContext()->reset();
+#endif
 
        FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
                q_button_state(e->button()));
@@ -962,7 +968,7 @@ void GuiWorkArea::generateSyntheticMouseEvent()
                d->buffer_view_->scroll(up ? -step : step);
                d->buffer_view_->updateMetrics();
        } else {
-               d->buffer_view_->scrollDocView(value + up ? -step : step, false);
+               d->buffer_view_->scrollDocView(value + (up ? -step : step), false);
        }
 
        // In which paragraph do we have to set the cursor ?
@@ -1563,7 +1569,11 @@ void TabWorkArea::paintEvent(QPaintEvent * event)
                // painting of the frame of the tab widget.
                // This is needed for gtk style in Qt.
                QStylePainter p(this);
+#if QT_VERSION < 0x050000
                QStyleOptionTabWidgetFrameV2 opt;
+#else
+               QStyleOptionTabWidgetFrame opt;
+#endif
                initStyleOption(&opt);
                opt.rect = style()->subElementRect(QStyle::SE_TabWidgetTabPane,
                        &opt, this);
@@ -1616,7 +1626,7 @@ GuiWorkArea * TabWorkArea::currentWorkArea()
                return 0;
 
        GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(currentWidget());
-       LASSERT(wa, /**/);
+       LATTEST(wa);
        return wa;
 }
 
@@ -1645,7 +1655,7 @@ void TabWorkArea::closeAll()
 {
        while (count()) {
                GuiWorkArea * wa = workArea(0);
-               LASSERT(wa, /**/);
+               LASSERT(wa, return);
                removeTab(0);
                delete wa;
        }
@@ -1654,7 +1664,7 @@ void TabWorkArea::closeAll()
 
 bool TabWorkArea::setCurrentWorkArea(GuiWorkArea * work_area)
 {
-       LASSERT(work_area, /**/);
+       LASSERT(work_area, return false);
        int index = indexOf(work_area);
        if (index == -1)
                return false;
@@ -1747,7 +1757,7 @@ void TabWorkArea::closeCurrentBuffer()
                wa = currentWorkArea();
        else {
                wa = workArea(clicked_tab_);
-               LASSERT(wa, /**/);
+               LASSERT(wa, return);
        }
        wa->view().closeWorkArea(wa);
 }
@@ -1760,7 +1770,7 @@ void TabWorkArea::hideCurrentTab()
                wa = currentWorkArea();
        else {
                wa = workArea(clicked_tab_);
-               LASSERT(wa, /**/);
+               LASSERT(wa, return);
        }
        wa->view().hideWorkArea(wa);
 }
@@ -1774,7 +1784,7 @@ void TabWorkArea::closeTab(int index)
                wa = currentWorkArea();
        else {
                wa = workArea(index);
-               LASSERT(wa, /**/);
+               LASSERT(wa, return);
        }
        wa->view().closeWorkArea(wa);
 }