Accessing NSWindow from C++/QT-based application - c++

I have an application that is written in C++ and is using QT as a framework. The compiler is gcc and the IDE is QT Creator.
On Mac OS, I need my app to interface with Spaces by accessing the collectionBehavior property of the NSWindow. So there should be a kind of a bridge from C++ app to NSWindow.
Can someone give me the hint on if/how this could be possible either with my current gcc/qtcreator setup (which I don't think is possible) or under xcode?

If you're using Cocoa Qt (there are 2 versions of Qt - Cocoa and Carbon, remember that!), you can use winId() on QWidget class to retrieve native widget handle.
On Qt Carbon QWidget::winId() returns HIViewRef, on Qt Cocoa it return NSView. I gues you can retrieve somehow NSWindow from NSView

Related

iOS notifications in Qt

I am trying to incorporate native notifications in my iOS application written in Qt + QML. For the desktop world I am simply using QSystemTrayIcon (works in Windows, macOS and Linux), for Android I am using a custom Java class called via QAndroidJniObject.
I don't know how to accomplish this for the iOS- is there a way to do this in C++ only?

Qt Creator, C++, Xcode

I'm a C++ developer and I would like to develop applications for OSX and IOS with my Mac.
I'd like to use Xcode to achieve these goals but apparently the best solution (that involves C++) is Qt Creator. (Let me know if I'm wrong)
Can I use the free version of QT Creator (community - no license fee) to code in C++ for iOS/OSX and publish my apps on the Apple Store or do I need the indie mobile license?
Can QT be integrated in Xcode?
Thank you
I'm just getting into OS X and iOS development using Qt 5.3.2. It looks like that you use Qt Creator to create an iOS (or OS X) project. Then, Qt Creator makes use of Xcode for the build.
I've successfully created a OS X project using Qt Creator. It is a QML project with a C++ plugin that I created. So, I believe that you can use Qt Creator to create a pure C++ project for OS X. But give Qt Creator a shot and see if that is true.
Now, for iOS, I think you'll have to create a QML project. You can always use C++ to add functionality. However, I am having trouble getting a C++ plugin to compile in an iOS project. But, I think that it is just a matter of finding the solution.
The workflow for OSX/iOS app development is quite simple. You develop your application as usual in Qt Creator. Each time qmake is called on your code, it created an Xcode project xxx.xcodeproj where xxx is the application name specified in your .pro file.
Hence, when you have completed the development process, you can open such a project and finalize the app packaging/submission via xcode. The created project includes all the necessary framework dependencies and is ready to be archived, i.e. packaged for AppStore submission. The submission is a tedious task, see here for example.
You can absolutely submit the app to the AppStore, even with the community license. Mind that you are subject to LGPL. This aspect is treated in full detail in this recent blog post.
If you're developing for iOS and OS X only - use native tools, i. e. Xcode. Qt library and Qt Creator IDE are best used for cross-platform development, but not for native OS X development.

OS X fullscreen in wxWidgets 3.0

I contribute to a cross-platform application which is built using wxWidgets stable version - 3.0.2.
I would like to enable the app to use the native fullscreen system on OS X Lion and above. This feature is implemented in current development versions of wxWidgets, but not in 3.0.2.
I understand that it should be possible to call the native Cocoa API from within the wxWidgets app to enable fullscreen mode, but I can't work out how to do so and can't find any information online.
How can I directly access the NSWindow class from my wxWidgets C++ code?
For reference, this question asks how to do the same with wxPython, and gets an answer - but python is different enough from C++ that I can't work out how I would do it in standard wxWidgets.
You can use wxWindow::MacGetTopLevelWindowRef() to get the NSWindow. See this commit for what you can do with it afterwards.

Qt 4.x/5.x and OpenGL for Desktop Gui application: What module to choose?

I am starting a new GUI application project using Qt and OpenGL for Linux/Windows desktops. My assumptions so far: use Qt GUI (C++ ... not QML/QtQuick 2) with OpenGL 4.1 or higher (requirement). After some reading, I am completely lost about what path to choose. What path will keep my application future-proof in term of support and libraries.
Qt 4.x or Qt 5.x?
Standard OpenGL or QGL or QOpenGL or QtOpenGL wrappers?
QWidget/QGLWidget (Qt 4.x) or QWindow (Qt 5.x)?
The application is intended to run in desktop environment and will do a lot of file (geometry) opening/saving, instanced 3D painting and some imaging. Could someone point me out to the best combination to choose with some explanation if possible?
Sean Harmer presentation on Qt 5 and OpenGL did answer some parts of my questions but I was a bit lost when he started using QML and QtQuick 2. I felt like QOpenGL was a lightweighted version to be used with QtQuick 2. Correct me If I am wrong on that please.
Qt 5.0 is still in beta, therefore if your project is serious, you should go with qt 4.8, because that is the latest stable release. However, if you must have some Qt 5.0 features, then you have no other choice but to go with 5.0.
Since you chosen Qt, you should stick to it. That means using QtOpenGL. That doesn't mean you are not going to use standard OpenGL. QtOpenGL provides you API to simplify some OpenGL calls, and make them more object oriented. After all, OpenGL is set of C functions, not set of c++ classes.

Qt Quick how to create a button that will loock native to each OS app is used in?

What I need is simple: qml way to create a button that would loock native on each platform app is compiled to? (mainly I wonder about linux, windows and Mac OS X)
There's nothing built-in.
But there is a project called Qt Quick Components, mainly for mobile platforms. There is also some development for desktop platforms, see http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/
There may not have been anything built-in when you asked this question, but QtQuick.Controls 1.0 was officially released as a part of Qt 5.1. It has a Button component that should tries to match the native look and feel.
The QtQuick.Controls module is basically the Qt Desktop Components project that blakharaz linked to in his answer. It just has a new name, is more developed and is better integrated now.