CI: enable clazy incorrect-emit

This commit is contained in:
Albert Astals Cid 2020-02-19 16:54:54 +01:00
parent 96f00a4d29
commit 1a05112be1
8 changed files with 50 additions and 49 deletions

View file

@ -70,7 +70,7 @@ bool pageSize::setPageSize(const QString& name)
// Set page width/height accordingly // Set page width/height accordingly
pageWidth.setLength_in_mm(staticList[currentSize].width); pageWidth.setLength_in_mm(staticList[currentSize].width);
pageHeight.setLength_in_mm(staticList[currentSize].height); pageHeight.setLength_in_mm(staticList[currentSize].height);
emit(sizeChanged(*this)); emit sizeChanged(*this);
return true; return true;
} }
} }
@ -88,7 +88,7 @@ bool pageSize::setPageSize(const QString& name)
rectifySizes(); rectifySizes();
reconstructCurrentSize(); reconstructCurrentSize();
emit(sizeChanged(*this)); emit sizeChanged(*this);
return true; return true;
} }
} }
@ -106,7 +106,7 @@ bool pageSize::setPageSize(const QString& name)
rectifySizes(); rectifySizes();
reconstructCurrentSize(); reconstructCurrentSize();
emit(sizeChanged(*this)); emit sizeChanged(*this);
return true; return true;
} }
} }
@ -117,7 +117,7 @@ bool pageSize::setPageSize(const QString& name)
pageWidth.setLength_in_mm(staticList[currentSize].width); pageWidth.setLength_in_mm(staticList[currentSize].width);
pageHeight.setLength_in_mm(staticList[currentSize].height); pageHeight.setLength_in_mm(staticList[currentSize].height);
qCCritical(OkularDviShellDebug) << "pageSize::setPageSize: could not parse '" << name << "'. Using " << staticList[currentSize].name << " as a default." << endl; qCCritical(OkularDviShellDebug) << "pageSize::setPageSize: could not parse '" << name << "'. Using " << staticList[currentSize].name << " as a default." << endl;
emit(sizeChanged(*this)); emit sizeChanged(*this);
return false; return false;
} }
@ -132,7 +132,7 @@ void pageSize::setPageSize(double width, double height)
rectifySizes(); rectifySizes();
reconstructCurrentSize(); reconstructCurrentSize();
if ( !isNearlyEqual(oldPage)) if ( !isNearlyEqual(oldPage))
emit(sizeChanged(*this)); emit sizeChanged(*this);
} }
@ -168,7 +168,7 @@ void pageSize::setPageSize(const QString& width, const QString& _widthUnits, con
rectifySizes(); rectifySizes();
reconstructCurrentSize(); reconstructCurrentSize();
if ( !isNearlyEqual(oldPage)) if ( !isNearlyEqual(oldPage))
emit(sizeChanged(*this)); emit sizeChanged(*this);
} }
@ -181,7 +181,7 @@ pageSize &pageSize::operator= (const pageSize &src)
pageHeight = src.pageHeight; pageHeight = src.pageHeight;
if ( !isNearlyEqual(oldPage)) if ( !isNearlyEqual(oldPage))
emit(sizeChanged(*this)); emit sizeChanged(*this);
return *this; return *this;
} }
@ -293,7 +293,7 @@ void pageSize::setOrientation(int orient)
pageWidth.setLength_in_mm(staticList[currentSize].width); pageWidth.setLength_in_mm(staticList[currentSize].width);
pageHeight.setLength_in_mm(staticList[currentSize].height); pageHeight.setLength_in_mm(staticList[currentSize].height);
} }
emit(sizeChanged(*this)); emit sizeChanged(*this);
} }

View file

