上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 164 下一页
摘要: 基本原理 拖放操作包括两个动作:拖动(drag)和放下(drop 或称为放置) 当被拖动时拖动的数据会被存储为 MIME 类型的对象,MIME 类型使用 QMimeData 类来描述。MIME 类型通常由剪贴板和拖放系统使用,以识别不同类型的数据 事件产生的顺序为:QDragEnterEvent、Q 阅读全文
posted @ 2020-10-03 20:40 天子骄龙 阅读(424) 评论(0) 推荐(0)
摘要: 1、发送事件由以下两个函数完成 static void QCoreApplication::postEvent (QObject* receiver, QEvent* event,int priority=Qt::NormalEventPriority); static bool QCoreAppl 阅读全文
posted @ 2020-09-25 20:16 天子骄龙 阅读(797) 评论(0) 推荐(0)
摘要: 需要 #include<QKeyEvent> 常用操作 win.h #ifndef WIN_H #define WIN_H #include <QWidget> #include <QDebug> #include<QKeyEvent> //键盘模块 class Win : public QWidg 阅读全文
posted @ 2020-09-25 13:59 天子骄龙 阅读(1573) 评论(0) 推荐(0)
摘要: 常用操作 判断鼠标按下了哪个键 void Win::mousePressEvent(QMouseEvent *e) { if(e->button() == Qt::LeftButton) //如果鼠标按下的键是左键 //e->button() 返回鼠标当时按下的键--触发事件的键 { qDebug( 阅读全文
posted @ 2020-09-24 09:15 天子骄龙 阅读(1175) 评论(0) 推荐(0)
摘要: 1、事件过滤器用于拦截传递到目标对象的事件,这样可以实现监视目标对象事件的作用 2、Qt 实现事件过滤器的步骤如下: ①、Qt 调用void QObject::installEventFilter (QObject* filterObj),给filterObj 对象设置安装(或注册)事件过滤器,fi 阅读全文
posted @ 2020-09-22 21:14 天子骄龙 阅读(1126) 评论(0) 推荐(0)
摘要: enent事件是通过返回true或false,来决定是否传递事件,不能通过接受accept()或忽略ignore() c.h文件 #ifndef C_H #define C_H #include <QPushButton> #include <QEvent> #include <QDebug> cl 阅读全文
posted @ 2020-09-22 09:34 天子骄龙 阅读(760) 评论(0) 推荐(0)
摘要: 1、事件可以被接受或忽略,被接受的事件不会再传递给其他对象,被忽略的事件会被传递给其他对象处理,或者该事件被丢弃(即没有对象处理该事件) 2、使用 QEvent::accept()函数表示接受一个事件,使用 QEvent::ignore()函数表示忽略一个事件。也就是说若调用 accept(),则事 阅读全文
posted @ 2020-09-21 19:51 天子骄龙 阅读(1304) 评论(0) 推荐(0)
摘要: cpp文件 #include "win.h" #include "ui_win.h" Win::Win(QWidget *parent) : QWidget(parent) , ui(new Ui::Win) { ui->setupUi(this); } Win::~Win() { delete u 阅读全文
posted @ 2020-09-21 09:47 天子骄龙 阅读(293) 评论(0) 推荐(0)
摘要: 事件详谈 事件处理的方式 事件的接受和忽略 event事件的传递 鼠标事件 键盘事件 事件过滤器 自定义事件与事件的发送 event(QEvent *e) 全部事件 事件类型: e->type()==QEvent::KeyPress 键盘按下类型 e->type() == QEvent::Mouse 阅读全文
posted @ 2020-09-21 05:10 天子骄龙 阅读(195) 评论(0) 推荐(0)
摘要: cpp文件 #include "win.h" #include "ui_win.h" Win::Win(QWidget *parent) : QDialog(parent) , ui(new Ui::Win) { ui->setupUi(this); QLabel* label=new QLabel 阅读全文
posted @ 2020-09-19 20:45 天子骄龙 阅读(253) 评论(0) 推荐(0)
上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 164 下一页