sabeesh
9th October 2007, 11:38
Hi,
I have a code in QT4.3 like this,
Qt Code:
QWidget *pWidget;
CCamPanel *pViewer;
pWidget = new QWidget(this );
assert(pWidget != NULL);
pWidget->setAutoFillBackground(true);
pWidget->setBackgroundRole(QPalette::Base);
pWidget->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
setCentralWidget(pWidget);
pViewer = new CImagePanelRGB(pVideo, pWidget);
pLastSnapshot = new CBasicPanel("snapshot", "Last snapshot", CCamPanel::RGB, pWidget);
viewsize = pVideo->GetSize();
QPixmap blackimg(viewsize);
painter.begin(&blackimg);
painter.fillRect(0, 0, viewsize.width(), viewsize.height(), Qt::black);
painter.setPen(Qt::yellow);
painter.drawText(0, 0, viewsize.width(), viewsize.height(), Qt::AlignCenter, tr("Your last saved snapshot appears here"));
painter.end();
if (pLastSnapshot != 0)
{
pLastSnapshot->SetSize(viewsize);
pLastSnapshot->SetImage(0, blackimg.toImage());
pLastSnapshot->hide();
}
pViewer->show();
and in another file I have a class like this
BasicPanel.cpp
------------------------
Qt Code:
CBasicPanel::CBasicPanel(const char *panel_name, const char *desc, int panel_type, QWidget *parent, const char *name)
: CCamPanel(panel_name, desc, panel_type, TRUE, parent, name)
{
}
My problem is that, when I run this program, it display a window and it hold a white widget. Why did I can't see the other widget?
Please help me.
I have a code in QT4.3 like this,
Qt Code:
QWidget *pWidget;
CCamPanel *pViewer;
pWidget = new QWidget(this );
assert(pWidget != NULL);
pWidget->setAutoFillBackground(true);
pWidget->setBackgroundRole(QPalette::Base);
pWidget->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
setCentralWidget(pWidget);
pViewer = new CImagePanelRGB(pVideo, pWidget);
pLastSnapshot = new CBasicPanel("snapshot", "Last snapshot", CCamPanel::RGB, pWidget);
viewsize = pVideo->GetSize();
QPixmap blackimg(viewsize);
painter.begin(&blackimg);
painter.fillRect(0, 0, viewsize.width(), viewsize.height(), Qt::black);
painter.setPen(Qt::yellow);
painter.drawText(0, 0, viewsize.width(), viewsize.height(), Qt::AlignCenter, tr("Your last saved snapshot appears here"));
painter.end();
if (pLastSnapshot != 0)
{
pLastSnapshot->SetSize(viewsize);
pLastSnapshot->SetImage(0, blackimg.toImage());
pLastSnapshot->hide();
}
pViewer->show();
and in another file I have a class like this
BasicPanel.cpp
------------------------
Qt Code:
CBasicPanel::CBasicPanel(const char *panel_name, const char *desc, int panel_type, QWidget *parent, const char *name)
: CCamPanel(panel_name, desc, panel_type, TRUE, parent, name)
{
}
My problem is that, when I run this program, it display a window and it hold a white widget. Why did I can't see the other widget?
Please help me.