PDA

View Full Version : QListWidget -> DoubleClick



Ifoerster
19th April 2014, 12:22
Hello,

I have a problem to send data from a doubleclick QListWidgetItem from a sub window to the parent window. I use the default connection:

connect(ui.driveList,
SIGNAL(itemDoubleClicked(QListWidgetItem *)),
this, SLOT(openDiskWrap(QListWidgetItem *)));

With this I call the function in the sub window:


void OpenProject::openDiskWrap(QListWidgetItem *item)
{
int currentRow = ui.driveList->currentRow();
((MainWindow*)this->parentWidget())->openDisk(currentRow);
//openDisk(int index)

}

It works so far ok, but it seems that there is a sandbox because in Mainwindow / OpenDisk I get read errors (Access violation) in a QStringArray and other members of MainWindow.
So I think I have a logical flaw inside. What I finaly need to do is to send the Index of the driveList to the Mainwindow to open the selected drive.

Any suggestion help?

Ingo

ChrisW67
19th April 2014, 21:39
Hard to say with so little information. The likely options are that parentWidget() is null or not a MainWindow, or that currentIndex is -1 and openDisk() uses it as an out-of-bounds index to a list. Your debugger backtrace and exit error message will tell you which.