当前位置:网站首页>Day16QtQLabel2021-10-22
Day16QtQLabel2021-10-22
2022-06-22 02:44:00 【Morning and evening rain】
QLabel Use
QLabel Generally used to display text and pictures , Can pass Qt The designer interface sets related properties , For example, set the text to be displayed in the middle ; You can set the font ; Can be used to display pictures and text , Let's make a small scene , Cover the above functions .
Use QLabel According to the text 、 picture 、 Moving graph
Clear... Has been described in the relevant configuration code , Post code directly
.cpp In the code
#include "mylabel.h"
#include "ui_mylabel.h"
#include <QPixmap>
#include <QMovie>
myLabel::myLabel(QWidget *parent)
: QWidget(parent)
, ui(new Ui::myLabel)
{
ui->setupUi(this);
// by Label Add border
ui->textLab->setFrameShape(QFrame::Box);
// Set the font
QFont font;
font.setFamily(" Chinese Xingkai ");// typeface
font.setPointSize(20);// size
font.setBold(true);// In bold
// font.setItalic(true);// Italics
ui->textLab->setFont(font);
ui->textLab->setText("Day15, perseverance prevails !");
// Use QLabel display picture
QPixmap pix(":/res/Day15.png");
// pix = pix.scaled(300,300);
ui->picLab->setScaledContents(true);// Set the playback content size to be adjustable , The same function as the previous comment statement
ui->picLab->setPixmap(pix);
// Use QLabel Show dynamic diagram
QMovie *movie = new QMovie(":res/action.gif");
// movie->resized(QSize(300,300));
ui->movieLab->setScaledContents(true);
ui->movieLab->setMovie(movie);
movie->start();
}
myLabel::~myLabel()
{
delete ui;
}
.h In the code
#ifndef MYLABEL_H
#define MYLABEL_H
#include <QWidget>
QT_BEGIN_NAMESPACE
namespace Ui {
class myLabel; }
QT_END_NAMESPACE
class myLabel : public QWidget
{
Q_OBJECT
public:
myLabel(QWidget *parent = nullptr);
~myLabel();
private:
Ui::myLabel *ui;
};
#endif // MYLABEL_H
effect

边栏推荐
- June25,2022 PMP Exam clearance manual-4
- [1. quick sort]
- How to use tensorboard add_ histogram
- C++ primer Chapter 2 summary of variables and basic types
- fatal error: png++/png. Hpp: no that file or directory
- 2022钎焊考试模拟100题及答案
- Technical exploration: 360 digital subjects won the first place in the world in ICDAR OCR competition
- C # judge whether the application is started and displayed
- GraphAcademy 课程讲解:《Neo4j 图数据科学基础》
- OpenJudge NOI 1.13 46:八进制到十进制
猜你喜欢

EMC rectification tips

File upload vulnerability shooting range analysis upload_ LABS

In 2022, the number of mobile banking users in Q1 will reach 650million, and ESG personal financial product innovation will be strengthened

GraphAcademy 课程讲解:《Neo4j 图数据科学基础》

Show you how to distinguish several kinds of parallelism

Brief analysis of application source code of neo4j intelligent supply chain
![Comprehensive interpretation by enterprise reviewers: enterprise growth of [State Grid] China Power Finance Co., Ltd](/img/4e/345ceb4e91aae844d7ab53ad3fd988.png)
Comprehensive interpretation by enterprise reviewers: enterprise growth of [State Grid] China Power Finance Co., Ltd

PMP备考相关敏捷知识

Rational Rose installation tutorial

【3.整数与浮点数二分】
随机推荐
Microsoft Internet Explorer was permanently closed on June 15
国产品牌OPPO官方最新出品!这份PPT报告!真刷新我对它认知了
ACL 2022 | multilingual knowledge map reasoning based on self supervised graph alignment
GraphConnect 2022 大会的产品发布一览
EMC辐射发射整改-原理案例分析
Neo4j 智能供应链应用源代码简析
B-Tree
In 2022, the number of mobile banking users in Q1 will reach 650million, and ESG personal financial product innovation will be strengthened
Official release of ideal L9: retail price of 459800 yuan will be delivered before the end of August
How to apply PMP project management knowledge?
C ++ Primer 第2章 变量和基本类型 总结
Asemi fast recovery diode FR107 parameter, FR107 real object, FR107 application
自动化工具-监测文件的变化
[3. binary integer and floating point number]
[6. high precision multiplication]
WinForm project console debugging mode
智翔金泰冲刺科创板:年营收3919万亏损超3亿 拟募资40亿
Create RT_ Thread thread
Markdown advanced syntax, marktext compatible
微软 IE 浏览器于 6 月 15 日被永久关闭