Results 1 to 9 of 9

Thread: how to add item in a list widget on clicking of a pushbutton

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: how to add item in a list widget on clicking of a pushbutton

    You can't do these from within Designer. Use either multiple or single inheritance approach and create custom slots for doing those tasks.

    Qt Code:
    1. connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(newItem()));
    2.  
    3. void MyForm::newItem()
    4. {
    5. ui.listWidget->addItem(ui.lineEdit->text());
    6. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    jyoti (13th November 2006)

Similar Threads

  1. When is the best time to delete a QCanvasItem
    By irudkin in forum Qt Programming
    Replies: 12
    Last Post: 8th March 2007, 21:28
  2. Programattically Clicking an Item in QTreeView
    By johnny_sparx in forum Qt Programming
    Replies: 4
    Last Post: 11th May 2006, 16:26

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.