Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Only static constant data integral member can be initialized within a class

Only static constant data integral member can be initialized within a class

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    venkatesh
    wrote on last edited by
    #1

    I get this error, when i build a code in Windows 8 Qt 4.8.3 when i try to run this

    @
    QGraphicsScene* ManualRegistrationScene_=new QGraphicsScene();
    QGraphicsPixmapItem* StationaryImage_=new QGraphicsPixmapItem();
    QGraphicsPixmapItem* MovingImage_=new QGraphicsPixmapItem();
    QGraphicsPixmapItem* DifferenceImage_=new QGraphicsPixmapItem();
    @
    I had done the same code in Mac. But it works perfectly. I built the Qt from source using VS 2012 64 bit. Is there any way to get rid of this error by the same initialization? Would be great to have some guidance

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you instantiating variables in your class declaration ?

      Can you show your header ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        venkatesh
        wrote on last edited by
        #3

        Hi,
        Thanks for replying. I have herewith attached my header
        @
        #ifndef OVERLAYVIEW_H
        #define OVERLAYVIEW_H

        //Qt Headers
        #include<QGraphicsView>
        #include<QGraphicsPixmapItem>
        //Itk Headers
        /*#include"ITK/itkImageFileReader.h"
        #include"ITK/itkResampleImageFilter.h"
        #include"ITK/itkImage.h"
        #include"ITK/itkImageToVTKImageFilter.h"
        #include"ITK/itkSubtractImageFilter.h"

        //vtk headers
        #include"VTK/vtkQImageToImageSource.h"
        #include"VTK/vtkImageToImageFilter.h"*/

        class OverlayView:public QGraphicsView
        {
        Q_OBJECT
        public:
        explicit OverlayView(QWidget *parent=0);
        void OpacityImage();
        // void DifferenceImage();
        void TransformMatrix();

        private:
        QGraphicsScene* ManualRegistrationScene=new QGraphicsScene();
        QGraphicsPixmapItem* StationaryImage_=new QGraphicsPixmapItem();
        QGraphicsPixmapItem* MovingImage_=new QGraphicsPixmapItem();
        // QGraphicsPixmapItem* DifferenceImage_;
        QTransform Transform_;
        QTransform ZoomAndRotateTransform_;

        public slots:
        void setOpacityImage(QGraphicsPixmapItem *StationaryImage,QGraphicsPixmapItem *MovingImage);
        // void setDifferenceImage(QGraphicsPixmapItem *DifferenceImage,QGraphicsPixmapItem *DifferenceMovingImage);
        void setTransform(QTransform Transform);
        void setZoomAndRotate(QTransform ZoomAndRotateTransform);

        signals:
        void TransformsChanged(QTransform TransformMatrix);
        };

        #endif // OVERLAYVIEW_H
        @

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Indeed that's wrong,

          You can't do that, I'm surprised it works on OS X but anyway, initialize your member variables in the constructor.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved