Hello,
I've got two monitors in Linux configured as multi-screen, so I've two monitors connected to one graphic card. I'm trying to display a QWidget on upper or lower monitor using QDesktopWidget, but I'm doing something wrong because I can't do it.
I leave some code below to understand better my issue:
The class inherits QWidget:
IFHMIQtGui
(QWidget* parent, GUIDevice device
)
IFHMIQtGui(QWidget* parent, GUIDevice device)
To copy to clipboard, switch view to plain text mode
The constructor:
IFHMIQtGui
::IFHMIQtGui(QWidget* parent, GUIDevice device
){
if (device == DEVICE_UPPER)
{
qscreen = pDesktop.screen(1);
}
else if (device == DEVICE_LOWER)
{
qscreen = pDesktop.screen(0);
}
}
IFHMIQtGui::IFHMIQtGui(QWidget* parent, GUIDevice device)
{
QDesktopWidget pDesktop;
QWidget *qscreen;
if (device == DEVICE_UPPER)
{
qscreen = pDesktop.screen(1);
}
else if (device == DEVICE_LOWER)
{
qscreen = pDesktop.screen(0);
}
QWidget(qscreen);
}
To copy to clipboard, switch view to plain text mode
I know that if I pass the QDesktopWidget to my IFHMIQtGui when I contruct the object, the QWidget is displayed on the right monitor. Anyway, the problem is that I need to use QDesktopWidget inside the IFHMIQtGui constructor.
Thank you.
Bookmarks