[SOLVED] QTreeView first item have no reaction



  • 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



  • Isn't first row treated as header?



  • 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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.