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. Signal for expanding item in QTreeView

Signal for expanding item in QTreeView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.4k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Serenity
    wrote on last edited by
    #1

    Hello,

    I want to get a signal for clicking on the "+" Button (so when it expands)

    !http://i.imagebanana.com/img/6h3ak0b0/treeview_expand.png!

    The background is: I have a filetree with only the directories with a fixed width
    [code]
    model.setRootPath("");
    #ifdef Q_OS_MAC
    model.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden);
    #else
    model.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
    #endif
    dirtree = new QTreeView(this);
    dirtree->setModel(&model);
    dirtree->setColumnHidden(1,true);
    dirtree->setColumnHidden(2,true);
    dirtree->setColumnHidden(3,true);
    dirtree->setHeaderHidden(true);
    dirtree->setAnimated(true);
    dirtree->setSortingEnabled(false);
    dirtree->setFixedWidth(200);
    dirtree->sortByColumn(0,Qt::AscendingOrder);
    [/code]

    When I got deeper and deeper in a tree, the widht of 200px is too low, so I need a horizontal scroll bar at the bottom. I can do that with resizeColumnToContents(0); but I have to find out, when the user expand one of the directories. Can anybody help me?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Just take a look into the "documentation":http://qt-project.org/doc/qt-4.8/qtreeview.html#expanded.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Serenity
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1362393335"]Just take a look into the "documentation":http://qt-project.org/doc/qt-4.8/qtreeview.html#expanded.[/quote]

        Thank you... I tried it before asking and now, it seems to work :)
        Strange... seems to be a mistake on my side :)

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          No worries. Good to hear it works now.

          (Z(:^

          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