Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Why itemChanged of QStandardItemModel is invoked on all items on my model when creating the QStandardItemModel subclass

    General and Desktop
    3
    7
    4095
    Loading More Posts
    • 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.
    • U
      umen242 last edited by

      Hi i have model subclass m_model ( of QStandardItemModel ) it contains QStandardItem's that one of its column has setCheckable(true)
      in the subclass in the constructor i have this single/slot wired:
      @connect(m_model, SIGNAL(itemChanged(QStandardItem*)), this,
      SLOT(tree_itemChanged(QStandardItem*))); @

      why each time i create the m_model and it happen only once it iterate all the items in my model with the tree_itemChanged method ?
      i want it to be invoked only when i check/unchecked the check box.

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

        bq. why each time i create the m_model and it happen only once it iterate all the items in my model with the tree_itemChanged method ?
        i want it to be invoked only when i check/unchecked the check box.

        If I 'm not wrong you have a QStandardItemModel that you use also for a tree?

        What does your SLOT tree_itemChanged do?
        You could use a condition to filter only the checked role.

        Can you elaborate a little more about the structure of your application? Do you use a proxymodel?

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • G
          goetz last edited by

          What do you do in the constructor of your subclassed model? And how and where do you populate it?

          Additionally, you can set a breakpoint in you slot and look at the call stack from where the signal was triggered.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply Reply Quote 0
          • U
            umen242 last edited by

            Hi
            Eddy the tree_itemChanged checks if the check box checked or not and i do filter with if/else
            Volker i did see the stack , its trigger from where i iniT the object with new operator

            1 Reply Last reply Reply Quote 0
            • G
              goetz last edited by

              So, what do you do in the constructor?

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply Reply Quote 0
              • U
                umen242 last edited by

                in my main app class i do
                @TreeViewWindowContainer* pTreeViewWindowContainer= new TreeViewWindowContainer();@

                TreeViewWindowContainer is my QStandardItemModel subclass

                1 Reply Last reply Reply Quote 0
                • G
                  goetz last edited by

                  No surprise in that.

                  How do you populate the model?

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post