On Wed, Nov 09, 2016 at 11:46:33AM +0100, Jean-Marc Lasgouttes wrote:
> When using dialogs (prefs for example) with master, I get some
> 
> QMetaObject::connectSlotsByName: No matching signal for
> on_bufferViewChanged()
> QMetaObject::connectSlotsByName: No matching signal for
> on_bufferViewChanged()
> QMetaObject::connectSlotsByName: No matching signal for
> on_bufferViewChanged()
> 
> Does this ring a bell for somebody?

I think the explanation is here:
http://www.qtforum.org/post/76950/connectslotsbyname.html

Qt interprets bufferViewChanged as an object name but doesn't find
any signal name. As we always manually connect signals and slots,
we should avoid having slots whose name begins with "on_".

The attached patch simply renames on_bufferViewChanged as
onBufferViewChanged (other than fixing an oversight in GuiView.cpp)
and gets rid of the warning. I don't know why this does not occur
on Qt5 or why it does not occur for all other on_XXX slots.

-- 
Enrico
diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h
index bf4a313..6858715 100644
--- a/src/frontends/qt4/Dialog.h
+++ b/src/frontends/qt4/Dialog.h
@@ -265,7 +265,7 @@ protected:
        ///
        virtual void apply();
        /// To be called when the buffer view has changed
