Commit d99d4d44 authored by Ahmad Samir's avatar Ahmad Samir

Use Q_EMIT instead of emit

In C++20 there are new classes that have member functions named emit().
c.f.:
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
https://en.cppreference.com/w/cpp/io/basic_osyncstream/emit

GIT_SILENT
parent 21ebb01b
......@@ -199,7 +199,7 @@ void KAboutApplicationPersonModel::onPersonJobFinished(Attica::BaseJob *job)
m_profileList.replace(personProfileListIndex, profile);
if (p.avatarUrl().isEmpty()) {
emit dataChanged(index(personProfileListIndex), index(personProfileListIndex));
Q_EMIT dataChanged(index(personProfileListIndex), index(personProfileListIndex));
fetchOcsLinkIcons(personProfileListIndex);
} else {
//TODO: Create a PixmapFromUrlJob in Attica which would use KIO::get if available
......@@ -227,7 +227,7 @@ void KAboutApplicationPersonModel::onAvatarJobFinished(QNetworkReply *reply)
if (reply->error() != QNetworkReply::NoError) {
//qCDebug(DEBUG_KXMLGUI) << "Could not fetch OCS person avatar.";
emit dataChanged(index(personProfileListIndex), index(personProfileListIndex));
Q_EMIT dataChanged(index(personProfileListIndex), index(personProfileListIndex));
return;
}
QByteArray data = reply->readAll();
......@@ -266,8 +266,8 @@ void KAboutApplicationPersonModel::onOcsLinksJobFinished(KAboutApplicationPerson
m_profileList.replace(personProfileListIndex, profile);
emit dataChanged(index(personProfileListIndex), index(personProfileListIndex));
emit layoutChanged();
Q_EMIT dataChanged(index(personProfileListIndex), index(personProfileListIndex));
Q_EMIT layoutChanged();
}
KAboutApplicationPersonProfileOcsLink::Type KAboutApplicationPersonProfileOcsLink::typeFromAttica(const QString &atticaType)
......@@ -359,7 +359,7 @@ void KAboutApplicationPersonIconsJob::getIcons(int i)
}
++i;
}
emit finished(this);
Q_EMIT finished(this);
}
void KAboutApplicationPersonIconsJob::onJobFinished(QNetworkReply *reply) //SLOT
......
......@@ -327,8 +327,8 @@ QAction *KActionCollection::addAction(const QString &name, QAction *action)
this, &KActionCollection::slotActionTriggered);
}
emit inserted(action);
emit changed();
Q_EMIT inserted(action);
Q_EMIT changed();
return action;
}
......@@ -358,9 +358,9 @@ QAction *KActionCollection::takeAction(QAction *action)
action->disconnect(this);
#if KXMLGUI_BUILD_DEPRECATED_SINCE(5, 0)
emit removed(action); //deprecated
Q_EMIT removed(action); //deprecated
#endif
emit changed();
Q_EMIT changed();
return action;
}
......@@ -718,7 +718,7 @@ void KActionCollection::slotActionTriggered()
{
QAction *action = qobject_cast<QAction *>(sender());
if (action) {
emit actionTriggered(action);
Q_EMIT actionTriggered(action);
}
}
......@@ -734,9 +734,9 @@ void KActionCollection::slotActionHovered()
QAction *action = qobject_cast<QAction *>(sender());
if (action) {
#if KXMLGUI_BUILD_DEPRECATED_SINCE(5, 0)
emit actionHighlighted(action);
Q_EMIT actionHighlighted(action);
#endif
emit actionHovered(action);
Q_EMIT actionHovered(action);
}
}
......@@ -752,9 +752,9 @@ void KActionCollectionPrivate::_k_actionDestroyed(QObject *obj)
//HACK the object we emit is partly destroyed
#if KXMLGUI_BUILD_DEPRECATED_SINCE(5, 0)
emit q->removed(action);
Q_EMIT q->removed(action);
#endif
emit q->changed();
Q_EMIT q->changed();
}
void KActionCollection::connectNotify(const QMetaMethod &signal)
......
......@@ -322,7 +322,7 @@ bool ToolBarListWidget::dropMimeData(int index, const QMimeData *mimeData, Qt::D
const bool sourceIsActiveList = mimeData->data(QStringLiteral("application/x-kde-source-treewidget")) == "active";
ToolBarItem *item = new ToolBarItem(this); // needs parent, use this temporarily
stream >> *item;
emit dropped(this, index, item, sourceIsActiveList);
Q_EMIT dropped(this, index, item, sourceIsActiveList);
return true;
}
......@@ -715,9 +715,9 @@ void KEditToolBarPrivate::defaultClicked()
_k_enableApply(false);
emit q->newToolBarConfig();
Q_EMIT q->newToolBarConfig();
#if KXMLGUI_BUILD_DEPRECATED_SINCE(4, 0)
emit q->newToolbarConfig(); // compat
Q_EMIT q->newToolbarConfig(); // compat
#endif
}
......@@ -751,9 +751,9 @@ void KEditToolBarPrivate::okClicked()
// button was already pressed and no further changes were made.
if (m_buttonBox->button(QDialogButtonBox::Apply)->isEnabled()) {
m_widget->save();
emit q->newToolBarConfig();
Q_EMIT q->newToolBarConfig();
#if KXMLGUI_BUILD_DEPRECATED_SINCE(4, 0)
emit q->newToolbarConfig(); // compat
Q_EMIT q->newToolbarConfig(); // compat
#endif
}
q->accept();
......@@ -763,9 +763,9 @@ void KEditToolBarPrivate::applyClicked()
{
(void)m_widget->save();
_k_enableApply(false);
emit q->newToolBarConfig();
Q_EMIT q->newToolBarConfig();
#if KXMLGUI_BUILD_DEPRECATED_SINCE(4, 0)
emit q->newToolbarConfig(); // compat
Q_EMIT q->newToolbarConfig(); // compat
#endif
}
......@@ -1386,7 +1386,7 @@ void KEditToolBarWidgetPrivate::slotInsertButton()
insertActive(m_inactiveList->currentItem(), m_activeList->currentItem(), false);
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
slotToolBarSelected(m_toolbarCombo->currentIndex());
......@@ -1461,7 +1461,7 @@ void KEditToolBarWidgetPrivate::removeActive(ToolBarItem *item)
}
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
// now iterate through to find the child to nuke
QDomElement elem = findElementForToolBarItem(item);
......@@ -1494,7 +1494,7 @@ void KEditToolBarWidgetPrivate::slotUpButton()
}
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
moveActive(item, static_cast<ToolBarItem *>(item->listWidget()->item(row - 1)));
}
......@@ -1547,7 +1547,7 @@ void KEditToolBarWidgetPrivate::slotDownButton()
}
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
moveActive(item, static_cast<ToolBarItem *>(item->listWidget()->item(newRow)));
}
......@@ -1620,7 +1620,7 @@ void KEditToolBarWidgetPrivate::slotChangeIcon()
act_elem.setAttribute(QStringLiteral("icon"), icon);
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
}
}
......@@ -1668,7 +1668,7 @@ void KEditToolBarWidgetPrivate::slotChangeIconText()
}
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
}
}
......@@ -1694,7 +1694,7 @@ void KEditToolBarWidgetPrivate::slotDropped(ToolBarListWidget *list, int index,
delete item; // not needed anymore. must be deleted before slotToolBarSelected clears the lists
// we're modified, so let this change
emit m_widget->enableOk(true);
Q_EMIT m_widget->enableOk(true);
slotToolBarSelected(m_toolbarCombo->currentIndex());
}
......
......@@ -237,7 +237,7 @@ void KHelpMenu::appHelpActivated()
void KHelpMenu::aboutApplication()
{
if (receivers(SIGNAL(showAboutApplication())) > 0) {
emit showAboutApplication();
Q_EMIT showAboutApplication();
} else { // if (d->mAboutData)
if (!d->mAboutApp) {
d->mAboutApp = new KAboutApplicationDialog(d->mAboutData, d->mParent);
......
......@@ -188,7 +188,7 @@ void SMTP::connectTimedOut()
// qCDebug(DEBUG_KXMLGUI) << "socket connection timed out";
socketClosed();
emit error(ConnectTimeout);
Q_EMIT error(ConnectTimeout);
}
void SMTP::interactTimedOut()
......@@ -197,7 +197,7 @@ void SMTP::interactTimedOut()
// qCDebug(DEBUG_KXMLGUI) << "time out waiting for server interaction";
socketClosed();
emit error(InteractTimeout);
Q_EMIT error(InteractTimeout);
}
void SMTP::socketReadyToRead()
......@@ -234,7 +234,7 @@ void SMTP::socketError(QAbstractSocket::SocketError socketError)
{
// qCDebug(DEBUG_KXMLGUI) << socketError << sock->errorString();
Q_UNUSED(socketError);
emit error(ConnectError);
Q_EMIT error(ConnectError);
socketClosed();
}
......@@ -247,7 +247,7 @@ void SMTP::socketClosed()
sock->deleteLater();
}
sock = nullptr;
emit connectionClosed();
Q_EMIT connectionClosed();
}
void SMTP::processLine(QByteArray *line)
......@@ -299,13 +299,13 @@ void SMTP::processLine(QByteArray *line)
case Data:
state = Finished;
finished = true;
emit messageSent();
Q_EMIT messageSent();
break;
default:
state = CError;
// qCDebug(DEBUG_KXMLGUI) << "smtp error (state error): [" << lastState << "]:[" << stat << "][" << *line << "]";
socketClosed();
emit error(Command);
Q_EMIT error(Command);
break;
}
break;
......@@ -323,19 +323,19 @@ void SMTP::processLine(QByteArray *line)
state = CError;
// qCDebug(DEBUG_KXMLGUI) << "smtp error (command error): [" << lastState << "]:[" << stat << "][" << *line << "]\n";
socketClosed();
emit error(Command);
Q_EMIT error(Command);
break;
case Unknown: //550
state = CError;
// qCDebug(DEBUG_KXMLGUI) << "smtp error (unknown user): [" << lastState << "]:[" << stat << "][" << *line << "]";
socketClosed();
emit error(UnknownUser);
Q_EMIT error(UnknownUser);
break;
default:
state = CError;
// qCDebug(DEBUG_KXMLGUI) << "unknown response: [" << lastState << "]:[" << stat << "][" << *line << "]";
socketClosed();
emit error(UnknownResponse);
Q_EMIT error(UnknownResponse);
}
}
......@@ -109,7 +109,7 @@ void ShortcutEditWidget::defaultToggled(bool checked)
if (m_customEditor->isKeySequenceAvailable(m_defaultKeySequence)) {
// Clear the customs widget
m_customEditor->clearKeySequence();
emit keySequenceChanged(m_defaultKeySequence);
Q_EMIT keySequenceChanged(m_defaultKeySequence);
} else {
// We tried to switch to the default key sequence and failed. Go
// back.
......@@ -117,7 +117,7 @@ void ShortcutEditWidget::defaultToggled(bool checked)
}
} else {
// The empty key sequence is always valid
emit keySequenceChanged(QKeySequence());
Q_EMIT keySequenceChanged(QKeySequence());
}
m_isUpdating = false;
}
......@@ -173,7 +173,7 @@ void ShortcutEditWidget::setCustom(const QKeySequence &seq)
// We do this by calling setKeySequence which will do the right thing.
setKeySequence(original);
emit keySequenceChanged(original);
Q_EMIT keySequenceChanged(original);
m_isUpdating = false;
}
......
......@@ -128,7 +128,7 @@ void KShortcutSchemesEditor::newScheme()
m_schemesList->addItem(newName);
m_schemesList->setCurrentIndex(m_schemesList->findText(newName));
updateDeleteButton();
emit shortcutsSchemeChanged(newName);
Q_EMIT shortcutsSchemeChanged(newName);
}
void KShortcutSchemesEditor::deleteScheme()
......@@ -154,7 +154,7 @@ Note that this will not remove any system wide shortcut schemes.", currentScheme
m_schemesList->removeItem(m_schemesList->findText(currentScheme()));
updateDeleteButton();
emit shortcutsSchemeChanged(currentScheme());
Q_EMIT shortcutsSchemeChanged(currentScheme());
}
QString KShortcutSchemesEditor::currentScheme()
......
......@@ -123,7 +123,7 @@ public:
void save()
{
m_keyChooser->save();
emit q->saved();
Q_EMIT q->saved();
}
KShortcutsDialog *const q;
......
......@@ -449,7 +449,7 @@ void KShortcutsEditorPrivate::changeKeyShortcut(KShortcutsEditorItem *item, uint
}
item->setKeySequence(column, capture);
emit q->keyChange();
Q_EMIT q->keyChange();
//force view update
item->setText(column, capture.toString(QKeySequence::NativeText));
}
......
......@@ -293,7 +293,7 @@ bool KShortcutsEditorDelegate::eventFilter(QObject *o, QEvent *e)
void KShortcutsEditorDelegate::keySequenceChanged(const QKeySequence &seq)
{
QVariant ret = QVariant::fromValue(seq);
emit shortcutChanged(ret, m_editingIndex);
Q_EMIT shortcutChanged(ret, m_editingIndex);
}
void KShortcutsEditorDelegate::setCheckActionCollections(
......@@ -308,7 +308,7 @@ void KShortcutsEditorDelegate::shapeGestureChanged(const KShapeGesture &gest)
{
//this is somewhat verbose because the gesture types are not "built in" to QVariant
QVariant ret = QVariant::fromValue(gest);
emit shortcutChanged(ret, m_editingIndex);
Q_EMIT shortcutChanged(ret, m_editingIndex);
}
#endif
......@@ -317,7 +317,7 @@ void KShortcutsEditorDelegate::shapeGestureChanged(const KShapeGesture &gest)
void KShortcutsEditorDelegate::rockerGestureChanged(const KRockerGesture &gest)
{
QVariant ret = QVariant::fromValue(gest);
emit shortcutChanged(ret, m_editingIndex);
Q_EMIT shortcutChanged(ret, m_editingIndex);
}
#endif
......@@ -103,7 +103,7 @@ void KShortcutWidget::setShortcut(const QList<QKeySequence> &newSc)
d->holdChangedSignal = false;
emit shortcutChanged(d->cut);
Q_EMIT shortcutChanged(d->cut);
}
//slot
......@@ -122,7 +122,7 @@ void KShortcutWidgetPrivate::priKeySequenceChanged(const QKeySequence &seq)
}
if (!holdChangedSignal) {
emit q->shortcutChanged(cut);
Q_EMIT q->shortcutChanged(cut);
}
}
......@@ -136,7 +136,7 @@ void KShortcutWidgetPrivate::altKeySequenceChanged(const QKeySequence &seq)
}
if (!holdChangedSignal) {
emit q->shortcutChanged(cut);
Q_EMIT q->shortcutChanged(cut);
}
}
......
......@@ -201,7 +201,7 @@ void KXMLGUIFactory::addClient(KXMLGUIClient *client)
}
if (d->emptyState()) {
emit makingChanges(true);
Q_EMIT makingChanges(true);
}
d->pushState();
......@@ -268,7 +268,7 @@ void KXMLGUIFactory::addClient(KXMLGUIClient *client)
d->popState();
emit clientAdded(client);
Q_EMIT clientAdded(client);
// build child clients
const auto children = client->childClients();
......@@ -277,7 +277,7 @@ void KXMLGUIFactory::addClient(KXMLGUIClient *client)
}
if (d->emptyState()) {
emit makingChanges(false);
Q_EMIT makingChanges(false);
}
/*
QString unaddedActions;
......@@ -409,7 +409,7 @@ void KXMLGUIFactory::removeClient(KXMLGUIClient *client)
}
if (d->emptyState()) {
emit makingChanges(true);
Q_EMIT makingChanges(true);
}
// remove this client from our client list
......@@ -454,10 +454,10 @@ void KXMLGUIFactory::removeClient(KXMLGUIClient *client)
d->popState();
if (d->emptyState()) {
emit makingChanges(false);
Q_EMIT makingChanges(false);
}
emit clientRemoved(client);
Q_EMIT clientRemoved(client);
}
QList<KXMLGUIClient *> KXMLGUIFactory::clients() const
......
......@@ -29,8 +29,8 @@ void
MouseWidget::mousePressEvent(QMouseEvent *e)
{
mouseButtonDown = true;
emit newXPos(e->x());
emit newYPos(e->y());
Q_EMIT newXPos(e->x());
Q_EMIT newYPos(e->y());
}
void
......@@ -43,16 +43,16 @@ void
MouseWidget::mouseMoveEvent(QMouseEvent *e)
{
if (mouseButtonDown) {
emit newXPos(e->x());
emit newYPos(e->y());
Q_EMIT newXPos(e->x());
Q_EMIT newYPos(e->y());
}
}
void
MouseWidget::resizeEvent(QResizeEvent *r)
{
emit newWidth(r->size().width());
emit newHeight(r->size().height());
Q_EMIT newWidth(r->size().width());
Q_EMIT newHeight(r->size().height());
}
KRulerTest::KRulerTest()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment