qt-creator源碼研究2

在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<QtPrivate::IndexesList<0, 1>, QtPrivate::List<Utils::FileName const&, Utils::FileName const&>, void, void (CppEditor::Internal::CppEditorDocument:: *)(Utils::FileName const&, Util
10 QtPrivate::FunctionPointer<void (CppEditor::Internal::CppEditorDocument:: *)(Utils::FileName const&, Utils::FileName const&)>::call<QtPrivate::List<Utils::FileName const&, Utils::FileName const&>, void>
11 QtPrivate::QSlotObject<void (CppEditor::Internal::CppEditorDocument:: *)(Utils::FileName const&, Utils::FileName const&), QtPrivate::List<Utils::FileName const&, Utils::FileName const&>, void>::impl    
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<QtPrivate::IndexesList<0>, QtPrivate::List<QModelIndex const&>, void, void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&)>::call                           
22 QtPrivate::FunctionPointer<void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&)>::call<QtPrivate::List<QModelIndex const&>, void>                                                  
23 QtPrivate::QSlotObject<void (ProjectExplorer::Internal::ProjectTreeWidget:: *)(QModelIndex const&), QtPrivate::List<QModelIndex const&>, void>::impl                                                      
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<QWidget>&, bool)                                                                                
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<QEventLoop::ProcessEventsFlag>)                                                                                                                     
44 ??                                                                                                                                                                                                        
45 g_main_context_dispatch                                                                                                                                                                                   
46 ??                                                                                                                                                                                                        
47 g_main_context_iteration                                                                                                                                                                                  
48 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                
49 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                                   
50 QCoreApplication::exec()                                                                                                                                                                                  
51 main 

51級堆棧纔到達我們的斷點。可以看到調用軌跡,TextEditor會調用CppEditor,後者又會回調前者。我感覺qt-creator模塊設計得不錯,以後可擴充至任何語言。                                                                                                                                                                                                     

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章