Skip to content

mohannad-aldulaimi/ringqml

Repository files navigation

RingQML Extension

A simple-to-use library used to interact with QML (Qt Meta-object Language) using the Ring programming language.

📋 Requirements

Build Requirements

To build the extension from source, you need:

Usage Requirements

To use the library in your projects:

📱 Note: All Android applications have been tested using the Samsung Galaxy S25 Ultra.

📥 Installation

Option 1: Using RingPM (Recommended)

You can install the package directly using the Ring Package Manager:

ringpm install ringqml from mohannad-aldulaimi

Option 2: Manual Installation

  1. Download this repository.
  2. Load the library in your code from lib/ringQML.ring.
  3. Ensure the DLL is accessible. Use loadlib to load src/Build/RingQML.dll.

💻 Usage Example

Here is a simple example showing how to load the library, create a Qt Application, and render a QML window with a green rectangle and text.

main.ring

load 'guilib.ring'
load 'ringQML.ring'

new qApp {
    oQML = new RingQML(NULL) {
        loadContent(getMainQml())
    }
    exec()
}

func getMainQml
    return "
        import QtQuick 2.15
        import QtQuick.Controls 2.15
        import QtQuick.Window 2.15
            
        Window {
            visible: true
            width: 400
            height: 400
            title: 'Ring QML Loaded'
            
            Rectangle { 
                anchors.fill: parent;
                id: myRedBoxRoot
                width: 500
                height: 500
                color: 'green'
                
                Text {
                    id: myText 
                    text: 'Ring QML Is Loaded'
                    font.pointSize: 20
                }
            }
        }
    "

Using Qt 6 with RingQML

Because Ring defaults to Qt 5.15, you must download your preferred Qt 6 version yourself (e.g., Qt 6.10.2). You can then use the useQt6(path) function to point the library to your Qt 6 compiler path, and it will handle the rest:

load 'ringQML.ring'
load 'ring_qt_qml.ring'

// Point to your custom Qt 6 installation
useQt6("C:\Qt\6.10.2\msvc2022_64")

new qApp {
    oQML = new RingQML(NULL) {
        loadContent(getQt6SimpleCodeContent())
    }
    exec()
}

📚 Documentation

Detailed documentation and guides on how to use the library features are available in the DOCS folder:

  • Getting Started Guide - Learn how to set up RingQML and load your first QML interface.
  • RingQML Class Reference - A complete reference to every method available in the library such as setWinIcon, shareImage, and NewComponent.
  • Interactivity and Data - Learn how to communicate bidirectionally with QML, including using direct native calls via oQML.root.
  • Components and Snapshots - Explore advanced features like instantiating ad-hoc QML elements and taking visual widget snapshots.

📂 File Structure

  • DOCS: Contains detailed Markdown documentation pages.
  • libraries/RingQML: Contains *.ring files (Ring library).
  • src: Contains C/C++ and Qt project files for the extension.
  • bin: Contains RingQML.dll file.
  • samples: Contains usage samples files.
  • tests: Contains simple *.ring files for testing.
  • projects: Contains applications developed using the RingQML extension.
  • QMLClasses: Contains *.cf files for the Ring code generator that generates code independent of the guilib.ring library.

📄 License

This project is licensed under the MIT License.

✍️ Author

Mohannad Alayash

About

A simple-to-use library used to interact with QML (Qt Meta-object Language) using the Ring programming language.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages