error: 'QDesktopServices' has not been declared
Worked before and now it seems broken I don't know how to resolve this got any clue?:confused:
mainWindow.cpp: In member function 'void mainWindow::homepage()':
mainWindow.cpp:123: error: 'QDesktopServices' has not been declared
mainWindow.cpp:123: error: invalid type in declaration before '(' token
mainWindow.cpp:123: error: cannot convert 'QUrl' to 'int' in initialization
mainWindow.cpp:123: warning: unused variable 'openUrl'
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QWidget>
#include <QMenuBar>
{
Q_OBJECT
public:
~mainWindow();
void createMenu();
public slots:
void homepage();
private:
};
Code:
#include <QLayout>
#include <QDesktopServices>
#include <QUrl>
#include "mainWindow.h"
#include "floorBoard.h"
mainWindow
::mainWindow(QWidget *parent
){
createMenu();
floorBoard *fxsBoard = new floorBoard(this);
mainLayout->setMenuBar(menuBar);
mainLayout->addWidget(fxsBoard);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
mainLayout
->setSizeConstraint
(QLayout::SetFixedSize);
setLayout(mainLayout);
};
mainWindow::~mainWindow()
{
};
void mainWindow::createMenu()
{
QAction *openAction
= fileMenu
->addAction
("&Open File...");
QAction *saveAction
= fileMenu
->addAction
("&Save");
QAction *saveAsAction
= fileMenu
->addAction
("Save &As...");
fileMenu->addSeparator();
QAction *exitAction
= fileMenu
->addAction
("E&xit");
menuBar->addMenu(fileMenu);
QAction *homepageAction
= helpMenu
->addAction
(" &Webpage");
menuBar->addMenu(helpMenu);
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
connect(homepageAction, SIGNAL(triggered()), this, SLOT(homepage()));
};
void mainWindow::homepage()
{
};
Re: error: 'QDesktopServices' has not been declared
Does your include path contains the path to QDesktopServices ?
Re: error: 'QDesktopServices' has not been declared
Re: error: 'QDesktopServices' has not been declared
Is it QDesktopServices or QDesktopService ?
I think it is QDesktopService
Re: error: 'QDesktopServices' has not been declared
Quote:
Originally Posted by
ucomesdag
mainWindow.cpp: In member function 'void mainWindow::homepage()':
mainWindow.cpp:123: error: 'QDesktopServices' has not been declared
mainWindow.cpp:123: error: invalid type in declaration before '(' token
mainWindow.cpp:123: error: cannot convert 'QUrl' to 'int' in initialization
mainWindow.cpp:123: warning: unused variable 'openUrl'
Are these the first errors you get? Do you have more than one Qt version installed on your system?
Re: error: 'QDesktopServices' has not been declared
These are the first errors I get and the only
Re: error: 'QDesktopServices' has not been declared
Quote:
Originally Posted by
munna
Does your include path contains the path to QDesktopServices ?
Found the problem somehow I managed to downgrade from 4.2.1 to 4.1 on linux.. oups...:o
Re: error: 'QDesktopServices' has not been declared
That's weird if it really didn't say anything about the missing header included.