Fix random clazy warnings
authorSoeren Apel <soeren@apelpie.net>
Sun, 21 Oct 2018 19:47:42 +0000 (21:47 +0200)
committerSoeren Apel <soeren@apelpie.net>
Sun, 21 Oct 2018 19:47:42 +0000 (21:47 +0200)
Some of them are invalid, though, so we suppress them for
future clazy runs.

pv/dialogs/connect.cpp
pv/mainwindow.cpp
pv/views/trace/analogsignal.cpp
pv/views/trace/logicsignal.cpp
pv/views/trace/view.cpp
pv/widgets/wellarray.hpp

index ee05a0e..084b114 100644 (file)
@@ -221,7 +221,7 @@ void Connect::scan_pressed()
                const int index = serial_devices_.currentIndex();
                if (index >= 0 && index < serial_devices_.count() &&
                    serial_devices_.currentText() == serial_devices_.itemText(index))
-                       serial = serial_devices_.itemData(index).value<QString>();
+                       serial = serial_devices_.itemData(index).toString();
                else
                        serial = serial_devices_.currentText();
                drvopts[ConfigKey::CONN] = Variant<ustring>::create(
index 6b3319b..dfabc9a 100644 (file)
@@ -172,8 +172,8 @@ shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
                QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
 
        QAbstractButton *close_btn =
-               dock->findChildren<QAbstractButton*>
-                       ("qt_dockwidget_closebutton").front();
+               dock->findChildren<QAbstractButton*>("qt_dockwidget_closebutton")
+                       .front();  // clazy:exclude=detaching-temporary
 
        connect(close_btn, SIGNAL(clicked(bool)),
                this, SLOT(on_view_close_clicked()));
@@ -314,7 +314,7 @@ void MainWindow::remove_session(shared_ptr<Session> session)
                // drops to zero. We must prevent this to keep the static
                // widgets visible
                for (QWidget *w : static_tab_widget_->findChildren<QWidget*>())
-                       w->setMinimumHeight(h);
+                       w->setMinimumHeight(h);  // clazy:exclude=range-loop
 
                int margin = static_tab_widget_->layout()->contentsMargins().bottom();
                static_tab_widget_->setMinimumHeight(h + 2 * margin);
index 3fda4cb..ae3fe8d 100644 (file)
@@ -236,7 +236,7 @@ void AnalogSignal::paint_back(QPainter &p, ViewItemPaintParams &pp)
 
                paint_axis(p, pp, get_visual_y());
        } else {
-               Trace::paint_back(p, pp);
+               Signal::paint_back(p, pp);
                paint_axis(p, pp, get_visual_y());
        }
 }
index a5d0a59..5c6aa54 100644 (file)
@@ -584,7 +584,7 @@ void LogicSignal::populate_popup_form(QWidget *parent, QFormLayout *form)
                // Only allow triggers to be changed when we're stopped
                if (session_.get_capture_state() != Session::Stopped)
                        for (QAction* action : trigger_bar_->findChildren<QAction*>())
-                               action->setEnabled(false);
+                               action->setEnabled(false);  // clazy:exclude=range-loop
 
                form->addRow(tr("Trigger"), trigger_bar_);
        }
index f1d7aa3..fa911f0 100644 (file)
@@ -1215,7 +1215,8 @@ void View::set_scroll_default()
 
 void View::determine_if_header_was_shrunk()
 {
-       const int header_pane_width = splitter_->sizes().front();
+       const int header_pane_width =
+               splitter_->sizes().front();  // clazy:exclude=detaching-temporary
 
        // Allow for a slight margin of error so that we also accept
        // slight differences when e.g. a label name change increased
@@ -1234,7 +1235,7 @@ void View::resize_header_to_fit()
        // splitter to the maximum allowed position.
 
        int splitter_area_width = 0;
-       for (int w : splitter_->sizes())
+       for (int w : splitter_->sizes())  // clazy:exclude=range-loop
                splitter_area_width += w;
 
        // Make sure the header has enough horizontal space to show all labels fully
index f1c25dc..194fe67 100644 (file)
@@ -52,8 +52,8 @@ struct WellArrayData;
 class WellArray : public QWidget
 {
     Q_OBJECT
-    Q_PROPERTY(int selectedColumn READ selectedColumn)
-    Q_PROPERTY(int selectedRow READ selectedRow)
+    Q_PROPERTY(int selectedColumn READ selectedColumn)  // clazy-exclude:property-without-notify
+    Q_PROPERTY(int selectedRow READ selectedRow)  // clazy-exclude:property-without-notify
 
 public:
     WellArray(int rows, int cols, QWidget* parent = nullptr);