文本框焦点:
ui->name->setFocus();
背景色设置:
setPalette(QPalette(Qt::white));//设置窗口为白色背景
setAutoFillBackground(true);
label标签插入图片,按比例缩放:
QImage Image;
Image.load(":/image1/panada.jpeg");
QPixmap pixmap = QPixmap::fromImage(Image);
int with = ui->panada->width();
int height = ui->panada->height();
QPixmap fitpixmap = pixmap.scaled(with, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); // 按比例缩放
ui->panada->setPixmap(fitpixmap);
获得当前系统时间:
QDateTime current_date_time =QDateTime::currentDateTime();
QString current_date =current_date_time.toString("yyyy.MM.dd hh:mm:ss:zzzz dddd");
文本框设置提示词:
ui->name->setPlaceholderText("Enter the name");
文本框设置有弧度角:
ui->name->setStyle