Giter Site home page Giter Site logo

dqml's Introduction

DQML

Build Status

QML binding for the D programming language

Supported features

  • Creation of custom QObjects
  • Creation of custom QAbstractItemModels
  • Creation of QML instantiable QObjects
  • Creation of QML instantiable Singleton

Requirements

  • Install the DOtherSide library 0.6.3 or higher
  • Install dmd 2.071 or higher

Build instructions

Linux

  • Compile and Install DOtherside in your system PATH (i.e. /usr/lib)
  • dub fetch dqml

Windows

Due to the shitty linker used by DMD (optlink) on windows. Using this bindings it's a little bit more complicated on this platform. Basically the hard part consists in generating a valid .lib for the DOtherSide.dll. I wrote a step by step tutorial, that you can read here;

dqml's People

Contributors

9il avatar drug007 avatar filcuc avatar katafrakt avatar shalokshalom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dqml's Issues

[enhancement] System tray icon support?

Native QML does not provide support for system tray icons, instead one needs to leverage QT and bind to QML as shown here or here. Would it be possible to get support for this into dqml?

Specifically, the functionality I am after is this:
One tray icon with two actions "Show" and "Quit", the former of which shows a specific window (maybe by its QML id?) if it is not yet shown (and focuses it), while the latter quits the QML application. It would also be nice if tray's icon could be loaded from QT's Resource system.

[enhancement] Receive events in D

Looking at the examples I figured out how to send signals to QML, but not the other way around. If it not implemented, I would like to request it. My use-case:

  1. D: Instantiate a (generic) controller logic (D class inheriting QObject) and expose it via engine.rootContext.setContextProperty
  2. QML: Dynamically create a new QML component chatWindow, fetch a specialised controller chat (D class inheriting QObject) from logic and pass it to chatWindow as one of its initial properties
  3. QML: chatWindow registers itself with chat via one of the latter's methods
  4. D: In that registration, chat binds to chatWindow's destroyed signal a callback that destroys chat itself

The result: When chatWindow gets destroyed the corresponding chat gets destroyed automatically.

Sadly, Component.onDestruction cannot be used in this context, as that would result in chatbeing destroyed while the destructor for chatWindow is still running, causing a bunch of QML null type errors, one for each reference to chat in chatWindow.

Now the first two steps are easy to do with what dqmlcurrently has. However, I'm at a loss on how to accomplish the last two steps without modifying Dotherside/dqml.

Problem with QVariant and QObject

Hi,

it seems that wrapping a QObject inside a QVariant does not work properly. The void* inside the QVariant for me points to a wrong address.
The following code prints e.g.: '55AF7A0C72E0 7FD2A2F15680', which are not the same addresses.

SomeQObject q = new SomeQObject();
QVariant qv = new QVariant(q);
writeln(qv.voidPointer, " ", cast(void*)q);

Similiarly when I have a QSlot() that accepts a QVariant and call the Slot from qml with a QObject I receive 'null' in the slot.

Any ideas?

Using `connect`

What is analog this in dqml?

connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*)));

context is here

I tried

connect(this, "windowChanged", this, "handleWindowChanged");

but got

QObject::connect: Use the SIGNAL macro to bind DQmlOpenGL::windowChanged

Example receivesignals provides example for more simple calling.

Improve the qobject connect syntax

We should support a static connect syntax that doesn't use strings.
Basically like Qt5 new connect signals
connect(sender, pointertofunction, receiver, pointertofunction) in order to have compile time checking.
Try to move some connect details to the C++ DOtherSide library in order to share some code with other bindings

Linker error compiling helloworld

Hi Filippo,
I have tried to compile helloworld

$ cd dqml/examples/helloworld/
$ dub build --verbose
/home/dao/.dub/packages/dqml-0.6.1/dqml/source/dqml/qobject.d(109,13): Deprecation: foreach: loop index implicitly converted from size_t to int
....
Linking...
/usr/bin/dmd -of.dub/build/application-debug-linux.posix-x86_64-dmd_2085-62B3124FD7CA697A98D4DCCFD778CEA8/helloworld .dub/build/application-debug-linux.posix-x86_64-dmd_2085-62B3124FD7CA697A98D4DCCFD778CEA8/helloworld.o -L--no-as-needed -L-lDOtherSide -g

/home/dao/.dub/packages/dqml-0.6.1/dqml/source/dqml/qabstracttablemodel.d:58: error: undefined reference to 'dos_qabstracttablemodel_create'
....
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

I downloaded DOtherSide from here then:

# pacman -U DOtherSide-0.5.2-1-x86_64.pkg.tar.xz

then:

$ sudo ldconfig

My environment

$ uname --all
Linux abe 5.0.2-arch1-1-ARCH #1 SMP PREEMPT Thu Mar 14 18:47:49 UTC 2019 x86_64 GNU/Linux

$ dmd --version
DMD64 D Compiler v2.085.0

$ dub --version
DUB version 1.14.0, built on Mar 17 2019

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.