I've created a custom plugin and put this on my designer widget box, after I created a new form (widget) for an application to test my plugin...
I just drop my custom plugin in a form widget and wrote the main.cpp file

Qt Code:
  1. #include <QApplication>
  2. #include <QDialog>
  3.  
  4. #include "ui_form.h"
  5.  
  6. int main(int argc,char *argv[]) {
  7.  
  8. QApplication app(argc,argv);
  9. QDialog* tela = new QDialog;
  10. Ui::Form ui;
  11. ui.setupUi(tela);
  12. tela->show();
  13. return app.exec();
  14.  
  15. }
To copy to clipboard, switch view to plain text mode 

But when I compile the source code, I got the follwing message:

g++ -c -pipe -march=pentium4 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/doc/qt-4.1.1/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
g++ -o teste_plugin_2 main.o -L/usr/lib/qt4 -lQtGui -L/usr/lib/mysql -L/usr/lib/qt4 -L/usr/lib -laudio -lXt -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
main.o: In function `main':
main.cpp:(.text+0x1a7): undefined reference to `MyButtons::MyButtons(QWidget*)'
collect2: ld returned 1 exit status
make: ** [teste_plugin_2] Erro 1

Here is my class definition (because I'm using a plugin I have to files mybuttons.h and mybuttonplugin.h, but I think the problem is on mybutton.h)

Qt Code:
  1. #ifndef MYBUTTONS_H
  2. #define MYBUTTONS_H
  3.  
  4. #include <QPushButton>
  5. #include <QHBoxLayout>
  6. #include <QWidget>
  7. #include <QtDesigner/QDesignerExportWidget>
  8.  
  9. class QDESIGNER_WIDGET_EXPORT MyButtons : public QWidget {
  10.  
  11. Q_OBJECT
  12. public:
  13. MyButtons(QWidget *parent=0);
  14. protected:
  15. void setB1Text(const QString&);
  16. void setB2Text(const QString&);
  17. const QString getB1Text() const;
  18. const QString getB2Text() const;
  19. signals:
  20. void B1Clicked();
  21. void B2Clicked();
  22. private:
  23. QHBoxLayout* layout;
  24. };
  25. #endif
To copy to clipboard, switch view to plain text mode 

And the constructor implementation

Qt Code:
  1. MyButtons::MyButtons(QWidget* parent) : QWidget(parent) {
  2.  
  3. B1 = new QPushButton();
  4. B2 = new QPushButton();
  5. layout = new QHBoxLayout(this);
  6.  
  7. layout->addWidget(B1);
  8. layout->addWidget(B2);
  9.  
  10. connect (B1, SIGNAL(clicked()), this, SIGNAL(B1Clicked()));
  11. connect (B2, SIGNAL(clicked()), this, SIGNAL(B2Clicked()));
  12. }
To copy to clipboard, switch view to plain text mode 

I'm using qt 4.1.1 (gcc 3.4.0) on a x86 machine.