[英]no matching function for call to ‘std::basic_ifstream<char>::basic_ifstream(QString&)’
[英]Error: no matching function for call to 'QLabel::text(QString&)'
我嘗試制作文件瀏覽器,但出了什么問題
這是我的mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_4_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
"",
tr("Files (*.mp3 *.ogg)"));
ui->label->text(fileName);
}
錯誤:
C:\Users\account\eka\mainwindow.cpp:24: error: no matching function for call to 'QLabel::text(QString&)'
ui->label->text(fileName);
^
我剛開始使用 Qt,請幫助我。
使用 setText() 而不是 text()。 text() 是一個吸氣劑
ui->label->setText(fileName);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.