Unsolved How create a Mac document_based app use qt on Mac?
-
I want develop a mac document-based App use Qt on mac which just like this : https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011179-CH1-SW1
Is there any documentation in qt for reference?if it has,please give some links,thanks a lot!
-
Hi @Princein,
Instead Model-View-Controller, Qt uses a Model-View-Delegate approach: http://doc.qt.io/qt-5/model-view-programming.html
But yes, you can develop this kind of apps with Qt, even if the concept is a bit different.
-
@Princein
Hi,There was a topic on MVC paradigm some time ago on this forum.
The result was that MVC is inapropriate in Qt since it was not design to use it.
The first thing you do in Qt is to subclass top level widgets (window/dialog) hence this top level widgets become 'de facto' a Controller object.As a mac user, the first time i'm looking to Qt, I realized there's a lot of things missing. So I passed a few months trying to add this missing features, in particular a sort of Document Architecture like you have on Cocoa.
Here a list of what I added:
- a notification center (NSNotificationCenter)
- a standard message error system (NSAlert, NSError)
- a responder chain ( for menu management)
- a document based like system (NSDocument)
- many others facilities about Prefs Dialog, Standard Menu management (recent open docs, open window list) etc ...
I can provide you a complete example if you like.
-
@mpergand said in How create a Mac document_based app use qt on Mac?:
ide you a complete example if yo
yes,thanks for your reply,you're a nice man!
-
Need a few days to provide a clean project and to add some english texts
(for now the comments are in french :) )
Stay tuned ... -
@mpergand
Yes, I need your example, can you give me, thanks a lot! -
@Princein
@legitnameyo
Here it is:
MultiDocsDemo.zip
Tested on :
MacOS 10.9.5 Qt 5.6.1
Linux Mate 18.04 Qt 5.11.2
Windows: not tested, hope it works :)There is a 'Read me' file for a few explanations.
The folder 'Test Files' contains some file types you can load with File->open menu item or on Mac by dragging it to the app icon in the dock or in the Finder.Note that i don't pretend my code is suitable to anybody or it's even good programming whatsoever.
It's just my attempt to add some fonctionalities that I think any modern app should have. All this fonctionalities are grouped in the 'Qt Sources' folder, it's enough to add it to any new project to get these goodies at once, easy ! -
@mpergand
Yes, you are so nice a man! can I make friend with you?
here is my Facebook account:
'Lee Yubin' ,please add me!
Thanks a lot! -
The program won't compile on Windows because of that:
#include <utime.h>
You can get ride of this line as well as the method :
bool FilePath::touch(QString &path)On Linux there are a bunch of misleading indentation warnings from GCC6.
Someone knows how to disable this in the compiler ?@Princein
I don't have any Facebook account, sorry -
@mpergand
Do you have other social accounts?
thanks, we can exchange development technology. -
@Princein said in How create a Mac document_based app use qt on Mac?:
Do you have other social accounts?
mpergand on gmail
Or by chat on this same forum.
-
On Linux there are a bunch of misleading indentation warnings from GCC6.
Someone knows how to disable this in the compiler ?Usually, its
-Wno-<name-of-warning>
.BUT you should really take them honestly and fix them.
It can help you to detect wrong code, like the famous Apple SSL bug for free!
Edit: Your source code is a mix of TAB and SPACE based indentation, that's why the compiler complains. You should reformat the source to use one style and stick to it.