Reputation: 370
How I can change title shown on the picture to "№". Thanks.
Upvotes: 4
Views: 1096
Reputation: 243907
That widget is an object of the QTableCornerButton
class that inherits from QAbstractButton
but it is a class that is part of the private Qt API that does not use text, so you can not use setText()
of QAbstractButton
, so the other option is establish a QLabel
with a layout above:
#include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableView w;
QStandardItemModel model(10, 10);
w.setModel(&model);
QAbstractButton *button = w.findChild<QAbstractButton *>();
if(button){
QVBoxLayout *lay = new QVBoxLayout(button);
lay->setContentsMargins(0, 0, 0, 0);
QLabel *label = new QLabel("№");
label->setContentsMargins(0, 0, 0, 0);
lay->addWidget(label);
}
w.show();
return a.exec();
}
Upvotes: 4