Search code examples
qteventsqwidgetqtablewidget

Qt : event invisible widget?


For some reasons, I need to draw a widget onto one another. The structure is the following (see the image) :

  • I have an original QTableWigetItem
  • On the QTableWigetItem, I create a QWidget at the foreground with the same geometry
  • This QWidget contains a QBoxLayout
  • This QBoxLayout contains a QPixmap and a QComboBox enter image description here

I want to do the following things : The QWidget is just a "container" for my QBoxLayout and I would like to set him completely "invisible" for the user. If the user click or move at the position of the widget, I want the event of the QTableWigetItem in the background to be trigerred. But the problem is that I want the QPixmap and the QComboBox to be at the foreground, visible and "normal". For me it's just a trick to be able to put children widgets in a QTableWidget of a HeaderView.

How to make the QWidget "completely invisible" (from the event/signals point of view) ?

Thank you very much.


Solution

  • Try QWidget::setWindowOpacity(0)