views:

451

answers:

9

Hey guys, I've been developing for Windows and *nix platforms for quite some time, and am looking to move into Mac development. I am tossing up between using ObjC/Cocoa and C++/Qt4.5.

The C++/moc semantics make more sense to me, and improving knowledge in Qt seems like a sensible thing to do given that you end up with a skill set that covers more platforms.

Am I likely to handicap my applications by skipping Cocoa? The sample Qt applications look pretty Mac-native to me, but they are quite simple so potentially don't tell the whole story. Are there other pros to the Xcode way that Qt won't hit, such as packaging, deployment, etc.?

Cheers,

Scott

+10  A: 

Here's an easy way to answer it:

If you were developing a Windows app with .NET or MFC, would you handicap your applications by using Qt? If the answer to that is yes, then the situation is likely to be the same on the Mac.

A few negatives I can think of off the top of my head:

  • Licensing
  • Qt apps, while good, are not completely a native UI experience and there's things a native UI designer can do in Cocoa which boggle the mind. While I can't be sure that all the same functionality isn't available in Qt, I doubt it.
  • Qt is always a little behind. If Microsoft or Apple come out with a great new technology, you have to wait for the Qt developers to update Qt.

However, with all that said, only you can determine the business value of using Qt. If you think cross-platform development is going to be a major part of your development, then Qt might be worth it, despite the issues mentioned.

Wade Williams
Well explained, thanks! I think the QT licensing is quite liberal since Nokia took it over.
Scott
These days QT is licensed under the either LGPL 2.1, GPL 3.0 or a commercial license, so it's very flexible. The LGPL is perfectly good for commercial apps, provided you follow a few simple requirements (dynamic linking simplifies many things). See http://qt.nokia.com/products/licensing for the full details.
gavinb
+1  A: 

Depending on what kind of apps you want to write, another contender is REALbasic.

The move from C++ is pretty easy (I have 15 years C++ experience) and the framework and IDE extremely productive. You have the added bonus of being able to deploy to Linux and Windows with trivial effort.

The big reason for learning Cocoa and coding in Objective-C is if you want to hone your iPhone skills or are chasing a really fancy user experience. If you wanted to rival the cutting edge of WPF development then I'd recommend Cocoa.

Andy Dent
+1  A: 

I'm currently developing both with QT (actually PyQT, but it makes no difference to your question) and native Cocoa app. For me it's no brainer, I'd chose Cocoa. It's really worth time to explore Cocoa in general, there are many great concepts within the Cocoa framework, and Objective-C 2.0 as well.

piobyz
Cocoa seems like a strong API. The message passing semantics really seem to make sense for UI / callback stuff.
Scott
If you'd like to explore Objective-C in more depth I recommend Learn Objective–C on the Mac (http://www.apress.com/book/view/1430218150) and for Cocoa a classic book is Cocoa(R) Programming for Mac(R) OS X (http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619).
piobyz
+3  A: 

DO NOT use Qt for a Mac app. You will get no hardware acceleration for 2D rendering, and you will not be able to deliver ADA compliance.

NSResponder
No hardware acceleration? That is a pretty big concern.
Scott
Another thing you should keep in mind is that if you require technical support, Apple supports Cocoa. Apple does not support Qt.
NSResponder
Don't you get ordinary OpenGL acceleration for your 2D UI elements?
e8johan
+1  A: 

I'd use Qt if you want this to be a crossplatform application.

joemoe
The Mac OS realizations of my cross-platform apps are shit. Don't do it. Good mac apps are made by mac shops.
Jonathan Sterling
+1  A: 

I do a lot of cross-platform development (Mac, Windows, Linux), and for some projects use Qt. It is a fine framework, and provides a rich class library. If you need to deploy on multiple platforms, cannot afford to spend the time/effort on platform-specific front-ends, or the "generic" support for each platform is sufficiently good, then use Qt.

However, Qt inevitably suffers in some ways from the lowest common denominator syndrome, and sometimes does not feel quite native enough. There are also certain features that are either difficult to support, or are simply not provided in the Qt libraries. So if you can afford the time and effort, or your app really demands the attention to detail and fit & finish, then developing separate front-ends may be worth it.

In either case, you ought to be writing your back-end (aka domain) code in a platform-neutral and front-end neutral manner. This way, the front-end is easily replaced, or modified between platforms.

You could always start with a Qt front-end and go for a quick time to market, then develop a native front-end down the line.

In practice, I've noticed that a Qt app on Windows looks most "native", while on Mac there are certain subtle telltale signs that make it look/feel not quite right. And Mac users tend to have much higher expectations when it comes to UI/UX!

gavinb
"You could always start with a Qt front-end and go for a quick time to market, then develop a native front-end down the line."This is an exceedingly bad idea. You only get one chance to make your first impression.
NSResponder
+2  A: 

Ask yourself: how many of the best Mac applications that you know of use Qt instead of native Cocoa?

For our robotic systems, we originally wrote our control software in C++ using the cross-platform wxWidgets library (we avoided Qt due to some licensing concerns), because we felt that we had to target Windows, Linux, and Mac platforms for our end users. This is what we shipped for over a year until I started tinkering with Cocoa.

Right away, the thing that most impressed me was how quickly you could develop using Cocoa. Eventually, we decided to drop support for Linux and Windows and rewrite our entire control applications in Cocoa. What had taken us years to put together in C++ required only three months to completely reimplement in Cocoa.

Aside from the "lowest common denominator" interface issues that others have pointed out, the rapid development allowed by Cocoa has become a competitive advantage for our company. Our software has advanced far more quickly since our conversion to Cocoa, and it has allowed us as a new company with one developer to pull even with 10-year-old competitors that have 20-man development teams. This appears to be a common story in the Mac development space, where you see a lot of small teams who are able to create products that compete with those of much larger companies.

As a final note, using Cocoa gives you the ability to stay on top of the new APIs Apple is continually rolling out. We're now working on a new control interface that will make heavy use of Core Animation, something that would be painful to deal with using Qt.

Brad Larson
+2  A: 

You can have a look at the QMacCocoaViewContainer class. It acts as some kind of wrapper for generic Cocoa views, so you can also have Cocoa elements which are not officially supported by Qt.

Of course this means learning a little about Cocoa and Objective C and how a Cocoa UI would need to look like. But if you already know Qt well and if it’s not like your application is all and only about the GUI this could be a good way to go.

And don’t forget about the QMacStyle::WidgetSizePolicy or you won’t understand why your tables come out so huge.

Debilski
+1  A: 

Since posting this, i've been learning the Cocoa / Objective-C way, and have been quite impressed. Despite what I initially thought was quite a quirky syntax, Objc appears to be a very effective language for implementing UI code, and the XCode sugar - things like Core Data and bindings - make short work of all of the boring bits.

I spent a while with the QT examples and documentation before digging into cocoa, and tend to agree with what has been said above w.r.t being slightly behind the curve and less 'aqua-ish' - albeit from a fairly trivial inspection. If I absolutely had to be build a cross-platform app i'd probably use QT rather than trying to separate out the UI code, as it seems like it would provide close-enough visuals, but for mac only purposes, Cocoa seems like a definite win.

Thanks all for your responses, they've all been very helpful!

Scott