• 6286阅读
  • 0回复

[提问]QSortFilterProxyModel 中 mapToSource() 方法Crash (4.8.4) [复制链接]

上一主题 下一主题
离线lovehouye
 

只看楼主 倒序阅读 楼主  发表于: 2013-07-16
使用QFileSystemModel,然后写了一个类继承自QSortFilterProxyModel,目的是只显示html文件。
使用QTreeView 来列出某个目录下的HTML文件。


添加了SLOT来监听QTreeView的doubleClick事件, SLOT中使用 QModelIndex sourceIndex = proxyModel->mapToSource(index); 目的是为了获取QFileSystemModel中的sourceIndex,以此知道FileInfo。


但是某些时候,当快速点击QTreeView 的时候,就会Crash.


Crash信息如下,请大家帮忙看看到底是什么原因呢?QT 出错了?




  1. >    QtGuid4.dll!QSortFilterProxyModelPrivate::index_to_iterator(const QModelIndex & proxy_index)  Line 193 + 0x8 bytes    C++
  2.      QtGuid4.dll!QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex & proxy_index)  Line 369    C++
  3.      QtGuid4.dll!QSortFilterProxyModel::mapToSource(const QModelIndex & proxyIndex)  Line 2519 + 0x10 bytes    C++
  4.      TBXXA.exe!MainWindow::onSaveBtnClicked()  Line 341 + 0x2a bytes    C++
  5.      TBXXA.exe!MainWindow::onTreeViewDoubleClicked(const QModelIndex & index)  Line 452    C++
  6.      TBXXA.exe!MainWindow::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a)  Line 84    C++
  7.      QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv)  Line 3539 + 0x2e bytes    C++
  8.      QtGuid4.dll!QAbstractItemView::doubleClicked(const QModelIndex & _t1)  Line 355 + 0x15 bytes    C++
  9.      QtGuid4.dll!QTreeView::mouseDoubleClickEvent(QMouseEvent * event)  Line 1878    C++
  10.      QtGuid4.dll!QWidget::event(QEvent * event)  Line 8380    C++
  11.      QtGuid4.dll!QFrame::event(QEvent * e)  Line 557 + 0xc bytes    C++
  12.      QtGuid4.dll!QAbstractScrollArea::viewportEvent(QEvent * e)  Line 1043 + 0xc bytes    C++
  13.      QtGuid4.dll!QAbstractItemView::viewportEvent(QEvent * event)  Line 1645    C++
  14.      QtGuid4.dll!QTreeView::viewportEvent(QEvent * event)  Line 1258    C++
  15.      QtGuid4.dll!QAbstractScrollAreaPrivate::viewportEvent(QEvent * event)  Line 100 + 0x28 bytes    C++
  16.      QtGuid4.dll!QAbstractScrollAreaFilter::eventFilter(QObject * o, QEvent * e)  Line 116 + 0x29 bytes    C++
  17.      QtCored4.dll!QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject * receiver, QEvent * event)  Line 1056 + 0x15 bytes    C++
  18.      QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e)  Line 4558 + 0x11 bytes    C++
  19.      QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e)  Line 4105 + 0x2f bytes    C++
  20.      QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event)  Line 946 + 0x15 bytes    C++
  21.      QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event)  Line 234 + 0x38 bytes    C++
  22.      QtGuid4.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous)  Line 3171 + 0xe bytes    C++
  23.      QtGuid4.dll!QETWidget::translateMouseEvent(const tagMSG & msg)  Line 3365 + 0x2a bytes    C++
  24.      QtGuid4.dll!QtWndProc(HWND__ * hwnd, unsigned int message, unsigned int wParam, long lParam)  Line 1698 + 0xc bytes    C++
  25.      user32.dll!7689c4e7()    
  26.      [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]    
  27.      user32.dll!7689c5e7()    
  28.      user32.dll!7689c590()    
  29.      user32.dll!7689cc19()    
  30.      user32.dll!7689cc70()    
  31.      QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags)  Line 810    C++
  32.      QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags)  Line 1204 + 0x15 bytes    C++
  33.      QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags)  Line 150    C++
  34.      QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags)  Line 204 + 0x2d bytes    C++
  35.      QtCored4.dll!QCoreApplication::exec()  Line 1218 + 0x15 bytes    C++
  36.      QtGuid4.dll!QApplication::exec()  Line 3824    C++
  37.      TBXXA.exe!main(int argc, char * * argv)  Line 32 + 0x6 bytes    C++
  38.      TBXXA.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow)  Line 131 + 0x12 bytes    C++
  39.      TBXXA.exe!__tmainCRTStartup()  Line 547 + 0x2c bytes    C
  40.      TBXXA.exe!WinMainCRTStartup()  Line 371    C
  41.      kernel32.dll!75fbed6c()    
  42.      ntdll.dll!76e6377b()    
  43.      ntdll.dll!76e6374e()


快速回复
限100 字节
 
上一个 下一个