Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DumpObjectTree not showing any output in netbeans Linux Kubuntu
Forum Updated to NodeBB v4.3 + New Features

DumpObjectTree not showing any output in netbeans Linux Kubuntu

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hans977
    wrote on last edited by
    #1

    I am trying to use the QObject::DumpObjectTree() method but it does not show any output. I am using netbeans IDE and the built in terminal shows anything I send to std::cout and std::cerr. I ran the compiled program from the terminal and it does not show anything there either. I tried DumpObjectTree with a simple project in Qt Creator with the same results. Is there some place I could see the code in the DumpObjectTree() method. There was a similar issue from several years back that was not resolved. http://qt-project.org/forums/viewthread/883

    I would really like to use that method so any help would be appreciated.

    Thanks

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hans977
      wrote on last edited by
      #2

      I found the code and copied it into simple little class (bellow) and it works that way But the QObject::DumpObjectTree() still does not work. I call it like this from main.
      @
      MainWindow mw;
      DumpTree::dumpObjectTree(&mw);
      mw.show();@

      I changed the method declarations so instead of dumping “this' I pass in a pointer to what I want dumped. Otherwise the code is exactly how I copied it out of qobject.cpp file. This will work for now but it would be nice to get it fixed right, especially if other people are having the same problem. Any ideas how to troubleshoot this. Thanks

      @#ifndef DUMPOBJECTTREE_H
      #define DUMPOBJECTTREE_H

      #include <QObject>

      class DumpTree : public QObject {

      Q_OBJECT
      

      public:
      static void dumpObjectTree( const QObject* ob) {
      dumpRecursive(0, ob);
      }

      private:

      static void dumpRecursive(int level, const QObject *object) {
      

      #if defined(QT_DEBUG)
      if (object) {
      QByteArray buf;
      buf.fill(' ', level / 2 * 8);
      if (level % 2)
      buf += " ";
      QString name = object->objectName();
      QString flags = QLatin1String("");
      #if 0
      if (qApp->focusWidget() == object)
      flags += 'F';
      if (object->isWidgetType()) {
      QWidget * w = (QWidget ) object;
      if (w->isVisible()) {
      QString t("<%1,%2,%3,%4>");
      flags += t.arg(w->x()).arg(w->y()).arg(w->width()).arg(w->height());
      } else {
      flags += 'I';
      }
      }
      #endif
      qDebug("%s%s::%s %s", (const char
      ) buf, object->metaObject()->className(), name.toLocal8Bit().data(),
      flags.toLatin1().data());
      QObjectList children = object->children();
      if (!children.isEmpty()) {
      for (int i = 0; i < children.size(); ++i)
      dumpRecursive(level + 1, children.at(i));
      }
      }
      #else
      Q_UNUSED(level)
      Q_UNUSED(object)
      #endif
      }

      };

      #endif /* DUMPOBJECTTREE_H */
      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved