To open documents on window i can catch on main arguments to open file.. this is ok...
And to set other extension to the new application i use the installer and if i click the document is open ok.
super!
Now on mac after qt4 to drag document to the dock or open by normal click on finder the operation is more complicated....
On qt3 i found a sample hot to drag file on dock.. this link
http://doc.trolltech.com/qq/qq12-mac-events.html this method not run on qt4 
on mac to associate my new doc type *.sdat i found on google this way:
on pro file i insert an other info.plist xml file to bring icon to new file type and to open application on finder by click the file.... this run ... the app start but a empty file is here.. and main arguments not work!
to find this Hack .. i open http://www.google.com/codesearch and i search QMAKE_INFO_PLIST && macEventFilter ... assistant not say nothing about this ...
QMAKE_INFO_PLIST = resource/mac_qedit.plist
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>sdat</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>mac_QeditIcon.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/plain</string>
<string>text/plain utf-8</string>
</array>
<key>CFBundleTypeName</key>
<string>Text File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
After i search / grep the qt4 source QMAKE_INFO_PLIST and i find the designer... and his associate ui file ok... now how designer open this ui file by click on finder or drag to dock from finder?
I found a designer server... , client ecc.. so much args...
/*
header...
QDesigner::QDesigner(int &argc, char **argv)
: QApplication(argc, argv),
m_server(0),
m_client(0),
m_workbench(0), suppressNewFormShow(false)
*/
QDesigner::QDesigner(int &argc, char **argv)
m_server(0),
m_client(0),
m_workbench(0), suppressNewFormShow(false)
{
QDesignerComponents::initializeResources();
#ifndef Q_WS_MAC
#endif
initialize();
}
/*
header...
QDesigner::QDesigner(int &argc, char **argv)
: QApplication(argc, argv),
m_server(0),
m_client(0),
m_workbench(0), suppressNewFormShow(false)
*/
QDesigner::QDesigner(int &argc, char **argv)
: QApplication(argc, argv),
m_server(0),
m_client(0),
m_workbench(0), suppressNewFormShow(false)
{
setOrganizationName(QLatin1String("Trolltech"));
setApplicationName(QLatin1String("Designer"));
QDesignerComponents::initializeResources();
#ifndef Q_WS_MAC
setWindowIcon(QIcon(QLatin1String(":/trolltech/designer/images/designer.png")));
#endif
initialize();
}
To copy to clipboard, switch view to plain text mode
But how designer open this ui file on MAC ? undocumented function?
Must i write a server and a client to open a new document type?
Or is here the event to open the file! and not QCoreApplication::.arguments();
bool QDesigner
::event(QEvent *ev
) {
bool eaten;
switch (ev->type()) {
// set it true first since, if it's a Qt 3 form, the messagebox from convert will fire the timer.
suppressNewFormShow = true;
if (!m_workbench->readInForm(static_cast<QFileOpenEvent *>(ev)->file()))
suppressNewFormShow = false;
eaten = true;
break;
QCloseEvent *closeEvent
= static_cast<QCloseEvent
*>
(ev
);
closeEvent->setAccepted(m_workbench->handleClose());
if (closeEvent->isAccepted()) {
// We're going down, make sure that we don't get our settings saved twice.
if (m_mainWindow)
m_mainWindow->setSaveSettingsOnClose(false);
}
eaten = true;
break;
}
default:
break;
}
return eaten;
}
bool QDesigner::event(QEvent *ev)
{
bool eaten;
switch (ev->type()) {
case QEvent::FileOpen:
// set it true first since, if it's a Qt 3 form, the messagebox from convert will fire the timer.
suppressNewFormShow = true;
if (!m_workbench->readInForm(static_cast<QFileOpenEvent *>(ev)->file()))
suppressNewFormShow = false;
eaten = true;
break;
case QEvent::Close: {
QCloseEvent *closeEvent = static_cast<QCloseEvent *>(ev);
closeEvent->setAccepted(m_workbench->handleClose());
if (closeEvent->isAccepted()) {
// We're going down, make sure that we don't get our settings saved twice.
if (m_mainWindow)
m_mainWindow->setSaveSettingsOnClose(false);
eaten = QApplication::event(ev);
}
eaten = true;
break;
}
default:
eaten = QApplication::event(ev);
break;
}
return eaten;
}
To copy to clipboard, switch view to plain text mode
Bookmarks