summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 08:33:52 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 09:02:17 (GMT)
commit4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1 (patch)
treeb34985c5716d98f01b9f36fd4a98f2ac9710099f /src/gui/kernel/qwidget.cpp
parenta0df97c03f26a38af17a42fb44ad6910536c8857 (diff)
parent2076f150995e541308b1d8da936b3e12ab68b886 (diff)
downloadQt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.zip
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.gz
Qt-4aafbd6222e7aeafd59a4a4356ba8c53b2bfa1d1.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: config.tests/unix/openssl/openssl.pri demos/embedded/embedded.pro examples/itemviews/chart/chart.pro examples/network/network.pro examples/painting/painterpaths/painterpaths.pro examples/threads/mandelbrot/mandelbrot.pro qmake/project.cpp src/3rdparty/libtiff/libtiff/tif_config.h src/corelib/arch/arch.pri src/corelib/global/qglobal.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qcore_unix_p.h src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/corelib/tools/qsharedpointer_impl.h src/corelib/tools/tools.pri src/gui/kernel/qaction.h src/gui/kernel/qapplication.cpp src/gui/painting/qregion.h src/gui/widgets/qlineedit.cpp src/gui/widgets/qlineedit_p.h src/network/socket/qnativesocketengine_unix.cpp tests/auto/qdir/tst_qdir.cpp tests/auto/qdiriterator/tst_qdiriterator.cpp tests/auto/qhttp/qhttp.pro tests/auto/qline/qline.pro tests/auto/qnetworkreply/tst_qnetworkreply.cpp tests/auto/qresourceengine/qresourceengine.pro tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qstring/qstring.pro tests/auto/qtcpsocket/qtcpsocket.pro tests/auto/qtcpsocket/tst_qtcpsocket.cpp
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r--src/gui/kernel/qwidget.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index c2fdadf..d7c89a6 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -511,7 +511,7 @@ void QWidget::setAutoFillBackground(bool enabled)
been outlined to indicate their full sizes.
If you want to use a QWidget to hold child widgets you will usually want to
- add a layout to the parent QWidget. See \l{Layout Classes} for more
+ add a layout to the parent QWidget. See \l{Layout Management} for more
information.
@@ -1438,6 +1438,12 @@ QWidget::~QWidget()
// set all QPointers for this object to zero
QObjectPrivate::clearGuards(this);
+ if(d->declarativeData) {
+ QDeclarativeData *dd = d->declarativeData;
+ d->declarativeData = 0;
+ dd->destroyed(this);
+ }
+
if (!d->children.isEmpty())
d->deleteChildren();
@@ -3567,11 +3573,16 @@ bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh)
minh = qMax(minh, 0);
}
createExtra();
- if (extra->minw == minw && extra->minh == minh)
+ int mw = minw, mh = minh;
+ if (mw == QWIDGETSIZE_MAX)
+ mw = 0;
+ if (mh == QWIDGETSIZE_MAX)
+ mh = 0;
+ if (extra->minw == mw && extra->minh == mh)
return false;
- extra->minw = minw;
- extra->minh = minh;
- extra->explicitMinSize = (minw ? Qt::Horizontal : 0) | (minh ? Qt::Vertical : 0);
+ extra->minw = mw;
+ extra->minh = mh;
+ extra->explicitMinSize = (mw ? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
return true;
}
@@ -3631,7 +3642,8 @@ bool QWidgetPrivate::setMaximumSize_helper(int &maxw, int &maxh)
return false;
extra->maxw = maxw;
extra->maxh = maxh;
- extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) | (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
+ extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) |
+ (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
return true;
}
@@ -3710,6 +3722,8 @@ void QWidget::setBaseSize(int basew, int baseh)
This will override the default size constraints set by QLayout.
+ To remove constraints, set the size to QWIDGETSIZE_MAX.
+
Alternatively, if you want the widget to have a
fixed size based on its contents, you can call
QLayout::setSizeConstraint(QLayout::SetFixedSize);
@@ -3751,7 +3765,8 @@ void QWidget::setFixedSize(int w, int h)
else
d->updateGeometry_helper(true);
- resize(w, h);
+ if (w != QWIDGETSIZE_MAX || h != QWIDGETSIZE_MAX)
+ resize(w, h);
}
void QWidget::setMinimumWidth(int w)
@@ -8993,7 +9008,7 @@ QRegion QWidget::mask() const
The layout manager sets the geometry of the widget's children
that have been added to the layout.
- \sa setLayout(), sizePolicy(), {Layout Classes}
+ \sa setLayout(), sizePolicy(), {Layout Management}
*/
QLayout *QWidget::layout() const
{
@@ -9023,7 +9038,7 @@ QLayout *QWidget::layout() const
The QWidget will take ownership of \a layout.
- \sa layout(), {Layout Classes}
+ \sa layout(), {Layout Management}
*/
void QWidget::setLayout(QLayout *l)
@@ -9989,6 +10004,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
data->window_modality = (w && w->testAttribute(Qt::WA_GroupLeader))
? Qt::WindowModal
: Qt::ApplicationModal;
+ // Some window managers does not allow us to enter modal after the
+ // window is showing. Therefore, to be consistent, we cannot call
+ // QApplicationPrivate::enterModal(this) here. The window must be
+ // hidden before changing modality.
}
if (testAttribute(Qt::WA_WState_Created)) {
// don't call setModal_sys() before create_sys()