wysota, I though I would try what appeared to be the easiest possibilities first.
You can set a background image using QWidget::setPalette() and setting a pixmap as a brush for the Base role.
The following displayed the image under the horizontal header but not on the white table surface (I could see it extend to the end of the table where the header was not drawn). Is there something I'm missing here?
m_pTable->setHorizontalHeaderLabels( sLabels );
QPixmap px
( ":/images/ShowLogSplash.png" );
m_pTable->setPalette( palette );
m_pTable = new QTableWidget( 0, 7, m_pMainWin );
m_pTable->setHorizontalHeaderLabels( sLabels );
QPalette palette = m_pTable->palette();
QPixmap px( ":/images/ShowLogSplash.png" );
palette.setBrush( QPalette::Window, QBrush( px ) );
m_pTable->setPalette( palette );
To copy to clipboard, switch view to plain text mode
Or you can even put a QLabel on the table (as the child of the viewport).
I used the following code to try to implement this but I feel I'm missing the point you were making. It shows nothing on the table surface. Is this remotely what you were suggesting?
m_pTable->setHorizontalHeaderLabels( sLabels );
QWidget* viewport
= m_pTable
->viewport
();
QLabel lbl
( "QLable Text in a Viewport" );
vLayout->addWidget( &lbl );
viewport->setLayout( vLayout );
m_pTable = new QTableWidget( 0, 7, m_pMainWin );
m_pTable->setHorizontalHeaderLabels( sLabels );
QWidget* viewport = m_pTable->viewport();
QLabel lbl( "QLable Text in a Viewport" );
QVBoxLayout* vLayout = new QVBoxLayout;
vLayout->addWidget( &lbl );
viewport->setLayout( vLayout );
To copy to clipboard, switch view to plain text mode
I'll now look at the event filter suggestion you made, although that looks more complicated than I wanted to try.
Thanks for you help.
Bookmarks