Le 09/11/2016 à 20:46, Enrico Forestieri a écrit :
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
The original intention was indeed to use auto-connect, and despite that
it did not do what I wanted I kept the name. According to the manual
(both qt4 and qt5) the syntax is on_<object name>_<signal name> so it
was not supposed to be triggered. Then the explanation would be that qt5
just behaves closer to the documentation.
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_".
I agree that it is better to avoid naming slots with "on_" unless an
auto-connection is intended. However, the LyX source do not always
connect manually: auto-connect is actually used (correctly) in some
places, in particular with objects defined in ui files.
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.
Patch looks good, feel free to commit. Except for:
QObject::connect(wa, SIGNAL(bufferViewChanged()),
- this, SIGNAL(bufferViewChanged()));
+ this, SLOT(onBufferViewChanged()));
The original code is intended (see e.g.
https://stackoverflow.com/q/9798195), and the replacement does not
achieve the same. But since this misleads into thinking that there was a
typo, I will add a comment.
Guillaume