[Qt-interest] Open and external file through menu
Ferenc Stelcz
ferenc at stelcz.hu
Wed Jun 17 11:14:18 CEST 2009
Sujan Dasmahapatra wrote:
> Dear Friends
>
> How can I open an external file through menu ? I have a manual.doc file
> I want to open it when user clicks the menu ?
>
void MainWindow::createActions()
{
showManAct = new QAction(
QIcon(":/images/manual.png"),
tr("&Manual"), this
);
showManAct->setShortcuts(QKeySequence::HelpContents);
showManAct->setStatusTip(tr("Shows the Manual"));
connect(
showManAct,
SIGNAL(triggered()),
this,
SLOT(showManual())
);
}
void MainWindow::showManual()
{
QDesktopServices::openUrl(
QUrl("file:///path_to/your_manual.doc",
QUrl::TolerantMode)
);
}
__________ Information from ESET Smart Security, version of virus signature database 4160 (20090616) __________
The message was checked by ESET Smart Security.
http://www.eset.com
More information about the Qt-interest-old
mailing list