OSDN Git Service

drop support for widgets counting
authorIvailo Monev <xakepa10@gmail.com>
Mon, 26 Oct 2020 01:59:42 +0000 (03:59 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 26 Oct 2020 01:59:42 +0000 (03:59 +0200)
it should've been enabled only for debug builds, when QT_NO_DEBUG is not
defined as is done for the grab/nograb functionality

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qapplication.cpp
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget_p.h

index 6bb9fcc..6041434 100644 (file)
@@ -373,7 +373,6 @@ bool QApplicationPrivate::animate_combo = false;
 bool QApplicationPrivate::animate_tooltip = false;
 bool QApplicationPrivate::fade_tooltip = false;
 bool QApplicationPrivate::animate_toolbox = false;
-bool QApplicationPrivate::widgetCount = false;
 
 static bool force_reverse = false;
 
@@ -444,8 +443,6 @@ void QApplicationPrivate::process_cmdline()
         } else if (qstrcmp(argv[i], "-reverse") == 0) {
             force_reverse = true;
             QApplication::setLayoutDirection(Qt::RightToLeft);
-        } else if (qstrcmp(argv[i], "-widgetcount") == 0) {
-            widgetCount = true;
         } else if (qstrcmp(argv[i], "-graphicssystem") == 0 && i < argc - 1) {
             graphics_system_name = QString::fromLocal8Bit(argv[++i]);
         } else {
@@ -512,9 +509,6 @@ void QApplicationPrivate::process_cmdline()
         \o  -session= \e session, restores the application from an earlier
             \l{Session Management}{session}.
         \o  -session \e session, is the same as listed above.
-        \o  -widgetcount, prints debug message at the end about number of
-            widgets left undestroyed and maximum number of widgets existed at
-            the same time
         \o  -reverse, sets the application's layout direction to
             Qt::RightToLeft
         \o  -graphicssystem, sets the backend to be used for on-screen widgets
@@ -844,8 +838,6 @@ QApplication::~QApplication()
 
     qt_cleanup();
 
-    if (QApplicationPrivate::widgetCount)
-        qDebug("Widgets left: %i    Max widgets: %i \n", QWidgetPrivate::instanceCounter, QWidgetPrivate::maxInstances);
 #ifndef QT_NO_SESSIONMANAGER
     delete d->session_manager;
     d->session_manager = 0;
@@ -866,7 +858,6 @@ QApplication::~QApplication()
     QApplicationPrivate::animate_combo = false;
     QApplicationPrivate::animate_tooltip = false;
     QApplicationPrivate::fade_tooltip = false;
-    QApplicationPrivate::widgetCount = false;
 
     // trigger unregistering of QVariant's GUI types
     qUnregisterGuiVariant();
index 3cdbc29..b5e0d68 100644 (file)
@@ -1000,9 +1000,6 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
     q->setAttribute(Qt::WA_PendingMoveEvent);
     q->setAttribute(Qt::WA_PendingResizeEvent);
 
-    if (++QWidgetPrivate::instanceCounter > QWidgetPrivate::maxInstances)
-        QWidgetPrivate::maxInstances = QWidgetPrivate::instanceCounter;
-
     if (QApplication::testAttribute(Qt::AA_ImmediateWidgetCreation))
         q->create();
 
@@ -1242,7 +1239,6 @@ QWidget::~QWidget()
     } QT_CATCH(...) {
         // if this fails we can't do anything about it but at least we are not allowed to throw.
     }
-    --QWidgetPrivate::instanceCounter;
 
     if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication
         QWidgetPrivate::allWidgets->remove(this);
@@ -1255,9 +1251,6 @@ QWidget::~QWidget()
     }
 }
 
-int QWidgetPrivate::instanceCounter = 0;  // Current number of widget instances
-int QWidgetPrivate::maxInstances = 0;     // Maximum number of widget instances
-
 void QWidgetPrivate::setWinId(WId id)                // set widget identifier
 {
     Q_Q(QWidget);
index 6f6772d..4730f98 100644 (file)
@@ -568,8 +568,6 @@ public:
     int topLayoutItemMargin;
     int rightLayoutItemMargin;
     int bottomLayoutItemMargin;
-    static int instanceCounter; // Current number of widget instances
-    static int maxInstances; // Maximum number of widget instances
     Qt::HANDLE hd;
     QWidgetData data;
     QSizePolicy size_policy;