#include 赞 踩 #include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : //lineEdit //设置内容 //设置边距 //lable //lCD //进度条 MainWindow::~MainWindow() //stackwidgets Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。
QT设计常用控件_qt string stra = ui->lineddita->text();
#include "ui_mainwindow.h"
#include <QDebug>
#include <QStringList>
#include <QCompleter>
#include <QMovie>
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//获取内容
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);
//设置内容
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);
ui->lcdNumber->display(124);
ui->progressBar->setMinimum(0);
ui->progressBar->setMaximum(100);
ui->progressBar->setValue(50);
//
}
{
delete ui;
}
void MainWindow::on_pushButton_3_clicked()
{
static int i = 0;
ui->stackedWidget->setCurrentIndex(++i%4);
}