- #ifndef TQT_H_  
- #define TQT_H_  
-   
- #include <QtGui>  
- #include <QtCore>  
-   
- class ClickedLabel : public QLabel  
- {  
-     Q_OBJECT  
- private:  
-     int press;  
-     
- protected:  
-     void mousePressEvent(QMouseEvent *event);  
- public:  
-     ClickedLabel(QLabel *parent = 0);  
-     ~ClickedLabel();  
-     private slots:  
-         void SingleClicked();  
- };  
-   
-   
- #endif  
-   
-   
- #include "tqt.h"  
-   
- ClickedLabel::ClickedLabel(QLabel *parent 
- : QLabel(parent)  
- {  
-     press = 0;  
-     setText("Please Click ME~~~");  
-     resize(200, 200);  
- }  
-   
- ClickedLabel::~ClickedLabel()  
- {  
-   
- }  
-   
- void ClickedLabel::mousePressEvent(QMouseEvent *event)  
- {  
-     press++;  
-     if(1 == press)  
-         QTimer::singleShot(300, this, SLOT(SingleClicked()));  
- }  
-   
- void ClickedLabel::SingleClicked()  
- {  
-     if(1 == press)  
-         QMessageBox::information(this, tr("OK"), tr("Signal Clicked"));  
-     else  
-         QMessageBox::information(this, tr("OK"), tr("Double Clicked"));  
-     press = 0;  
- }  
-   
-   
- #include "tqt.h"  
-   
- int main(int argc, char **argv)  
- {  
-     QApplication app(argc, argv);  
-     ClickedLabel *label = new ClickedLabel;  
-     label->show();  
-     return app.exec();  
- }  
http://blog.csdn.net/small_qch/article/details/6742011