如何將QTreeView旋轉90度 我使用了tabWidget中tab樣式的重繪的方法,繼承QProxyStyle,但只是改變了樣式,作用范圍沒有改變,還需點擊原來的位置。
uj5u.com熱心網友回復:
如果只是想要實作界面旋轉90度,可以使用:
QGraphicsScene scene;
scene.addWidget(treeView);
QGraphicsView view(&scene);
view.rotate(90);
view.show();
uj5u.com熱心網友回復:
QTreeView只是頁面的一部分 使用view.show()會打開單獨的空頁面uj5u.com熱心網友回復:
參考下面一段代碼
QTreeView *treeView = new QTreeView;
QFileSystemModel model;
QString strPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
model.setRootPath(strPath);
treeView->setModel(&model);
QLabel *label = new Label("this is a label");
QGraphicsScene scene;
scene.setSceneRect(QRect(-400, -400, 800, 800));
QGraphicsProxyWidget *labelProxy = scene.addWidget(label);
labelProxy->setGeometry(QRect(-400, -400, 400, 800));
QGraphicsProxyWidget *treeProxy = scene.addWidget(treeView);
treeProxy->setGeometry(QRect(400, -400, 800, 400));
treeProxy->setRotation(90);
QGraphicsView view(&scene);
view.resize(800, 800);
view.show();
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/62737.html
標籤:Qt
上一篇:android studio EditText控制元件 怎么獲取每次輸入的值
下一篇:iOS上傳文字給pc實時顯示
