int main(int argc, char* argv[])
{
table.setAlternatingRowColors(true);
table.show();
widget
= new QLabel("bla",
&table
);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.
setColor(QPalette::Base, Qt
::green);
palette.
setColor(QPalette::AlternateBase, Qt
::red);
widget->setPalette(palette);
table.setCellWidget(0, 0, widget);
widget
= new QLabel("ble",
&table
);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.
setColor(QPalette::Base, Qt
::green);
palette.
setColor(QPalette::AlternateBase, Qt
::red);
widget->setPalette(palette);
table.setCellWidget(1, 0, widget);
widget
= new QLabel("bli",
&table
);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.
setColor(QPalette::Base, Qt
::green);
palette.
setColor(QPalette::AlternateBase, Qt
::red);
widget->setPalette(palette);
table.setCellWidget(2, 0, widget);
widget
= new QLabel("blo",
&table
);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.
setColor(QPalette::Base, Qt
::green);
palette.
setColor(QPalette::AlternateBase, Qt
::red);
widget->setPalette(palette);
table.setCellWidget(3, 0, widget);
widget
= new QLabel("blu",
&table
);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.
setColor(QPalette::Base, Qt
::green);
palette.
setColor(QPalette::AlternateBase, Qt
::red);
widget->setPalette(palette);
table.setCellWidget(4, 0, widget);
return app.exec();
}
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QTableWidget table(5,1);
table.setAlternatingRowColors(true);
table.show();
QPalette palette;
QWidget *widget;
widget = new QLabel("bla", &table);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.setColor(QPalette::Base, Qt::green);
palette.setColor(QPalette::AlternateBase, Qt::red);
widget->setPalette(palette);
table.setCellWidget(0, 0, widget);
widget = new QLabel("ble", &table);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.setColor(QPalette::Base, Qt::green);
palette.setColor(QPalette::AlternateBase, Qt::red);
widget->setPalette(palette);
table.setCellWidget(1, 0, widget);
widget = new QLabel("bli", &table);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.setColor(QPalette::Base, Qt::green);
palette.setColor(QPalette::AlternateBase, Qt::red);
widget->setPalette(palette);
table.setCellWidget(2, 0, widget);
widget = new QLabel("blo", &table);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.setColor(QPalette::Base, Qt::green);
palette.setColor(QPalette::AlternateBase, Qt::red);
widget->setPalette(palette);
table.setCellWidget(3, 0, widget);
widget = new QLabel("blu", &table);
widget->setAutoFillBackground(true);
palette = widget->palette();
palette.setColor(QPalette::Base, Qt::green);
palette.setColor(QPalette::AlternateBase, Qt::red);
widget->setPalette(palette);
table.setCellWidget(4, 0, widget);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks