Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 'Create Implementation' adds a 'QT_NAMESPACE::'

You must be registered to post a reply.
Click here to register.

Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji

Forum code is on.
Html is off.

Check to subscribe to this topic.

T O P I C    R E V I E W
XMi Posted - Mar 25 2015 : 07:03:25 AM

I am developing Qt applications in C++ using Visual Studio 2013. The 'Create Implementation' has a little problem with Qt data types.

If I declare in a class a member function that returns a Qt data type, the 'Create Implementation' command will add a QT_NAMESPACE:: specifier to the return type. For example, the implementation for member function
QLocale Preferences::getLocale() const

will be
QT_NAMESPACE::QLocale Preferences::getLocale() const

Note the the problem occurs only for the return type.
void Preferences::setLocale(QLocale const& locale);

will be implemented properly as
void Preferences::setLocale(QLocale const& locale)

My system:
Windows 8.1 Ultimate 64bit EN
Visual Studio 2013 Professional EN
Visual Assist build 2059
Qt 5.4.1
5   L A T E S T    R E P L I E S    (Newest First)
ChrisG Posted - Jun 18 2020 : 01:35:25 AM
case=20637 is fixed in build 2380.
accord Posted - Mar 26 2015 : 1:47:11 PM
Thank you for the follow-up. I have added a comment with your info to the case.
XMi Posted - Mar 26 2015 : 01:38:26 AM
Hi. Thanks for investigating the problem.

QT_NAMESPACE is normally not defined at all as it is a feature that is not enabled by default. You have to enable it during Qt compilation. Its aim is to help dealing with multiple Qt versions. More details here: http://wiki.qt.io/Qt_In_Namespace
accord Posted - Mar 25 2015 : 6:48:21 PM
Okay, playing around with this a little more, I see that the code doesn't compile until I remove the "QT_NAMESPACE::" part so it is definitely a problem. My default class (in a new QT project that I used for the test) itself derives from QMainWindow without qualification but that class is indeed in QT_NAMESPACE so there must be a using namespace somewhere included. Anyhow, I have added comments to the case with repro steps.
accord Posted - Mar 25 2015 : 6:14:01 PM
Assuming that you are using "using namespace QT_NAMESPACE;", I am seeing the same effect here:


Are you using it directly, or it is always present, e.g. because it's included via a header file? I'm not really familiar with QT.

© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000