Results 1 to 4 of 4

Thread: double clicked on an item QTreeWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Qt products
    Unix/X11 Windows

    Default double clicked on an item QTreeWidget

    I am using QTreeWidget on the MainWindow and items are added to the TreeWidget from a table of a database.The tree has four rows and two columns.When i double click either the root or children on the specific row of the tree,then displays another widget.I am doing this using QModelIndex object.I want only the root of the row to "goes to" the specified widget and not the children.

    My code is:

    //Double click on the treeWidget
    void MainWindow::changeSWidget(QModelIndex index)
    //row 0
    case Tree::Computers://1
    case Tree::Files://1
    connect(Tree,SIGNAL(loadWidget(QModelIndex)),this, SLOT(changeSWidget(QModelIndex)));

    How can i find which item is clicked ??Doing this when i clicked on each item is called the slot display.
    //double click on treewidget items
    connect(ui->treeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetIt em*,int)),this,SLOT(display(QTreeWidgetItem*,int)) );

    Is it better for me to use a model/view approach??
    i hope you understand what i am saying..
    Last edited by milli; 6th May 2011 at 22:05.

Similar Threads

  1. Getting the Id of a double clicked item
    By thefatladysingsopera in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2011, 14:18
  2. Replies: 1
    Last Post: 16th December 2009, 02:48
  3. Replies: 12
    Last Post: 24th July 2009, 10:38
  4. Replies: 1
    Last Post: 17th July 2008, 14:42
  5. QTableWidget::item to Double?
    By Afflicted.d2 in forum Qt Programming
    Replies: 2
    Last Post: 30th October 2006, 06:23


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.