Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qev.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#include <QWidget>
5#include <QApplication>
6#include <QDebug>
7#include <QFile>
8#include <qevent.h>
9
11
12QIODevice *qout;
13
14class Widget : public QWidget
15{
16public:
17 Widget(){ setAttribute(Qt::WA_InputMethodEnabled); }
18 QSize sizeHint() const override { return QSize(20, 20); }
19 bool event(QEvent *e) override
20 {
21 if (e->type() == QEvent::ContextMenu)
22 return false;
23 QDebug(qout) << e << Qt::endl;
24 return QWidget::event(e);
25 }
26};
27
28
29int main(int argc, char **argv)
30{
31 QApplication app(argc, argv);
32
33 QFile fout;
34 fout.open(stdout, QIODevice::WriteOnly);
35 qout = &fout;
36
37 Widget w;
38 w.show();
39 return app.exec();
40}
int main(int argc, char *argv[])
[2]
Definition buffer.cpp:77
QSize sizeHint() const override
Definition qev.cpp:18
bool event(QEvent *e) override
This is the main event handler; it handles event event.
Definition qev.cpp:19
Widget()
Definition qev.cpp:17