Results 1 to 8 of 8

Thread: How to add Treewidget Items when clicking on PushButton

Threaded View

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

    Post How to add Treewidget Items when clicking on PushButton

    HI All,

    i getting a problem, when iam clicking on pushbutton(OK) the TreeWidgetItems are not adding not only that ,the mainwindow is also closing when iam clicking on push button(OK).plz go throught the below code and let me know what the mistake i had done and how to solve this issues.

    Qt Code:
    1. // newproject window is another window ,it has some functionalities like ok and canccel PushButton and other widgets
    2. newproject::newproject(QWidget *parent)
    3. : QDialog(parent)
    4. {
    5. ui.setupUi(this);
    6. connect(ui.okButton,SIGNAL(clicked()),this,SLOT(on_okButton_clicked()));
    7. connect(ui.cancelButton,SIGNAL(clicked()),this,SLOT(close()));
    8. }
    9.  
    10. void newproject::on_okButton_clicked()
    11. {
    12. //ECLogic is the other window(mainwindow)
    13. eclogic->createMainTree();
    14. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. // ECLlogic is the main window
    2. // below is the slot , it will work when i click on New menuitem
    3. void ECLogic::on_action_New_triggered()
    4. {
    5. NewProject=new newproject(main_tab_widget);
    6. NewProject->show();
    7.  
    8. }
    9. void ECLogic::createMainTree()
    10. {
    11. //this item has to add in the treewidget
    12. QTreeWidgetItem *lnx = new QTreeWidgetItem(ui->treeWidget);
    13. lnx->setText(0,tr("LOGIC"));
    14. ui->treeWidget->addTopLevelItem(lnx);
    15. }
    To copy to clipboard, switch view to plain text mode 

    Plz understand the code and let me know further clarifications and how can i solve this problem.

    Thanks & Regards,
    Mkkguru.
    Last edited by mkkguru; 10th February 2010 at 09:51.

Similar Threads

  1. Replies: 8
    Last Post: 1st October 2015, 07:23
  2. Double Clicking Pro File
    By BalaQT in forum Installation and Deployment
    Replies: 2
    Last Post: 18th November 2009, 05:23
  3. Replies: 1
    Last Post: 28th July 2009, 06:58
  4. Problem editing TreeWidget items
    By Moezzie in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2007, 21:22
  5. Replies: 2
    Last Post: 14th November 2006, 11:22

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.