@ -37,11 +37,11 @@ void Converter::handleMetadata(const QMap<Mobipocket::Document::MetaKey,QString>
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
switch (it.key()) { switch (it.key()) {
case Mobipocket::Document::Title: addMetaData(Okular::DocumentInfo::Title, it.value()); break; case Mobipocket::Document::Title: emit addMetaData(Okular::DocumentInfo::Title, it.value()); break;
case Mobipocket::Document::Author: addMetaData(Okular::DocumentInfo::Author, it.value()); break; case Mobipocket::Document::Author: emit addMetaData(Okular::DocumentInfo::Author, it.value()); break;
case Mobipocket::Document::Description: addMetaData(Okular::DocumentInfo::Description, it.value()); break; case Mobipocket::Document::Description: emit addMetaData(Okular::DocumentInfo::Description, it.value()); break;
case Mobipocket::Document::Subject: addMetaData(Okular::DocumentInfo::Subject, it.value()); break; case Mobipocket::Document::Subject: emit addMetaData(Okular::DocumentInfo::Subject, it.value()); break;
case Mobipocket::Document::Copyright: addMetaData(Okular::DocumentInfo::Copyright, it.value()); break; case Mobipocket::Document::Copyright: emit addMetaData(Okular::DocumentInfo::Copyright, it.value()); break;
} }
} }
} }

View file

@ -1123,8 +1123,8 @@ void Part::openUrlFromDocument(const QUrl &url)
} }
} }
m_bExtension->openUrlNotify(); emit m_bExtension->openUrlNotify();
m_bExtension->setLocationBarUrl(url.toDisplayString()); emit m_bExtension->setLocationBarUrl(url.toDisplayString());
openUrl(url); openUrl(url);
} }

View file

@ -838,7 +838,7 @@ void Shell::slotFitWindowToPage(const QSize& pageViewSize, const QSize& pageSize
const int yOffset = pageViewSize.height() - pageSize.height(); const int yOffset = pageViewSize.height() - pageSize.height();
showNormal(); showNormal();
resize( width() - xOffset, height() - yOffset); resize( width() - xOffset, height() - yOffset);
moveSplitter(pageSize.width()); emit moveSplitter(pageSize.width());
} }
/* kate: replace-tabs on; indent-width 4; */ /* kate: replace-tabs on; indent-width 4; */

View file

@ -1,4 +1,4 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 by Chu Xiaodong <xiaodongchu@gmail.com> * * Copyright (C) 2006 by Chu Xiaodong <xiaodongchu@gmail.com> *
* Copyright (C) 2006 by Pino Toscano <pino@kde.org> * * Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
* Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group * * Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group *
@ -232,7 +232,9 @@ AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot, Okular::
lowerlay->addWidget( sb ); lowerlay->addWidget( sb );
m_latexRenderer = new GuiUtils::LatexRenderer(); m_latexRenderer = new GuiUtils::LatexRenderer();
emit containsLatex( GuiUtils::LatexRenderer::mightContainLatex( m_annot->contents() ) ); // The emit below is not wrong even if emitting signals from the constructor it's usually wrong
// in this case the signal it's connected to inside MovableTitle constructor a few lines above
emit containsLatex( GuiUtils::LatexRenderer::mightContainLatex( m_annot->contents() ) ); // clazy:exclude=incorrect-emit
m_title->setTitle( m_annot->window().summary() ); m_title->setTitle( m_annot->window().summary() );
m_title->connectOptionButton( this, SLOT(slotOptionBtn()) ); m_title->connectOptionButton( this, SLOT(slotOptionBtn()) );

View file

