/**
|
* Ò¶º£»Ô
|
* QQȺ121376426
|
* http://blog.yundiantech.com/
|
*/
|
|
#ifndef DRAGABLEWIDGET_H
|
#define DRAGABLEWIDGET_H
|
|
#include <QWidget>
|
#include <QTimer>
|
|
namespace Ui {
|
class DragAbleWidget;
|
}
|
|
//Êó±êʵÏָı䴰¿Ú´óС
|
#define PADDING 6
|
enum Direction { UP=0, DOWN, LEFT, RIGHT, LEFTTOP, LEFTBOTTOM, RIGHTBOTTOM, RIGHTTOP, NONE };
|
|
|
class DragAbleWidget : public QWidget
|
{
|
Q_OBJECT
|
|
public:
|
explicit DragAbleWidget(QWidget *parent = 0);
|
~DragAbleWidget();
|
|
QWidget *getContainWidget();
|
|
void setTitle(QString str);
|
|
private:
|
Ui::DragAbleWidget *ui;
|
|
QTimer *mTimer;
|
|
///ÒÔÏÂÊǸı䴰Ìå´óСÏà¹Ø
|
////////
|
protected:
|
// bool eventFilter(QObject *obj, QEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
|
private:
|
bool isMax; //ÊÇ·ñ×î´ó»¯
|
QRect mLocation;
|
|
bool isLeftPressDown; // ÅжÏ×ó¼üÊÇ·ñ°´ÏÂ
|
QPoint dragPosition; // ´°¿ÚÒÆ¶¯Í϶¯Ê±ÐèÒª¼ÇסµÄµã
|
int dir; // ´°¿Ú´óС¸Ä±äʱ£¬¼Ç¼¸Ä±ä·½Ïò
|
|
void checkCursorDirect(const QPoint &cursorGlobalPoint);
|
|
void doShowFullScreen();
|
void doShowNormal();
|
|
void showBorderRadius(bool isShow);
|
void doChangeFullScreen();
|
|
private slots:
|
void slotTimerTimeOut();
|
|
void on_btnMenu_Close_clicked();
|
void on_btnMenu_Max_clicked();
|
void on_btnMenu_Min_clicked();
|
|
};
|
|
#endif // DRAGABLEWIDGET_H
|