According to wikipedia, QML is a declarative, reactive, scripting programming language. It also seems to be a unique language. Nothing similar to it apparently exists, while many other programming languages in wide use today shamelessly copy ideas from one another.
Do there exist programming languages or approaches within a language (such as within C++), that mimick QML?
The reason that I'm asking is because that I'm trying to implement my own QML-like language and compiling it into Lua, but it is hard work. Something even remotely similar to QML might do the job instead.
In the same year QML was released (2009), Microsoft released XAML.
XAML works together with C#, like QML and C++ do. JavaScript is also integrated.
<canvas debug="true">
<button name="button1" text="Click me !">
<handler name="onclick">
parent.button1.setAttribute("text","Hello, World !"); // JavaScript-Code
</handler>
</button>
</canvas>
Related
I am currently learning GTK, specifically gtkmm. As i can see GTK has excellent support in different languages through bindings. So one can use c, c++, js, python and more to implement gtk apps. Thats great. But what if i wanted to create one application, say the base window and some api objects/instances in gtkmm and c++ and want to let others create modules in any other language that has gtk binding. I want to share the api objects/instances (say they are singletons) between all modules. But i definitely don't want to spawn multiple processes for this to work. I know boost has support for exposing c++ objects into python modules. I am looking for something like that. But from the documentation so far (i haven't finished it yet, so forgive me if i have missed anything), i couldn't find the proper way to do that.
My long term goal is to make HCI development for embedded devices, and by embedded I really mean it, not phone devices.
I've been working on Qt Widgets for a month now, avoiding Qt Quick for some reasons (I feared that QML code wasn't optimize), but yesterday I have watched this video :Youtube
The speaker says at the end : "If you're making an embedded product these days, use Qt Quick, especially now in 5.8. There's no excuse not to use Qt Quick"
But on the contrary, he explains that for embedded devices we should use c++ code, not JavaScript.
I don't really get it, does it means that I have to create all my objects in c++ code and make my architecture using Qt Quick ?
I don't really get what Qt want us to do. Is it just communication, since they don't want to optimize the old and stable Qt widgets, or is Qt Quick really the solution for embedded devices ?
I personally think that Qt is not the solution for embedded devices, as they keep evolving, changing strategy, and seems not to know where they are going.
I apologize for this non-algorithmic question, and thank you for all your answers.
I can't speak to the developer's intent, nor can I speak for other developers. I can only speak to what I understand, as a developer that has been designing embedded devices for 40 years (sorry for being a number dropper).
C++ or JavaScript? I don't feel that question has too much to do with whether you use QtQuick or not. Sure, you can embed some JaveScript in QML code (with limitations), but you can also use C++ in the same code base (just not embedded in the QML). Then there's Python. Both Qt and QtQuick are programming frameworks, and are somewhat language agnostic.
My perspective is that QtQuick is a good, portable way to create your user-interface code. In my current project (a multi-axis industrial servo-control system) I use QML for the user-interface (with a little JavaScript where needed), C++ for the bulk of the higher level processing (like network control and data-streaming), C and assembly language for the lower levels (those routines executed in uC's and DSP's). QML and C++ interface together nicely, in my opinion.
I believe the speaker is getting at the idea that most if not all your business logic should be done using a C++ model back-end. It is possible to do all your logic just in QML with embedded JavaScript however, because JS is an interpreted language its performance at run-time can possibly be less than compiled C++ code(dependent on how well the C++ is written).
Essentially you only want to use JS to manipulate graphical components while using C++ with QObject models to update the QtQuick elements' individual properties.
This is mentioned in the Qt Quick Best Practices wiki,
https://wiki.qt.io/Qt_Quick_Best_Practices
i want to know how to create events like mouse events or onkeypress (hotkey) event etc in c++ but not the in Microsoft visual c++ environment....
if you can suggest any ebook or any tutorial to learn from.....
thanks in advance
There are no such thing as "events" in C++.
Those only exist in a specific programming framework. Since you mention "Visual C++", I assume that you're thinking of Windows Forms, which is an object-oriented wrapper for the Win32 API that allows you write applications targeting the .NET Framework. The .NET Framework supports events, delegates, and other handy features, but those have nothing to do with the C++ language.
You will need to use whatever environment is required to support the framework you're programming to. For .NET WinForms applications, that is generally Microsoft's Visual C++. However, you can use whatever text editor you want. This has nothing to do with the IDE and everything to do with the compiler and the target framework.
Learn Qt, wxWidgets, gtkmm -- they all have events in some form.
Qt have visual designed like in VS, but not require you to use it.
C++ itself have no standart way to get GUI, events (and a lot more, in fact)...
boost.signals documentation and tutorials will give you a good start.
libstdc++ is another alternative.
I am going to code a text/code editor (GUI with QML and the rest in D*). But I have several problems:
I code the GUI with QML and C++ and then I connect it with a D-Backend for formatting etc. purposes. What is the best way to connect different Languages? Pipes, Sockets or in D the ability to use C++ Libraries?
IMHO rich text is used to format the text (in most cases). How is it possible to edit this "markup" in an easy way?? Is the formated code like a background image and the user edits an opaque non-formated-text?
Are there common techniques?
*Because QML is cool, platform indepedent and fast. On the other hand D is powerful and easy to use.
As you might know, there is QtD, Qt binding for D. It's not production ready right now, but it might be some day.
Another option would be connecting C++ and D, through C wrapper. This is the most commonly used way of interacting between C++ and D.
extern(C++) interfaces are specific to DigitalMars C++ compiler on Windows and are very limited, so that probably wouldn't help with your problem.
Also you might want to look at SWIG. It's a tool automatically generating glue code for interaction of other languages with C++. It supports D.
If performance is not an issue communications with D code could work through sockets or pipes.
QML isn't for WebApp. It s QtQuick Markup Language. The 'new' way to do UI at Qt. And QWidget will probably be deprecated in favor of QML in Qt5.
I've try to do the same thing. But i fear that qml isn't ready yet to do things like that. Most element available today are just good enought to draw image, rectangle, listview, one line text input and do transition.
I was trying to achieve that by coloring with python and pygments, too slow, using html3.2 style to do that isn't the right way. But it's the only way to style text in qml textedit. ;(
QtQuick 2.0 should bring better text control.
I'm starting an institute project. I'll try to create a "web-typograph", a tool that's to be used to correct texts (according to typographic rules of a language) before they're sent to the site. My choice is C++ with Qt because I'd like to create "multilingual" library (I mean it could be used from Ruby, Python, PHP and so on).
Honestly, I heard something about QtRuby, QtPython (even PHP Qt...) but I just can't imagine, how I can bind my library with them.
P.S. Yes, I've googled. But some comments of the experienced would be nice :)
PyQt and the other bindings to Qt are bindings to the core Qt library. To add bindings to your own (possibly Qt-based) classes, you'll have to use tools like SWIG or SIP (PyQt's tool which may be more relevant for Qt-related classes) to generate the bindings. Alternatively, you can make a C API to your library which is easier to wrap and bind from scripting languages.
That said, you should first understand what you need Qt for at all. Are you planning a GUI or using any other capabilities Qt provides? Which?