Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    3
    3
    8205
    Loading More Posts
    • 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
      scumpyt last edited by

      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 Reply Quote 0
      • E
        Evgeniy_Zemlyakov last edited by

        How did you solved it???

        1 Reply Last reply Reply Quote 0
        • raven-worx
          raven-worx Moderators last edited by

          [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 Reply Quote 0
          • First post
            Last post