myplugin.h

Qt Code:
  1. #include <QLabel>
  2.  
  3. #include "/home/michael/Projects/QPanel/qpanelappletinterface.h"
  4.  
  5. class ClockPlugin : public QObject, public QPanelAppletInterface
  6. {
  7. Q_OBJECT
  8. Q_INTERFACES(QPanelAppletInterface)
  9.  
  10. public:
  11. MyPlugin();
  12. QWidget* getWidget();
  13. void showPreferencesDialog();
  14.  
  15. private:
  16. QLabel* label;
  17. };
To copy to clipboard, switch view to plain text mode 

myplugin.cpp

Qt Code:
  1. #include "myplugin.h"
  2.  
  3. MyPlugin::MyPlugin()
  4. {
  5. label = new QLabel("Time goes here");
  6. }
  7.  
  8. QWidget* MyPlugin::getWidget()
  9. {
  10. return label;
  11. }
  12.  
  13. void MyPlugin::showPreferencesDialog()
  14. {
  15. // no preferences
  16. }
To copy to clipboard, switch view to plain text mode 

myplugin.pro

Qt Code:
  1. ######################################################################
  2. # Automatically generated by qmake (2.01a) Fri Aug 27 08:29:32 2010
  3. ######################################################################
  4.  
  5. TEMPLATE = lib
  6. CONFIG = plugin
  7. TARGET =
  8. DEPENDPATH += .
  9. INCLUDEPATH += .
  10.  
  11. # Input
  12. HEADERS += myplugin.h
  13. SOURCES += myplugin.cpp
To copy to clipboard, switch view to plain text mode