Hello,

I'm trying to open a .pdf file from qt. I have develop the following code to achieve my goal:

Qt Code:
  1. #include <QDesktopServices>
  2. #include <QUrl>
  3.  
  4. exercise::exercise(QWidget *parent)
  5. : QWidget(parent)
  6. {
  7. ui.setupUi(this);
  8. connect(ui.open,SIGNAL(clicked()),this,SLOT(openDocument()));
  9. }
  10.  
  11. exercise::~exercise()
  12. {
  13.  
  14. }
  15.  
  16. void exercise::openDocument()
  17. {
  18. desk.openUrl(QUrl("file://C:/a.pdf"));
  19. }
To copy to clipboard, switch view to plain text mode 


Can someone help me? i have read the post about this thread, but i'm not capable to solve the problem.