display control
1, label
The function is to display some text , or for mapping
1. Way of loading resources: Right-click the project -->add new
Enter the name, you can get a package of qrc, and then add the prefix /image to this position to indicate the picture
Then add the file to add it to the resource
2. lable set the text content through setText
ui->label_2->setText(" Today is the second class of QT");
3, lable set pictures by setPixmap
QPixmap mImage=QPixmap(":/image/C:/Users/yxd/Desktop/image/png/chudai.png");//This is the path ui-> label_6->setScaledContents(true);//Setting can be scaled ui->label_6->setPixmap(mImage);
4, lable set the gif image through setMovie
QMovie *pMovie=new QMovie(":/image/C:/Users/yxd/Desktop/image/gif/C++ .gif");ui->label_8->setFixedSize(300,168);//Set the size of the animation ui->label_8->setMovie(pMovie);pMovie->start();
2, textbrowser
provides a rich text browser with hypertext navigation device
【Lead QT Development Tutorial learning materials, Click the link below to collect the fee ↓↓, code first to not get lost~]
Click → Receive "Link"
3. LCD number
Display the number in LCD font
ui->lcdNumber->display(QTime::currentTime().toString("hh:mm:ss"));ui->lcdNumber_2->display(QTime::currentTime( ).toString("hh:mm:ss:zzz"));//zzz displays milliseconds
4. progressBar
progress bar
Through the F4 mode, associate the scroll bar, and move according to the progressBar
setMaximum(int) set maximum value setValue(int) set value setMinimum(int) set minimum value
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Qts%20basic%20controls%20%20display%20controls.html
评论列表(196条)
测试