#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QStringList>
#include <QCompleter>
#include <QMovie>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//lineEdit
//获取内容
QString str = ui->lineEdit->text();
qDebug() << str;
//设置内容
ui->lineEdit->setText("huangxingao");
//设置显示方式
//ui->lineEdit->setEchoMode(QLineEdit::Password);
//设置边距
ui->lineEdit->setTextMargins(15,0,0,0);
//设置提示
QStringList list;
list<<"heoll"<<"haha"<<"How are you";
QCompleter *com = new QCompleter(list,this);
com->setCaseSensitivity(Qt::CaseInsensitive);//不区分大小写
ui->lineEdit->setCompleter(com);
//lable
//设置内容
ui->label_text->setText("黄贤高的图片");
//设置图片
ui->label_picture->setPixmap(QPixmap("://image/logo.jpg"));
ui->label_picture->setScaledContents(true);//让图片适应lable大小
//设置gif
QMovie * mymovie = new QMovie("://image/gif.gif");//设置动画
ui->label_gif->setMovie(mymovie);
ui->label_gif->setScaledContents(true);
mymovie->start();
//设置url
ui->label_url->setText("<h1><a href=\"https://www.baidu.com\">百度一下</a></h1>");
ui->label_url->setOpenExternalLinks(true);
//lCD
ui->lcdNumber->display(124);
//进度条
ui->progressBar->setMinimum(0);
ui->progressBar->setMaximum(100);
ui->progressBar->setValue(50);
//
}
MainWindow::~MainWindow()
{
delete ui;
}
//stackwidgets
void MainWindow::on_pushButton_3_clicked()
{
static int i = 0;
ui->stackedWidget->setCurrentIndex(++i%4);
}