Changeset 106
- Timestamp:
- Aug 12, 2009, 3:28:29 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qwidget_pm.cpp
r100 r106 107 107 } 108 108 109 // returns the human readable widget id in the form "name/class". 110 // used for debugging. 111 static QString widgetName(HWND hwnd) 109 // Returns a QWidget pointer or 0 if there is no widget corresponding to the 110 // given HWND. As opposed to QWidget::find(), correctly handles WC_FRAME windows 111 // created for top level widgets. Used for debugging. 112 static QWidget *widgetFromId(HWND hwnd) 112 113 { 113 114 char buf[10]; … … 115 116 if (!strcmp(buf, "#1")) // WC_FRAME 116 117 hwnd = WinWindowFromID(hwnd, FID_CLIENT); 117 QWidget *w = QWidget::find(hwnd); 118 if (w) 119 return QString().sprintf("%s/%s", 120 w->metaObject()->className(), 121 w->objectName().toLocal8Bit().constData()); 122 } 123 return QLatin1String("<non-Qt-widget>"); 118 return QWidget::find(hwnd); 119 } 120 return 0; 121 } 122 123 // Returns a human readable widget name in the form "class/name". 124 // Used for debugging. 125 static QByteArray widgetName(QWidget *w) 126 { 127 if (w) 128 return QString() 129 .sprintf("%s/%s", w->metaObject()->className(), 130 w->objectName().toLocal8Bit().constData()).toLocal8Bit(); 131 return QByteArray("<no-widget>"); 124 132 } 125 133 … … 160 168 { 161 169 #if defined(QT_DEBUGWIDGETMASK) 162 qDebug("qt_WinInvalidateRegionEx: hwnd=%08lX (%s)"170 qDebug("qt_WinInvalidateRegionEx: hwnd=%08lX " 163 171 "hwndFrom=%08lX hwndTo=%08lX", hwnd, 164 widgetName( hwnd).toLocal8Bit().constData(),172 widgetName().constData(), 165 173 hwndFrom, hwndTo); 166 174 #endif … … 191 199 WinQueryWindowPos(child, &swp); 192 200 #if defined(QT_DEBUGWIDGETMASK) 193 qDebug(" child=%08lX [fl=%08lX] (%s)", child, swp.fl,194 widgetName( child).toLocal8Bit().constData());201 qDebug(" child=%08lX [fl=%08lX] ", child, swp.fl, 202 widgetName().constData()); 195 203 #endif 196 204 // proceed only if not hidden … … 276 284 277 285 #if defined(QT_DEBUGWIDGETMASK) 278 qDebug("qt_WinProcessWindowObstacles: hwnd=%08lX (%s), prcl=%p "286 qDebug("qt_WinProcessWindowObstacles: hwnd=%08lX , prcl=%p " 279 287 "hrgn=%08lX, op=%ld flags=%08lX", hwnd, 280 widgetName( hwnd).toLocal8Bit().constData(),288 widgetName().constData(), 281 289 prcl, hrgn, op, flags); 282 290 #endif … … 330 338 WinQueryWindowPos(relative, &swp); 331 339 #if defined(QT_DEBUGWIDGETMASK) 332 qDebug(" child=%08lX [fl=%08lX] (%s)", relative, swp.fl,333 widgetName( relative).toLocal8Bit().constData());340 qDebug(" child=%08lX [fl=%08lX] ", relative, swp.fl, 341 widgetName().constData()); 334 342 #endif 335 343 // skip if hidden … … 370 378 WinQueryWindowPos(relative, &swp); 371 379 #if defined(QT_DEBUGWIDGETMASK) 372 qDebug(" sibling=%08lX [fl=%08lX] (%s)", relative, swp.fl,373 widgetName( relative).toLocal8Bit().constData());380 qDebug(" sibling=%08lX [fl=%08lX] ", relative, swp.fl, 381 widgetName().constData()); 374 382 #endif 375 383 // skip if hidden … … 420 428 WinQueryWindowPos(parent, &swp); 421 429 #if defined(QT_DEBUGWIDGETMASK) 422 qDebug(" parent=%08lX [fl=%08lX] (%s)", parent, swp.fl,423 widgetName( parent).toLocal8Bit().constData());430 qDebug(" parent=%08lX [fl=%08lX] ", parent, swp.fl, 431 widgetName().constData()); 424 432 #endif 425 433 delta.x += swp.x; … … 429 437 WinQueryWindowPos(relative, &swp); 430 438 #if defined(QT_DEBUGWIDGETMASK) 431 qDebug(" ancestor=%08lX [fl=%08lX] (%s)", relative, swp.fl,432 widgetName( parent).toLocal8Bit().constData());439 qDebug(" ancestor=%08lX [fl=%08lX] ", relative, swp.fl, 440 widgetName().constData()); 433 441 #endif 434 442 // skip if hidden … … 480 488 { 481 489 #if defined(QT_DEBUGWIDGETMASK) 482 qDebug("qt_WinSetWindowPos: hwnd=%08lX (%s)fl=%08lX", hwnd,483 widgetName( hwnd).toLocal8Bit().constData(), fl);490 qDebug("qt_WinSetWindowPos: hwnd=%08lX fl=%08lX", hwnd, 491 widgetName().constData(), fl); 484 492 #endif 485 493 … … 568 576 #if defined(QT_DEBUGWIDGETMASK) 569 577 qDebug(" moving up? %ld", up); 570 qDebug(" hwndFrom=%08lX (%s)", hwndFrom,571 widgetName( hwndFrom).toLocal8Bit().constData());572 qDebug(" hwndTo=%08lX (%s)", hwndTo,573 widgetName( hwndTo).toLocal8Bit().constData());578 qDebug(" hwndFrom=%08lX ", hwndFrom, 579 widgetName().constData()); 580 qDebug(" hwndTo=%08lX ", hwndTo, 581 widgetName().constData()); 574 582 #endif 575 583 … … 584 592 WinQueryWindowPos(sibling, &swp); 585 593 #if defined(QT_DEBUGWIDGETMASK) 586 qDebug(" sibling=%08lX [fl=%08lX] (%s)", sibling, swp.fl,587 widgetName( sibling).toLocal8Bit().constData());594 qDebug(" sibling=%08lX [fl=%08lX] ", sibling, swp.fl, 595 widgetName().constData()); 588 596 #endif 589 597 // proceed only if not hidden … … 615 623 WinQueryWindowPos(sibling, &swp); 616 624 #if defined(QT_DEBUGWIDGETMASK) 617 qDebug(" sibling=%08lX [fl=%08lX] (%s)", sibling, swp.fl,618 widgetName( sibling).toLocal8Bit().constData());625 qDebug(" sibling=%08lX [fl=%08lX] ", sibling, swp.fl, 626 widgetName().constData()); 619 627 #endif 620 628 // proceed only if not hidden … … 889 897 } 890 898 #if defined(QT_DEBUGWINCREATEDESTROY) 891 qDebug("|Creating top level window (frame) [%s /%s]:\n"899 qDebug("|Creating top level window (frame) [%s]:\n" 892 900 "| owner = %08lX\n" 893 901 "| title = '%s'\n" 894 902 "| style = %08lX\n" 895 903 "| fcFlags = %08lX", 896 q->objectName().toLocal8Bit().constData(), 897 q->metaObject()->className(), 898 ownerw, title.constData(), fStyle, fcFlags); 904 widgetName(q).constData(), ownerw, title.constData(), fStyle, 905 fcFlags); 899 906 #endif 900 907 fId = WinCreateWindow(HWND_DESKTOP, WC_FRAME, title, fStyle, … … 918 925 // create client window 919 926 #if defined(QT_DEBUGWINCREATEDESTROY) 920 qDebug("|Creating top level window (client) [%s /%s]:\n"927 qDebug("|Creating top level window (client) [%s]:\n" 921 928 "| owner & parent = %08lX\n" 922 929 "| class = '%s'\n" 923 930 "| title = '%s'\n" 924 931 "| style = %08lX", 925 q->objectName().toLocal8Bit().constData(), 926 q->metaObject()->className(), 927 fId, className.constData(), title.constData(), style); 932 widgetName(q).constData(), fId, className.constData(), 933 title.constData(), style); 928 934 #endif 929 935 // note that we place the client on top (HWND_TOP) to exclude other … … 933 939 } else { 934 940 #if defined(QT_DEBUGWINCREATEDESTROY) 935 qDebug("|Creating top level window (popup) [%s /%s]:\n"941 qDebug("|Creating top level window (popup) [%s]:\n" 936 942 "| class = '%s'\n" 937 943 "| title = '%s'\n" 938 944 "| style = %08lX", 939 q->objectName().toLocal8Bit().constData(), 940 q->metaObject()->className(), 941 className.constData(), title.constData(), style); 945 widgetName(q).constData(), className.constData(), 946 title.constData(), style); 942 947 #endif 943 948 id = WinCreateWindow(HWND_DESKTOP, className, title, style, … … 1047 1052 1048 1053 #if defined(QT_DEBUGWINCREATEDESTROY) 1049 qDebug("|Creating child window [%s /%s]:\n"1054 qDebug("|Creating child window [%s]:\n" 1050 1055 "| owner & parent = %08lX\n" 1051 1056 "| class = '%s'\n" 1052 1057 "| title = '%s'\n" 1053 1058 "| style = %08lX", 1054 q->objectName().toLocal8Bit().constData(), 1055 q->metaObject()->className(), 1056 parentw, className.constData(), title.constData(), style); 1059 widgetName(q).constData(), parentw, className.constData(), 1060 title.constData(), style); 1057 1061 #endif 1058 1062 id = WinCreateWindow(parentw, className, title, style, … … 1126 1130 } 1127 1131 #if defined(QT_DEBUGWINCREATEDESTROY) 1128 qDebug("|Destroying window [%s/%s]:\n" 1129 "| hwnd = %08lX", 1130 objectName().toLocal8Bit().constData(), 1131 metaObject()->className(), id); 1132 qDebug("|Destroying window [%s]:\n" 1133 "| hwnd = %08lX", widgetName(this).constData(), id); 1132 1134 #endif 1133 1135
Note:
See TracChangeset
for help on using the changeset viewer.