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. QObject wrong children list
Forum Update on Monday, May 27th 2025

QObject wrong children list

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.0k Views
  • 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.
  • M Offline
    M Offline
    mmiacca
    wrote on last edited by
    #1

    I'm using 5.8 on ubuntu 64.
    I have a project with many subproject as plugins libs.
    All subprojects have an ui class with the same name on each but different buttons, labels, etc.
    The project call children() for the main widget, the software fail when i try to cast each child to QWidget (null pointer) and also the list of children showed by the debugger is different than any of the ui classes (the capture shows a children with the same pointer than the parent, the ui files as ui header files does not have this structure, all ui are made with the qt creator built in form editor) .
    But if I leave only one subproject all running fine.

    Any idea?
    0_1491667924523_upload-8cf1a6d0-90bc-4193-86f1-0d50d3fe47f3

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      First try to print class name of each children using obj.metaobject.classname. I suspect that one of the childrens is not widget. So your typecast is failing. Check classname. That shud help to solve the problem.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mmiacca
        wrote on last edited by
        #3

        I did it...

        In all the

        I print with the next code

        qDebug() << "Objet type " << object->metaObject()->className() << " name" << object->objectName();

        and got

        ../../Fuentes/LReportes/Reporte.cpp - line 201 - Objet DateEdit name "filtroPorTipoCuenta"

        but in all the software there are only one definition in the ui file

                <widget class="LineEdit" name="filtroPorTipoCuenta">
        

        Then the object report a different class (there are many of this problems), i moving to old qt version windows in order to have more information

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mmiacca
          wrote on last edited by
          #4

          I'm working on this and have news... the problem begins with multiple plugins.
          If i load only one plugin, children() and children()->children()... gets the correct answer, if I load two or more plugins the answer is broken.
          The call to children is made from a dynamic library to a widget in the plugins.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi and welcome to devnet,

            Please show the exact code you are using.

            Note that it's still pretty unusual to implement several widgets with the exact same name even if in different plugins.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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