Sorry for my english ...
I am trying to developer a Application Plugin-Aware
following the "C++ GUI Programming with Qt 4 - 2nd Edition" book, but i am having a lot of trouble.
- I am use the "QT Creator"
- I am in the windows
- If a understand, i have to create a .dll file that is is my plugin, and the main app will read.
- To make the plugin i choose the "C++ Library" option in the IDE
I am attach the interface and the class that implements its (the is the plugin)
Error:
expected class-name before '(' token - Iplugin.h 12
expected initializer before '*' token - Iplugin.h 18
return type `struct QStringList' is incomplete - pluginteste.cpp 5
invalid use of undefined type `struct QStringList' - pluginteste.cpp 6
forward declaration of `struct QStringList' - qstring.h 86
// Iplugin.h
#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QtPlugin>
class Iplugin
{
public:
virtual ~TextArtInterface() { }
};
Q_DECLARE_INTERFACE(TextArtInterface,
"com.software-inc.TextArt.TextArtInterface/1.0")
#endif // IPLUGIN_H
// Iplugin.h
#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QtPlugin>
class QStringList;
class Iplugin
{
public:
virtual ~TextArtInterface() { }
virtual QStringList effects() const = 0;
};
Q_DECLARE_INTERFACE(TextArtInterface,
"com.software-inc.TextArt.TextArtInterface/1.0")
#endif // IPLUGIN_H
To copy to clipboard, switch view to plain text mode
//pluginteste.h
#ifndef PLUGINTESTE_H
#define PLUGINTESTE_H
#include <QObject>
#include "Iplugin.h"
class Pluginteste
: public QObject ,
public Iplugin
{
Q_OBJECT
Q_INTERFACES(Iplugin)
public:
};
#endif // PLUGINTESTE_H
//pluginteste.h
#ifndef PLUGINTESTE_H
#define PLUGINTESTE_H
#include <QObject>
#include "Iplugin.h"
class QStringList;
class Pluginteste : public QObject , public Iplugin {
Q_OBJECT
Q_INTERFACES(Iplugin)
public:
QStringList effects() const;
};
#endif // PLUGINTESTE_H
To copy to clipboard, switch view to plain text mode
//pluginteste.cpp
#include "pluginteste.h"
{
return QStringList() <<
"Plain" <<
"Outline" <<
"Shadow";
}
Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
//pluginteste.cpp
#include "pluginteste.h"
QStringList Pluginteste::effects() const
{
return QStringList() << "Plain" << "Outline" << "Shadow";
}
Q_EXPORT_PLUGIN2(pluginteste, Pluginteste);
To copy to clipboard, switch view to plain text mode
//pluginteste.pro
# -------------------------------------------------
# Project created by QtCreator 2009-04-22T20:24:13
# -------------------------------------------------
QT -= gui
TARGET = pluginteste
TEMPLATE = lib
CONFIG += plugin
SOURCES += pluginteste.cpp
HEADERS += pluginteste.h \
Iplugin.h
//pluginteste.pro
# -------------------------------------------------
# Project created by QtCreator 2009-04-22T20:24:13
# -------------------------------------------------
QT -= gui
TARGET = pluginteste
TEMPLATE = lib
CONFIG += plugin
SOURCES += pluginteste.cpp
HEADERS += pluginteste.h \
Iplugin.h
To copy to clipboard, switch view to plain text mode
Bookmarks