mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
add click widgets
This commit is contained in:
parent
88da5a3891
commit
bfb412b324
@ -85,8 +85,13 @@ void QQtClickHelper::mouseReleaseEvent ( QMouseEvent* event, QWidget* userWidget
|
||||
p2debug() << "send long click " ;
|
||||
emit longClick();
|
||||
emit longClickWithPoint ( event->pos() );
|
||||
|
||||
emit longClickWithPointF ( event->localPos() );
|
||||
|
||||
#if 0
|
||||
emit longClick ( userWidget );
|
||||
emit longClickWithPoint ( event->pos(), userWidget );
|
||||
emit longClickWithPointF ( event->localPos(), userWidget );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else if ( mClickType == QQtClick )
|
||||
@ -115,8 +120,14 @@ void QQtClickHelper::mouseReleaseEvent ( QMouseEvent* event, QWidget* userWidget
|
||||
p2debug() << "send click." ;
|
||||
emit click();
|
||||
emit clickWithPoint ( event->pos() );
|
||||
|
||||
emit clickWithPointF ( event->localPos() );
|
||||
|
||||
#if 0
|
||||
emit click ( userWidget );
|
||||
emit clickWithPoint ( event->pos(), userWidget );
|
||||
emit clickWithPointF ( event->localPos(), userWidget );
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -30,13 +30,9 @@ public:
|
||||
explicit QQtClickHelper ( QObject* parent = 0 );
|
||||
virtual ~QQtClickHelper();
|
||||
|
||||
//调用于userWidget相对应的Event里
|
||||
//允许重写
|
||||
public:
|
||||
virtual void mousePressEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
|
||||
//发给业务层
|
||||
//发回界面层
|
||||
//这些信号不区分Widget,谁发过来都发出去,不论Widget
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
@ -49,6 +45,27 @@ signals:
|
||||
void clickWithPointF ( QPointF point );
|
||||
void longClickWithPointF ( QPointF point );
|
||||
|
||||
#if 0
|
||||
//发给业务层
|
||||
//发回界面层
|
||||
//这里的信号都带着Widget指针,可以区分Widget
|
||||
signals:
|
||||
void click ( QWidget* userWidget );
|
||||
void clickWithPoint ( QPoint point, QWidget* userWidget );
|
||||
void clickWithPointF ( QPointF point, QWidget* userWidget );
|
||||
|
||||
void longClick ( QWidget* userWidget );
|
||||
void longClickWithPoint ( QPoint point, QWidget* userWidget );
|
||||
void longClickWithPointF ( QPointF point, QWidget* userWidget );
|
||||
#endif
|
||||
|
||||
//调用于userWidget相对应的Event里
|
||||
//允许重写
|
||||
public:
|
||||
virtual void mousePressEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event, QWidget* userWidget = 0 );
|
||||
|
||||
//optional
|
||||
public:
|
||||
//设置longClick超时 default:1200ms
|
1
src/exquisite/clickwidgets/qqtclicklabel.cpp
Normal file
1
src/exquisite/clickwidgets/qqtclicklabel.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtclicklabel.h"
|
105
src/exquisite/clickwidgets/qqtclicklabel.h
Normal file
105
src/exquisite/clickwidgets/qqtclicklabel.h
Normal file
@ -0,0 +1,105 @@
|
||||
#ifndef QQTCLICKLABEL_H
|
||||
#define QQTCLICKLABEL_H
|
||||
|
||||
#include <qqtlabel.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个basic类 提供click信号
|
||||
* 提供安装ClickHelper的能力
|
||||
* 提供MouseEvent响应
|
||||
*
|
||||
* 用户使用方法
|
||||
* new ClickHelper
|
||||
* installClickHelper
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtClickLabel : public QQtLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtClickLabel ( QWidget* parent = 0 ) :
|
||||
QQtLabel ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtClickLabel() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtLabel::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtLabel::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtLabel::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QQTCLICKLABEL_H
|
1
src/exquisite/clickwidgets/qqtclickwidget.cpp
Normal file
1
src/exquisite/clickwidgets/qqtclickwidget.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtclickwidget.h"
|
103
src/exquisite/clickwidgets/qqtclickwidget.h
Normal file
103
src/exquisite/clickwidgets/qqtclickwidget.h
Normal file
@ -0,0 +1,103 @@
|
||||
#ifndef QQTCLICKWIDGET_H
|
||||
#define QQTCLICKWIDGET_H
|
||||
|
||||
#include <qqtwidget.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 内置ClickHelper
|
||||
*
|
||||
* 添加了click支持的QQtWidget
|
||||
* 这个Widget表示了如何使用QQtWidgetClickHelper和它的子类
|
||||
*
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtClickWidget : public QQtWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtClickWidget ( QWidget* parent = 0 ) :
|
||||
QQtWidget ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtClickWidget() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtWidget::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtWidget::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtWidget::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QQTCLICKWIDGET_H
|
1
src/exquisite/clickwidgets/qqtdoubleclicklabel.cpp
Normal file
1
src/exquisite/clickwidgets/qqtdoubleclicklabel.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtdoubleclicklabel.h"
|
112
src/exquisite/clickwidgets/qqtdoubleclicklabel.h
Normal file
112
src/exquisite/clickwidgets/qqtdoubleclicklabel.h
Normal file
@ -0,0 +1,112 @@
|
||||
#ifndef QQTDOUBLECLICKLABEL_H
|
||||
#define QQTDOUBLECLICKLABEL_H
|
||||
|
||||
#include <qqtlabel.h>
|
||||
#include <qqtdoubleclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtDoubleClickLabel : public QQtLabel
|
||||
{
|
||||
public:
|
||||
explicit QQtDoubleClickLabel ( QWidget* parent = 0 ) :
|
||||
QQtLabel ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtDoubleClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtDoubleClickLabel() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
void doubleClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
void doubleClickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this, SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this,
|
||||
SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtLabel::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtLabel::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtLabel::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QQTDOUBLECLICKLABEL_H
|
1
src/exquisite/clickwidgets/qqtdoubleclickwidget.cpp
Normal file
1
src/exquisite/clickwidgets/qqtdoubleclickwidget.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtdoubleclickwidget.h"
|
115
src/exquisite/clickwidgets/qqtdoubleclickwidget.h
Normal file
115
src/exquisite/clickwidgets/qqtdoubleclickwidget.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef QQTDOUBLECLICKWIDGET_H
|
||||
#define QQTDOUBLECLICKWIDGET_H
|
||||
|
||||
#include <qqtwidget.h>
|
||||
#include <qqtdoubleclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 内置DoubleClickHelper
|
||||
*
|
||||
* 添加了doubleClick支持的QQtClickWidget
|
||||
* 这个Widget表示了如何使用QQtWidgetClickHelper和它的子类
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtDoubleClickWidget : public QQtWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtDoubleClickWidget ( QWidget* parent = 0 ) :
|
||||
QQtWidget ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtDoubleClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtDoubleClickWidget() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
void doubleClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
void doubleClickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this, SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this,
|
||||
SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtWidget::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtWidget::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtWidget::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QQTDOUBLECLICKWIDGET_H
|
1
src/exquisite/clickwidgets/qqtlongclicklabel.cpp
Normal file
1
src/exquisite/clickwidgets/qqtlongclicklabel.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtlongclicklabel.h"
|
108
src/exquisite/clickwidgets/qqtlongclicklabel.h
Normal file
108
src/exquisite/clickwidgets/qqtlongclicklabel.h
Normal file
@ -0,0 +1,108 @@
|
||||
#ifndef QQTLONGCLICKLABEL_H
|
||||
#define QQTLONGCLICKLABEL_H
|
||||
|
||||
#include <qqtlabel.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
* 为确定功能的子类Label服务
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtLongClickLabel : public QQtLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtLongClickLabel ( QWidget* parent = 0 ) :
|
||||
QQtLabel ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtLongClickLabel() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtLabel::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtLabel::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtLabel::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // QQTLONGCLICKLABEL_H
|
1
src/exquisite/clickwidgets/qqtlongclickwidget.cpp
Normal file
1
src/exquisite/clickwidgets/qqtlongclickwidget.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "qqtlongclickwidget.h"
|
107
src/exquisite/clickwidgets/qqtlongclickwidget.h
Normal file
107
src/exquisite/clickwidgets/qqtlongclickwidget.h
Normal file
@ -0,0 +1,107 @@
|
||||
#ifndef QQTLONGCLICKWIDGET_H
|
||||
#define QQTLONGCLICKWIDGET_H
|
||||
|
||||
#include <qqtwidget.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 提供安装ClickHelper的能力
|
||||
* 为确定功能的子类Widget服务
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtLongClickWidget : public QQtWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQtLongClickWidget ( QWidget* parent = 0 ) :
|
||||
QQtWidget ( parent ) {
|
||||
mClickHelper = 0;
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper ( mClickHelper );
|
||||
}
|
||||
virtual ~QQtLongClickWidget() {}
|
||||
|
||||
/**
|
||||
* 提供给App用信号
|
||||
* 界面层内部直接处理
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
|
||||
/**
|
||||
* 用户需要这个进行设置ClickHelper,这个label才产生click能力.
|
||||
*/
|
||||
public:
|
||||
inline void installClickHelper ( QQtClickHelper* helper ) {
|
||||
unConnectClickHelper();
|
||||
mClickHelper = helper;
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connectClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 子类重写这两个函数,实现丰富的click能力
|
||||
*/
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void connectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
virtual void unConnectClickHelper() {
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
private:
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
/**
|
||||
* 子类不必重写MouseEvent函数,
|
||||
* 这里实现对clickHelper的响应能力
|
||||
*/
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtWidget::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtWidget::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) {
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtWidget::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QQTLONGCLICKWIDGET_H
|
@ -1,35 +0,0 @@
|
||||
#include "qqtcanclicklabel.h"
|
||||
|
||||
QQtCanClickLabel::QQtCanClickLabel ( QWidget* parent ) :
|
||||
QQtLabel ( parent )
|
||||
{
|
||||
mClickHelper = 0;
|
||||
}
|
||||
|
||||
QQtCanClickLabel::~QQtCanClickLabel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QQtCanClickLabel::mousePressEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtLabel::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
void QQtCanClickLabel::mouseReleaseEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtLabel::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
void QQtCanClickLabel::mouseDoubleClickEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtLabel::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
#ifndef QQTCANCLICKLABEL_H
|
||||
#define QQTCANCLICKLABEL_H
|
||||
|
||||
#include <qqtlabel.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
* 为确定功能的子类Label服务
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtCanClickLabel : public QQtLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtCanClickLabel ( QWidget* parent = 0 );
|
||||
virtual ~QQtCanClickLabel();
|
||||
|
||||
signals:
|
||||
|
||||
signals:
|
||||
|
||||
public:
|
||||
inline void setClickHelper ( QQtClickHelper* helper ) {
|
||||
uninstallClickHelper();
|
||||
mClickHelper = helper;
|
||||
installClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
protected:
|
||||
//需要重写
|
||||
virtual void installClickHelper() {}
|
||||
virtual void uninstallClickHelper() {}
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) override;
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) override;
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) override;
|
||||
};
|
||||
|
||||
#endif // QQTCANCLICKLABEL_H
|
@ -1,35 +0,0 @@
|
||||
#include "qqtcanclickwidget.h"
|
||||
|
||||
QQtCanClickWidget::QQtCanClickWidget ( QWidget* parent ) :
|
||||
QQtWidget ( parent )
|
||||
{
|
||||
mClickHelper = 0;
|
||||
}
|
||||
|
||||
QQtCanClickWidget::~QQtCanClickWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QQtCanClickWidget::mousePressEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mousePressEvent ( event, this );
|
||||
return QQtWidget::mousePressEvent ( event );
|
||||
}
|
||||
|
||||
void QQtCanClickWidget::mouseReleaseEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseReleaseEvent ( event, this );
|
||||
return QQtWidget::mouseReleaseEvent ( event );
|
||||
}
|
||||
|
||||
void QQtCanClickWidget::mouseDoubleClickEvent ( QMouseEvent* event )
|
||||
{
|
||||
if ( mClickHelper )
|
||||
mClickHelper->mouseDoubleClickEvent ( event, this );
|
||||
return QQtWidget::mouseDoubleClickEvent ( event );
|
||||
}
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
#ifndef QQTCANCLICKWIDGET_H
|
||||
#define QQTCANCLICKWIDGET_H
|
||||
|
||||
#include <qqtwidget.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
* 为确定功能的子类Widget服务
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtCanClickWidget : public QQtWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtCanClickWidget ( QWidget* parent = 0 );
|
||||
virtual ~QQtCanClickWidget();
|
||||
|
||||
signals:
|
||||
|
||||
signals:
|
||||
|
||||
public:
|
||||
inline void setClickHelper ( QQtClickHelper* helper ) {
|
||||
uninstallClickHelper();
|
||||
mClickHelper = helper;
|
||||
installClickHelper();
|
||||
}
|
||||
inline const QQtClickHelper* clickHelper() const {
|
||||
return mClickHelper;
|
||||
}
|
||||
protected:
|
||||
//需要重写
|
||||
virtual void installClickHelper() {}
|
||||
virtual void uninstallClickHelper() {}
|
||||
QQtClickHelper* mClickHelper;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent ( QMouseEvent* event ) override;
|
||||
virtual void mouseReleaseEvent ( QMouseEvent* event ) override;
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent* event ) override;
|
||||
};
|
||||
|
||||
#endif // QQTCANCLICKWIDGET_H
|
@ -1,35 +0,0 @@
|
||||
#include "qqtclicklabel.h"
|
||||
|
||||
QQtClickLabel::QQtClickLabel ( QWidget* parent ) :
|
||||
QQtCanClickLabel ( parent )
|
||||
{
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper();
|
||||
}
|
||||
|
||||
QQtClickLabel::~QQtClickLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void QQtClickLabel::installClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
void QQtClickLabel::uninstallClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
#ifndef QQTCLICKLABEL_H
|
||||
#define QQTCLICKLABEL_H
|
||||
|
||||
#include <qqtcanclicklabel.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtClickLabel : public QQtCanClickLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtClickLabel ( QWidget* parent = 0 );
|
||||
virtual ~QQtClickLabel();
|
||||
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void installClickHelper() override;
|
||||
virtual void uninstallClickHelper() override;
|
||||
};
|
||||
|
||||
#endif // QQTCLICKLABEL_H
|
@ -1,35 +0,0 @@
|
||||
#include "qqtclickwidget.h"
|
||||
|
||||
QQtClickWidget::QQtClickWidget ( QWidget* parent ) :
|
||||
QQtCanClickWidget ( parent )
|
||||
{
|
||||
mClickHelper = new QQtClickHelper ( this );
|
||||
installClickHelper();
|
||||
}
|
||||
|
||||
QQtClickWidget::~QQtClickWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void QQtClickWidget::installClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
void QQtClickWidget::uninstallClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
#ifndef QQTCLICKWIDGET_H
|
||||
#define QQTCLICKWIDGET_H
|
||||
|
||||
#include <qqtcanclickwidget.h>
|
||||
#include <qqtclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 内置ClickHelper
|
||||
*
|
||||
* 添加了longClick支持的QQtCanClickWidget
|
||||
* 这个Widget表示了如何使用QQtWidgetClickHelper和它的子类
|
||||
*
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtClickWidget : public QQtCanClickWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtClickWidget ( QWidget* parent = 0 );
|
||||
virtual ~QQtClickWidget();
|
||||
|
||||
/**
|
||||
* 按键功能支持者
|
||||
*/
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void installClickHelper() override;
|
||||
virtual void uninstallClickHelper() override;
|
||||
};
|
||||
|
||||
#endif // QQTCLICKWIDGET_H
|
@ -1,37 +0,0 @@
|
||||
#include "qqtdoubleclicklabel.h"
|
||||
|
||||
QQtDoubleClickLabel::QQtDoubleClickLabel ( QWidget* parent ) :
|
||||
QQtCanClickLabel ( parent )
|
||||
{
|
||||
mClickHelper = new QQtDoubleClickHelper ( this );
|
||||
installClickHelper();
|
||||
}
|
||||
|
||||
QQtDoubleClickLabel::~QQtDoubleClickLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void QQtDoubleClickLabel::installClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this, SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
void QQtDoubleClickLabel::uninstallClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this,
|
||||
SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#ifndef QQTDOUBLECLICKLABEL_H
|
||||
#define QQTDOUBLECLICKLABEL_H
|
||||
|
||||
#include <qqtcanclicklabel.h>
|
||||
#include <qqtdoubleclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 这个是个虚类
|
||||
* 提供安装ClickHelper的能力
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtDoubleClickLabel : public QQtCanClickLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtDoubleClickLabel ( QWidget* parent = 0 );
|
||||
virtual ~QQtDoubleClickLabel();
|
||||
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
void doubleClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
void doubleClickWithPoint ( QPoint point );
|
||||
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void installClickHelper() override;
|
||||
virtual void uninstallClickHelper() override;
|
||||
};
|
||||
|
||||
#endif // QQTDOUBLECLICKLABEL_H
|
@ -1,38 +0,0 @@
|
||||
#include "qqtdoubleclickwidget.h"
|
||||
|
||||
QQtDoubleClickWidget::QQtDoubleClickWidget ( QWidget* parent ) :
|
||||
QQtCanClickWidget ( parent )
|
||||
{
|
||||
mClickHelper = new QQtDoubleClickHelper ( this );
|
||||
installClickHelper();
|
||||
}
|
||||
|
||||
QQtDoubleClickWidget::~QQtDoubleClickWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void QQtDoubleClickWidget::installClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
connect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
connect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
connect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this, SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
||||
void QQtDoubleClickWidget::uninstallClickHelper()
|
||||
{
|
||||
if ( !mClickHelper )
|
||||
return;
|
||||
disconnect ( mClickHelper, SIGNAL ( click() ), this, SIGNAL ( click() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClick() ), this, SIGNAL ( longClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClick() ), this, SIGNAL ( doubleClick() ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( clickWithPoint ( QPoint ) ), this, SIGNAL ( clickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( longClickWithPoint ( QPoint ) ), this, SIGNAL ( longClickWithPoint ( QPoint ) ) );
|
||||
disconnect ( mClickHelper, SIGNAL ( doubleClickWithPoint ( QPoint ) ), this,
|
||||
SIGNAL ( doubleClickWithPoint ( QPoint ) ) );
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
#ifndef QQTDOUBLECLICKWIDGET_H
|
||||
#define QQTDOUBLECLICKWIDGET_H
|
||||
|
||||
#include <qqtcanclickwidget.h>
|
||||
#include <qqtdoubleclickhelper.h>
|
||||
|
||||
#include <qqt-local.h>
|
||||
#include <qqtcore.h>
|
||||
|
||||
/**
|
||||
* 内置DoubleClickHelper
|
||||
*
|
||||
* 添加了doubleClick支持的QQtClickWidget
|
||||
* 这个Widget表示了如何使用QQtWidgetClickHelper和它的子类
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQtDoubleClickWidget : public QQtCanClickWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtDoubleClickWidget ( QWidget* parent = 0 );
|
||||
virtual ~QQtDoubleClickWidget();
|
||||
|
||||
signals:
|
||||
void click();
|
||||
void longClick();
|
||||
void doubleClick();
|
||||
|
||||
signals:
|
||||
void clickWithPoint ( QPoint point );
|
||||
void longClickWithPoint ( QPoint point );
|
||||
void doubleClickWithPoint ( QPoint point );
|
||||
|
||||
// QQtWidget interface
|
||||
protected:
|
||||
virtual void installClickHelper() override;
|
||||
virtual void uninstallClickHelper() override;
|
||||
};
|
||||
|
||||
#endif // QQTDOUBLECLICKWIDGET_H
|
@ -343,6 +343,7 @@ contains (DEFINES, __EXQUISITE__) {
|
||||
#single color only widget
|
||||
DEFINES += __COLORWIDGETS__
|
||||
|
||||
DEFINES += __CLICKWIDGETS__
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@ -432,6 +433,7 @@ defineReplace(qqt_header){
|
||||
|
||||
#exquisite widgets
|
||||
command += $${path}/exquisite
|
||||
command += $${path}/exquisite/clickwidgets
|
||||
command += $${path}/exquisite/svgwidgets
|
||||
command += $${path}/exquisite/gifwidgets
|
||||
command += $${path}/exquisite/openglwidgets
|
||||
|
@ -318,36 +318,6 @@ contains (DEFINES, __NETWORKSUPPORT__) {
|
||||
|
||||
contains (DEFINES, __EXQUISITE__) {
|
||||
#exquisite
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtclicksoundhelper.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtclicksoundhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtclickhelper.cpp \
|
||||
$$PWD/exquisite/qqtdoubleclickhelper.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtclickhelper.h \
|
||||
$$PWD/exquisite/qqtdoubleclickhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtcanclickwidget.cpp \
|
||||
$$PWD/exquisite/qqtclickwidget.cpp \
|
||||
$$PWD/exquisite/qqtdoubleclickwidget.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtcanclickwidget.h \
|
||||
$$PWD/exquisite/qqtclickwidget.h \
|
||||
$$PWD/exquisite/qqtdoubleclickwidget.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtcanclicklabel.cpp \
|
||||
$$PWD/exquisite/qqtclicklabel.cpp \
|
||||
$$PWD/exquisite/qqtdoubleclicklabel.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtcanclicklabel.h \
|
||||
$$PWD/exquisite/qqtclicklabel.h \
|
||||
$$PWD/exquisite/qqtdoubleclicklabel.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtframelesshelper.cpp \
|
||||
$$PWD/exquisite/qqtframelesshelperprivate.cpp
|
||||
@ -355,6 +325,39 @@ contains (DEFINES, __EXQUISITE__) {
|
||||
$$PWD/exquisite/qqtframelesshelper.h \
|
||||
$$PWD/exquisite/qqtframelesshelperprivate.h
|
||||
|
||||
#can click support widgets
|
||||
contains (DEFINES, __CLICKWIDGETS__) {
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclicksoundhelper.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclicksoundhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclickhelper.cpp \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclickhelper.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclickhelper.h \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclickhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclickwidget.cpp \
|
||||
$$PWD/exquisite/clickwidgets/qqtlongclickwidget.cpp \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclickwidget.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclickwidget.h \
|
||||
$$PWD/exquisite/clickwidgets/qqtlongclickwidget.h \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclickwidget.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclicklabel.cpp \
|
||||
$$PWD/exquisite/clickwidgets/qqtlongclicklabel.cpp \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclicklabel.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/clickwidgets/qqtclicklabel.h \
|
||||
$$PWD/exquisite/clickwidgets/qqtlongclicklabel.h \
|
||||
$$PWD/exquisite/clickwidgets/qqtdoubleclicklabel.h
|
||||
}
|
||||
|
||||
#dialog
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtpopupdialog.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user