Hello All,
I m using Qt 4.4.0
I have below code
//in Header file
class C1
{
private:
}
//in Header file
class C1
{
private:
QLabel *img_label_1;
QLabel *img_label_2;
QLabel *img_label_3;
QLabel *img_label_4;
}
To copy to clipboard, switch view to plain text mode
//in CPP file
{
ui.setupUi(this);
setWindowFlags( Qt::FramelessWindowHint);
img_label_4 = NULL;
img_label_1 = NULL;
img_label_2 = NULL;
img_label_3 = NULL;
if((img_label_1
= new QLabel(ui.
frame)) != NULL) img_label_1
->setPixmap
(QPixmap(":/images/pink-1.png"));
img_label_1->setGeometry(6,4,16,16);
img_label_1->setScaledContents(TRUE);
img_label_1->show();
img_label_1->setStyleSheet( "border-style:solid;\n"
"border-color:rgb(86,86,86);\n"
"border-width:1px;\n"
);
//In same way I m alloctiing 2 more labels
//And now the turn of 4th label
if((img_label_4
= new QLabel(this)) != NULL)
}
//in CPP file
C1::C1(QWidget * parent):QDialog(parent)
{
ui.setupUi(this);
setWindowFlags( Qt::FramelessWindowHint);
img_label_4 = NULL;
img_label_1 = NULL;
img_label_2 = NULL;
img_label_3 = NULL;
if((img_label_1 = new QLabel(ui.frame)) != NULL)
QMessageBox::information(this,"TRUE","");
img_label_1->setPixmap(QPixmap(":/images/pink-1.png"));
img_label_1->setGeometry(6,4,16,16);
img_label_1->setScaledContents(TRUE);
img_label_1->show();
img_label_1->setStyleSheet( "border-style:solid;\n"
"border-color:rgb(86,86,86);\n"
"border-width:1px;\n"
);
//In same way I m alloctiing 2 more labels
//And now the turn of 4th label
if((img_label_4 = new QLabel(this)) != NULL)
QMessageBox::information(this,"TRUE","");
}
To copy to clipboard, switch view to plain text mode
Now the problem is
when I include
if((img_label_4
= new QLabel(this)) != NULL)
if((img_label_4 = new QLabel(this)) != NULL)
To copy to clipboard, switch view to plain text mode
statement
after closing the EXE it gives Memory error
If I comment the above line it doesnt giv any error..
The drive where program resides has 1.2 G free memory.
As soon as it allocates memory for 4th label ,it gives memory error after closing EXE.
Please help
Bookmarks