首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏C++开发

    【Qt】EventFilter,要增加事件拦截器才能拦截到事件

    17910编辑于 2025-06-01
  • 来自专栏sktj

    python pyqt5 事件过滤器

    from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * import sys class EventFilter (QDialog): def init(self, parent=None): super(EventFilter, self).init(parent) self.setWindowTitle( self.label3, 500, 2) mainLayout.addWidget(self.LabelState, 600, 1) self.setLayout(mainLayout) def eventFilter self.LabelState.setText("释放鼠标按钮") self.label1.setPixmap(QPixmap.fromImage(self.image1)) return QDialog.eventFilter if name == 'main': app = QApplication(sys.argv) dialog = EventFilter() dialog.show() sys.exit(app.exec

    1.7K20发布于 2019-07-22
  • 来自专栏祥的专栏

    [QT]屏蔽Tab键切换控件焦点

    源码 3.1.安装事件过滤器 3.2.重写eventFilter()函数 ---- 0. 2.解决思路 如上图所示,窗体有3个QLineEdit控件,在窗体的构造函数中安装事件过滤器,然后重写eventFilter(QObject *obj, QEvent *event)函数 3. ui.edit_m_absolute->installEventFilter(this);//控件2 ui.edit_keyboard->installEventFilter(this);//控件3 } 3.2.重写eventFilter ()函数 重写eventFilter(QObject *obj, QEvent *event)函数 bool check_keyboard_mouse::eventFilter(QObject *obj isShield_KeyTab) { return true;//屏蔽Tab,不响应 } else { return QDialog::eventFilter

    2.6K20发布于 2020-03-10
  • 来自专栏《ATT&CK视角下的红蓝攻防对抗》

    Windows WMI 详解之WMI事件

    1.WMI永久事件订阅组成(1)EventFilter(事件过滤器)EventFilter(事件过滤器)存储在一个ROOT\subscription:__EventFilter对象的实例里,其主要作用是使用 WMI的查询语言来过滤审核特定的事件,一个事件过滤器接受一个WMI事件查询参数,同时EventFilter事件过滤器可以对Intrinsic Events (内部事件)和Extrinsic Events \\root\\subscription")2.创建_EventFilter类的实例并使用其查询属性来存储您的WQL事件查询。 instance of __EventFilter as $EventFilter{ Name = "Event Filter Instance Name"; EventNamespace instance of __FilterToConsumerBinding{ Filter = $EventFilter; Consumer = $Consumer;}; 我正在参与2024

    1.2K10编辑于 2024-01-30
  • 来自专栏嵌入式项目开发

    QT应用编程: QSlider设置滚动块定位到鼠标点击的地方

    在主界面的类里重载eventFilter函数,拦截鼠标事件。 protected: bool eventFilter(QObject *obj, QEvent *event); private: Ui::Widget *ui; }; Widget installEventFilter(this); ...................略................................. } bool Widget::eventFilter ui->horizontalSlider_2->setValue(value); } } } return QObject::eventFilter

    2.6K10编辑于 2022-01-07
  • 来自专栏C++/Linux

    【QT】事件分发器 & 事件过滤器

    如下图示: 事件过滤器的⼀般使用步骤: 安装事件过滤器; 重写事件过滤器函数:eventfilter() 代码示例: 1、设计 UI 文件,拖入一个 label,如下图示; 3、在项目新添加⼀个类:MyLabel Q_OBJECT public: Widget(QWidget *parent = nullptr); ~Widget(); // 声明 eventfilter 事件 bool eventFilter(QObject* obj, QEvent* e); private: Ui::Widget *ui; }; 10 重写eventfilter事件 bool Widget::eventFilter(QObject *obj, QEvent *e) { // 判断控件 if(obj (obj, e); } 执行效果如下,当在标签中点击鼠标时不会执行 event 函数,而会执行 eventfilter 函数:

    1.3K10编辑于 2024-07-27
  • 来自专栏Linux驱动

    17.QT-事件处理分析、事件过滤器、拖放事件

    同样也会继续进入QMyWidget类处理事件  Qt中的事件过滤器 事件过滤器可以对需要的组件接收到的事件进行过滤,以及监控 任意的QObject对象都可以作为事件过滤器使用 事件过滤器的实现,需要重写eventFilter eventFilter函数体如下所示: bool QObject::eventFilter ( QObject * watched, QEvent * event ); // watched 实现文本框只允许输入数字: class MainWindow : public QMainWindow { public: MainWindow(); protected: bool eventFilter WA_InputMethodEnabled, false); //禁止中文输入法 textEdit->installEventFilter(this); } bool MainWindow::eventFilter { return false; } } else { return QMainWindow::eventFilter

    2K20发布于 2018-05-28
  • 来自专栏黑白天安全团队

    WMI持久性后门(powershell)(水文)

    组成的 –Class 参数,然后指定我们希望查看的适当类 #List Event Filters Get-WMIObject -Namespace root\Subscription -Class __EventFilter \root\subscription:__EventFilter").CreateInstance() 然后我们需要在这个Filter 实例中添加内容,需要添加的只是 Query、QueryLanguage ErrorAction = 'Stop' NameSpace = 'root\subscription' } 接下来是过滤器的创建 $wmiParams.Class = '__EventFilter WMI Subscriptions using Remove-WMIObject #Filter Get-WMIObject -Namespace root\Subscription -Class __EventFilter the Event Filter was created $EventCheck = Get-WmiObject -Namespace root/subscription -Class __EventFilter

    1.7K10编辑于 2022-11-11
  • 来自专栏Linux驱动

    19.QT-事件发送函数sendEvent()、postEvent()

    //... ... } 由于Qt不认识自定义事件,所以程序里需要提供处理自定义事件对象的方法 常用两种方法来处理 1.通过事件过滤器处理 通过installEventFilter()安装到目标对象 在eventFilter class Widget : public QWidget { private : QLabel label; bool event( QEvent * e); bool eventFilter sendEvent(&label,&event); //发送自定义事件 } } return QWidget::event(e); } bool Widget::eventFilter t->setText(str->str()); t->adjustSize(); return true; } return QWidget::eventFilter

    3.5K50发布于 2018-05-28
  • 来自专栏谢公子学安全

    WMI利用(权限维持)

    事件的官方解释以及部分博客解释: · WMI事件通知 · 接收WMI事件 查询事件 列出事件过滤器 Get-WMIObject -Namespace root\Subscription -Class __EventFilter wmic添加永久事件 注册一个 WMI 事件过滤器 wmic /NAMESPACE:"\\root\subscription" PATH __EventFilter CREATE Name="BugSecFilter \root\subscription:__EventFilter.Name="BugSecFilter"', Consumer='\\. 'Trigger'" QueryLanguage = 'WQL' }; $Filter = Set-WmiInstance -Namespace root/subscription -Class __EventFilter ; RunInteractively=false; CommandLineTemplate="cmd.exe /c c:\beacon.exe"; }; instance of __EventFilter

    2.3K21编辑于 2022-01-19
  • 来自专栏日常活动篇

    Qt5实战第十篇:Qt5事件处理详解

    #include <QApplication>#include <QWidget>#include <QEvent>#include <QDebug>class EventFilter : public QObject { Q_OBJECTprotected: bool eventFilter(QObject *obj, QEvent *event) override { if ); }};int main(int argc, char *argv[]) { QApplication app(argc, argv); MyWidget widget; EventFilter widget.installEventFilter(&filter); // 为widget安装事件过滤器 widget.show(); return app.exec();}在上面的示例中,EventFilter 类重写了eventFilter函数,以监听和处理MyWidget对象上的键盘按键事件。

    89611编辑于 2025-01-03
  • 来自专栏全栈程序员必看

    QT 播放器之列表隐藏

    m_button->setText(QStringLiteral("显示")); } } 列表显示的时候按钮位于列表左侧,隐藏的时候位于窗口右边 bool HideShowListView::eventFilter m_button->move(x,y); return false; } } return QObject::eventFilter HideShowListView(QWidget*list, QWidget *parent = nullptr); // QObject interface public: bool eventFilter connect(m_button,&QPushButton::clicked,this,&HideShowListView::clickButton); } bool HideShowListView::eventFilter )); m_animation->setEndValue(0.99); m_animation->start(); } return QObject::eventFilter

    1K20编辑于 2022-09-05
  • 来自专栏AIoT技术交流、分享

    Python Qt GUI设计:5种事件处理机制(提升篇—3)

    2.3、安装事件过滤器 如果对QObject调用installEventFilter,则相当于为这个QObject安装了一个事件过滤器,对于QObject的全部事件来说,它们都会先传递到事件过滤函数eventFilter 对要过滤的控件设置installEventFilter,这些控件的所有事件都会被eventFilter函数接收并处理。 (QDialog): def __init__(self, parent=None): super(EventFilter, self). if __name__ == '__main__': app = QApplication(sys.argv) dialog = EventFilter() dialog.show (QDialog): def __init__(self, parent=None): super(EventFilter, self).

    2.9K30发布于 2021-11-24
  • 来自专栏红蓝对抗

    技术分享-持久性-WMI事件订阅

    通常,通过 WMI 事件订阅的持久性需要创建以下三个类,它们用于存储有效负载或任意命令,指定将触发有效负载的事件并将两个类(__EventConsumer &__EventFilter)关联起来,以便执行和触发绑定一起 __EventFilter // 触发器(新进程、登录失败等) EventConsumer // 执行动作(执行有效载荷等) __FilterToConsumerBinding // 绑定过滤器和消费者类 wmic /NAMESPACE:"//root/subscription" PATH __EventFilter CREATE Name="PentestLab", EventNameSpace="root Get-WMIObject` `-Namespace` `root/Subscription` `-Class` `__EventFilter Get-WMIObject` `-Namespace` ` 从 PowerShell 控制台执行以下命令将验证有效负载是否存储在“ __EventConsumer** ”中并且“ **__EventFilter ”已创建。

    3.7K10编辑于 2022-06-30
  • 来自专栏Linux驱动

    19.QT-事件发送函数sendEvent()、postEvent()

    //... ... } 由于Qt不认识自定义事件,所以程序里需要提供处理自定义事件对象的方法 常用两种方法来处理 1.通过事件过滤器处理 通过installEventFilter()安装到目标对象 在eventFilter class Widget : public QWidget { private : QLabel label; bool event( QEvent * e); bool eventFilter sendEvent(&label,&event); //发送自定义事件 } } return QWidget::event(e); } bool Widget::eventFilter t->setText(str->str()); t->adjustSize(); return true; } return QWidget::eventFilter

    1.2K30发布于 2018-07-31
  • 来自专栏FreeBuf

    无文件加密挖矿软件GhostMiner

    \ROOT\subscription:__EventFilter.Name=”PowerShell Event Log Filter” EventNamespace : root\cimv2 Query FilterToConsumerBinding.Consumer=”CommandLineEventConsumer.Name=\”PowerShell Event Log Consumer\””,Filter=”__EventFilter.Name Event Log Filter\”” Consumer : CommandLineEventConsumer.Name=”PowerShell Event Log Consumer” Filter : __EventFilter.Name

    1.8K00发布于 2019-10-10
  • 来自专栏全栈程序员必看

    顺丰科技QT面试题「建议收藏」

    这样所有发往B的事件都将先由A的eventFilter()处理. 然后, A要重载QObject::eventFilter()函数, 在eventFilter() 中书写对事件进行处理的代码. 4) 给QAppliction对象安装事件过滤器. 一旦我们给qApp(每个程序中唯一的QApplication对象)装上过滤器,那么所有的事件在发往任何其他的过滤器时,都要先经过当前这个 eventFilter().

    1.1K10编辑于 2022-09-07
  • 来自专栏Linux驱动

    29.QT-自定义窗口拖动、自定义QToolButton/QPushButton开关按钮、界面阴影

    需要将窗口标志设为: Qt::FramelessWindowHint |Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint 2.然后还需要通过安装EventFilter WindowMinMaxButtonsHint); qApp->installEventFilter(this); //给自己加事件过滤器,用来实现拖动窗口 ... ... } eventFilter 事件处理函数实现: bool myUi::eventFilter(QObject *obj, QEvent *evt) { QMouseEvent *mouse = dynamic_cast< dragFlag = false; return true; } } return QWidget::eventFilter

    5K30发布于 2018-07-04
  • 来自专栏HACK学习

    Windows中常见后门持久化方法总结

    => "__EventFilter Name ."), lambda({ if ("$3['eventfilter']" ismatch '__EventFilter Name..' || "$3['eventquery']" ismatch CREATE Name="'.$3['eventfilter'] => "__EventFilter Name ismatch '__EventFilter Name..' || "$3['eventquery']" ismatch 'Event Query...

    3.4K21发布于 2019-10-09
  • 来自专栏Linux驱动

    63.QT-重写QStackedWidget实现home界面左右滑动

    m_smoothCurrentIndex=-1; QPropertyAnimation *animation; float m_smoothMovePos; bool eventFilter signals: protected slots: void OnSmoothAnimationFinished(); }; #endif // SMOOTHSTACKEDWIDGET_H 其中eventFilter 当鼠标(手指)松开后,则调用SmoothAnimationStart()来实现界面移动(到底是切换上一页、还是切换下一页、还是当前页). bool SmoothStackedWidget::eventFilter pos().x(),durationMs); m_dragFlag = MOUSE_RELEASE; } } return QWidget::eventFilter

    2.9K20发布于 2021-01-13
领券