QT_QLabel点击事件-创新互联

创新互联公司是专业的平邑网站建设公司,平邑接单;提供网站制作、网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行平邑网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!> class login_window : public QWidget { Q_OBJECT protected: bool eventFilter(QObject * watched, QEvent * event); } ui.label_obj_sample->installEventFilter(this); ui.label_zip_sample->installEventFilter(this);
  bool login_window::eventFilter(QObject * watched, QEvent * event)
    {
        
if (watched == ui.label_forget_key &&
 event->type() == QEvent::MouseButtonPress)
        {
            QMessageBox::information(NULL,"Title", QStringLiteral("忘记密码"), QMessageBox::Cancel );
        }
elseif (watched == ui.label_apply &&
 event->type() == QEvent::MouseButtonPress)
        {
            QMessageBox::information(NULL,"Title", QStringLiteral("申请权限"), QMessageBox::Cancel );
        }
return QWidget::eventFilter(watched, event);
    }

本文名称:QT_QLabel点击事件-创新互联
本文地址:http://myzitong.com/article/cdhpdi.html