[Qt-interest] Fwd: qt how to use multi-screen
Samuel Gaist
samuel.gaist at edeltech.ch
Fri Jul 22 09:06:32 CEST 2011
Hi,
You can get it from QDesktopWidget:
http://doc.qt.nokia.com/4.7/qdesktopwidget.html#primaryScreen-prop
Hope this helps
Samuel
Begin forwarded message:
> From: tang ke <tangk at lemote.com>
> Date: 22 juillet 2011 03:27:22 HAEC
> To: Paul Miller <paul at fxtech.com>
> Cc: qt-interest at qt.nokia.com
> Subject: Re: [Qt-interest] qt how to use multi-screen
>
> 于 2011年07月22日 05:48, Paul Miller 写道:
>> On 7/21/2011 3:10 AM, tang ke wrote:
>>> yes,I want to use multiple monitor in my program.
>>>
>>> the next is my test code:
>> ...
>>> the loop execute twice.
>>> but I get the same pointer of app.desktop().screen(i)
>> Depending on your platform there may only be one widget which spans both
>> screens.
>>
>> Instead, use the screen geometry or available geometry, and then set
>> your widget geometry for each widget to go to the appropriate area.
> thanks, I fixed it with next code:
>
> #include <QApplication>
> #include <QDesktopWidget>
> #include <QPushButton>
> #include <QDebug>
> int main(int argc, char **argv) {
> QApplication app(argc, argv);
> QWidget p;
> const int screen = app.desktop()->screenCount();
> qDebug() << screen;
> const QRect availableRect1(QApplication::desktop()->availableGeometry(0));
> const QRect availableRect2(QApplication::desktop()->availableGeometry(1));
> qDebug() << availableRect1;
> qDebug() << availableRect2;
> p.move(availableRect1.left(),availableRect1.top());
> p.showFullScreen();
> return app.exec();
> }
>
> but I don't know which screen is the primary screen. maybe It's setted
> by system monitor settings.
>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>
>
> --
> Best Regards
>
>
> Tang Ke (Application develop of software department)
> Tel:0086-512-52308628 Fax:0086-512-52308688
> Phone:18962393077
> E-mail:tangk at lemote.com MSN:tangk at lemote.com, mumutouv at gmail.com
> Web: http://www.lemote.com <http://www.lemote.com/>
> JiangSu ZhongKe Lemote Technology Co.,Ltd
> MengLan Industry Park,YuShan,ChangShu City,JiangSu,China
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tangk.vcf
Type: text/x-vcard
Size: 443 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110722/3d49b407/attachment.vcf
-------------- next part --------------
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list