I'm trying to build a plugin, but make produces an error which I don't know what to do...
Following the directions from the book "C++ GUI Programming with Qt4"
I have 2 parallel directories: clientNotebook which has the .ui part (compiled without errors) and clientNotebookPlugin dir.
Problem is when I try to make the plugin, i get the following error:
clientNotebookPlugin.cpp: In member function ‘virtual QWidget* ClientNotebookPlugin::createWidget(QWidget*)â€⠄¢:
clientNotebookPlugin.cpp:48: error: expected type-specifier before ‘ClientNotebook’
clientNotebookPlugin.cpp:48: error: cannot convert ‘int*’ to ‘QWidget*’ in return
clientNotebookPlugin.cpp:48: error: expected ‘;’ before ‘ClientNotebook’
clientNotebookPlugin.cpp:48: error: ‘ClientNotebook’ was not declared in this scope
make: *** [clientNotebookPlugin.o] Error 1
This is (I think is relevant) source code in the plugin directory...
// The plugin .pro file:
TEMPLATE = lib
CONFIG += designer plugin release
HEADERS += ../clientNotebook/clientNotebook.h\
clientNotebookPlugin.h
SOURCES += ../clientNotebook/clientNotebook.cpp\
clientNotebookPlugin.cpp
DESTDIR = /usr/local/Qt4.3/plugins/designer
// eof
// The plugin cpp file:
#include <QtPlugin>
#include "./clientNotebookPlugin.h"
ClientNotebookPlugin::ClientNotebookPlugin(QObject *parent)
: QObject (parent)
{
}
.... name() includeFile() group() etc...
// This is the problem function...
QWidget *ClientNotebookPlugin::createWidget(QWidget *parent)
{
return new ClientNotebook(parent);
}
Q_EXPORT_PLUGIN2(clientNotebookPlugin, ClientNotebookPlugin)
// eof
// plugin.h file:
#ifndef CLIENTNOTEBOOKPLUGIN_H
#define CLIENTNOTEBOOKPLUGIN_H
#include <QDesignerCustomWidgetInterface>
class ClientNotebookPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
ClientNotebookPlugin(QObject *parent = 0);
QString name() const;
QString includeFile() const;
QString group() const;
QIcon icon() const;
QString toolTip() const;
QString whatsThis() const;
bool isContainer() const;
QWidget *createWidget(QWidget *parent);
};
#endif
Bookmarks