Changeset 128 for trunk/src/gui/kernel/qwidget_pm.cpp
- Timestamp:
- Aug 26, 2009, 9:00:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qwidget_pm.cpp
r124 r128 1254 1254 } 1255 1255 1256 void QWidgetPrivate::reparentChildren() 1257 { 1258 Q_Q(QWidget); 1259 QObjectList chlist = q->children(); 1260 for (int i = 0; i < chlist.size(); ++i) { // reparent children 1261 QObject *obj = chlist.at(i); 1262 if (obj->isWidgetType()) { 1263 QWidget *w = (QWidget *)obj; 1264 if ((w->windowType() == Qt::Popup)) { 1265 ; 1266 } else if (w->isWindow()) { 1267 bool showIt = w->isVisible(); 1268 QPoint old_pos = w->pos(); 1269 w->setParent(q, w->windowFlags()); 1270 w->move(old_pos); 1271 if (showIt) 1272 w->show(); 1273 } else { 1274 w->d_func()->invalidateBuffer(w->rect()); 1275 WinSetParent(w->effectiveWinId(), q->effectiveWinId(), FALSE); 1276 WinSetOwner(w->effectiveWinId(), q->effectiveWinId()); 1277 w->d_func()->reparentChildren(); 1278 #if 0 // @todo check if this is really necessary any longer 1279 // bring PM coords into accordance with Qt coords, 1280 // otherwise setGeometry() below will wrongly position 1281 // children if this widget manages their layout. 1282 SWP swp; 1283 int hd = q->height() - old_height; 1284 WinQueryWindowPos(w->effectiveWinId(), &swp); 1285 swp.y += hd; 1286 WinSetWindowPos(w->effectiveWinId(), 0, swp.x, swp.y, 0, 0, SWP_MOVE); 1287 #endif 1288 } 1289 } 1290 } 1291 } 1292 1256 1293 void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) 1257 1294 { 1258 // @todo implement 1295 Q_Q(QWidget); 1296 bool wasCreated = q->testAttribute(Qt::WA_WState_Created); 1297 if (q->isVisible() && q->parentWidget() && parent != q->parentWidget()) 1298 q->parentWidget()->d_func()->invalidateBuffer(q->geometry()); 1299 1300 WId old_fid = frameWinId(); 1301 1302 // hide and reparent our own window away. Otherwise we might get 1303 // destroyed when emitting the child remove event below. See QWorkspace. 1304 if (q->isVisible() && old_fid != NULLHANDLE) { 1305 qt_WinSetWindowPos(old_fid, 0, 0, 0, 0, 0, SWP_HIDE); 1306 WinSetParent(old_fid, HWND_OBJECT, FALSE); 1307 WinSetOwner(old_fid, NULLHANDLE); 1308 } 1309 bool dropSiteWasRegistered = false; 1310 if (q->testAttribute(Qt::WA_DropSiteRegistered)) { 1311 dropSiteWasRegistered = true; 1312 q->setAttribute(Qt::WA_DropSiteRegistered, false); // ole dnd unregister (we will register again below) 1313 } 1314 1315 if ((q->windowType() == Qt::Desktop)) 1316 old_fid = NULLHANDLE; 1317 setWinId(0); 1318 1319 QObjectPrivate::setParent_helper(parent); 1320 bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); 1321 1322 data.window_flags = f; 1323 data.fstrut_dirty = true; 1324 q->setAttribute(Qt::WA_WState_Created, false); 1325 q->setAttribute(Qt::WA_WState_Visible, false); 1326 q->setAttribute(Qt::WA_WState_Hidden, false); 1327 adjustFlags(data.window_flags, q); 1328 // keep compatibility with previous versions, we need to preserve the created state 1329 // (but we recreate the winId for the widget being reparented, again for compatibility) 1330 if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created))) 1331 createWinId(); 1332 if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden) 1333 q->setAttribute(Qt::WA_WState_Hidden); 1334 q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); 1335 1336 if (wasCreated) { 1337 reparentChildren(); 1338 } 1339 1340 if (extra && !extra->mask.isEmpty()) { 1341 QRegion r = extra->mask; 1342 extra->mask = QRegion(); 1343 q->setMask(r); 1344 } 1345 if (extra && extra->topextra && !extra->topextra->caption.isEmpty()) { 1346 setWindowIcon_sys(true); 1347 setWindowTitle_helper(extra->topextra->caption); 1348 } 1349 if (old_fid != NULLHANDLE) 1350 qt_WinDestroyWindow(old_fid); 1351 1352 if (q->testAttribute(Qt::WA_AcceptDrops) || dropSiteWasRegistered 1353 || (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))) 1354 q->setAttribute(Qt::WA_DropSiteRegistered, true); 1355 1356 invalidateBuffer(q->rect()); 1259 1357 } 1260 1358
Note:
See TracChangeset
for help on using the changeset viewer.