PDA

View Full Version : igstk::QTWidget display problem.



Ashwath
4th March 2011, 07:51
Hi All,

I have developed a QT GUI which uses IGSTK ,ITK AND VTK classes functionality.


//ScribbleArea.h is as shown below

class ScribbleArea : public igstk::QTWidget
{
Q_OBJECT

public:
ScribbleArea(QWidget *parent = 0,Qt::WFlags flags = 0);
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
void setPenColor(const QColor &newColor);
void setPenWidth(int newWidth);

bool isModified() const { return modified; }
QColor penColor() const { return myPenColor; }
int penWidth() const { return myPenWidth; }
void DrawEllipse();


public slots:
void clearImage();
void print();

protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
private:
void drawLineTo(const QPoint &endPoint);
bool modified;
bool scribbling;
int myPenWidth;
QColor myPenColor;
QImage image;
QPoint lastPoint;

};
//part of ScribbleArea.cpp is as shown below
ScribbleArea::ScribbleArea(QWidget *parent,Qt::WFlags flags):igstk::QTWidget(parent,flags)
{
setAttribute(Qt::WA_StaticContents);
modified = false;
scribbling = false;
myPenWidth = 3;
myPenColor = Qt::blue;
}
void ScribbleArea::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::red, 12, Qt::DashDotLine, Qt::RoundCap));
painter.setBrush(QBrush(Qt::green, Qt::SolidPattern));
painter.drawEllipse(80, 80, 200, 200);
}
//In the constructor of the QMainWindow derived class (i.e in QFIRST.CPP)i have the below code:

ScribbleArea* AxialWidget;
m_AxialWidget = new ScribbleArea(ui.groupBox_4);

typedef igstk::View2D View2DType;
View2DType::Pointer m_view2DAxial;

m_AxialWidget->RequestSetView(m_view2DAxial);


The problem is that i am not able to see the ellipse inside the m_AxialWidget when i run the application.
PLease help me in this, i am a newbie in QT,IGSTK,VTK and ITK.

thanks,
ashwath