C++ (Qt)QToolButton *cb= new QToolButton(ui.tableWidget_11);cb->setStyleSheet("QToolButton{background-color:rgb(0,0,0);color:rgb(0,228,0);}QToolButton:hover:!pressed{color:red;}}");cb->setCursor(Qt::PointingHandCursor);cb->setIcon(QIcon(":/Resources/par.png"));cb->setFont(QFont("Sans",5,QFont::Normal)); //po figu !!!!!!!ui.tableWidget_11->setCellWidget(0,0,cb);
C++ (Qt)int main(int argc, char *argv[]){ QApplication a(argc, argv); QTableWidget *tableWidget = new QTableWidget(); tableWidget->insertColumn(0); tableWidget->insertRow(0); QFont font=QFont("Sans",20,QFont::Normal); tableWidget->verticalHeader()->setFont(font); QToolButton *cb= new QToolButton(tableWidget); cb->setStyleSheet("QToolButton{background-color:rgb(0,0,0);color:rgb(0,228,0);}QToolButton:hover:!pressed{color:red;}}"); cb->setCursor(Qt::PointingHandCursor); //cb->setIcon(QIcon(":/Resources/par.png")); cb->setText("ttt"); cb->setFont(QFont("Sans",5,QFont::Normal)); //po figu !!!!!!! tableWidget->setCellWidget(0,0,cb); tableWidget->setVerticalHeaderItem(0, new QTableWidgetItem("header")); tableWidget->show(); return a.exec();}