Enable window dragging code in QToolBar on Mac
Allows moving the window by dragging the unified title and toolbar area. Task-number: QTBUG-34411 Change-Id: Idd85c0031895b5afd7dfdc8616e4452c47935af2 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>bb10
parent
684ebc6648
commit
cd5ae8fb21
|
|
@ -272,7 +272,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
|
|||
QStyleOptionToolBar opt;
|
||||
q->initStyleOption(&opt);
|
||||
if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_OSX
|
||||
// When using the unified toolbar on Mac OS X, the user can click and
|
||||
// drag between toolbar contents to move the window. Make this work by
|
||||
// implementing the standard mouse-dragging code and then call
|
||||
|
|
@ -306,7 +306,7 @@ bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
|
|||
endDrag();
|
||||
return true;
|
||||
} else {
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_OSX
|
||||
if (!macWindowDragging)
|
||||
return false;
|
||||
macWindowDragging = false;
|
||||
|
|
@ -322,7 +322,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
|
|||
Q_Q(QToolBar);
|
||||
|
||||
if (!state) {
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_OSX
|
||||
if (!macWindowDragging)
|
||||
return false;
|
||||
QWidget *w = q->window();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
allowedAreas(Qt::AllToolBarAreas), orientation(Qt::Horizontal),
|
||||
toolButtonStyle(Qt::ToolButtonIconOnly),
|
||||
layout(0), state(0)
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_OSX
|
||||
, macWindowDragging(false)
|
||||
#endif
|
||||
{ }
|
||||
|
|
@ -107,7 +107,7 @@ public:
|
|||
};
|
||||
DragState *state;
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_OSX
|
||||
bool macWindowDragging;
|
||||
QPoint macWindowDragPressPosition;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue