vsqlite--
vsqlite-- copied to clipboard
The function `emit` shadows Qt's emit functionality
The function emit works without Qt and Qt works without vsqlite++. When using both together, you get the following compiler error:
In file included from src/./vsqlite++/include/sqlite/execute.hpp:35,
from src/./database.hpp:5,
from src/./todo.hpp:8,
from src/gui/mainwindow.cpp:9:
src/vsqlite++/include/sqlite/command.hpp:80:19: error: expected unqualified-id before ‘)’ token
bool emit();
A simple renaming of the function emit()
, which just forwards step()
, in vsqlite++ solves this error.
Is there any reason for sqlite::command::emit
or will it stay equal to sqlite::command::step
?
No, there's no reason it was called 'emit' - However changing this would break the API for anyone ever using emit, which is kind of unfortunate.
Then again Qt Sql does support sqlite out of the box, wouldn't it be easier to use that one?
I am not sure of a solution for this except for renaming the method, which would break a quite stable API and also an ABI.
I am open to hear about other possible workarounds
Qt supports disabling its signals and slots macros, by adding CONFIG += no_keywords
in the qproject file, or passing directly a define or macro to the compiler.
You must then use Q_SIGNAL, Q_EMIT, Q_SLOT.
See https://doc.qt.io/qt-5/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots