46 #include <QMouseEvent>
56 using namespace DISPLIB;
63 Qt::WindowFlags flags,
67 : QWidget(parent, flags)
68 , m_bRoundEdges(bRoundEdges)
69 , m_bDraggable(bDraggable)
70 , m_bMousePressed(false)
72 this->setWindowFlag(Qt::CustomizeWindowHint, bFrameless);
94 return QWidget::mousePressEvent(event);
97 if (event->button() == Qt::LeftButton) {
98 m_dragPosition =
event->globalPos() - frameGeometry().topLeft();
100 m_bMousePressed =
true;
109 return QWidget::mouseMoveEvent(event);
112 if (event->buttons() && Qt::LeftButton && m_bMousePressed) {
113 move(event->globalPos() - m_dragPosition);
122 if(event->button() == Qt::LeftButton) {
123 m_bMousePressed =
false;
132 setMask(
roundedRect(QRect(0,0,width(),height()),10));
142 region += rect.adjusted(r, 0, -r, 0);
143 region += rect.adjusted(0, r, 0, -r);
145 QRect corner(rect.topLeft(), QSize(r*2, r*2));
146 region += QRegion(corner, QRegion::Ellipse);
148 corner.moveTopRight(rect.topRight());
149 region += QRegion(corner, QRegion::Ellipse);
151 corner.moveBottomLeft(rect.bottomLeft());
152 region += QRegion(corner, QRegion::Ellipse);
154 corner.moveBottomRight(rect.bottomRight());
155 region += QRegion(corner, QRegion::Ellipse);