-       virtual void on_bufferViewChanged() = 0;
+       virtual void onBufferViewChanged() = 0;
 
 private:
        /** The Dialog's name is the means by which a dialog identifies
diff --git a/src/frontends/qt4/DialogView.cpp b/src/frontends/qt4/DialogView.cpp
index 7b9ee9c..9b114ec 100644
--- a/src/frontends/qt4/DialogView.cpp
+++ b/src/frontends/qt4/DialogView.cpp
@@ -21,7 +21,7 @@ DialogView::DialogView(GuiView & lv, QString const & name, 
QString const & title
        : QDialog(&lv), Dialog(lv, name, "LyX: " + title)
 {
        connect(&lv, SIGNAL(bufferViewChanged()),
-               this, SLOT(on_bufferViewChanged()));
+               this, SLOT(onBufferViewChanged()));
 
        // remove question marks from Windows dialogs
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h
index 180bcb1..aa00f64 100644
--- a/src/frontends/qt4/DialogView.h
+++ b/src/frontends/qt4/DialogView.h
@@ -49,7 +49,7 @@ protected:
        void hideEvent(QHideEvent * ev);
 
 protected Q_SLOTS:
-       void on_bufferViewChanged() {};
+       void onBufferViewChanged() {};
 };
 
 } // namespace frontend
diff --git a/src/frontends/qt4/DockView.cpp b/src/frontends/qt4/DockView.cpp
index ea385ee..c1b459b 100644
--- a/src/frontends/qt4/DockView.cpp
+++ b/src/frontends/qt4/DockView.cpp
@@ -27,7 +27,7 @@ DockView::DockView(GuiView & parent, QString const & name,
        parent.addDockWidget(area, this);
        hide();
        connect(&parent, SIGNAL(bufferViewChanged()),
-               this, SLOT(on_bufferViewChanged()));
+               this, SLOT(onBufferViewChanged()));
 }
 
 
diff --git a/src/frontends/qt4/DockView.h b/src/frontends/qt4/DockView.h
index 3c5f764..621368b 100644
--- a/src/frontends/qt4/DockView.h
+++ b/src/frontends/qt4/DockView.h
@@ -58,7 +58,7 @@ public:
        //@}
 
 protected Q_SLOTS:
-       void on_bufferViewChanged() {} //override
+       void onBufferViewChanged() {} //override
 };
 
 } // frontend
diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp
index 91ee667..cad37e6 100644
--- a/src/frontends/qt4/GuiDialog.cpp
+++ b/src/frontends/qt4/GuiDialog.cpp
@@ -29,7 +29,7 @@ GuiDialog::GuiDialog(GuiView & lv, QString const & name, 
QString const & title)
          is_closing_(false)
 {
        connect(&lv, SIGNAL(bufferViewChanged()),
-               this, SLOT(on_bufferViewChanged()));
+               this, SLOT(onBufferViewChanged()));
 
        // remove question marks from Windows dialogs
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h
index 20ffde0..3b26943 100644
--- a/src/frontends/qt4/GuiDialog.h
+++ b/src/frontends/qt4/GuiDialog.h
@@ -60,7 +60,7 @@ public Q_SLOTS:
        void closeEvent(QCloseEvent * e);
 
 protected Q_SLOTS:
-       void on_bufferViewChanged() {};//override
+       void onBufferViewChanged() {};//override
 
 public:
        /** Check whether we may apply our data.
diff --git a/src/frontends/qt4/GuiDocument.cpp 
b/src/frontends/qt4/GuiDocument.cpp
index 2a40873..a69a111 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -1457,7 +1457,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 }
 
 
-void GuiDocument::on_bufferViewChanged()
+void GuiDocument::onBufferViewChanged()
 {
        if (isVisibleView())
                initialiseParams("");
diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h
index c2f944d..c055378 100644
--- a/src/frontends/qt4/GuiDocument.h
+++ b/src/frontends/qt4/GuiDocument.h
@@ -83,7 +83,7 @@ public:
        BufferParams const & params() const { return bp_; }
 
 public Q_SLOTS:
-       void on_bufferViewChanged();//override
+       void onBufferViewChanged();//override
 
 private Q_SLOTS:
        void updateNumbering();
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index fb57c2e..9d736fe 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -513,7 +513,7 @@ GuiView::GuiView(int id)
          command_execute_(false), minibuffer_focus_(false)
 {
        connect(this, SIGNAL(bufferViewChanged()),
-               this, SLOT(on_bufferViewChanged()));
+               this, SLOT(onBufferViewChanged()));
 
        // GuiToolbars *must* be initialised before the menu bar.
        normalSizedIcons(); // at least on Mac the default is 32 otherwise, 
which is huge
@@ -1203,13 +1203,13 @@ void GuiView::on_currentWorkAreaChanged(GuiWorkArea * 
wa)
        QObject::connect(wa, SIGNAL(busy(bool)),
                         this, SLOT(setBusy(bool)));
        QObject::connect(wa, SIGNAL(bufferViewChanged()),
-                        this, SIGNAL(bufferViewChanged()));
+                        this, SLOT(onBufferViewChanged()));
        Q_EMIT updateWindowTitle(wa);
        Q_EMIT bufferViewChanged();
 }
 
 
-void GuiView::on_bufferViewChanged()
+void GuiView::onBufferViewChanged()
 {
        structureChanged();
        // Buffer-dependent dialogs must be updated. This is done here because
diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h
index 4beeb0e..4bc8b18 100644
--- a/src/frontends/qt4/GuiView.h
+++ b/src/frontends/qt4/GuiView.h
@@ -233,7 +233,7 @@ private Q_SLOTS:
        ///
        void on_currentWorkAreaChanged(GuiWorkArea *);
        ///
-       void on_bufferViewChanged();
+       void onBufferViewChanged();
        ///
        void on_lastWorkAreaRemoved();
 
diff --git a/src/frontends/qt4/GuiViewSource.cpp 
b/src/frontends/qt4/GuiViewSource.cpp
index b413b9c..9c0ea1d 100644
--- a/src/frontends/qt4/GuiViewSource.cpp
+++ b/src/frontends/qt4/GuiViewSource.cpp
@@ -423,7 +423,7 @@ GuiViewSource::GuiViewSource(GuiView & parent,
 }
 
 
-void GuiViewSource::on_bufferViewChanged()
+void GuiViewSource::onBufferViewChanged()
 {
        widget_->setText();
        widget_->setEnabled((bool)bufferview());
diff --git a/src/frontends/qt4/GuiViewSource.h 
b/src/frontends/qt4/GuiViewSource.h
index f2bc1ce..873f8db 100644
--- a/src/frontends/qt4/GuiViewSource.h
+++ b/src/frontends/qt4/GuiViewSource.h
@@ -119,7 +119,7 @@ public:
 
 public Q_SLOTS:
        ///
-       void on_bufferViewChanged();//override
+       void onBufferViewChanged();//override
 
 private Q_SLOTS:
        /// The title displayed by the dialog reflects source type.

Reply via email to