Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.0
-
None
Description
QHeaderView will decide to elide the text based on whether or not there is room to display the text using the default font but most styles use a bold font for the current section. This way the eliding doesn't happen when it should. Shouldn't the style do the eliding since it is the one that knows what font to use?
To reproduce:
run this app
click on a header section
notice how the text is truncated off the left edge but not elided
#include <QtGui>
class TableModel : public QAbstractTableModel
{
public:
TableModel()
{
}
QVariant data(const QModelIndex &, int) const
{ return QVariant(); }QVariant headerData(int , Qt::Orientation o, int role) const
{ if (role == Qt::DisplayRole && o == Qt::Horizontal) return " very long string is so long it will never fit correctly"; else return QVariant(); }int rowCount(const QModelIndex &) const
{ return 2; }int columnCount(const QModelIndex &) const
{ return 2; }
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTableView *tv = new QTableView();
tv->horizontalHeader()->setTextElideMode(Qt::ElideRight);
tv->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
tv->verticalHeader()->hide();
tv->setModel(new TableModel());
tv->show();
return a.exec();
}