Interact between Ring and QML

153 views
Skip to first unread message

MOHANNAD ALDULAIMI

unread,
Sep 5, 2025, 11:57:02 AMSep 5
to The Ring Programming Language
Hello Mahmoud, and all Ring Family.

You mentioned before that QML ring events is in your to-do list in this topic:

I wanted to create new ring Arabic application ,for android with QML.
but I surprised that ring is still not support events from QML, or even we can not access the QML objects from Ring code to set this events manually...

i do not have the enough knowledge for CPP  to create a sub library that helps me to do tis, 
also I asked AI but did not get myself to the right way...

So Please if you have a time to make this feature with new Ring Release

Best Wishes...
Mohannad




Mahmoud Fayed

unread,
Sep 5, 2025, 12:11:33 PMSep 5
to The Ring Programming Language
Hello Mohannad

Thanks for your suggestion, I am not interested in this feature at the current stage because I don't need it in my applications.

In a large open-source project like Ring, I don't provide contributions based on (feature requests)
Because large projects could be improved in many unlimited directions and each developer could ask about such improvements.

I am just like you and other developers in this group, I use Ring, and when I need something, I develop it and share it for others.

I hope that one of the other contributors will need this feature and/or decide to implement/share.

Greetings,
Mahmoud

Mansour Ayouni

unread,
Sep 5, 2025, 12:14:59 PMSep 5
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

I'm also interested in this feature and understand your answer. Still, I kindly ask you to share your vision of the best way to do this, in a way that give s us hint to do it the best way possible...

All the best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/78ec6429-cb79-4c19-b99f-791838d78209n%40googlegroups.com.

Mahmoud Fayed

unread,
Sep 5, 2025, 12:24:51 PMSep 5
to The Ring Programming Language
Hello Mansour

>> "I kindly ask you to share your vision of the best way to do this, in a way that give s us hint to do it the best way possible"

Qt provides example about calling C++ from QML and calling QML from C++

All what you need is getting one of these examples (QML code that call C++ code) then update the C++ code to call Ring code

Examples about C++ code that call Ring code already exists (Many RingQt classes does this)


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

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

So, in reality it's just about calling ring_vm_runcode() function, passing the VM pointer and the code string to execute

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Sep 5, 2025, 12:31:58 PMSep 5
to The Ring Programming Language
Hello Mohanned

>> "I do not have the enough knowledge for CPP  to create a sub library that helps me to do this"

Trust me, you have the knowledge and experience, you just need to do what we do with any programming task (Try & Error & Give it more time). 

I looked at your wonderful code in (Listen to Quran) application, and how you defined more functions in C++ to help you in your app, so you can :D

Just follow these steps

(1) Try to get one of the examples about calling C++ from QML, study this example and run it.
(2) Update this example to call Ring code 
(3) Based on (1) and (2) write more functions/classes.

Greetings,
Mahmoud

On Friday, September 5, 2025 at 6:57:02 PM UTC+3 mohann...@gmail.com wrote:

Mansour Ayouni

unread,
Sep 5, 2025, 12:32:21 PMSep 5
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

I ser now why you said it's simple to implement! Thank you very mutch.

Best,
Mansour

Mahmoud Fayed

unread,
Sep 5, 2025, 12:34:07 PMSep 5
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings,
Mahmoud

MOHANNAD ALDULAIMI

unread,
Sep 7, 2025, 6:00:47 AMSep 7
to The Ring Programming Language
Hello Mahmoud and  Mansour  ,

I'm working on the library, my cpp capabilities not professional but my code still good and work without memory leaks or crashes.

I'm sure this is a strong evedance about the easy cpp api of Ring,while a someone who doesn't have ability to create simple cpp projects can create a Ring Qt CPP library ...

my library now is provide:
- the abilty to call ring functions from QML.
- the ability to share RingQt object into a QML and access modify its properties.
- the ability to share QML Objects into Ring code and modify ita properties.
- Setter/Getter for QML objects properties.

I will share it as RingPM package,

But I needs your suggestions…:D

Best Wishes…
Mohannad

Mahmoud Fayed

unread,
Sep 7, 2025, 8:57:20 AMSep 7
to The Ring Programming Language
Hello Mohannad

This is very nice, feel free to share the RingPM package so we can try it.

Greetings,
Mahmoud

Mansour Ayouni

unread,
Sep 7, 2025, 3:41:46 PMSep 7
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

