#include <QtGui>
#include <QApplication>
{
tableWidget->setObjectName(name);
tableWidget->setRowCount(10);
tableWidget->setColumnCount(10);
return tableWidget;
}
int main(int argc, char *argv[])
{
stackedWidget.showMaximized();
stackedWidget.addWidget(createPage("Page1"));
stackedWidget.addWidget(createPage("Page2"));
stackedWidget.setStyleSheet(
"QStackedWidget QTableWidget#Page1 QHeaderView::section {"
" background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
" stop:0 #616161, stop: 0.5 #505050,"
" stop: 0.6 #434343, stop:1 #656565);"
" color: white;"
" padding-left: 4px;"
" border: 1px solid #6c6c6c;"
"}"
"QStackedWidget QTableWidget#Page2 QHeaderView::section {"
" background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1,"
" stop:0 #red, stop: 0.5 #green,"
" stop: 0.6 #green, stop:1 #pink);"
" color: white;"
" padding-left: 4px;"
" border: 1px solid #bule;"
"}");
stackedWidget.setCurrentIndex(0);
// stackedWidget.setCurrentIndex(1);
return app.exec();
}
#include <QtGui>
#include <QApplication>
QWidget * createPage(const QString & name)
{
QTableWidget * tableWidget = new QTableWidget;
tableWidget->setObjectName(name);
tableWidget->setRowCount(10);
tableWidget->setColumnCount(10);
return tableWidget;
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStackedWidget stackedWidget;
stackedWidget.showMaximized();
stackedWidget.addWidget(createPage("Page1"));
stackedWidget.addWidget(createPage("Page2"));
stackedWidget.setStyleSheet(
"QStackedWidget QTableWidget#Page1 QHeaderView::section {"
" background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,"
" stop:0 #616161, stop: 0.5 #505050,"
" stop: 0.6 #434343, stop:1 #656565);"
" color: white;"
" padding-left: 4px;"
" border: 1px solid #6c6c6c;"
"}"
"QStackedWidget QTableWidget#Page2 QHeaderView::section {"
" background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1,"
" stop:0 #red, stop: 0.5 #green,"
" stop: 0.6 #green, stop:1 #pink);"
" color: white;"
" padding-left: 4px;"
" border: 1px solid #bule;"
"}");
stackedWidget.setCurrentIndex(0);
// stackedWidget.setCurrentIndex(1);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks