[Qt-interest] Multi-head API?
Paul Colby
qt at colby.id.au
Tue Oct 20 12:15:28 CEST 2009
I think you'll find (I haven't tried it, but seems to be so on Windows
at least) that each screen has a distinct geometry ie
QDesktopWidget::screenGeometry would return a different, and
non-overlapping QRect for each screen.
Assuming that's the case, you should be able to set your main window's
geometry to lie within a different screen's QRect (or even across more
than one).
eg:
this->setGeometry(QApplication::desktop()->screenGeometry(2)); // Take
this as pseudo-code, but it's probably right.
should put "this" on to screen "2", and make it the full size of that
screen (just an example).
I haven't tried that exactly, but I've done something very similar in
the past to make an application startup on a different screen to the
one it was launched from... worked on Windows XP at least.
Hope that helps.
pc.
On Tue, Oct 20, 2009 at 6:51 PM, Murray Cumming <murrayc at murrayc.com> wrote:
> On Mon, 2009-10-19 at 09:00 -0400, Josiah Bryan wrote:
>> http://doc.trolltech.com/4.5/qdesktopwidget.html
>>
>> QDesktopWidget *d = QApplication::desktop();
>> int ns = d->numScreens();
>>
>> for(int screenNum = 0; screenNum < ns; screenNum ++)
>> {
>> QRect geom = d->screenGeometry(screenNum);
>>
>> // do whatever with geom
>> }
>
> Thanks. I see that I can discover what screen a widget is mostly on with
> int QDesktopWidget::screenNumber ( const QWidget * widget = 0 ) const
> http://doc.trolltech.com/4.5/qdesktopwidget.html#screenNumber
>
> But how can I move a window to a screen, or say that it should appear
> there when it is shown? The class documentation says "Applications can
> use this classs ... to place child widgets on one screen."
>
> I don't see anything suitable in QMainWindow, QWidget, or QApplication
> either.
>
>> Murray Cumming wrote:
>> > Is there any API in Qt to discover the available physical screens and
>> > the available configured displays? Likewise, is there any API I can use
>> > to discover what display a window is on and to say that a particular
>> > window should be on a particular screen?
>> >
>> > I'm hoping for equivalents to GTK+'s GdkScreen and GdkDisplay objects,
>> > http://library.gnome.org/devel/gdk/stable/GdkScreen.html
>> > http://library.gnome.org/devel/gdk/stable/GdkDisplay.html
>> > and to functions such as gtk_window_set_screen():
>> > http://library.gnome.org/devel/gtk/unstable/GtkWindow.html#gtk-window-set-screen
>> >
>>
>
>
> --
> murrayc at murrayc.com
> www.murrayc.com
> www.openismus.com
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
http://colby.id.au
--
http://colby.id.au
More information about the Qt-interest-old
mailing list