10-10-2012 11:09 AM - edited 10-10-2012 11:14 AM
I am trying to connect the standard finished signal to my slot for the SystemPrompt and I am getting the following run time error:
No such signal bb:: system:: SystemPrompt::finished(bb:: system:: SystemUiResult::Type value) in ../src/App.cpp
my code:
prompt = new SystemPrompt();
prompt->setTitle("Enter.....");
prompt->setDismissAutomatically(true);
// Connect a function to handle the predefined signals
// for the two standard buttons, Login and Cancel.
bool success = connect(prompt,
SIGNAL (finished(bb:: system:: SystemUiResult::Type value)),
this,
SLOT (onPromptFinished(bb:: system:: SystemUiResult::Type value)));
If I comment out connect then everything executes correctly and the Prompt is shown as it is suppose to be.
I beleive I have everything written as it is in the example from SystemDialogs
The only difference is that in the SystemPrompt class definition documentation it states:
Due to a work around for a Qt Core issue with accessing enums from QML, use result to access the current value instead of the signal argument to avoid runtime errors.
So this is what I did above.
It must be something simple that I am either not doing or screwed up but I do not see what.
10-10-2012 05:51 PM
I'm having the same problem.
The weird part is that if I connect another SIGNAL like titleChanged(QString), it runs.
10-10-2012 06:09 PM
I found a work around for the time being. I declared the SystemPrompt in my Qml and I used onFinished to call my c++ function. I also created a SystemPrompt pointer in my application class, found the Qml object and assigned it to my pointer. By doing this I can change parameters that you cannot do in Qml such as making the input a password input.
10-10-2012 06:18 PM - edited 10-11-2012 09:39 AM
I've made some progress.
This is my code:
// Label the two standard buttons with specific text.
// Add a custom button for more stuff.
SystemDialog *dialog = new SystemDialog("one", "two");
dialog->setTitle("title");
dialog->setBody("bodeh");
// Connect your functions to handle the predefined signals for the buttons.
// The slot will check the SystemUiResult to see which button was clicked.
bool success = QObject::connect(dialog, SIGNAL(finished (bb::system:
ystemUiResult::Type)), //omitted "type"
this, SLOT (appVerDialogFinished(bb::system:
ystemUiResult::Type)));
Q_ASSERT(success);
Q_UNUSED(success);
// Now show the dialog in your UI
dialog->show();
The dialog does appear, I've yet to test it. Pressed the first button and nothing happened, but pressing the second button dismissed the dialog.
The example is very strange, (The SLOT receives 2 parameters, no comma between SIGNAL and "this", etc.) may be part of a conspiracy...
10-11-2012 10:11 AM
It didn't disappear on the first click because I was showing the dialog twice (DERP)
When clicked it prints the values "2" and "3", which according to SystemUIResult Reference they mean
None = 0, ButtonSelection = 1, ConfirmButtonSelection = 2, CancelButtonSelection = 3, TimeOut = 4, Error = 5, CustomButtonSelection = 6
Also, I noticed that if after showing it I leave this line
dialog->deleteLater();
the dialog never appears...
10-12-2012 05:46 AM
Hi,
I think this is the problem, while connecting just give parameter type don't give name in signal and slot connect fuction in .cpp file like this,
QObject::connect(prompt,SIGNAL(finished(bb::system
ystemUiResult::Type)),this,SLOT(onDialogFinished(b
ystemUiResult::Type)));
Not like this
connect(prompt, SIGNAL (finished(bb:: system:: SystemUiResult::Type value)),this, SLOT (onPromptFinished(bb:: system:: SystemUiResult::Type value)));
I think this will solve ur problem.
Regards,
Naresh Kodumuri.
10-12-2012 07:20 AM
yes nareshkodumuri is correct you only pass the method signature not the parameter name.
Problem is signal are only evaluated a runtime so you don't get no errors until you run it.