Use Apple Pencil through Qt framework - c++

I want to port my Qt application to use the apple pencil on an iPad Pro. Currently, my app uses QTabletEvent to draw to a QGraphicsScene using a Wacom enabled device. I'm planning on trying to handle events from apple pencil with objective-c++ and feed it into Qt's event system. I've never used objective-c++, what are some good tutorials to try to solve this problem? I'm specifically looking for how to pass events from objective-c++ to Qt.

You can call any Qt code from methods in Objective C++ code. You can easily create new events and post them to your application.

Related

How to embed a native window into QML component?

I'm developing a cross-platform SIP application based on PJSUA2 for the core and QtQuick for the GUI.
PJSUA2 provides an API for displaying the user's capture devices as well as the remote party video stream. Such an API exposes a native window handler for a given video. The native window handler is platform-specific (HWND on Windows, NSView* on Mac, etc).
I'd like to embed this native window into a specific QML component, let's say a Rectangle.
Is that possible?
FYI: I'm using MacOS Sierra 10.12.6, PJSIP 2.7 with SDL backend and Qt 5.9.2. But I'd like to make it work on both Windows and MacOS.
You cannot. You can't even include a QWidget inside a Qt Quick Item.
To give you somehting to chew, you can take a look at https://github.com/vlc-qt/vlc-qt .
They offer QWidgets and QtQuick Items that allow to use VLC to play videos.
They use a window handle (HWND) for the widget (https://github.com/vlc-qt/vlc-qt/blob/master/src/core/MediaPlayer.cpp#L217).
But for Qt Quick they copy each video frame into a QSGNode (https://github.com/vlc-qt/vlc-qt/blob/master/src/core/VideoStream.cpp#L111 and https://github.com/vlc-qt/vlc-qt/blob/master/src/qml/rendering/VideoNode.cpp#L32).

Integrating CLIPS with Qt

I've been trying to build a GUI with Qt. However, I have no idea how to integrate CLIPS with the signals and slots of Qt.
For example, in the GUI if a user presses ctrl+r it should run the source file entered. Similarly, the agenda has a different window which updates as the rules are loaded. How can I integrate all of this with Qt?
I'm also open to any ideas you may have about building a frontend for CLIPS.
Thanks
Take a look at CLIPSShell on SourceForge: https://sourceforge.net/projects/clipsshell/. It's written in Qt.

How does one build a custom native OSX webkit widget in Qt/C++?

How does one build a custom widget in Qt/C++ (version 5.5) that loads the native OSX webkit? I read this tutorial but need to do something more powerful because Qt doesn't already contain the native webkit.
Qt 5.5 has a "tech preview" for the native webkit, but it's buggy -- when you load form controls, they appear all wonky.
I've taught myself some Objective C. So, I was wondering if I had to build something in Objective C and then somehow load it inside Qt/C++?
Or, perhaps I can build the interface in Objective C and then have it call Qt/C++?
Ultimately, here's what I want:
Uses native OSX webkit, not the one bundled with Qt, not the tech preview.
Embeds a link to my Qt/C++ class in Javascript. So, I can do something like: var sFileSelection = cpp.selectFile('*.txt'); and it calls a Qt class method selectFile(QString sFile) to do work such as show a popup select file window, and then Javascript receives this back in sFileSelection.
The better solution that has been proposed is to develop the app's GUI in Objective C, and then call a Qt/C++ Dylib (the equivalent of a DLL on Windows) from the Objective C to do the heavy-lifting. (Assuming you prefer to do most of the coding in Qt.) The drawback of the Qt Dylib is that it cannot draw GUI components or show things like a file dialog because it has no application context handle to use for such things. Therefore, those GUI things must be called from ObjectiveC. However, one can have the class method in Qt and then it can send a message back to ObjectiveC to call one of its own class methods.
As for how to load a Dylib created with Qt inside an Objective C application, that's another question entirely.

How to create VST plugin using MFC?

I already have an MFC gui standalone program. What should be done to make it a VST 2.x plugin? (It would a lot of rework if I use VSTGUI/win32/qt/etc - or is it possible/appropriate to use VSTGUI?)
Which VST interfaces (gui and others) should I implement for VST 2.x gui plugin?
You are worried about the GUI of a VST when in fact you should be worried about the structure of the rest of your code. VST 2.x hands you a HWND for a frame, all you have to do is create a child window that hosts your GUI. MFC, raw WIN32 - does not matter.
However, the real 'problem' is in the rest of the VST 2.x interface. You should study this interface and learn how it works. Then you'll be able to assess if your code is in the correct structure to easily interface as a VST plugin.
you just need to slave your window code to the HWND you're given. The easiest way is just to slave your whole window using SetParent, and then implement MFC like you would in a normal app.
However, there are no knobs, nor digital or analog readouts. Even with MFC if you want to make a polished VST interface you'll be rolling your own UI code either way.
So it's almost worth it just to handle the WM_XXXX messages and do the windowing and drawing all yourself.

How do you create a textbox in C++ and DirectX 9 for games?

I'm currently working on the menu for a game and I've tried searching for information on how to create a textbox within the menu for some particular options such as the name of the player, and I haven't found any useful information about it.
I am using DirectInput for the keyboard input for the game itself, but it seems that would be far too 'over-sensitive' for typing into a textbox. How would I create a textbox that could reliably accept input?
When it comes to game UIs, they rely upon non-OS primitives so that they can be styled and flow exactly as the game designers intend. Also using non-OS primitives allows better integration with the game engine. A popular open source game UI toolkit is CEGUI. If you want a UI toolkit for debug purposes I'd look at AntTweakBar. And finally a UI toolkit provided by the DirectX SDK is the DXUT (Look at DX9 SDK samples for the DXUT 9 version).