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. [SOLVED] QTreeView first item have no reaction
QtWS25 Last Chance

[SOLVED] QTreeView first item have no reaction

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k 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.
  • G Offline
    G Offline
    Galbarad
    wrote on last edited by
    #1

    Hi All
    I have a problem with my QTreeView - first item in grid have no reaction on mouse click
    for all another items on mouse click I'm going to breakpoint in QTreeModel::canFetchMore and after QTreeModel::fetchMore
    but not for first item (
    that's code I'm use for fill my model

    @ root = new QDBTreeItem(dtitRoot, dtitFolder, "Root", 0);
    model = new QTreeModel(root, this);

    QDBTreeItem *child;
    

    // first item is disabled
    child = new QDBTreeItem(dtitFolder, dtitTable, "Tables", root);
    child->addChild(new QDBTreeItem(dtitFolder, dtitFolder, "Fake", child));
    child->setFetchData(&QOciDBTree::loadDataForItem);
    root->addChild(child);
    // second item that same as first but it's work
    child = new QDBTreeItem(dtitFolder, dtitTable, "Tables", root);
    child->addChild(new QDBTreeItem(dtitFolder, dtitFolder, "Fake", child));
    child->setFetchData(&QOciDBTree::loadDataForItem);
    root->addChild(child);@

    I have no idea in which way I should dig
    thanks for help

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bodzio131
      wrote on last edited by
      #2

      Isn't first row treated as header?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galbarad
        wrote on last edited by
        #3

        my first item is
        @
        root = new QDBTreeItem(dtitRoot, dtitFolder, "Root", 0);
        @
        under "first item" I'm mean first visible item.

        I try to use yet one root item, but I do not receive normal result
        internal structure is

        • Root -- this item is invisible in grid
          __+table -- this item has [+] but do not respond on mouse click
          __+views -- this item have normal behavior

        when I add yet one root element

        • Root -- this item is invisible in grid
          __+Database -- this item is visible and have normal behavior
          ____table -- this item has no [+] and do not respond on mouse click
          ____+views -- this item have normal behavior

        perhaps I forget some very small and simple, but I can't found it by myself

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Galbarad
          wrote on last edited by
          #4

          ok I suppose it's y code internal problem, I put on first place item with already prepared children instead of item that create children on expand event. and it's work properly

          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