Results 1 to 2 of 2

Thread: QListWidget -> DoubleClick

  1. #1
    Join Date
    Apr 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QListWidget -> DoubleClick

    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:
    Qt Code:
    1. connect(ui.driveList,
    2. SIGNAL(itemDoubleClicked(QListWidgetItem *)),
    3. this, SLOT(openDiskWrap(QListWidgetItem *)));
    To copy to clipboard, switch view to plain text mode 

    With this I call the function in the sub window:

    Qt Code:
    1. void OpenProject::openDiskWrap(QListWidgetItem *item)
    2. {
    3. int currentRow = ui.driveList->currentRow();
    4. ((MainWindow*)this->parentWidget())->openDisk(currentRow);
    5. //openDisk(int index)
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QListWidget -> DoubleClick

    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.

Similar Threads

  1. DoubleClick on QwtLegend
    By hassinoss in forum Qwt
    Replies: 2
    Last Post: 11th February 2014, 17:37
  2. QTableView crashes after doubleclick
    By nickla in forum Qt Programming
    Replies: 2
    Last Post: 18th March 2011, 19:22
  3. doubleclick with tableview reacts only once
    By qt_gotcha in forum Newbie
    Replies: 1
    Last Post: 13th July 2010, 17:17
  4. Prevent docking on doubleclick
    By yartov in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2008, 20:46
  5. [QT4 & XP] doubleClick on QtreeView
    By incapacitant in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 12:15

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.