Switching from wxWidgets to QT for porting to Mac? - macos

We are selling an image processing application (about 120k lines of code) developed with wxWidgets. We planned everything to be as most cross platform as possible in case the porting from Windows to other OS was needed. And in fact we are going to realiza a version for Mac.
We haven't tested wxWidgest on Mac yet, but we haven't read very good things about it.
In general, do you think is it worth to port from wxWidgets to QT? Do you believe it will be an hard and long job?
Is QT for Mac much better than wxWidgets implementation?
Is QT much more productive that wxWidgets?
I would like to add that we would'n like to keep code bases for gui, so the choice is just wxWidgets vs QT.

Test your application on Mac, and then decide. If there are only a few wrinkles to iron out, why put in all that extra work to switch toolkits?
It will be a long hard job. Without knowing more about your application and situation, it is hard to say whether making the switch is worth the effort. I do know that I would rather work on a Qt app than a wx app.
I have a friend who recently switched a significant wx application to Qt, and he is quite happy with the change. Mac support is one of his (boss's) important features, but I think wx's support for Mac was adequate, if not stellar.
My experience has been that Qt is definitely more productive than wx.

It is worth noting that wxWidgets on the Mac is transitioning to Cocoa. This should be done for wxWidgets 3.0, but is testable with the development release wxWidgets 2.9 now. Is Qt Cocoa or Carbon based?
We have an application that runs under Windows and the Mac, built using wxWidgets. The application performs very well on both platforms.

I recommend switching over to Qt. wxWidgets is a GUI toolkit, whereas Qt is an application framework with much, much more features.
I can't say anything about their mac implementations, but i can clearly say that i am far more productive using Qt. When i was using wxWidgets, i was a student and then when i got a job, i started using Qt.
wxWidgets gave me a feeling of incompleteness, but as i said, this may be caused by the fact that i was an inexperienced student but nonetheless, i think Qt is way better.

Until you have investigated more and have a good reason(s) to switch toolkits, then absolutely not.
We are using wxWidgets for Linux & the like, Mac, and Windows. It's a great toolkit and certainly much more than just a GUI.

Like dtw and NuSkooler, we are using wxWidgets on Mac (carbon/cocoa), Linux (32/64), Windows (32/64) and all works fine. In wx, we use gui, filesystem, threads, html libs.

+1 for Qt
I have used both wxWidgets and Qt extensively on different projects for the Windows platform writing C++ applications.
Having used both and compared the two after, I would absolutely use Qt over wxWidgets. You need to consider (as some of the others have pointed out) if the re-factoring effort is is something you have time for and are willing to do.
Also consider the cost -- this may not matter in your situation, but unlike wxWidgets, the Qt Library is not free for commercial use. I have spoken to TrollTech at length and read through their licensing agreement to verify this; you definitely have to pay unless you GPL your application.
Regarding licensing see:
http://qt.nokia.com/about/licensing/frequently-asked-questions
"Will you continue to offer Qt under a
commercial license?"
"Yes, absolutely. Our commercial
licensing will continue."
"Why would I want to buy a commercial
license? What is the difference?"
"The commercial Qt license includes
email support, access to upgrades and
allows you to develop fully closed
source software. The LGPL carries some
restrictions regarding the ability for
users to relink libraries and other
restrictions that may impose
architectural requirements that some
organizations might not be comfortable
with."
Qt is definitely worth the money though, even if you are not doing cross-platform development. It has a lot more and better documentation. Qt and wxWidgets are not perfect... The fact that they are bloated and provide APIs for networking, data structures, and database handling is not necessarily a good thing. Sometimes sticking with the STL or Boost libraries (if you're coding in C++) is a much better solution.
Good luck.
-bn

+1 for wxWidgets. A big project of mine used wxWidgets and found it a nice framework to use, and an easy enough framework to get your head around to modify if you need to (to support Mac specific features).
Try it: you could be 80% there when you first generate the binary.

Related

Comparing Qt4 with Cocoa

I'm on the beginning slope of learning Mac programming and in particular Cocoa. It seems to be a comprehensive framework providing all kinds of things every app programmer needs. Qt4 is the same sort of thing at a general level, except it runs on other platforms and uses C++ instead of Obj-C. More importantly for me, I've used Qt4 and so am familiar with it, though hardly expert. I am new to Obj-C and app programming in general, but know C++.
I'd be interested in comparisons of Qt4 and Cocoa, tips for those starting one coming from the other (either way), and discussions on their internals, API design, intended uses, how the designers of each made decisions about how things should work, etc.
What are some recommended readings?
(Of course, I want serious writings by professional developers with real experience with both, not flame wars or fanboy gush or marketing pablum.)
So far I have used Qt4 to implement some cross-platform applications (Windows & Mac) and I used XCode (Objective-C) only for iPhone Applications development - therefore I don't have first-hand experience in using Objective-C for native Mac applications.
I think the best advantage of Qt4 is portability, and I love it for it.
Not only you may port the entire Qt Application to different environments, but with a small effort you can create standard C++ libraries (libraries that not use Qt4 Classes) which are far more useful and portable.
On the other hand, I think the XCode/Objective-C environment is more mature regarding project management and UI Design and off-course you can use the full set of Mac-OS native calls in your application. As you may know Objective-C is fully compatible with C++ and you can use any third party C++ libraries, but if your main environment is XCode/Cocoa you will finally find yourself writing mainly Objective-C code which cannot be ported to any other environment but Mac-OS/iOS.
Therefore to cut a long story short, I think your decision must be based more on your long-term needs than to any environment/design/language/API details:
=> If you know that you will build Apps for Mac-OSX (or iOS) for the next 1-2 years and there is no portability requirements, go with the XCode/Objective-C approach to create a more solid base for Mac Application development.
=> If this is a "Just One Mac/OSX Application" thing and then you will return to Qt4 or another environment, maybe it's better to stick with Qt4, enjoy the advantages of portability and use the experience you already have to reduce the developing time.

Is there any cross-platform GUI Toolkit which does not follow the one source to rule them all concept?

After a long evaluation period of mainstream toolkits Qt, WxWidget, GTK i came to the conclusion that it does not make sense to religiously equalize the different platform. Now more then ever before.
In the days before Java portability meant, that platform dependent code was located in known places and should be small but not none. No write once, run everywhere marketing.
Is there any GUI tookit - experimental or commerical (even outdated or dead projects) - that is going this way. It would need to give me native widgets of course. I would like to have a look at them before i start my own toolkit
If you think this is a stupid idea tell me why (cause everybody else is doing it differently there may be a reason i don't see)
As someone who zealously believes that GUIs should be drawn with native widgets, I must say I've been very impressed with wxWidgets, although you mention that at the beginning.
As far as I know, wxWidgets uses native widgets whenever possible, and indeed it does also include platform-specific features that are neither possible nor relevant on other platforms. A good example of this is how you can use the native Mac OS X menu, while on other systems it won't do squat. There are other and better examples.
I must mention wxPython in particular, in case you either don't want to or just don't have the time to write a C++ program. wxPython astonished me when I tried it out first, and I even managed to make a stand-alone .exe file from it that worked on a fresh install of Windows 2000 without any updates or particular runtime environments.
If wxWidgets doesn't suit your needs, I wonder what would. :) Hurray for wxWidgets!
AFAIK, wxWidgets uses the platform's native widgets whenever possible.
Have a look at SWT, it tries to use the widgets of the underlying platform as much as possible.

Transferring from web programming to GUI programming?

I've been doing web development for about six years now, and somehow have entirely avoided ever developing a desktop application.
I am considering writing a desktop application (I'm thinking something similar to a Word clone) on Linux but have no idea where to start. I hear of Qt and GTK+, but I'm curious if there are any frameworks that are similar to web development. Language isn't a problem, as long as it isn't Java.
You really want to go with Qt these days. Both Nokia and Intel are now pushing it as the main GUI in their new distro Meego. This means, if you are using Qt, you'll be able to target all their platforms (both desktop, embedded and phone domain), including all the platforms already supported by Qt.
Qt also comes with a GUI Designer and an IDE which will support you in the whole process, and soon there will be QML, which is a declarative UI language, for even more rapid development of apps.
Take a look here:
http://qt.nokia.com/products
http://www.youtube.com/watch?v=U7IgwNrcln8
http://www.youtube.com/watch?v=xoo_Ows1ExU
http://www.youtube.com/watch?v=Fr5FuGhTqm8
GTK+ and QT are GUI frameworks. They use xlib under the hood and encapsulate the nuances of xlib and provide you with an easier interface.
For rapid development you can use GLADE and quickly build GUI applications in C/C++.
Check out wxWidgets, it's another framework that is usually compared with Qt & GTK+
Go for Qt. And, if you are webdev, you will find in QML one of the best instruments EVER.
It has:
A Declarative approach to UI definition and Graphics elements Behavious/Animations
It's cool and simple at the same time
For now is only available in a couple of (old) binary drops, or by clone-compiling qt.gitorious.com/qt, branch ">4.7"
If you don't have to release today, but do you have time to develop and test, then QML should be "stable" by end H1 2010. If I got the schedule right ;-)

Moving from Windows API to Mac OS

I'm a Windows (native, not .NET) programmer and I'd like to port an application to the Mac.
Actually, I believe it will be more of a rewrite, as the original depends on many activex controls.
As I have never used a Mac in my entire life, I'll need some guidance. O:-)
a) What book(s) would you recommend to make the move from Win32 to Mac OS?
b) Is there anything similar to Delphi (RAD) for the Mac?
c) Can anyone recommend (or not) Lispworks (www.lispworks.com)?
d) Is there anything similar to the Windows market of 3rd party COM components (so I don't have to write everything)?
e) Anything else I should be aware of the Mac market?
f) Oh, BTW, what Mac should I buy? O:-) (must be a laptop)
Thanks in advance
I've taught Cocoa programming to several Windows-experienced programmers. You may find a previous post on the subject useful.
Cocoa is a very different way of thinking then MFC and its kin. You will do much, much better if you take the time to learn how Cocoa approaches things and adapt to its mindset rather than trying to find the quickest way to implement your current way of thinking in ObjC. It is possible to write MFC-style code for Mac, but you will always be fighting the framework if you do. I've seen a lot of Windows developers struggle with this.
The best book to learn Cocoa is Cocoa Programming for Mac OS X. Assuming you are a C++ developer with a solid OOP background, this is the book to start with. If you have limited Object Oriented background, then start with Programming Objective-C 2.0.
You would be amazed how fast Objective-C can be to code once you understand the patterns. It really can be stunning compared to C++ in my experience. There are more RAD-like systems like REALbasic, and you can develop Cocoa apps in Ruby now which can be a bit quicker. But there really is no substitute in the Mac market for ObjC. It's hard to make an app that works like a Mac app without using the Mac frameworks, and Mac users tend to be much fussier about such things than Windows users.
I have no background in LispWorks, but LISP seems a terrible language for developing the kind of rich UIs that Mac apps are known for. I like LISP (quite a lot actually), but Functional Programming's "no side effects" philosophy seems at odds with most rich UI goals (especially as the Mac UI becomes more and more animation-centric). If anything, Mac programming is moving towards Declarative rather than Functional programming (Core Animation and Grand Central Dispatch have a lot of Declarative concepts creeping in).
There is not as large a third-party component market as there is for Windows. Some of this is because Cocoa already provides such a rich set of components, which MFC does not, and because well-behaved Mac apps are expected to use those components so that you work like all other Mac apps. There is definitely little market for commercial components in the vein of RadControls for .NET (very nice toolkit, that one). But there are quite a few nice free components out there with flexible licenses (generally MIT-based). A few of my favorites:
Positive Spin Media's excellent tabbar control
OmniGroup's frameworks (though I never use them "as is;" they're better used as examples of how to do things)
Growl
Sparkle
RegexKit
CocoaDev's ObjectLibrary list of other stuff
As I mentioned before, Mac users are picky about their UI. Much, much more so than Windows users. They expect things to be polished, and they expect things to integrate with all the little things that make Macs nice. That means drag-and-drop, Spotlight, services, Applescript, Expose, QuickLook, integrated spelling check, etc. etc. It's very hard to do all these things right if you don't use the built-in frameworks. That's why I recommend new Mac developers start at the beginning and learn the frameworks.
For a Mac, if you have a bunch of hardware lying around (like keyboards and monitors), then a Mac Mini is a nice cheap box. iMacs are great if you want an all-in-one, and any MacBook is appropriate if you like portability. There is no Mac on the market today that is not a perfectly fine development box. Obviously if you do a lot of work, an 8-core Mac Pro makes compiling much faster, but I've done a lot of professional development on a 13" MacBook. If you want to get in as cheaply as possible, look for refurbished or used (I love my refurbished Mac Mini). Any Intel-based Mac is going to be fine for development, at least while you're getting started.
If you are familiar with C, you may want to learn Objective C since that is the Macs "native" programming language. It's also what you have to use to write iPhone applications. Cocoa is Apple's primary API that will have a lot of the tools you are looking for.
a) Read this thread for book recommendations: https://stackoverflow.com/questions/7571/cocoa-and-objective-c-resources
b) Apple makes Xcode for developing in. There are certainly better ones out there, but it's not bad.
d) Cocoa is Apple's main API, which provides "core" services like CFNetwork for networking. There is also core data, core audio, core animation, core image, core location,... Underneath it all, OSX is Unix, so you have access to many unix/linux libs.
e) The iPhone is a big part of the Mac market. The iPhone and OSX development environments are not that different, so you can learn both.
f) Any Mac is sufficient for most development. If you want a laptop, it's really a question of screen size and price. But I would recommend at least a 15 inch screen. You don't need to spend extra for a faster CPU, but you may want to get a larger hard drive.
If you've done your native Windows programming in C and/or C++, you may have an easier time migrating your application to C#/.Net, and then running it in Mac using Mono. At least some of the available third-party .Net components will run on Mono (see http://www.mono-project.com/Third_Party_Controls_Status).
I have no idea what Mac you should buy - I recommend getting one of the pretty ones.
a) ...
b) You could use Python coupled with wxPython and be cross platform. Python is included by default with Mac OS X.
c) ...
d) I'm sure there is, but I can't tell you more. If you use Python, you get tons of third party libraries for free.
e) They don't take kindly alien GUI guidelines:
Word 6.0, launched in 1993, is widely considered to be the worst version of Word ever for the Mac, as it was based on the same codebase as Word 6.0 for Windows. That meant that it looked and worked more like Windows software than a Macintosh program. Mac users were so up in arms that Microsoft actually released a Word 5.1 downgrade to unhappy Word 6.0 owners.
f) Mostly any iMac will be good enough for programming. Choose the one that you like the most and has lots of RAM.
e) Its a small market.
f) An iMac. Edit: since it says laptop - Macbook Pro 13 is a great deal.

