All pastes #387770 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2007-03-09 17:05 UTC
rendered paste body
#include <QApplication>#include <QObject>#include <QWidget>#include <QLabel>#include <QMouseEvent>class myLabel : public QLabel{        Q_OBJECT        public:                void mouseReleaseEvent(QMouseEvent *e);                myLabel(QWidget *parent = 0);          ~myLabel();signals:                void clicked();};myLabel::myLabel(QWidget *parent) : QLabel(parent){}myLabel::~myLabel(){}void myLabel::mouseReleaseEvent(QMouseEvent* e){        if (e->button() == Qt::LeftButton)                setText("Left Clicked");        if (e->button() == Qt::MidButton)                setText("Mid Clicked");        if (e->button() == Qt::RightButton)                setText("Right Clicked");        QLabel::mouseReleaseEvent(e);        emit clicked();}int main (int argc, char *argv[]){        QApplication app(argc, argv);        myLabel lbl;        QObject::connect(&lbl, SIGNAL(clicked()), &app, SLOT(close()));        lbl.setGeometry(512,100,100,10);        lbl.show();        app.exec();}#include "main.moc"//-----------------------------// &#1082;&#1086;&#1084;&#1087;&#1080;&#1083;&#1080;&#1090;&#1100; &#1090;&#1072;&#1082;:// qmake -project// qmakemake