From: Soeren Apel Date: Sun, 21 Oct 2018 19:47:42 +0000 (+0200) Subject: Fix random clazy warnings X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=b571a8e7e0dc3e3b6daa58f27050e76466f006dd;ds=inline Fix random clazy warnings Some of them are invalid, though, so we suppress them for future clazy runs. --- diff --git a/pv/dialogs/connect.cpp b/pv/dialogs/connect.cpp index ee05a0e1..084b1142 100644 --- a/pv/dialogs/connect.cpp +++ b/pv/dialogs/connect.cpp @@ -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(); + serial = serial_devices_.itemData(index).toString(); else serial = serial_devices_.currentText(); drvopts[ConfigKey::CONN] = Variant::create( diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 6b3319be..dfabc9a0 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -172,8 +172,8 @@ shared_ptr MainWindow::add_view(const QString &title, QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable); QAbstractButton *close_btn = - dock->findChildren - ("qt_dockwidget_closebutton").front(); + dock->findChildren("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) // drops to zero. We must prevent this to keep the static // widgets visible for (QWidget *w : static_tab_widget_->findChildren()) - 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); diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 3fda4cb6..ae3fe8d2 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -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()); } } diff --git a/pv/views/trace/logicsignal.cpp b/pv/views/trace/logicsignal.cpp index a5d0a598..5c6aa54b 100644 --- a/pv/views/trace/logicsignal.cpp +++ b/pv/views/trace/logicsignal.cpp @@ -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()) - action->setEnabled(false); + action->setEnabled(false); // clazy:exclude=range-loop form->addRow(tr("Trigger"), trigger_bar_); } diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index f1d7aa3d..fa911f0b 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -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 diff --git a/pv/widgets/wellarray.hpp b/pv/widgets/wellarray.hpp index f1c25dc0..194fe675 100644 --- a/pv/widgets/wellarray.hpp +++ b/pv/widgets/wellarray.hpp @@ -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);