在TextEditor里下断点,得到如下堆栈:
1 TextEditor::TextDocument::plainText
2 CppEditor::Internal::CppEditorDocument::contentsText
3 CppEditor::Internal::CppEditorDocumentHandleImpl::contents
4 CppTools::CppModelManager::buildWorkingCopyList
5 CppTools::CppModelManager::workingCopy
6 CppTools::BuiltinEditorDocumentProcessor::run
7 CppEditor::Internal::CppEditorDocument::processDocument
8 CppEditor::Internal::CppEditorDocument::onFilePathChanged
9 QtPrivate::FunctorCall
10 QtPrivate::FunctionPointer
11 QtPrivate::QSlotObject
12 QMetaObject::activate(QObject *, int, int, void * *)
13 Core::IDocument::filePathChanged
14 Core::IDocument::setFilePath
15 TextEditor::TextDocument::setFilePath
16 TextEditor::TextDocument::openImpl
17 TextEditor::TextDocument::open
18 Core::Internal::EditorManagerPrivate::openEditor
19 Core::EditorManager::openEditor
20 ProjectExplorer::Internal::ProjectTreeWidget::openItem
21 QtPrivate::FunctorCall
22 QtPrivate::FunctionPointer
23 QtPrivate::QSlotObject
24 QMetaObject::activate(QObject *, int, int, void * *)
25 QAbstractItemView::activated(QModelIndex const&)
26 QTreeView::mouseDoubleClickEvent(QMouseEvent *)
27 QWidget::event(QEvent *)
28 QFrame::event(QEvent *)
29 QAbstractItemView::viewportEvent(QEvent *)
30 QTreeView::viewportEvent(QEvent *)
31 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *)
32 QApplicationPrivate::notify_helper(QObject *, QEvent *)
33 QApplication::notify(QObject *, QEvent *)
34 QCoreApplication::notifyInternal2(QObject *, QEvent *)
35 QApplicationPrivate::sendMouseEvent(QWidget *, QMouseEvent *, QWidget *, QWidget *, QWidget * *, QPointer
36 ??
37 ??
38 QApplicationPrivate::notify_helper(QObject *, QEvent *)
39 QApplication::notify(QObject *, QEvent *)
40 QCoreApplication::notifyInternal2(QObject *, QEvent *)
41 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *)
42 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *)
43 QWindowSystemInterface::sendWindowSystemEvents(QFlags
44 ??
45 g_main_context_dispatch
46 ??
47 g_main_context_iteration
48 QEventDispatcherGlib::processEvents(QFlags
49 QEventLoop::exec(QFlags
50 QCoreApplication::exec()
51 main
51级堆栈才到达我们的断点。可以看到调用轨迹,TextEditor会调用CppEditor,后者又会回调前者。我感觉qt-creator模块设计得不错,以后可扩充至任何语言。