@ -607,12 +607,12 @@ void FormLineEdit::slotChanged()
if ( contents != form->text() ) if ( contents != form->text() )
{ {
m_controller->formTextChangedByWidget( pageItem()->pageNumber(), emit m_controller->formTextChangedByWidget( pageItem()->pageNumber(),
form, form,
contents, contents,
cursorPos, cursorPos,
m_prevCursorPos, m_prevCursorPos,
m_prevAnchorPos ); m_prevAnchorPos );
} }
m_prevCursorPos = cursorPos; m_prevCursorPos = cursorPos;
@ -794,12 +794,12 @@ void TextAreaEdit::slotChanged()
if (contents != form->text()) if (contents != form->text())
{ {
m_controller->formTextChangedByWidget( pageItem()->pageNumber(), emit m_controller->formTextChangedByWidget( pageItem()->pageNumber(),
form, form,
contents, contents,
cursorPos, cursorPos,
m_prevCursorPos, m_prevCursorPos,
m_prevAnchorPos ); m_prevAnchorPos );
} }
m_prevCursorPos = cursorPos; m_prevCursorPos = cursorPos;
m_prevAnchorPos = textCursor().anchor(); m_prevAnchorPos = textCursor().anchor();
@ -903,12 +903,12 @@ void FileEdit::slotChanged()
int cursorPos = lineEdit()->cursorPosition(); int cursorPos = lineEdit()->cursorPosition();
if (contents != form->text()) if (contents != form->text())
{ {
m_controller->formTextChangedByWidget( pageItem()->pageNumber(), emit m_controller->formTextChangedByWidget( pageItem()->pageNumber(),
form, form,
contents, contents,
cursorPos, cursorPos,
m_prevCursorPos, m_prevCursorPos,
m_prevAnchorPos ); m_prevAnchorPos );
} }
m_prevCursorPos = cursorPos; m_prevCursorPos = cursorPos;
@ -987,9 +987,9 @@ void ListEdit::slotSelectionChanged()
} }
Okular::FormFieldChoice *form = static_cast<Okular::FormFieldChoice *>(m_ff); Okular::FormFieldChoice *form = static_cast<Okular::FormFieldChoice *>(m_ff);
if ( rows != form->currentChoices() ) { if ( rows != form->currentChoices() ) {
m_controller->formListChangedByWidget( pageItem()->pageNumber(), emit m_controller->formListChangedByWidget( pageItem()->pageNumber(),
form, form,
rows ); rows );
} }
} }
@ -1064,13 +1064,13 @@ void ComboEdit::slotValueChanged()
int cursorPos = lineEdit()->cursorPosition(); int cursorPos = lineEdit()->cursorPosition();
if ( text != prevText ) if ( text != prevText )
{ {
m_controller->formComboChangedByWidget( pageItem()->pageNumber(), emit m_controller->formComboChangedByWidget( pageItem()->pageNumber(),
form, form,
currentText(), currentText(),
cursorPos, cursorPos,
m_prevCursorPos, m_prevCursorPos,
m_prevAnchorPos m_prevAnchorPos
); );
} }
prevText = text; prevText = text;
m_prevCursorPos = cursorPos; m_prevCursorPos = cursorPos;

View file

@ -37,7 +37,6 @@ Layers::Layers(QWidget *parent, Okular::Document *document) : QWidget(parent), m
m_treeView = new QTreeView( this ); m_treeView = new QTreeView( this );
mainlay->addWidget( m_treeView ); mainlay->addWidget( m_treeView );
emit hasLayers( false );
m_treeView->setSortingEnabled( false ); m_treeView->setSortingEnabled( false );
m_treeView->setRootIsDecorated( true ); m_treeView->setRootIsDecorated( true );
m_treeView->setAlternatingRowColors( true ); m_treeView->setAlternatingRowColors( true );

View file

@ -284,13 +284,13 @@ void MiniBar::slotChangePage( int pageNumber )
void MiniBar::slotEmitNextPage() void MiniBar::slotEmitNextPage()
{ {
// emit signal // emit signal
nextPage(); emit nextPage();
} }
void MiniBar::slotEmitPrevPage() void MiniBar::slotEmitPrevPage()
{ {
// emit signal // emit signal
prevPage(); emit prevPage();
} }
void MiniBar::slotToolBarIconSizeChanged() void MiniBar::slotToolBarIconSizeChanged()