osx & windows development -- for newbies

my background: i've been developing web applications using php and javascript for the past ten years. before that, i've developed applications using turbo pascal for DOS. in my opinion application and web application development are two different kinds of development (at least it's what i think when i remember back the old days of DOS application development).
now i am in the need to go back to "normal" application development for various reasons. the application i want to build needs a GUI and it has to run on osx and windows. as mac os user it would be very nice for me to get an application as result, that really feels like an osx application. i don't need any special UI components: an explorer/finder like tree, a datagrid and some form-elements would be enough for my needs.
now the problem is, that i don't know where to start: i would classify me as newbie, because it's that long time since i last developed anything other than a web application. are there any recommendations of programming languages and gui toolkits with a not to steep learning curve? or can you recommend any book i should read for getting into cross-plattform osx/windows app development?
many thanks!
thanks everyone! i think i'll have a look at realbasic!
Edit Nov 2011 - a retraction
Most of what I say below is still true however I have now got serious reservations about recommending REALbasic for anyone trying to release commercial-quality applications. To save me remembering to edit this post later, see if RealSoftware have managed to release a robust version of their IDE using the Cocoa version of their frameworks. If not, be very cautious.
It's with a heavy heart that I write this because I still really like the language and think the framework and IDE are well-done. The problem is apparently one of under-capitalization and possibly a software development culture inside the company that consistently fails to deal with a bug regression problem. Many bugs are fixed each release but there appears to be a huge tax on the developers in the number of introduced bugs. They have a very small team for the complexity of the product, especially considering the newly released Web Edition which is effectively an entirely new platform.
It's still theoretically a great product but take advantage of the trial period, test it thoroughly on each of the platforms you plan to target and decide if you can live with any bugs you find because they may be there for a while.
REALbasic.
The language is a powerful, modern OO language that won't be hard for you to adapt to from your vaguely remembered Pascal or current JavaScript. It has most of the power of C++ without the dangerous bits that make debugging a nightmare. You will also find the IDE simpler and easier to deal with than say Visual Studio.
The IDE makes it very easy to throw together a GUI and have it just work on multiple platforms. The Pro version has one of the best cross-platform debuggers I've used and it is easy to just work (say) on a Mac and develop for Windows and Linux, compiling and testing with one click.
There is also a thriving community including many people at your level of expertise so you won't be mocked for being a newbie.
I am a professional software developer with over 25 years experience and currently mainly working in REALbasic, C++, C#, Objective-C and a bit of Ruby. For apps such as you mention, REALbasic is my tool of choice.
edit: I can't believe someone downvoted this but didn't have the guts to add a comment explaining why. I'd heard about prejudice against REALbasic but this is the first time I've encountered it. In what way was my answer inappropriate for this question?
Just to add to my cred, I've implemented cross-platform frameworks used by systems deployed to tens of thousands of end users - I have the C++ cross-platform experience to applaud someone else doing a good job and the REALbasic frameworks are very nice.
The best cross-platform tool I've dabbled in with a relatively small learning curve...especially if you're familiar with Visual Basic...is REALbasic. With REALbasic Pro you can compile a program to target Win32, Linux, and OS X from the same codebase, as long as you're not using OS-specific calls and features (which you can do with plugins or direct calls). Their support has been pretty responsive to my questions, the personal edition (which compiles to only the single target platform you'd downloaded the IDE for) is free for Linux and inexpensive for other platforms, but really you might want to download and try it out. One IDE, relatively inexpensive, and can compile native applications on OS X, Windows, and Linux...it's less hassle, and for me that's important when you want to get a job done.
I'd advise against C and Qt and would also recommend REALbasic.
With your background in Pascal and probably JavaScript you'll feel much more comfortable with REALbasic. I've done a lot of coding in Pascal and C/C++ - where Pascal guides you to avoid programming mistakes, C lets you step right in, even invites you, and then you'll have a hard time figuring out why it went wrong. Qt is a very abstract framework and requires you to learn a lot before you can get something working, just like with C. When compared to the easyness we used to have with TP back then.
RB is much more like Pascal in this regard. And its IDE is quite modern in regards to supporting your programming, with an easy-to-use GUI designer, straight-forward editor to fill in the gaps for handling UI events, code completion, etc.
Only when you get into huge program sizes, RB loses some of its appeal because it is missing tools to give you a good overview of complex class interactions etc.
Another thing is that Qt is more likely to cause ugly-looking Mac apps than RB would. RB visually guides you to get it all aligned nicely - in Qt you have to work with numbers, offsets, etc. to position your objects (at least it was that way when I used Qt 2 years ago).
I've written quite a few x-platform apps in RB and am pretty happy with the results.
You won't probably write those super-nice looking apps that compete with the best on the open small business market, but if you just want to get some solid code working, with an easy-to-design UI that's acceptable to the average user, give RB a try.
It's not free, though. But its rather small community is on your side - they're eager to help, instead of bashing everyone who's trying to talk sense :)
I'm new here but picked up on this thread through the REALbasic User Group. I think my position was similar to yours. I did website design for my work, using mostly javascript (with a little php, not much). I had a Pascal and BASIC background. I'd dabbled it C but didn't like the level of detail you needed to monitor it. It reminded me too much of assembly (which I still have nightmares about from my high-school/college days).
I was looking for a cross-platform language, with a familiar feel to it, but initially started with VB because it was free. I prefer programming in MacOS however, so I tried REALbasic. I found that REALbasic's UI builder was much easier to use than VB's. I'd echo other comments that the community is the most responsive of any user groups I've been involved with. I've since used REALbasic and my Mac to make several programs that over 100 users use every day at my work (on PCs, mostly XP and 2000). I've received compliments on the polish and ease of use of these programs. You DO have to remember to adjust the 'little' things to make it look right cross platform (ie: default button placement is opposite on PC vs. Mac, button sizes are different on Linux, etc). Many people have donated custom classes that do this stuff for you though.
People seem to assume that a "BASIC" language cannot be powerful enough for their purposes. While it is BASIC at it's core (with For..Next, Do..While, and If..Then commands), it ain't your daddy's BASIC. It's much more OOP than anything else I've used, based upon an event-driven structure, which for me was easy to pick up. They have a free trial, so grab a demo and run through the tutorial. If you get stuck, ask for questions on the NUG or Forums at the website and you'll likely get an answer quickly.
You may be interested in the following questions and answers:
Cross-platform development - Go with a cross-platform UI toolkit or native on multiple platforms?
Easiest cross platform widget toolkit?
Should I use a cross-platform GUI-toolkit or rely on the native ones?
Using a Mac for cross platform development?
and many others suggested in the Related sidebar of these questions.
Some answers suggest gtk (which is used by cross-platform gimp). Others suggest native approaches. Some suggest that a Mac is a nice platform for developing for Mac OS X, Windows, Unix and Linux.
I wholeheartedly recommend RealBasic too. I have been using RB for about 8 years now and find it to be a perfect tool for my Companies development needs, from small apps, to large multi-user systems.
It is perfect for beginners and those that are getting back into programming, and also for professional developers.
Highly recommended.
As Andy Dent and others here have indicated, for a newbie to create cross-platform applications it is hard to beat REALbasic (now Xojo).
Sure, there are plenty of other cross platform solutions such as QT (C++), Java, .NET (to some extent) and wxWidgets but they are not something a beginner would be able to use effectively.
I have many years of professional development experience in a wide variety of languages and technologies and I prefer to use REALbasic most of the time.
With that said, you might also consider Runtime Revolution or Adobe Air.
Whilst it might seem tempting to use a language thats platform independent and allow you to write the app once and use anywhere, you will undoubtably be sacrificing something on each, particularly in the UI and user experience.
If you can your best creating something using a native API that lets you take full advantage of the features of the OS to make your application shine.
I would definitely go for C++ and Qt, the code you write once will compile and run without problems on Windows, Mac and Linux. The new IDE that comes with Qt - Qt Creator is brilliant, works and looks the same on Windows, Mac and Linux, you don't need to anything else to start writing cross-platform applications.
I tried WxWidgets but didn't find good IDE, the best one was Code Blocks but GUI Designer is not perfect and has different problems on different systems and the IDE itself is still under heavy development.
Other options are Java and C# but those are not cross-platform languages, those are platforms themselves. Although you wouldn't need to compile code for each platform there will a lot of different issues on the way...
If your GUI's simple enough, why not just create a generic GUI layer, then program to that? Compile a version for each OS using native widgets. That's the best way to ensure native L&F on multiple platforms.
Both the Qt and REALbasic suggestions are good, although they tie you to that particular technology (which I can't imagine would be an issue in this particular case).
Personally, I'd go with Java, because it's worked for me before (I had an app that ran on my PDA, my phone and my desktop), but it doesn't use native widgets.
Adding a late comment here:
Take a look at Revolution. It's sort of like a modern Hyper-card on roids. And it's cross platform (Mac, Linux and Windows). This is a serious competitor to RealBasic and is coming on strong. Though I still use RB (and like it) I'm giving Revolution a serious look at.
I would also look into either Realbasic or Revolution. They both create cross platform native apps. Personally I think Realbasic would be a better choice as it is very similar, language wise, to VB. You can learn some valuable skills with RB and it can grow with your experience. I have been using VB and RB for more then 10 years combined and I think you will be happy.
If you need your code to be cross platform, you would have to go with something like QT.
Although, I would recommend using native API for each one (Cocoa for Mac OS X, .NET or the Win32 API for Windows). User experience will be much better. But of course, that will cost you more money in terms of developers hours.

Resources