In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 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 "what are the tips for Qt development?". In the operation of actual cases, many people will encounter such a dilemma. Then 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!
QColor in Qt perfectly encapsulates colors and supports various transformations, such as rgb, hsb, cmy, hsl, corresponding to toRgb, toHsv, toCmyk, toHsl, transparency settings, and color values can be converted to hexadecimal format.
QColor color (255,0,0,100); qDebug () horizontalHeader ()-> setMinimumSectionSize (0)
There are some undisclosed cool techs that cannot be used directly in the Qt source code, which are hidden in the private of the corresponding module, such as gui-private widgets-private, for example, zip file decompression class QZipReader, compressed class QZipWriter is in the gui-private module, and you need to introduce QT + = gui-private into the pro before you can use it.
# include "QtGui/private/qzipreader_p.h" # include "QtGui/private/qzipwriter_p.h" QZipReader reader (dirPath); QString path ("); / extract the folder to the current directory reader.extractAll (path); / / folder name QZipReader::FileInfo fileInfo = reader.entryInfoAt (0); / / extract the file QFile file (filePath); file.open (QIODevice::WriteOnly); file.write (reader.fileData (QString::fromLocal8Bit ("% 1 "). Arg (filePath)); file.close () Reader.close (); QZipWriter * writer = new QZipWriter (dirPath); / / add folders writer- > addDirectory (unCompress); / / add files QFile file (filePath); file.open (QIODevice::ReadOnly); writer- > addFile (data, file.readAll ()); file.close (); writer- > close ()
In theory, serial port and network sending and receiving data are asynchronous by default, and the operating system automatically dispatches and will not jam the interface at all. Those on the Internet who say that sending and receiving data are stuck on the main thread of the interface are all pulling eggs. The real time-consuming is in the operation and post-operation processing, rather than sending and receiving data. In some projects with a small amount of data processing, it is generally not recommended to use threads to process, and threads need to schedule overhead. Don't throw everything into the thread. Threads are not omnipotent. Only when you really need to do some time-consuming operations, such as encoding and decoding, do you need to move to threading.
It is probably incorrect to get the width and height of the control in the constructor, which needs to be obtained after the control is displayed for the first time. The control will not set the correct width and height value until after the first display. Remember, it is after the first display, not after the constructor or the program is started, if there are some container controls, such as controls for pages that are not displayed in QTabWidget, after the program is started. It may also be incorrect for you to get width and height, and the foolproof way is to get it after the first display.
This is the end of the content of "what are the tips for Qt development". 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.