Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1530: Parser, didn't parse QT slots and signals
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jul 19 2006 :  04:52:55 AM  Show Profile  Reply with Quote

QT from Trolltech (www.trolltech.com) introduce the keywords "signals" and "slots" to mark sections in a class. In Qt4 this keywords are set to a null token in the header "qobjectdefs.h":


#   define slots
#   define signals protected


If I write code like that:


#include <QObject>
class Foo {
  Q_OBJECT
public:
  Foo();
  virtual ~Foo();
public slots:
  void doSomething();
signals:
  void beep();
};


Refactoring is not available neither for "doSomething()" nor for "beep()".

I use in this case the Qt4 VS2005 integration. So all include paths are correctly added in the vcproj file. You can try that out with the evaluation version of Qt4.

best regards
Tobias

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 20 2006 :  12:23:36 AM  Show Profile  Reply with Quote
Even though they are defined out, VA is being confused by the new "keywords". This is a known issue.

case=912

There looks to have been some work on this, but no resolution as yet.

Joe Pizzi
Go to Top of Page

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jul 20 2006 :  02:21:33 AM  Show Profile  Reply with Quote
Does the VA parser interpret the preprocessor defines declared in the VS project file? E.g. the _DEBUG or WIN32 definitions. Then it should be possible to declare "slots" and "signals" there.

best regards
Tobias
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 20 2006 :  02:35:55 AM  Show Profile  Reply with Quote
I believe that VA collects symbols from #define statements, but performs no substitutions based upon those symbols.

I am pretty sure that VA pays no attention to project defines, as you might be developing with the "wrong" configuration selected.

I would not be surprised to be corrected on either of these, though.

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jul 20 2006 :  6:07:36 PM  Show Profile  Reply with Quote
i use Qt 3 all of the time, so if anyone finds a workaround it would be nice. unfortunately the only work around i know is to use a much older version of VA, since it handled Qt 3 correctly before the parser re-write.

however i find the other features, especially refactoring, to be far to useful in the new versions of VA to consider this.

zen is the art of being at one with the two'ness
Go to Top of Page

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jul 21 2006 :  03:20:00 AM  Show Profile  Reply with Quote
As foreign english speaker, I don't understand what you mean with this sentence (sorry :-).
quote:
however i find the other features, especially refactoring, to be far to useful in the new versions of VA to consider this.

best regards
Tobias
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jul 21 2006 :  12:18:07 PM  Show Profile  Reply with Quote
Try these defines in stdafx.h in the Misc subdirectory of the VA X installation directory:

#define slots
#define signals public

Press Rebuild on the Performance node of our options dialog and restart your IDE.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 22 2006 :  12:52:26 AM  Show Profile  Reply with Quote
drzoom: feline's statement,
quote:
however i find the other features, especially refactoring, to be far to too useful in the new versions of VA to consider this.

means that in this particular case, the older version of VA handles the code better than the latest versions. However, there are other features that he feels outweigh the lack of handling this problem.

Joe Pizzi
Go to Top of Page

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jul 22 2006 :  09:32:19 AM  Show Profile  Reply with Quote
Thank you very much for the "translation"!

best regards
Tobias
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jul 23 2006 :  12:22:38 PM  Show Profile  Reply with Quote
quote:
Originally posted by support

Try these defines in stdafx.h in the Misc subdirectory of the VA X installation directory:

#define slots
#define signals public

Press Rebuild on the Performance node of our options dialog and restart your IDE.



one experiment later
i have already found one strange side effect of this, but it has fixed the major problems i had with signals and slots and VA! woohoo! i wish i had thought of this sooner.

zen is the art of being at one with the two'ness
Go to Top of Page

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jul 23 2006 :  4:31:04 PM  Show Profile  Reply with Quote
I suggest this lines for Qt4:


// for QT4
#define slots
#define signals public
#define QT_LARGEFILE_SUPPORT
#define QT_DLL
#define QT_GUI_LIB
#define QT_CORE_LIB
#define QT_THREAD_SUPPORT
#define QT_SQL_LIB
#define QT_NETWORK_LIB
#define QT_XML_LIB
#define QT_SVG_LIB


best regards
Tobias
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Jul 24 2006 :  6:43:35 PM  Show Profile  Reply with Quote
not in VA's stdafx.h file though. this header file is to help VA parse library code. after the first 2 you are just listing pre-processor definitions.

since VA does not know which ones are active, and assumes you will want help editing code that might be disabled with the current compiler settings, it parses code even inside #if 0 #endif blocks.

zen is the art of being at one with the two'ness
Go to Top of Page

kika
Junior Member

21 Posts

Posted - Mar 03 2007 :  5:49:02 PM  Show Profile  Reply with Quote
Hi,

There is still some issue with refactoring slots/signals. I did everything as described in the FAQ, added defines to StdAfx.h, and now refactoring works, but not correctly for the first slot after the "slot" "keyword".
like
class QFoo : public QBar
{
public slots:
void moreMoney(quint64 amount);
};

when I hover over moreMoney() and click "Create Implementation" then implementation is created actually but of no return type.
i.e. in QFoo.cpp I get:
QFoo::moreMoney(quint64 amount)
{
}

which is by default of type 'int' and conflicts with class declaration. Second, third and further slots are created correctly with correct return type 'void'.

Thanks,
Kirill

Best regards,\rCyril\r
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 05 2007 :  08:55:13 AM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=5352

For now you will need to add the return type manually.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000