Please also share a small tutorial on how to do the link between QML and Ring in short examples.

All the best,
Mansour

Mansour Ayouni

unread,
Sep 8, 2025, 7:56:14 AMSep 8
to Mahmoud Fayed, The Ring Programming Language
Sorry, my last message was to Mohanned not Mahmoud.

Best,
Mansour

MOHANNAD ALDULAIMI

unread,
Sep 15, 2025, 8:54:44 AMSep 15
to The Ring Programming Language
Hello Mahmoud,

Please if you have a time give me a super simple example about adding list to another list using c code,

I spent more than 2 days of searching in ring source code/fastpro source and did not understand the concept ,
while a function called : ring_vm_addlisttolist is not useable as api in c because when use it i get link error...

Best Wishes 
Mohannad

Mahmoud Fayed

unread,
Sep 15, 2025, 9:25:40 AMSep 15
to The Ring Programming Language
Hello Mohannad

In Ring, lists contains items
Each item could be a String/Number/List

We can use 
List * ring_list_newlist ( List *pList ) ;
List * ring_list_newlist_gc ( void *pState,List *pList ) ;This will add an empty list to our list (i.e. sub list) as a new item, then return the list pointer of the new sub list

Using this sub list pointer, you can add items using normal functions used with lists

Search inside ring/language/src/*.c using ring_list_newlist and You will find many example in Ring Compiler/VM implementation

Greetings,
Mahmoud
Message has been deleted
Message has been deleted

max

unread,
Sep 15, 2025, 9:49:52 AMSep 15
to The Ring Programming Language

MOHANNAD ALDULAIMI

unread,
Sep 15, 2025, 9:59:29 AMSep 15
to The Ring Programming Language
Hello  Mahmoud, max
Thanks for your help , it worked as expected ...:D

it is easier than I thought ...

this was required for the QML lib ,to call ring language functions from QML with its parameters, and return the ring function value as typed from Ring (int,double,String)
According to return ring lists there is no a large benefit to return it because we can return list2json(alist) and in QML use JSON.parse ...:D

Best wishes...
Mohannad

Mahmoud Fayed

unread,
Sep 15, 2025, 10:00:33 AMSep 15
to The Ring Programming Language
Hello Mohannad

You are welcome :D

Greetings,
Mahmoud

Mansour Ayouni

unread,
Sep 15, 2025, 10:22:34 AMSep 15
to Mahmoud Fayed, The Ring Programming Language
Hello Mohannad,

Can you share a small tutorial on the necessary steps to call Ring from QML?

Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.

MOHANNAD ALDULAIMI

unread,
Sep 15, 2025, 4:01:21 PMSep 15
to The Ring Programming Language
Hello Mansour,

Of course, I'll share some easy-to-follow tutorials and samples. It should take about 2–3 days before I release this useful library (hopefully before the new Ring version is launched).

The concept is simple: you have a JS object called Ring. Everything you want to do with Ring is done by calling its methods. For example:

- Get a global Ring variable containing text:
  Use Ring.getVar("cVarName")
  Example for button text:
  button {
      text: Ring.getVar("G_MainBtnText")
  }

- Call a Ring event (no return value):
  Use Ring.callEvent("cEvent")

- Call a Ring function and pass parameters from QML:
  Use Ring.callFunc("cFuncName", aParams)
  Example:
  console.log(Ring.callFunc("substr", ["Ring and QML", " ", "_"])) // Output: Ring_and_QML

Key details:
- You can call any Ring function (not just built-ins).
- Parameters can be: QML objects, strings, numbers (int, double, bool), or JSON arrays.
- Return types from Ring: strings, numbers, JSON objects, or JavaScript arrays (as JSON objects).

This isn’t all—more features are coming once development is complete!

From the Ring side:
- Share QWidget objects with QML and interact with them.
- Retrieve a QML object by its objectName property.
- Update QML properties directly from Ring.

These aren’t all the features I’ve completed—there’s much more to come!

Note:my message enhanced by AI

Best wishes,
Mohannad

Mansour Ayouni

unread,
Sep 15, 2025, 4:08:15 PMSep 15
to MOHANNAD ALDULAIMI, The Ring Programming Language
Hello Mohannad,

Excellent work!

Since your are going to contribute the library to Ring then stay focused on its achievement. We will understand the implementation from the code and the examples.

Thank you very mutch!
Mansour

Reply all
Reply to author
Forward
0 new messages