for(int i = 0; i < historic.size; i++) {
table->insertRow( i );
for(int j = 0; j < historic.limit; j++) {
// Put zero in front of the number if he is smaller than 10.
if(historic.historic[i][j] < 10)
else
val->setTextAlignment( Qt::AlignHCenter );
val
->setSizeHint
(QSize(2,
5));
// Nothing is changed if i set different vals for the arguments.
// Set the row colors
if(((i + 1) % 2) == 0)
val
->setBackgroundColor
( QColor(149,
149,
149,
255) );
else
val
->setBackgroundColor
( QColor(186,
186,
186,
255) );
table->setItem(i, j, val);
}
}
}
void showHistTable(QTableWidget *table, Data historic) {
for(int i = 0; i < historic.size; i++) {
table->insertRow( i );
for(int j = 0; j < historic.limit; j++) {
QTableWidgetItem *val;
// Put zero in front of the number if he is smaller than 10.
if(historic.historic[i][j] < 10)
val = new QTableWidgetItem( QString("0").append( QString::number( historic.historic[i][j] ) ) );
else
val = new QTableWidgetItem( QString::number( historic.historic[i][j] ) );
val->setTextAlignment( Qt::AlignHCenter );
val->setSizeHint(QSize(2, 5));// Nothing is changed if i set different vals for the arguments.
// Set the row colors
if(((i + 1) % 2) == 0)
val->setBackgroundColor( QColor(149, 149, 149, 255) );
else
val->setBackgroundColor( QColor(186, 186, 186, 255) );
table->setItem(i, j, val);
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks