class GraphicsView_Layout
: public QWidget {
Q_OBJECT
};
{
ui.setupUi(this);
mfloorImg
=new QImage("./img.jpg");
}
//This function will be called every 10 sec once to fill different color.
void QWidget::Fill_Area_With_Color(float* nPmv
) {
//Here I want to clear the previously drawn color
//Draw color
int nPos_X=0;
int nPos_Y=0;
for(int i=0;i<g_area_count;i++)
{
int nblock_count=mBlock_Count[i];
areaColor=Get_Area_Color(nPmv[i]);
for(int j=0;j<nblock_count;j++)
{
nPos_X=mPtrCoordinates[i][j][0];
nPos_Y=mPtrCoordinates[i][j][1];
//painter.fillRect(QRect(nPos_X,nPos_Y,28,24),QBrush(areaColor));
painter.
fillRect(QRect(nPos_X,nPos_Y,
28,
24),
QBrush(areaColor
));
}
}
m_gviewBasic->addImage(mfloorImg);
emit Show_GraphicsView_Layout(true);
QObject::connect(m_gviewBasic,
SIGNAL(Mouse_Left_Button_Clicked
(int,
int)),
this,
SLOT(Mouse_Clicked
(int,
int)));
}
class GraphicsView_Layout : public QWidget
{
Q_OBJECT
QImage* mfloorImg;
};
QWidget::QWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
mfloorImg=new QImage("./img.jpg");
}
//This function will be called every 10 sec once to fill different color.
void QWidget::Fill_Area_With_Color(float* nPmv)
{
//Here I want to clear the previously drawn color
//Draw color
QPainter painter(mfloorImg);
QColor areaColor;
int nPos_X=0;
int nPos_Y=0;
for(int i=0;i<g_area_count;i++)
{
int nblock_count=mBlock_Count[i];
areaColor=Get_Area_Color(nPmv[i]);
for(int j=0;j<nblock_count;j++)
{
nPos_X=mPtrCoordinates[i][j][0];
nPos_Y=mPtrCoordinates[i][j][1];
//painter.fillRect(QRect(nPos_X,nPos_Y,28,24),QBrush(areaColor));
painter.fillRect(QRect(nPos_X,nPos_Y,28,24),QBrush(areaColor));
}
}
m_gviewBasic->addImage(mfloorImg);
emit Show_GraphicsView_Layout(true);
QObject::connect(m_gviewBasic,SIGNAL(Mouse_Left_Button_Clicked(int,int)),this,SLOT(Mouse_Clicked(int,int)));
}
To copy to clipboard, switch view to plain text mode
Bookmarks