//ScribbleArea.h is as shown below
class ScribbleArea : public igstk::QTWidget
{
Q_OBJECT
public:
ScribbleArea
(QWidget *parent
= 0,Qt
::WFlags flags
= 0);
protected:
};
//part of ScribbleArea.cpp is as shown below
ScribbleArea
::ScribbleArea(QWidget *parent,Qt
::WFlags flags
):igstk
::QTWidget(parent,flags
){
setAttribute(Qt::WA_StaticContents);
}
{
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);
//ScribbleArea.h is as shown below
class ScribbleArea : public igstk::QTWidget
{
Q_OBJECT
public:
ScribbleArea(QWidget *parent = 0,Qt::WFlags flags = 0);
protected:
void paintEvent(QPaintEvent *event);
};
//part of ScribbleArea.cpp is as shown below
ScribbleArea::ScribbleArea(QWidget *parent,Qt::WFlags flags):igstk::QTWidget(parent,flags)
{
setAttribute(Qt::WA_StaticContents);
}
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);
To copy to clipboard, switch view to plain text mode
The problem is that i am not able to see the ellipse inside the m_AxialWidget when i run the application.
Bookmarks