Qt点击按钮打开图片

void MainWindow::on_pushButton_clicked()
{
QString filename=QFileDialog::getOpenFileName(this,tr(“openfile”),QDir::currentPath());
if(!filename.isEmpty())
{
QImage image(filename);
label->setPixmap(QPixmap::fromImage(image));
}
}

你可能感兴趣的:(QT编程,qt)