designer无法加载自定义部件
第一次尝试编写一个继承于QLineEdit的自定义部件,实现一些其他的功能,能编译通过并在designer的插件文件夹生成so文件,但是designer中无法加载,网上的帖子千篇一律的都是转载的C++ Qt那本书上第五章的内容,不知道问题出在哪,高手帮忙看看
pro文件
TEMPLATE = libCONFIG += designer plugin releaseHEADERS += myeditplugin.h \ myedit.hSOURCES += myeditplugin.cpp \ myedit.cppDESTDIR = $$[QT_INSTALL_PLUGINS]/designerTARGET = myEdit
#ifndef MYEDITPLUGIN_H#define MYEDITPLUGIN_H#include <QDesignerCustomWidgetInterface>class MyEditPlugin : public QObject, public QDesignerCustomWidgetInterface{ Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface)public: MyEditPlugin(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 // MYEDITPLUGIN_H
#include "myeditplugin.h"#include "myedit.h"#include <QtPlugin>#define ICON_PATH "/opt/QtDesktop/image/qt_myEditPlugin/"MyEditPlugin::MyEditPlugin(QObject *parent) :QObject(parent){}QString MyEditPlugin::name() const{ return "myEdit";}QString MyEditPlugin::includeFile() const{ return "myedit.h";}QString MyEditPlugin::group() const{ return tr("My Widgets");}QIcon MyEditPlugin::icon() const{ return QIcon(ICON_PATH + QString("myEditPluginIcon.png"));}QString MyEditPlugin::toolTip() const{ return tr("Can use systemkeyboard");}QString MyEditPlugin::whatsThis() const{ return tr("");}bool MyEditPlugin::isContainer() const{ return false;}QWidget *MyEditPlugin::createWidget(QWidget *parent){ return new MyEdit(parent);}Q_EXPORT_PLUGIN2(myEditPlugin,MyEditPlugin)
#ifndef MYEDITPLUGIN_H#define MYEDITPLUGIN_H#include <QDesignerCustomWidgetInterface>class MyEditPlugin : public QObject, public QDesignerCustomWidgetInterface{ Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface)public: MyEditPlugin(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 // MYEDITPLUGIN_H
mv -f libmyEdit.so /usr/local/Trolltech/QtEmbedded-4.4.3/plugins/designer/