#include #include #include #include int main(int argc, char *argv[]) { QApplication::setStyle("fusion"); QApplication app(argc, argv); QDialog dialog; dialog.setWindowTitle(QApplication::style()->name()); QVBoxLayout* verticalLayout =new QVBoxLayout(&dialog); QTableWidget tableWidget(&dialog); const int rowCount = 10; const int columnCount = 10; tableWidget.setRowCount(rowCount); tableWidget.setColumnCount(columnCount); for (int r = 0; r < rowCount; ++r) { for (int c = 0; c < columnCount; ++c) { QTableWidgetItem* item = new QTableWidgetItem(QString("%1, %2").arg(r).arg(c)); tableWidget.setItem(r, c, item); } } tableWidget.setAlternatingRowColors(true); verticalLayout->addWidget(&tableWidget); dialog.exec(); return 0; }