使用QFileSystemModel,然后写了一个类继承自QSortFilterProxyModel,目的是只显示html文件。
使用QTreeView 来列出某个
目录下的HTML文件。
添加了SLOT来监听QTreeView的doubleClick事件, SLOT中使用 QModelIndex sourceIndex = proxyModel->mapToSource(index); 目的是为了获取QFileSystemModel中的sourceIndex,以此知道FileInfo。
但是某些时候,当快速点击QTreeView 的时候,就会Crash.
Crash信息如下,请大家帮忙看看到底是什么原因呢?QT
出错了?


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