Calling ring function from QML?

42 views
Skip to first unread message

Majdi Sobain

unread,
Sep 18, 2018, 11:58:23 AM9/18/18
to The Ring Programming Language
Hello Eng. Mahmoud

Is There any way to call a Ring function from within QML code? so that we can use QML as a UI and Ring code as a backend.

I did some search but couldn't figure it out?

I found this black hole that I thought may help but could not get out of it with any result :)

Any help will be really appreciated :)

Greetings
Majdi

Mahmoud Fayed

unread,
Sep 18, 2018, 7:22:25 PM9/18/18
to The Ring Programming Language
Hello Majdi

QML support in RingQt still in progress, I am working on other things like adding more classes that I need or use in my applications.

Until now RingQt support only running QML files that contains JavaScript code.

I think through your knowledge about Ring and RingQt, You can work on adding this feature.
Then share your work with other to be integrated with RingQt.

Greetings,
Mahmoud

Majdi Sobain

unread,
Sep 20, 2018, 12:26:02 PM9/20/18
to ring...@googlegroups.com
Hello Eng Mahmoud

Thank you very much for your reply.

Regarding porting this feature to ring by using our regular method in wrapping qt classes, I think this will not be done because as I read QML engine could not call any qt method unless it has been specially defined before time of compilation. Something like this.

Do you have any kind of clue that we can have any communication with qml engine from within ring code?

I think that I could not figure it from just using the previous wrapping method

Greetings
Majdi

Mahmoud Fayed

unread,
Sep 20, 2018, 9:29:15 PM9/20/18
to The Ring Programming Language
Hello Majdi

You can create a new class in C++
Add it to RingQt project file
And wrap it using configuration files.

We are using this way to support (Signals and Slots)

For example, we have the next class (GPushButton) in C++ code that inherit (QPushButton)


This class define the clicked() signal to call the next slot (that call Ring code)

void GPushButton::clickedSlot()
{
   
if (strcmp(this->cClickEvent,"")==0)
       
return ;

    ring_vm_runcode
(this->pVM,this->cClickEvent);
}


Using this way, You can support calling Ring code from QML
QML ----> Call C++ Code ----> Call Ring Code

Greetings,
Mahmoud

Majdi Sobain

unread,
Sep 21, 2018, 8:20:30 PM9/21/18
to ring...@googlegroups.com
Hello Eng Mahmoud 

Thank you for your hint. 

To apply your suggestion I found myself the whole day and night digging into a lot of resources to get those two qml examples that are in the samples folder to run on my Ubuntu desktop or my android device but I couldn't. 

I tried to wrap some additional qt classes but with no luck. This try by the way took most of the time as I faced a lot of errors until I got them compiled correctly. 

Finally, I think I should say I'm sorry that I could not do more tests these days because I don't have enough time.

But I may come back with some more tests in the future :)

Thank you very much for your help and time :)

Greetings
Majdi

Mahmoud Fayed

unread,
Sep 22, 2018, 12:20:12 AM9/22/18
to The Ring Programming Language
Hello Majdi

You are welcome :D

When you come back to this work
Check this file

This file is a code generator that we are using to generate files like gpushbutton.cpp and gpushbutton.h
I know that you know about it from your work on QtConverter
The point is (Code Generation + Automation) is what works here in short time when you care about productivity.

Keep up the good work :D

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Dec 30, 2025, 4:15:36 PM (15 hours ago) Dec 30
to The Ring Programming Language
Hello Majdi

>> "Is There any way to call a Ring function from within QML code? so that we can use QML as a UI and Ring code as a backend."

Just an update to this topic for our future readers

As of 2025.12.30, our friend Mohannad published RingQML


Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages