#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(450,300);
this->setWindowTitle("QQ");
this->setWindowIcon(QIcon("D:\\HQYJRJ\\QT\\day1\\02_first\\QQ.png"));
QLabel *lab1 = new QLabel(this);
QPixmap originalPixmap("D:\\HQYJRJ\\QT\\day1\\02_first\\QQ2.png");
QPixmap resizedPixmap = originalPixmap.scaled(450, 100);
lab1->setPixmap(resizedPixmap);
lab1->resize(450,100);
lab1->setScaledContents(true);
// QRect labelGeometry = lab1->geometry(); // 获取标签的位置和尺寸信息
// int x = labelGeometry.x(); // 获取标签的横坐标
// int y = labelGeometry.y(); // 获取标签的纵坐标
// qDebug() << "Label Position: (" << x << ", " << y << ")";
QLineEdit *edit1 = new QLineEdit(this);
edit1->resize(200,40);
edit1->move(140,140);
edit1->setStyleSheet("border:none;border-bottom:3px,solid,blue");
edit1->setPlaceholderText("QQ号//微信//邮箱");
QLabel *lab2 =new QLabel(this);
lab2->setPixmap(QPixmap("D:\\HQYJRJ\\QT\\day1\\02_first\\denglu.png"));
lab2->setScaledContents(true);
lab2->resize(40,40);
lab2->move(100,140);
QLabel *lab3 =new QLabel(this);
lab3->setPixmap(QPixmap("D:\\HQYJRJ\\QT\\day1\\02_first\\denglumima.png"));
lab3->setScaledContents(true);
lab3->resize(40,40);
lab3->move(100,190);
QLineEdit *edit2 = new QLineEdit(this);
edit2->resize(200,40);
edit2->move(140,190);
edit2->setStyleSheet("border:none;border-bottom:3px,solid,blue");
edit2->setEchoMode(QLineEdit::Password);
edit2->setPlaceholderText("密码");
QPushButton *btn1 = new QPushButton("登录",this);
btn1->resize(50,50);
btn1->move(280,240);
btn1->setIcon(QIcon("D:\\HQYJRJ\\QT\\day1\\02_first\\denglu_1.png"));
btn1->setStyleSheet("border-radius:10px;");
QPushButton *btn2 = new QPushButton("取消",this);
btn2->resize(50,50);
btn2->move(340,240);
btn2->setIcon(QIcon("D:\\HQYJRJ\\QT\\day1\\02_first\\cancel.png"));
btn2->setStyleSheet("border-radius:10px");
}
MainWindow::~MainWindow()
{
delete ui;
}
文章来源:https://www.toymoban.com/news/detail-530834.html
文章来源地址https://www.toymoban.com/news/detail-530834.html
到了这里,关于QT day1的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!