QT5-control-QLabel and QLCDNumber-Label display pictures or videos. LCD is good for PC,

Source: Internet
Author: User

QT5-control-QLabel and QLCDNumber-Label display pictures or videos. LCD is good for PC,

#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include <QLabel>#include <QLCDNumber>#include <QPixmap>class MainWindow : public QMainWindow{    Q_OBJECTpublic:    MainWindow(QWidget *parent = 0);    ~MainWindow();    QLabel* label[10];    QLCDNumber* lcd[10];};#endif // MAINWINDOW_H
# Include "mainwindow. h "MainWindow: MainWindow (QWidget * parent): QMainWindow (parent) {this-> resize (600,400); this-> centralWidget (); label [0] = new QLabel ("world, bad", this); label [0]-> setGeometry ); QPixmap pix = QPixmap ("res/01.png"); label [1] = new QLabel (this); label [1]-> setPixmap (pix ); label [1]-> setGeometry (300,300,); LCD [0] = new QLCDNumber (2, this); LCD [0]-> display ("24 "); LCD [0]-> s EtGeometry (200,100,); LCD [0] = new QLCDNumber (5, this); LCD [0]-> display "); LCD [0]-> setGeometry (350,150,200,100); // set the display style // QLCDNumber: The same color of the Outline display and window background // QLCDNumber :: the same color as the font for Filled display. // QLCDNumber: Flat does not show the style of the font outer box line. // LCD [1]-> setSegmentStyle (QLCDNumber: Filled);} MainWindow :: ~ MainWindow (){}
#include "mainwindow.h"#include <QApplication>int main(int argc, char *argv[]){    QApplication a(argc, argv);    MainWindow w;    w.show();    return a.exec();}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.