Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1530: Parser, didn't parse QT slots and signals

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

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

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
drzoom Posted - Jul 19 2006 : 04:52:55 AM

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.
13   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Mar 05 2007 : 08:55:13 AM
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.
kika Posted - Mar 03 2007 : 5:49:02 PM
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
feline Posted - Jul 24 2006 : 6:43:35 PM
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.
drzoom Posted - Jul 23 2006 : 4:31:04 PM
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

feline Posted - Jul 23 2006 : 12:22:38 PM
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.
drzoom Posted - Jul 22 2006 : 09:32:19 AM
Thank you very much for the "translation"!
jpizzi Posted - Jul 22 2006 : 12:52:26 AM
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.
support Posted - Jul 21 2006 : 12:18:07 PM
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.
drzoom Posted - Jul 21 2006 : 03:20:00 AM
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.
feline Posted - Jul 20 2006 : 6:07:36 PM
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.
jpizzi Posted - Jul 20 2006 : 02:35:55 AM
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.
drzoom Posted - Jul 20 2006 : 02:21:33 AM
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.
jpizzi Posted - Jul 20 2006 : 12:23:36 AM
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.

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