我爲Qt gui應用程序創建了一個deploy文件夾,我添加了他尖叫的所有.dll文件。該應用程序正在運行,但有2個功能缺失。部署Qt應用程序時缺少功能
void MainWindow::on_action_About_triggered()
{
QString filePatch = QApplication::applicationDirPath() + "/changelog.txt";
QFile f(filePatch);
if (!f.open(QFile::ReadOnly | QFile::Text))
return;
QTextStream in(&f);
QMessageBox::about(this, tr("About testapp"),
getAppVersion() + "\ntestapp\n\n" + in.readAll());
}
而且
QPrinter printer;
printer.setFullPage(true);
printer.setPaperSize(QPrinter::A4);
printer.setOrientation(QPrinter::Landscape);
if (SpecialTypes::printType_t::ePrint == pType)
{
printer.setOutputFormat(QPrinter::NativeFormat);
QPrintDialog printDial(&printer, this);
if (printDial.exec() == QDialog::Accepted)
{
textEdit->document()->print(&printer);
}
}
兩個對話框中並沒有顯示在部署文件夾的計算機上。當我在PC上運行Qt創建器時,我正在構建應用程序,這些對話框正常工作。我想我需要包括一些額外的庫,但我不知道哪些,因爲應用程序不會拋出任何錯誤,它只是不顯示對話框。我會幫助所有人。
我已經解決了關於打印對話框的問題 - 我不得不在可執行文件旁邊添加一個名爲printsupport的文件夾。在那個文件夾我不得不把windowsprintersupport.dll。然而,我不知道爲什麼沒有關於對話框的工作。 – Bremen
嘗試使用可在'QTDIR/bin/windeployqt.exe'中找到的Windows部署工具來部署您的應用程序。它會自動將所有必需的文件放入應用程序目錄中。 – Nejat
這個程序不會添加一些我需要的.dll,例如libgcc_s_dw2-1.dll – Bremen