QDesktopWidget initialization
I am trying to write an application that will use multiple screens, if available. I know how to open windows on target screens, but QApplication::desktop()->numScreens() returns 1, even on a 4 screen setup. In examining the Qt (3 and 4) source code, I see that the private attribute QDesktopWidget::d is only initialized (QDesktopPrivate::init()) in resizeEvent(). I have tried sending a resize event, but no joy.
For now, I will use ScreenCount(QPaintDevice::x11AppDisplay()) to get the number of screens, but I am curious as to how to get the QDesktopWidget::init() method called.
Re: QDesktopWidget initialization
Am not sure about the number of screens,
but u can try this -
Call a QTimer::singlShot(0,this,initialize()); from the constructor.
In the initialize function try to get the number of screens
Code:
MyWindow::initialize()
{
m_no_of_screens = qApp->desktop()->numScreens();
}
see if the value is correct this time.
Re: QDesktopWidget initialization
Thanks for the suggestion, but still no luck.
Re: QDesktopWidget initialization
Solved. I am using Qt3, and had xinerama support turned on. It evidently conflicted with nvidia driver in "non-twinview" mode. Partial olution is to turn off xinerama. Also had to patch qdesktopwidget_x11.cpp. Looks like they (Trolltech) fixed qdesktopwidget_x11.cpp in Qt4.
Re: QDesktopWidget initialization
Quote:
Originally Posted by
drweilert
I am trying to write an application that will use multiple screens, if available. I know how to open windows on target screens, but QApplication::desktop()->numScreens() returns 1, even on a 4 screen setup. In examining the Qt (3 and 4) source code, I see that the private attribute QDesktopWidget::d is only initialized (QDesktopPrivate::init()) in resizeEvent(). I have tried sending a resize event, but no joy.
For now, I will use ScreenCount(QPaintDevice::x11AppDisplay()) to get the number of screens, but I am curious as to how to get the QDesktopWidget::init() method called.
Hi Dear
Would you tell me how can i affecte a widget to a spesific screen please ?