Hi, all.

In my video player I'm trying to have widget with controls on top of video widget. Using QStackedWidget or QStackedLayout with stackMode set to StackAll allowed me to place controls over video, but in this case i cannot handle mouse clicks in video widget. Here's simple test program to demonstrate my problem:

Qt Code:
  1. #include <QtGui>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication a(argc, argv);
  6. QWidget mainWidget;
  7.  
  8. mainWidget.setMinimumSize(300, 400);
  9.  
  10. QStackedLayout* stackedLayout = new QStackedLayout();
  11. stackedLayout->setStackingMode(QStackedLayout::StackAll);
  12.  
  13. QWidget *videoWidget = new QWidget();
  14. videoWidget->setLayout(new QVBoxLayout());
  15. videoWidget->layout()->addWidget(new QPushButton("Video"));
  16. static_cast<QVBoxLayout *>(videoWidget->layout())->insertStretch(-1);
  17. stackedLayout->addWidget(videoWidget);
  18.  
  19. QWidget *controlWidget = new QWidget();
  20. controlWidget->setLayout(new QVBoxLayout());
  21. static_cast<QVBoxLayout *>(controlWidget->layout())->insertStretch(-1);
  22. controlWidget->layout()->addWidget(new QPushButton("Controls"));
  23. stackedLayout->addWidget(controlWidget);
  24.  
  25. mainWidget.setLayout(new QHBoxLayout());
  26. static_cast<QHBoxLayout *>(mainWidget.layout())->addLayout(stackedLayout);
  27. mainWidget.show();
  28.  
  29. return a.exec();
  30. }
To copy to clipboard, switch view to plain text mode 

In this program it's impossible to click on "Video" button.

Any suggestions?

Thanks in advance.