View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005544VTK(No Category)public2007-08-20 17:262008-04-01 13:02
Reporteralexiuk 
Assigned ToClinton Stimpson 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005544: QVTKWidget uses QT keywords that interfere with Boost signals / slots
DescriptionQt #defines three lower-case words to appear as an extension to C++: signals, slots, and emit. This interferes with other use of those terms, e.g. a method named emit() is not possible. Nor is an alternative implementation of signals and slots.

The way around this is to #define QT_NO_KEYWORDS on the compiler invocation and change the code as follows:

signals -> Q_SIGNALS
slots -> Q_SLOTS
emit foo() -> foo()

Removing these keywords now allows us to use them as normal and leaves the door open for using the Boost implementation of signals & slots alongside Qt’s, should that prove useful. See http://www.scottcollins.net/articles/a-deeper-look-at-signals-and-slots.html [^] for a comparison.
Additional InformationThe following is a diff of the changes:
the_wild_kingdom>p4 diff -du QVTKWidget.h
==== //depot/src/vtk-5.0.3/GUISupport/Qt/QVTKWidget.h#1 - C:/perforce/misp-MAIN\import\src\vtk-5.0.3\GUISupport\Qt\QVTKWidget.h ====
@@ -137,7 +137,7 @@

     virtual QPaintEngine* paintEngine() const;

- signals:
+ Q_SIGNALS:
     // Description:
     // This signal will be emitted whenever a mouse event occurs
     // within the QVTK window
@@ -153,7 +153,7 @@
     void cachedImageClean();


- public slots:
+ public Q_SLOTS:
     // Description:
     // This will mark the cached image as dirty. This slot is automatically
     // invoked whenever the render window has a render event or the widget is
@@ -230,7 +230,7 @@
     static OSStatus DirtyRegionProcessor(EventHandlerCallRef er, EventRef event, void*);
 #endif

- private slots:
+ private Q_SLOTS:
     void internalMacFixRect();

   protected:
@@ -277,7 +277,7 @@
   // Overloaded destroy timer method for destroying Qt timers.
   virtual int DestroyTimer();

-public slots:
+public Q_SLOTS:
   // timer event slot
   virtual void TimerEvent();

TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0010310)
Clinton Stimpson (developer)
2008-01-28 15:21

Do you have a suggested patch that would still build with Qt version < 4.1?
(0011016)
Maik Beckmann (reporter)
2008-04-01 11:36

I tried to do some preprocessor action, but qt3-moc refuses everything accept
  slots:
  signals:

IMHO the best solution is to use configure_file. When QT_NO_KEYWORDS is supported we do
 @Q_SIGNALS@ -> Q_SIGNALS
 @Q_SLOTS@ -> Q_SLOTS
otherwise
 @Q_SIGNALS@ -> signals
 @Q_SLOTS@ -> slots


-- Maik
(0011018)
Clinton Stimpson (developer)
2008-04-01 13:02

I didn't think of a configured header. Thanks.

/cvsroot/VTK/VTK/GUISupport/Qt/QVTKWidget.h,v <-- QVTKWidget.h
new revision: delete; previous revision: 1.16
/cvsroot/VTK/VTK/GUISupport/Qt/QVTKWidget.h.in,v <-- QVTKWidget.h.in
initial revision: 1.1
/cvsroot/VTK/VTK/vtkIncludeDirectories.cmake,v <-- vtkIncludeDirectories.cmake
new revision: 1.48; previous revision: 1.47
/cvsroot/VTK/VTK/GUISupport/Qt/CMakeLists.txt,v <-- GUISupport/Qt/CMakeLists.txt
new revision: 1.40; previous revision: 1.39

 Issue History
Date Modified Username Field Change
2007-08-20 17:26 alexiuk New Issue
2008-01-28 14:57 Clinton Stimpson Status backlog => tabled
2008-01-28 14:57 Clinton Stimpson Assigned To => Clinton Stimpson
2008-01-28 15:21 Clinton Stimpson Note Added: 0010310
2008-04-01 11:36 Maik Beckmann Note Added: 0011016
2008-04-01 13:02 Clinton Stimpson Status tabled => closed
2008-04-01 13:02 Clinton Stimpson Note Added: 0011018
2008-04-01 13:02 Clinton Stimpson Resolution open => fixed
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team