1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/testbodyresizer/mainwidget.cpp

50 lines
1.6 KiB
C++
Raw Normal View History

#include <mainwidget.h>
2019-08-25 17:51:54 +08:00
#include <qqtcore.h>
#include <qqtbodyresizer.h>
#include <qqtbodymover.h>
2019-08-25 17:51:54 +08:00
#include <qqtdoubleclickhelper.h>
QQtDoubleClickHelper* helper3;
MainWidget::MainWidget ( QWidget* parent ) : QWidget ( parent )
{
//用户设置 - UI中
setMouseTracking ( true );//必要
setWindowFlags ( windowFlags() | ( Qt::FramelessWindowHint ) );
2019-08-25 17:51:54 +08:00
QQtBodyResizer* helper = new QQtBodyResizer ( this );
this->installEventFilter ( helper );
//顺便测试一下bodyMover
QQtBodyMover* helper2 = new QQtBodyMover ( this );
this->installEventFilter ( helper2 );
2019-08-25 17:51:54 +08:00
//顺便测试一下mouseClicker
helper3 = new QQtDoubleClickHelper ( this );
this->installEventFilter ( helper3 );
//this->removeEventFilter(helper3);
connect ( helper3, SIGNAL ( clickWithPoint ( QPoint ) ), this, SLOT ( clickWithPoint ( QPoint ) ) );
connect ( helper3, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SLOT ( longClickWithPoint ( QPoint ) ) );
connect ( helper3, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this, SLOT ( doubleClickWithPoint ( QPoint ) ) );
}
MainWidget::~MainWidget() {}
2019-08-25 17:51:54 +08:00
void MainWidget::clickWithPoint ( QPoint point )
{
pline() << "click" << point << helper3->clickNum() << helper3->clickNumWithCancel();
}
void MainWidget::longClickWithPoint ( QPoint point )
{
pline() << "long click" << point << helper3->longClickNum() << helper3->longClickNumWithCancel();
}
void MainWidget::doubleClickWithPoint ( QPoint point )
{
pline() << "double click" << point << helper3->doubleClickNum() << helper3->doubleClickNumWithCancel();
}