开发者

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 w开发者_运维问答rote for Windows platform are convertible to Mac? Is it 100% of the code are convertible or none of it are convertible?


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)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