Results 1 to 2 of 2

Thread: List Widget

  1. #1
    Join Date
    Apr 2011
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Symbian S60

    Post List Widget

    how to go one screen to another screen.i want when i select the listwidget item then open new window please any one can help me .

    Thanks

  2. #2
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: List Widget

    Hi,

    You can connect the signal void itemClicked ( QListWidgetItem * item ) to an slot in the parent window (the window where your list is).

    This signal is emitted with the specified item when a mouse button is clicked on an item in the widget.

    For example:

    You declare a slot called callWindow in the .h of the parent window:
    Qt Code:
    1. private slots:
    2. void callWindow(QListWidgetItem * item);
    To copy to clipboard, switch view to plain text mode 

    Then you connect the signal of the list to that slot somewhere in the code of the parent window, in the constructor for example:

    Qt Code:
    1. connect(ui->mylist,SIGNAL(itemClicked ( QListWidgetItem * item )),this,SLOT( callWindow(QListWidgetItem * item))
    To copy to clipboard, switch view to plain text mode 

    The connection passes a pointer to the selected item. So you can access its data. For example its caption.

    So in the c++ of the parent window you have:

    Qt Code:
    1. void MainWindow::callWindow(QListWidgetItem * item)
    2. {
    3. //Here you call the other window
    4. }
    To copy to clipboard, switch view to plain text mode 

    With this when the user clicks on the item it calls the slot so it can call your new window.
    Last edited by qlands; 3rd May 2011 at 14:28.

Similar Threads

  1. Scrollable List of Arbitary Widget
    By vaibhav in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2011, 07:40
  2. Circular list widget
    By codebehind in forum Qt-based Software
    Replies: 3
    Last Post: 25th January 2011, 23:12
  3. Help me on creating a List Widget...
    By Bong.Da.City in forum Newbie
    Replies: 50
    Last Post: 11th September 2010, 14:51
  4. How can I create a widget list as Qt Designer?
    By ricardo in forum Qt Programming
    Replies: 5
    Last Post: 3rd May 2009, 12:54
  5. List Widget need help!
    By patrick772goh in forum Newbie
    Replies: 1
    Last Post: 15th August 2007, 10:25

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
  •  
Qt is a trademark of The Qt Company.