Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function emit shadows Qt's emit functionality #32

Open
nullptrT opened this issue Feb 13, 2019 · 2 comments
Open

The function emit shadows Qt's emit functionality #32

nullptrT opened this issue Feb 13, 2019 · 2 comments

Comments

@nullptrT
Copy link

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?

@vinzenz
Copy link
Owner

vinzenz commented Feb 15, 2019

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

@janderudder
Copy link

janderudder commented Sep 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants