Results 1 to 20 of 42

Thread: QTreeWidget clicked signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Oct 2009
    Posts
    35
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11
    Thanks
    12

    Default Re: QTreeWidget clicked signal

    i too have a getting same problem related to treewidget item signals ,

    Qt Code:
    1. QTreeWidgetItem *plc = new QTreeWidgetItem(ui->treeWidget);
    2. plc->setText(0,QString("PLC %1").arg(i));
    3.  
    4. if(plc)
    5. {
    6. connect(ui->treeWidget,SIGNAL(itemClicked(QTreeWidgetItem *,int)),this,SLOT(plcconfig()));
    7. }
    8.  
    9. QTreeWidgetItem *plcItem = new QTreeWidgetItem(plc);
    10. plcItem->setText(0, tr("CONFIGURATION"));
    11. plc->addChild(plcItem);
    12.  
    13. QTreeWidgetItem *cpuconfig = new QTreeWidgetItem(plcItem);
    14. cpuconfig->setText(0, tr("CPU CONFIGURATION"));
    15. plcItem->addChild(cpuconfig);
    16.  
    17. // if(cpuconfig)
    18. // {
    19. // connect(ui->treeWidget,SIGNAL(itemClicked(QTreeWidgetItem *,int)),this,SLOT(showCPU()));
    20. // }
    21.  
    22. QTreeWidgetItem *varconfig = new QTreeWidgetItem(plcItem);
    23. varconfig->setText(0, tr("VARIABLE CONFIGURATION"));
    24. plcItem->addChild(varconfig);
    25.  
    26. QTreeWidgetItem *progconfig = new QTreeWidgetItem(varconfig);
    27. progconfig->setText(0, tr("PROGRAM VARIABLE CONFIGURATION"));
    28. varconfig->addChild(progconfig);
    29.  
    30. if(varconfig)
    31. {
    32. connect(ui->treeWidget,SIGNAL(itemClicked(QTreeWidgetItem *,int)),this,SLOT(showpvc()));
    33. }
    To copy to clipboard, switch view to plain text mode 

    As iam using above signal when iam cliicking on PROGRAM VARIABLE CONF..... the required window has to opened as below.

    Qt Code:
    1. void ECLogic::showpvc( )
    2. {
    3. QTabBar *tab_4=new QTabBar(ui->widgetConf);
    4. PCD= new programvariableconfiguration(tab_4);
    5. PCD->setWindowTitle(QString("PVC"));
    6. tabwidget3->insertTab(0,tab_4,QString("PVC"));
    7. tab_4->setCurrentIndex(tabwidget3->indexOf(ui->widgetConf));
    8. tab_4->setTabsClosable(true);
    9. tab_4->setEnabled(true);
    10. PCD->show();
    11. }
    To copy to clipboard, switch view to plain text mode 

    but my problem is getting the connections to all the treewidggetitems not for the particular....is there any way to get my condtion ....so please suggests me the way to write the code........
    Last edited by wysota; 22nd January 2010 at 10:04. Reason: Missing [code] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.