[Qt-interest] Open and external file through menu

Sujan Dasmahapatra sdh at lmglasfiber.com
Wed Jun 17 11:30:31 CEST 2009


And moreover I am the only developer in my company I have none to ask or
discuss about my problems.My only source of discussion is
qt-interest....try to understand.

Kind Regards,
Sujan Dasmahapatra

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Ferenc Stelcz
Sent: Wednesday, June 17, 2009 2:44 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Open and external file through menu

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


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list