Bring back MacSizeChange event
This ensures WA_MacNormalSize & Co. work (almost) properly. Task-number: QTCREATORBUG-7966 Change-Id: Ib03b5c0f163409e2bc387f6cf9b56c72c43caec7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>bb10
parent
8c838f29d4
commit
f8b6d104b9
|
|
@ -8318,10 +8318,11 @@ void QWidget::changeEvent(QEvent * event)
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
case QEvent::MacSizeChange:
|
||||
updateGeometry();
|
||||
break;
|
||||
#elif defined Q_WS_MAC
|
||||
case QEvent::ToolTipChange:
|
||||
case QEvent::MouseTrackingChange:
|
||||
qt_mac_update_mouseTracking(this);
|
||||
|
|
@ -9923,6 +9924,24 @@ static void setAttribute_internal(Qt::WidgetAttribute attribute, bool on, QWidge
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void QWidgetPrivate::macUpdateSizeAttribute()
|
||||
{
|
||||
Q_Q(QWidget);
|
||||
QEvent event(QEvent::MacSizeChange);
|
||||
QApplication::sendEvent(q, &event);
|
||||
for (int i = 0; i < children.size(); ++i) {
|
||||
QWidget *w = qobject_cast<QWidget *>(children.at(i));
|
||||
if (w && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))
|
||||
&& !q->testAttribute(Qt::WA_MacMiniSize) // no attribute set? inherit from parent
|
||||
&& !w->testAttribute(Qt::WA_MacSmallSize)
|
||||
&& !w->testAttribute(Qt::WA_MacNormalSize))
|
||||
w->d_func()->macUpdateSizeAttribute();
|
||||
}
|
||||
resolveFont();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Sets the attribute \a attribute on this widget if \a on is true;
|
||||
otherwise clears the attribute.
|
||||
|
|
@ -10004,7 +10023,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
|
|||
case Qt::WA_MacNormalSize:
|
||||
case Qt::WA_MacSmallSize:
|
||||
case Qt::WA_MacMiniSize:
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
{
|
||||
// We can only have one of these set at a time
|
||||
const Qt::WidgetAttribute MacSizes[] = { Qt::WA_MacNormalSize, Qt::WA_MacSmallSize,
|
||||
|
|
|
|||
|
|
@ -725,7 +725,9 @@ public:
|
|||
void grabMouseWhileInWindow();
|
||||
void registerTouchWindow();
|
||||
void winSetupGestures();
|
||||
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC
|
||||
#elif defined(Q_OS_MAC) // <--------------------------------------------------------- MAC
|
||||
void macUpdateSizeAttribute();
|
||||
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC (old stuff)
|
||||
// This is new stuff
|
||||
uint needWindowChange : 1;
|
||||
|
||||
|
|
@ -752,7 +754,6 @@ public:
|
|||
//these are here just for code compat (HIViews)
|
||||
Qt::HANDLE qd_hd;
|
||||
|
||||
void macUpdateSizeAttribute();
|
||||
void macUpdateHideOnSuspend();
|
||||
void macUpdateOpaqueSizeGrip();
|
||||
void macUpdateIgnoreMouseEvents();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@
|
|||
|
||||
#include "qstyleoption.h"
|
||||
#include "qapplication.h"
|
||||
#ifdef Q_WS_MAC
|
||||
# include "private/qt_mac_p.h"
|
||||
#ifdef Q_OS_MAC
|
||||
# include "qmacstyle_mac.h"
|
||||
#endif
|
||||
#include <qdebug.h>
|
||||
|
|
@ -206,7 +205,8 @@ void QStyleOption::init(const QWidget *widget)
|
|||
extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
|
||||
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
|
||||
state &= ~QStyle::State_Enabled;
|
||||
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
switch (QMacStyle::widgetSizePolicy(widget)) {
|
||||
case QMacStyle::SizeSmall:
|
||||
state |= QStyle::State_Small;
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ bool QCheckBox::event(QEvent *e)
|
|||
{
|
||||
Q_D(QCheckBox);
|
||||
if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2660,7 +2660,7 @@ void QComboBox::changeEvent(QEvent *e)
|
|||
switch (e->type()) {
|
||||
case QEvent::StyleChange:
|
||||
d->updateDelegate();
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
case QEvent::MacSizeChange:
|
||||
#endif
|
||||
d->sizeHint = QSize(); // invalidate size hint
|
||||
|
|
|
|||
|
|
@ -1036,7 +1036,7 @@ bool QDateTimeEdit::event(QEvent *event)
|
|||
d->updateEdit();
|
||||
break;
|
||||
case QEvent::StyleChange:
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
case QEvent::MacSizeChange:
|
||||
#endif
|
||||
d->setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem);
|
||||
|
|
|
|||
|
|
@ -1204,7 +1204,7 @@ void QDialogButtonBox::changeEvent(QEvent *event)
|
|||
it.key()->setStyle(newStyle);
|
||||
}
|
||||
// fallthrough intended
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
case QEvent::MacSizeChange:
|
||||
#endif
|
||||
d->resetLayout();
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ void QFrame::changeEvent(QEvent *ev)
|
|||
{
|
||||
Q_D(QFrame);
|
||||
if (ev->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| ev->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -688,7 +688,7 @@ void QGroupBox::changeEvent(QEvent *ev)
|
|||
d->_q_setChildrenEnabled(false);
|
||||
}
|
||||
} else if (ev->type() == QEvent::FontChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| ev->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
|| ev->type() == QEvent::StyleChange) {
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ bool QLabel::event(QEvent *e)
|
|||
if (d->control)
|
||||
d->textLayoutDirty = true;
|
||||
} else if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ bool QProgressBar::event(QEvent *e)
|
|||
{
|
||||
Q_D(QProgressBar);
|
||||
if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -674,7 +674,7 @@ bool QPushButton::event(QEvent *e)
|
|||
dialog->d_func()->setMainDefault(this);
|
||||
}
|
||||
} else if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ bool QRadioButton::event(QEvent *e)
|
|||
{
|
||||
Q_D(QRadioButton);
|
||||
if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1258,7 +1258,7 @@ bool QSpinBox::event(QEvent *event)
|
|||
{
|
||||
Q_D(QSpinBox);
|
||||
if (event->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| event->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1050,7 +1050,7 @@ bool QTabWidget::event(QEvent *ev)
|
|||
void QTabWidget::changeEvent(QEvent *ev)
|
||||
{
|
||||
if (ev->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| ev->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
)
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ void QToolButton::changeEvent(QEvent *e)
|
|||
if (qobject_cast<QToolBar*>(parentWidget()))
|
||||
d->autoRaise = true;
|
||||
} else if (e->type() == QEvent::StyleChange
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
|| e->type() == QEvent::MacSizeChange
|
||||
#endif
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue