Hello everyone!
Does anyone have issues with the Wayland compositor? Here I have a Linux + Weston + Wayland machine with a small integrated LCD display (800x480) and an external HDMI monitor (1920x1080).
My goal is to programmatically select the screen on which showing a QFrame, but no matter what I do it appears on the main display. Here's an example of my attempts:


Qt Code:
  1. bool Manager::StartOnScreen(int screenIdx)
  2. {
  3. _desktopWidget = QApplication::desktop();
  4.  
  5. //Check if requested screen is available
  6. if(screenIdx >= _desktopWidget->screenCount())
  7. {
  8. qDebug() << "Screen index out of range";
  9. return false;
  10. }
  11.  
  12. QWidget* screen = _desktopWidget->screen(screenIdx);
  13. QFrame* mainFrame = new QFrame();
  14.  
  15. //Set frame color
  16. if(screenIdx == 0)
  17. mainFrame->setStyleSheet("background-color:rgb(0, 0, 254);");
  18. else
  19. mainFrame->setStyleSheet("background-color:rgb(254, 0, 0);");
  20.  
  21. int width = screen->geometry().width();
  22. int height = screen->geometry().height();
  23. int x = screen->geometry().x();
  24. int y = screen->geometry().y();
  25.  
  26. qDebug() << "Screen config #" + QString::number(screenIdx) + ": position=" + QString::number(x) + "x" + QString::number(y) + " size=" +QString::number(width) + "x" + QString::number(height);
  27.  
  28. //Set frame screen and geometry
  29. mainFrame->setGeometry(screen->geometry());
  30.  
  31. //Show the frame (windowed)
  32. mainFrame->show();
  33.  
  34. //Show the frame (fullscreen)
  35. //mainFrame->showFullScreen();
  36.  
  37. //Try to move the frame with setScreen
  38. //mainFrame->windowHandle()->setScreen(qApp->screens().at(screenIdx));
  39.  
  40. return true;
  41. }
To copy to clipboard, switch view to plain text mode