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:
private slots:
private slots:
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:
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:
{
//Here you call the other window
}
void MainWindow::callWindow(QListWidgetItem * item)
{
//Here you call the other window
}
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.
Bookmarks