Originally Posted by
vishal.chauhan
Hi All,
I m using Qt 4.1.5 on my Intel Mac.
I want to create a Link in Qt. I can make a Link in Qt 4.2.2 but Actually QT 4.2.2 does not give support to MAC 10.2 so I have to use Qt 4.1.5.
So If anybody knws then plz help me.
Thanks.
Link?? a href link or start a link file like a pdf same as terminal:
mac:
open file.pdf
http://doc.trolltech.com/4.2/qdesktopservices.html
/* qt2 > */
void FullEdit
::OpenDesktop( QUrl loc
) {
qDebug() << "#### OpenDesktop " << loc;
#if defined Q_WS_WIN
QString winbuh
= DesktopFile
(loc.
toString());
/* attach file:// if a local url */ /* QUrl(winbuh) */
if (!wr) {
QMessageBox::warning(0, tr
("Error"),tr
("Unable to open file or dir %1").
arg(loc.
toString()));
}
return;
#endif
if (!r) {
QMessageBox::warning(0, tr
("Error"),tr
("Unable to open file or dir %1").
arg(loc.
toString()));
}
}
/* qt2 < */
void ClassName::OpenUrl_File_Dir_Dektop()
{
#if defined(Q_WS_WIN)
s << "url.dll,FileProtocolHandler" << "http://www.qtforum.de/forum/";
p.
startDetached(QString("rundll32.exe") , s
);
#endif
#if defined Q_WS_MAC
macs << "http://www.qtforum.de/forum/"; /* oeffnet der default browser */
m.
startDetached(QString("open") , macs
);
#endif
}
/* qt2 > */
void FullEdit::OpenDesktop( QUrl loc )
{
qDebug() << "#### OpenDesktop " << loc;
#if defined Q_WS_WIN
QString winbuh = DesktopFile(loc.toString()); /* attach file:// if a local url */
/* QUrl(winbuh) */
bool wr = QDesktopServices::openUrl(loc);
if (!wr) {
QMessageBox::warning(0, tr("Error"),tr("Unable to open file or dir %1").arg(loc.toString()));
}
return;
#endif
bool r = QDesktopServices::openUrl(loc);
if (!r) {
QMessageBox::warning(0, tr("Error"),tr("Unable to open file or dir %1").arg(loc.toString()));
}
}
/* qt2 < */
void ClassName::OpenUrl_File_Dir_Dektop()
{
#if defined(Q_WS_WIN)
QProcess p;
QStringList s;
s << "url.dll,FileProtocolHandler" << "http://www.qtforum.de/forum/";
p.startDetached(QString("rundll32.exe") , s );
#endif
#if defined Q_WS_MAC
QProcess m;
QStringList macs;
macs << "http://www.qtforum.de/forum/"; /* oeffnet der default browser */
m.startDetached(QString("open") , macs );
#endif
}
To copy to clipboard, switch view to plain text mode
Bookmarks