I read this advice:
How do I use Qt and SDL together?
and now I have question connected to it. This example was created for Linux, but how use it under Windows? winId() under Windows return WinAPI Handler for widgets, other then Linux. Is there any possibility to use SDL under Windows with Qt?
Yes.
Both of them are portable frameworks and tools. I think there is no huge problem but maybe there is some easy compilation issues.
Note: winId() returns OS-specific value such as HWND for Windows, HIView for Mac and Window for X.
Returns the window system identifier of the widget.
Portable in principle, but if you use it you are probably about to do
something non-portable. Be careful.
If a widget is non-native (alien) and winId() is invoked on it, that
widget will be provided a native handle.
On Mac OS X, the type returned depends on which framework Qt was
linked against. If Qt is using Carbon, the {WId} is actually an
HIViewRef. If Qt is using Cocoa, {WId} is a pointer to an NSView.
Related
I'm running Lazarus Pascal (1.4.2, FPC 2.6.4) on a Intel Mac OS X (10.10) and would like my application window to be visible on all virtual desktops (Spaces). How can I achieve this?
I'm using the Carbon widget set, as the Cocoa widget set is still in early stages of development.
Note: I realize this question is very similar to this StackOverflow question, however that question is geared towards Objective-C. I have no clue how (in Carbon) to use the code suggestion. Mostly because it is Cocoa specific, but also because I have no idea how to link this behavior to my TForm - if that is even possible.
You can use method setCollectionBehavior: of NSWindow with the
NSWindowCollectionBehaviorCanJoinAllSpaces bitwise flag.
Since I can apply the "All Desktop" option in Finder, when I have multiple virtual desktops/spaces, maybe there is an alternative to set this outside of the application? (i.e. something like using "defaults" in Terminal)
I need to develop an application to interact with an FPGA through TCP in a Linux environment. Given that I'm mainly an OS X guy and have only had minimal exposure to Linux, I figure that writing in Qt, which I'm slightly familiar with, in OS X will be the easiest way to get the job done.
Anyways, I was pretty disappointed after getting set up with Qt Creator, given that I'm used to Xcode and Storyboards for iOS development. I'm sure that if I stuck with it I'd figure out my way around, but I don't plan on ever doing much Qt in the future; if I am making something that needs to look pretty, I'd rather do it natively.
Long story short, is there any way that I can use Xcode/Storyboards to create my application's UI? Or any alternative to Qt Creator that would better suit someone who's most comfortable with Obj-C/Cocoa?
Two options in Qt for designing UI
Programmatically, using the Qt class Widgets
Use Qt Creator's designer
I don't believe there is any current method to create the UI with Xcode and Storyboards. You could just use Qt Creator to design the UI, then import it into your XCode project, but learning Qt Creator and using it for what it does best is probably going to be easier for you in the long term.
Note that you can use Objective-C with Qt, in Qt Creator.
Like with toolkits such as qT, wxwidgets and such, how does an API designer provide and api that is the same, even though it calls totally different system calls to do so? For example, in Windows OS you have to mess around with a whole lot of functions in the GDI. On Linux you have to mess around with a whole lot of functions in XLib and whatever other layers the distribution has on top of in. So how how can you design an widgit kit that can unify all that functionality? so that say CreateWindow() will create a windon on any platform? I don't comprehend how this can be done.
Instead of using Xlib or GDI, you could use something that is more universal. For example, you could use OpenGL, which is supported everywhere. I think that is what Blender's UI does.
Some toolkits can be modified to use some kind of backend for each platform they support. This is basically what Qt does. On Mac OS X, Qt apps use Cocoa as a backend. Qt for OS X was made specifically for that OS. However, there are other Qt implementations on other platforms, so that's what makes Qt work on more than one platform. SWT for Java works the same way (using the OS's native toolkit as a backend).
Other toolkits can use some kind of high-level layer to render. For example, Swing for Java is rendered purely using Java APIs, and is not tied to any platform at all.
Is it possible to get the pointer or the window number of the underlying NSWindow of a JComponent on Mac, using JNA. I found methods getWindowID and getWindowPointer in com.sun.jna.Native. The documentation mentions getWindowID is for X11 and getWindowPointer is for win32. Is there a similar function for Mac OSX ?? I know how to get the cocoa window of a component using a JNI function but I am interested in using something in Java without writing a JNI function.
-Thanks,
Abhinay.
If you know how to do it in jni, then you most probably can do it with JNA. But, you would have to create your own mapping to cocoa libraries or see if rococoa already has what you need.
getWindowPointer() does the same thing for Mac OSX (it returns a pointer corresponding to the cocoa view ref). You may have to do additional manipulations to get a reference to the exact reference you need; as Denis suggests, rococoa likely has some utilities that would provide useful.
I am porting a windows only application to run on mac as well using Qt. We had a third party library for the spell checking on windows which isn't available for OS X. I would like to tie into NSSpellchecker using Objective-C or Objective-C++. I have looked around quite a bit and found one half solution of using a custom widget. We would prefer to have it abstracted out in a class that checks instead of the widget so as to not have to use a different widget depending on operating system. I am confident in my ability to write the class for checking and that shouldn't be an issue.
My question is if I will need to create a custom UI that houses the suggestions/options or if OS X has a stock spelling grammar panel that we can just tie into?
Does anyone have experience doing spell check with Qt on Mac? We are using Qt 4.8+ and targeting Win7 / Snow Leopard.
To answer your question I don't know and I don't think there's a stock Qt widget to do it. This list covers pretty much every Qt widget you can use: enter link description here
As a solution you can use hunspell (http://hunspell.sourceforge.net/) directly even on Windows. It's used in Libre and Open Office and also used by MacOSX.
And to implement it you can use QCompleter (enter link description here).