Solve cppcheck warnings

This commit is contained in:
lupoDharkael
2018-05-26 18:38:06 +02:00
parent dcaa2e321f
commit 49227fac43
15 changed files with 13 additions and 28 deletions

View File

@@ -55,7 +55,7 @@ private:
QString m_generalErrorMessage;
struct Node {
Node(const CommandArgument &arg) : argument(arg) {}
explicit Node(const CommandArgument &arg) : argument(arg) {}
Node() {}
bool operator==(const Node &n) const {
return argument == n.argument &&

View File

@@ -22,7 +22,7 @@
class ButtonListView : public QListWidget {
public:
ButtonListView(QWidget *parent= nullptr);
explicit ButtonListView(QWidget *parent= nullptr);
public slots:
void selectAll();

View File

@@ -26,7 +26,7 @@ class QPushButton;
class GeneneralConf : public QWidget {
Q_OBJECT
public:
GeneneralConf(QWidget *parent = nullptr);
explicit GeneneralConf(QWidget *parent = nullptr);
public slots:
void updateComponents();

View File

@@ -25,7 +25,7 @@ class FlameshotDBusAdapter : public QDBusAbstractAdaptor {
Q_CLASSINFO("D-Bus Interface", "org.dharkael.Flameshot")
public:
FlameshotDBusAdapter(QObject *parent = nullptr);
explicit FlameshotDBusAdapter(QObject *parent = nullptr);
virtual ~FlameshotDBusAdapter();
signals:

View File

@@ -48,9 +48,9 @@ int main(int argc, char *argv[]) {
QTranslator translator;
QStringList trPaths = PathInfo::translationsPaths();
bool match = false;
for (const QString &path: trPaths) {
match = translator.load(QLocale::system().language(),
bool match = translator.load(QLocale::system().language(),
"Internationalization", "_",
path);
if (match) {

View File

@@ -59,7 +59,7 @@ public:
QColor (*rainbow_from_hue)(qreal);
int max_size = 128;
Private(ColorWheel *widget)
explicit Private(ColorWheel *widget)
: w(widget), hue(0), sat(0), val(0),
wheel_width(20), mouse_status(Nothing),
display_flags(FLAGS_DEFAULT),

View File

@@ -36,6 +36,8 @@ TextConfig::TextConfig(QWidget *parent) : QWidget(parent) {
int index = fontsCB->findData(QFont().family());
if ( index != -1 ) {
fontsCB->setCurrentIndex(index);
} else {
}
QColor bgColor(palette().background().color());

View File

@@ -22,7 +22,7 @@
#define BASE_POINT_SIZE 8
TextTool::TextTool(QObject *parent) : CaptureTool(parent) {
TextTool::TextTool(QObject *parent) : CaptureTool(parent), m_size(1) {
}
bool TextTool::isValid() const {

View File

@@ -289,9 +289,8 @@ void ButtonHandler::positionButtonsInside(int index) {
QPoint center = QPoint(mainArea.center().x(),
mainArea.bottom() - m_buttonExtendedSize);
int addCounter;
while (m_vectorButtons.size() > index) {
addCounter = buttonsPerRow;
int addCounter = buttonsPerRow;
addCounter = qBound(0, addCounter, m_vectorButtons.size() - index);
QVector<QPoint> positions = horizontalPoints(center, addCounter, true);
moveButtonsToPoints(positions, index);

View File

@@ -30,7 +30,7 @@ class ButtonHandler : public QObject {
Q_OBJECT
public:
ButtonHandler(const QVector<CaptureButton*>&, QObject *parent = nullptr);
ButtonHandler(QObject *parent = nullptr);
explicit ButtonHandler(QObject *parent = nullptr);
void hideSectionUnderMouse(const QPoint &p);

View File

@@ -134,10 +134,6 @@ void CaptureButton::animatedShow() {
}
}
CaptureButton::ButtonType CaptureButton::buttonType() const {
return m_buttonType;
}
CaptureTool *CaptureButton::tool() const {
return m_tool;
}

View File

@@ -65,7 +65,6 @@ public:
QString description() const;
QIcon icon() const;
QString styleSheet() const;
ButtonType buttonType() const;
CaptureTool* tool() const;
void setColor(const QColor &c);

View File

@@ -563,10 +563,6 @@ void CaptureWidget::initSelection() {
m_selection->setGeometry(QRect());
}
void CaptureWidget::initWidget() {
}
void CaptureWidget::setState(CaptureButton *b) {
if (!b) {
return;
@@ -826,10 +822,6 @@ void CaptureWidget::childLeave() {
update();
}
int CaptureWidget::handleSize() {
return (QApplication::fontMetrics().height() * 0.7);
}
void CaptureWidget::copyScreenshot() {
m_captureDone = true;
ScreenshotSaver().saveToClipboard(pixmap());

View File

@@ -123,16 +123,12 @@ private:
void initContext(const QString &savePath, bool fullscreen);
void initPanel();
void initSelection();
void initWidget();
void initShortcuts();
void updateSizeIndicator();
void updateCursor();
void pushToolToStack();
void makeChild(QWidget *w);
// size of the handlers at the corners of the selection
int handleSize();
QRect extendedSelection() const;
QUndoStack m_undoStack;

View File

@@ -62,5 +62,6 @@ void NotifierBox::showMessage(const QString &msg) {
}
void NotifierBox::showColor(const QColor &color) {
Q_UNUSED(color);
m_message = "";
}