Quote Originally Posted by jfinn88 View Post
Like to be able to search by date and userName... I want to pass text values back to my c++ function a would like to use the signal and slot mechanism to perform this action. However I get lost with what Object I need to pass the QObject::connect() method, for it to work.
I created two signals and two slots one for the date text field in qml and the other is for the userName text field in qml.
in C++ I created to slots to receive the qml signals and to out put the text data passed to the console using a debug() method.
I'm little confused on where to place the QObject::connect method in my project... main.cpp or sqliteModel.cpp in the constructor ?
I am unsure what objects to pass the connect() method for the signal to receive the slot ?
You just call the slots directly.
Slots, like Q_INVOKABLE methods, can be called from QML.

Your QML code suggests that you want to pass both date and user name when clicking search, so a single slot with two arguments will do.

Quote Originally Posted by jfinn88 View Post
I would also Like to create a table in the database for each separate day for user event logging and delete old tables after 30 days
here is my code: (had to remove functions for model in cpp file to get it to fit)
I guess you have two options:
- use an additional table that maps from a date to a table name for that date
- encode the date in the table name

Quote Originally Posted by jfinn88 View Post
I was able to pass the text form qml to my cpp slot by expose Qt slot to QML element. By using the context property I set for my model to be exposed to QML.
Yes, exactly, though you probably want to use a single method if both inputs are to be used in the search.

Quote Originally Posted by jfinn88 View Post
(?) I did the same for my dbConnect and sqlSelect fcns however I have to include Q_INVOKABLE when intializing them in the header file or for some reason or I cant call them in QML with out the Q_INVOKABLE keyword but my searchDateText & searchUserNameText fucntions do??? -> error: Property 'dbConnect' of object sqliteModel() is not a function
They have to be slots or Q_INVOKABLE.

From the QML side's point of view there is actually no difference.
It is customary though to use Q_INVOKABLE when methods return something, as slots usually don't do that.

In your case all methods you have so far could be slots.

Quote Originally Posted by jfinn88 View Post
I would like to pass the QML text using a QML signal to a CPP slot using the QObject::connect() mainly for learning purposes...
I would advise against that, you would put effort into learning something that you then don't want to use.
I.e. you don't want your C++ code to be dependent on specific QML objects or their specific signals.

Quote Originally Posted by jfinn88 View Post
The objects that I need to pass the connect() method make more sense now, I need to pass a QML object for the qml signal() and pass a class object (sqliteModel) for the slot()
Yes, but you really don't want to do that.

Quote Originally Posted by jfinn88 View Post
if I use the connect() method in my cpp class (in the constructor) I can use keyword "this" for the CPP object for the connect method?
Theoretically yes, but the QML scene has not been loaded yet when the model's constructor runs, so the connect would have to happen from outside after both model and QML objects exist.

Cheers,
_