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] Can’t connect to doubleclick signal in treeview.
Forum Update on Tuesday, May 27th 2025

[SOLVED] Can’t connect to doubleclick signal in treeview.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 8.5k 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
    scumpyt
    wrote on 17 Aug 2010, 16:08 last edited by
    #1

    First, I apologize for not formatting my code correctly.

    Second, I have solved the issue: I included variable names in my SIGNAL/SLOT declaration, which of course need to be removed, then all works fine.

    @connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex& )),
    this, SLOT(onShowCenteredBookMark(const QModelIndex&))); // Variable names removed@

    Hi,

    I have a dock-able widget with a treeView in it. The tree contains book-marked locations to the central map in my app. I would like to be able to double-click on the items in the tree, and then jump to that location on the map. The problem is that I can't seem to get my connect to recognize the signal.

    Here is the set-up code in my dockwidget constructor:

    @
    // Configure treeView...
    ui.treeView->setModel(PC->myBookMarkModel);
    ui.treeView->setHeaderHidden(false);
    ui.treeView->setSortingEnabled(true);
    ui.treeView->setSelectionMode( QAbstractItemView::SingleSelection );
    ui.treeView->setExpandsOnDoubleClick(false); // Turn off double-click for expand.
    ui.treeView->setEditTriggers(QAbstractItemView::NoEditTriggers); // Turn off double-click for edit

    // Connect to a slot that will return the view to the bookMarked spot...
    connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex& index)),
    this, SLOT(onShowCenteredBookMark(const QModelIndex& index)));
    @

    It compiles fine, but when I run it, I get this message saying that there is no such signal... What am I doing wrong?
    @
    Object::connect: No such signal QTreeView::doubleClicked(const QModelIndex& index) in c:\workspace\nextgen\projects\bsoko\source\bookmarkdockwidget.cpp:84
    Object::connect: (sender name: 'treeView')
    Object::connect: (receiver name: 'BookMarkDockWidget')
    @
    Anybody have an ideas?

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Evgeniy_Zemlyakov
      wrote on 6 Nov 2013, 10:40 last edited by
      #2

      How did you solved it???

      1 Reply Last reply
      0
      • R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 6 Nov 2013, 10:48 last edited by
        #3

        [quote author="Evgeniy_Zemlyakov" date="1383734456"]How did you solved it???[/quote]

        as stated in the first post:

        [quote author="scumpyt" date="1282061305"]First, I apologize for not formatting my code correctly.

        Second, I have solved the issue: I included variable names in my SIGNAL/SLOT declaration, which of course need to be removed, then all works fine.

        @connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex& )),
        this, SLOT(onShowCenteredBookMark(const QModelIndex&))); // Variable names removed@
        [/quote]

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        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