I'm having some issues working with the QGridLayout. Here's the code and the explanation comes after:
for(int i =0; i<fileCount; i++)
{
int row = 0;
int col = 0;
QString DocName = FilteredFiles.at(i).at(0);
QLabel* DocTitle = new QLabel;
DocTitle->setText(DocName);
QLabel* DocIcon = new QLabel;
if(FilteredFiles.at(i).at(2)== "WORD")
{
QPixmap Icon("C:blah/blah/blah/WordIcon.jpg");
DocIcon->setPixmap(Icon);
}
else if(FilteredFiles.at(i).at(2)== "EXCEL")
{
QPixmap Icon("C:/blah/blah/blah/ExcelIcon.png");
DocIcon->setPixmap(Icon);
}
else
{
QPixmap Icon("C:/blah/blah/blah/PpIcon.png");
DocIcon->setPixmap(Icon);
}
GridContainer->addWidget(DocIcon);
GridContainer->addWidget(DocTitle);
TopGrid->addLayout(GridContainer,row,col,1,1);
col++;
}
MainContainer->addLayout(TopGrid);
The above code is supposed to make two Qlabels, pixmap an image to one of the labels, add the pixmapped label and the regular label to a QVBoxLayout and then add the QVBoxLayout to a QGridLayout. The output grid was supposed to have everything on a single row but it's in a column. Can someone explain why this is happening?