In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to achieve Qt window rotation". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Modify the display process of the main window in main.cpp. Rotate is the main window class:
Int main (int argc, char * argv [])
{
QApplication a (argc, argv)
Rotate w / WT / main window
/ *
* rotate the main window
, /
QGraphicsScene * scene = new QGraphicsScene
QGraphicsProxyWidget * gpw = scene- > addWidget
Gpw- > setRotation (90); / / rotate 90 degrees
QGraphicsView * view = new QGraphicsView (scene)
View- > showFullScreen (); / / full screen display
Return a.exec ()
}
After being added, it is shown in figure 94.1:
The child window uses the "this" pointer to specify that the parent window loads all project interfaces into QGraphicsScene. The time code for creating the child window object is as follows:
Void Rotate::showOpenFile ()
{
Gf = new getfile (this); / / the child window calls scene
Gf- > show ()
Connect (gf,SIGNAL (OK_signal ()), this,SLOT (showText (); / / receive the signal from the child window
}
After completion, as shown in figure 94.2:
The effect of the main window is shown in figure 94.3:
Click on the toolbar to open the file, pop up the child window, and select the file name in the child window.
Displays the contents of the file:
When running on the development board, the window should be resized according to the screen size. Using this method, you must put all the windows in the project into Scene in order to achieve the effect of rotation.
This is the end of the content of "how to rotate Qt window". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.