You could for example override list view's paint event and draw the text by hand in case there is no items.
{
QListView::paintEvent(event
);
// let the list view draw itself as it would
// special case when there is no items
if (model()->rowCount() == 0)
{
p.drawText(rect(), Qt::AlignCenter, "No items..");
}
}
void MyListView::paintEvent(QPaintEvent* event)
{
QListView::paintEvent(event); // let the list view draw itself as it would
// special case when there is no items
if (model()->rowCount() == 0)
{
QPainter p(viewport());
p.drawText(rect(), Qt::AlignCenter, "No items..");
}
}
To copy to clipboard, switch view to plain text mode
Not sure if it works as desired or if it even compiles, but it should give you an idea..
Bookmarks