#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(); // 獲取標(biāo)簽的位置和尺寸信息
// int x = labelGeometry.x(); // 獲取標(biāo)簽的橫坐標(biāo)
// int y = labelGeometry.y(); // 獲取標(biāo)簽的縱坐標(biāo)
// 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號(hào)//微信//郵箱");
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;
}
文章來源:http://www.zghlxwxcb.cn/news/detail-530834.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-530834.html
到了這里,關(guān)于QT day1的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!