Thank you!
 Beginner
					
					
						Beginner
					
					
                                        
					
						
							
								 
							
						
					
					
						 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		Thank you!
 Beginner
					
					
						Beginner
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
       
    
    
    
    
    
    
   
    
    
       
    
    
    
    
   Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		I still don't get it. This is one of those things in Qt that is not documented well.
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		It is possible to compile Qt inside any given namespace. See configure -help for more details. These macros ensure that Qt classes are properly declared inside the given namespace if any.
J-P Nurmi
 Intermediate user
					
					
						Intermediate user
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
    
    
   Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		What are the difference between
Qt Code:
To copy to clipboard, switch view to plain text mode
and
Qt Code:
QT_BEGIN_NAMESPACE
class QTableView;
QT_END_NAMESPACETo copy to clipboard, switch view to plain text mode
and
in a header file of a QtClass (like a MainWindow)?
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		Let's say one configures Qt with -qtnamespace Foo.
1)
Expands to:Qt Code:
To copy to clipboard, switch view to plain text mode
Qt Code:
To copy to clipboard, switch view to plain text mode
2)
Expands to:Qt Code:
QT_BEGIN_NAMESPACE
class QTableView;
QT_END_NAMESPACETo copy to clipboard, switch view to plain text mode
3)
Will cause a conflict because QTableView is forward declared outside the appropriate namespace, whereas including <QTableView> in the .cpp file brings in another QTableView declared inside the namespace and <QtGlobal> says
in order to make client code compile regardless of the Qt namespace usage. So QTableView becomes ambiguous and the compiler doesn't know which one to use, QTableView or Foo::QTableView.
Summary: Plain "class QTableView;" works as long as Qt is not compiled in a namespace. Using the macros will make your code more compatible. As far as I remember, for example the Eclipse integration requires Qt to be compiled in a certain namespace.
J-P Nurmi
nightghost (2nd July 2009), Phlucious (6th December 2011), xiangxw (26th September 2011)
 Novice
					
					
						Novice
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
    
    
   Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		how do you configure that option ?
where do I put it ? inside pro file ?
thanx
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		just go to the QTDIR and run configure with -help option for deatails. You declare namespace name while use configure before building Qt
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
 Novice
					
					
						Novice
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
    
    
   Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		oh .. so this means I will have to compile QT separate for every project ?
 Intermediate user
					
					
						Intermediate user
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
       
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
 Re: What's effect of QT_BEGIN_NAMESPACE? Thanks
		if you want qt for every project in another namespace, then yes.
Bookmarks