[Qt-interest] qt how to use multi-screen

tang ke tangk at lemote.com
Fri Jul 22 03:27:22 CEST 2011


于 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: 442 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110722/2c1f5a39/attachment.vcf 


More information about the Qt-interest-old mailing list