1
0
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:
AbelTian 2018-05-18 19:52:17 +08:00
parent 88da5a3891
commit bfb412b324
32 changed files with 728 additions and 502 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -0,0 +1 @@
#include "qqtclicklabel.h"

View 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

View File

@ -0,0 +1 @@
#include "qqtclickwidget.h"

View 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

View File

@ -0,0 +1 @@
#include "qqtdoubleclicklabel.h"

View 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

View File

@ -0,0 +1 @@
#include "qqtdoubleclickwidget.h"

View 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

View File

@ -0,0 +1 @@
#include "qqtlongclicklabel.h"

View 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

View File

@ -0,0 +1 @@
#include "qqtlongclickwidget.h"

View 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

View File

@ -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 );
}

View File

@ -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

View File

@ -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 );
}

View File

@ -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

View File

@ -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 ) ) );
}

View File

@ -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

View File

@ -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 ) ) );
}

View File

@ -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

View File

@ -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 ) ) );
}

View File

@ -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

View File

@ -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 ) ) );
}

View File

@ -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

View File

@ -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

View File

@ -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