#include <QtGui>
{
Q_OBJECT
public:
{}
protected:
{
qWarning() << Q_FUNC_INFO << event;
}
};
{
Q_OBJECT
public:
{
setText("send weel event");
test = new Test(this);
connect(this, SIGNAL(clicked()),this, SLOT(send()));
}
private Q_SLOTS:
void send()
{
}
private:
Test *test;
};
int main(int argc, char *argv[])
{
Base b(0);
b.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
class Test : public QWidget
{
Q_OBJECT
public:
Test(QWidget *parent) : QWidget(parent)
{}
protected:
void wheelEvent(QWheelEvent *event)
{
qWarning() << Q_FUNC_INFO << event;
}
};
class Base : public QPushButton
{
Q_OBJECT
public:
Base(QWidget *parent) : QPushButton(parent)
{
setText("send weel event");
test = new Test(this);
connect(this, SIGNAL(clicked()),this, SLOT(send()));
}
private Q_SLOTS:
void send()
{
QWheelEvent event(QPoint(10, 10), 120, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(test, &event);
}
private:
Test *test;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Base b(0);
b.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks