山高疑日近,海阔觉天低

Qt 整个界面旋转

QApplication a(argc, argv);
//qApp->setStyleSheet(“QLineEdit{color:#3D90DA;font-size: 18px;}”);
qApp->setStyleSheet(“QLineEdit{border:1px solid rgb(148,148,148);border-radius:2px;color:#3D90DA;font-size: 18px;}”);

MainWindow w;
//w.show();

QGraphicsScene *scene = new QGraphicsScene();
QGraphicsView *view = new QGraphicsView();
//view->setGeometry(w.geometry());

view->setGeometry(0,0,800,480);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scene->addWidget(&w);
view->setScene(scene);
view->show();
view->rotate(90);

//w.show();

return a.exec();

 

这样不仅是显示,触摸也跟着旋转了

还有一种方式:

./App -platform linuxfb:fb=/dev/fb0:mmsize=134×208:rotation=90

Settings Description
fb=/dev/fbN Specifies the framebuffer devices. On multiple display setups, this setting allows you to run the application on different displays. Currently, there’s no way to use multiple framebuffers from one Qt application.
size=<width>x<height> Specifies the screen size in pixels. The plugin tries to query the display dimensions, both physical and logical, from the framebuffer device. However, this query may not always lead to proper results; it may be necessary to specify the values explicitly.
mmsize=<width>x<height> Specifies the physical width and height in millimeters.
offset=<width>x<height> Specifies the top-left corner of the screen offset in pixels. The default position is at (0, 0).
nographicsmodeswitch Specifies not to switch the virtual terminal to graphics mode (KD_GRAPHICS). Typically, enabling graphics mode disables the blinking cursor and screen blanking. However, when this parameter is set, those two features are also skipped.
tty=/dev/ttyN Overrides the virtual console. Only used when nographicsmodeswitch isn’t set.

作者试过 mmsize成功了 实现了缩放,rotation 旋转没起作用

赞(0) 打赏
未经允许不得转载:Mr.Zhang » Qt 整个界面旋转

你的打赏是我的动力

登录

找回密码

注册