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



  • 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?



  • How did you solved it???


  • Moderators

    [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]


Log in to reply
 

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