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. QTreeView - rename notify

QTreeView - rename notify

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtreeviewqstandarditemmoqstandarditem
4 Posts 2 Posters 2.2k 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    How can I get notified when I 2x click on item and change its name? Is there a signal or something that can tell me which item/role got updated?

    Or I need to subclass the view/model/item etc to get that?

    Regards
    Dariusz

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      https://doc.qt.io/qt-5/qabstractitemmodel.html#dataChanged

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • D Offline
        D Offline
        Dariusz
        wrote on last edited by
        #3

        Hmmm

        So I run

            connect(mModelActionList, &QStandardItemModel::dataChanged, this, &icActionManager::actionDataChanged);
        
        

        But that does not give me the role for some reason. I get this from debug

            void actionDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
            qDebug() << topLeft << bottomRight << roles;
        >>
        
        QModelIndex(0,0,0x20324b0f7c0,QStandardItemModel(0x2032470f510)) QModelIndex(0,0,0x20324b0f7c0,QStandardItemModel(0x2032470f510)) QVector()
        

        Bit strange... is it just a full refresh?

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          What model are you using? QStandardItemModel had the roles argument working from Qt 5.11 onward. An empty role vector implies "all roles changed"

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          3

          • Login

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