summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_mac.mm
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-23 08:46:26 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-04-23 08:46:26 (GMT)
commitbe3916b7e4e8007394cbed40484ef6b696e90f2b (patch)
treea66dc85f3900e08a040f0d80eb0e56f43a163efc /src/gui/kernel/qwidget_mac.mm
parented24cd82444faeeda0a171a9082808ebb667e092 (diff)
parent389c4fdebe681eb3af5a2431c390323f52a03c17 (diff)
downloadQt-be3916b7e4e8007394cbed40484ef6b696e90f2b.zip
Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.gz
Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: src/corelib/global/qfeatures.h src/gui/painting/qtransform.cpp util/scripts/make_qfeatures_dot_h
Diffstat (limited to 'src/gui/kernel/qwidget_mac.mm')
-rw-r--r--src/gui/kernel/qwidget_mac.mm88
1 files changed, 49 insertions, 39 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 013fc1e..0f74c32 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3995,6 +3995,33 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
}
}
+void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h)
+{
+ if (QWExtra *extra = extraData()) {
+ w = qMin(w, extra->maxw);
+ h = qMin(h, extra->maxh);
+ w = qMax(w, extra->minw);
+ h = qMax(h, extra->minh);
+
+ // Deal with size increment
+ if (QTLWExtra *top = topData()) {
+ if(top->incw) {
+ w = w/top->incw;
+ w *= top->incw;
+ }
+ if(top->inch) {
+ h = h/top->inch;
+ h *= top->inch;
+ }
+ }
+ }
+
+ if (isRealWindow()) {
+ w = qMax(0, w);
+ h = qMax(0, h);
+ }
+}
+
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
@@ -4005,7 +4032,9 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
QMacCocoaAutoReleasePool pool;
bool realWindow = isRealWindow();
+
if (realWindow && !(w == 0 && h == 0) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ applyMaxAndMinSizeConstraints(w, h);
topData()->isSetGeometry = 1;
topData()->isMove = isMove;
#ifndef QT_MAC_USE_COCOA
@@ -4031,10 +4060,26 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
{
Q_Q(QWidget);
bool realWindow = isRealWindow();
- if(QWExtra *extra = extraData()) { // any size restrictions?
- if(realWindow) {
+
+ QPoint oldp = q->pos();
+ QSize olds = q->size();
+ const bool isResize = (olds != QSize(w, h));
+
+ if (!realWindow && !isResize && QPoint(x, y) == oldp)
+ return;
+
+ if (isResize)
+ data.window_state = data.window_state & ~Qt::WindowMaximized;
+
+ const bool visible = q->isVisible();
+ data.crect = QRect(x, y, w, h);
+
+ if (realWindow) {
+ if (QWExtra *extra = extraData()) {
+ applyMaxAndMinSizeConstraints(w, h);
qt_mac_update_sizer(q);
- if(q->windowFlags() & Qt::WindowMaximizeButtonHint) {
+
+ if (q->windowFlags() & Qt::WindowMaximizeButtonHint) {
#ifndef QT_MAC_USE_COCOA
OSWindowRef window = qt_mac_window_for(q);
if(extra->maxw && extra->maxh && extra->maxw == extra->minw
@@ -4045,43 +4090,8 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
}
#endif
}
- }
-
- w = qMin(w,extra->maxw);
- h = qMin(h,extra->maxh);
- w = qMax(w,extra->minw);
- h = qMax(h,extra->minh);
-
- // Deal with size increment
- if(QTLWExtra *top = topData()) {
- if(top->incw) {
- w = w/top->incw;
- w *= top->incw;
- }
- if(top->inch) {
- h = h/top->inch;
- h *= top->inch;
- }
- }
- }
-
- if (realWindow) {
- w = qMax(0, w);
- h = qMax(0, h);
- }
-
- QPoint oldp = q->pos();
- QSize olds = q->size();
- const bool isResize = (olds != QSize(w, h));
- if(!realWindow && !isResize && QPoint(x, y) == oldp)
- return;
- if(isResize && q->isMaximized())
- data.window_state = data.window_state & ~Qt::WindowMaximized;
- const bool visible = q->isVisible();
- data.crect = QRect(x, y, w, h);
- if(realWindow) {
- if(QWExtra *extra = extraData()) { //set constraints
+ // Update max and min constraints:
const float max_f(20000);
#ifndef QT_MAC_USE_COCOA
#define SF(x) ((x > max_f) ? max_f : x)