huahsin68
huahsin68

Reputation: 6989

How to convert Qt program from Win to Mac?

I have a Windows program that writen in QT using C++. May I know whether those code wrote for Windows platform are convertible to Mac? Is it 100% of the code are convertible or none of it are convertible?

Upvotes: 0

Views: 3873

Answers (2)

Vinicius Kamakura
Vinicius Kamakura

Reputation: 7778

Go for the brute force approach, IMO.

Download the Mac SDK

Install, open the project, compile.

If it fails, check the code for platform specific stuff.

It's not "smart" but it's effective since you will need to download the SDK anyway if you plan on coding for mac.

(Note that this is not a cross-compiler, I'm assuming you have a mac to develop on)

Upvotes: 8

Jens
Jens

Reputation: 6329

There are a couple of things that are different on the Mac

  • the Installer of your application needs to be written from scratch (if you have on)
  • Windows API calls need to be ported (if there are any)
  • file associations (e.g. .doc means call WinWord.exe) are done differently on Mac OS
  • double clicking an associated file is implemented differently (not via argv as in Windows)
  • the menus are different (the default menu contains for example the About Box, whereas the About Box in Windows is usually located under the Help Menu) - note that this can be expressed in native, good QT, but usually, Windows programmers forget to implement menus cleanly)
  • and so on.

So my conclusion would be: While it is possible to write clean Qt code which can be 100% ported from one OS to another, usually, programmers fail to do it 100% clean and thus there will be some porting work to be done.

As hexa recommends, go ahead, compile the stuff and try to sort the errors into categories. Once you have these categories, make your decision on how to proceed.

Upvotes: 7

Related Questions