Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Make Widget visible in QScrollArea (by Layout)
blueSpirit last edited by
I ve implemented a FlowGridLayout (similar to http://doc.trolltech.com/4.7/layouts-flowlayout.html) and added some cursor functionality (pressing left-key will focus the left element, pressing down-key will focus the bottom element) to the layout, since it's the only object which knows the row-/column-count.
How can I make an item visible, when it's hidden by a QScrollArea? Since I only have a pointer to the item, I have no access to the scroll area. With setting "QScrollArea::setWidget()", the widget is only assigned to the viewport (widget) - but not to the scroll area.
I found a very very very ugly workaround:
if( pNewWidget != NULL )
pNewWidget->previousInFocusChain()->setEnabled( false );
// Now the 'pNewWidget' is visible
pNewWidget->previousInFocusChain()->setEnabled( true );
But there must be a better solution...!