-
-
Save 40/5328649 to your computer and use it in GitHub Desktop.
Make Call in BB10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBS += -lbbsystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in the header | |
#include <bb/system/phone/Phone> | |
.... | |
// remember to set the context property to somethin | |
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); | |
// place it after the above line | |
qml->setContextProperty("appcontext", this); | |
//create a new method below | |
void App::makecall(QString number){ | |
bb::system::phone::Phone phone; | |
phone.initiateCall(number); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add this line | |
public: | |
Q_INVOKABLE void makecall(QString number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button{ | |
text: "Make call" | |
onClicked: { | |
//replace the number with whatever number you're calling | |
appcontext.makeCall("4151231234"); | |
// ^ ^ ^ ---------------------------------- this is the argument from the method its QString. | |
// - - This is the method name in your cpp file | |
// - | |
// - This is the qml.setContextProperty name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment