For me it works (I tried only in Windows).
Are your environment configured to launch OpenOffice Writer to read ODT files?
Can you post the code?
This in my code
// Ask the user to select a ODT file
void Widget::on_openUrlButton_clicked()
{
this,
tr ("Open File"),
".",
tr ("Open Document Text Files (*.odt)"));
if (!fileName.isEmpty ()) {
ui->urlEdit->setText (fileName);
}
}
// Launch proper application to read selected file
void Widget::on_goButton_clicked()
{
QUrl url
= QUrl::fromLocalFile (ui
->urlEdit
->text
());
if (!result)
qWarning () << "Failed to open URL " << url;
}
// Ask the user to select a ODT file
void Widget::on_openUrlButton_clicked()
{
QString fileName = QFileDialog::getOpenFileName (
this,
tr ("Open File"),
".",
tr ("Open Document Text Files (*.odt)"));
if (!fileName.isEmpty ()) {
ui->urlEdit->setText (fileName);
}
}
// Launch proper application to read selected file
void Widget::on_goButton_clicked()
{
QUrl url = QUrl::fromLocalFile (ui->urlEdit->text ());
bool result = QDesktopServices::openUrl (url);
if (!result)
qWarning () << "Failed to open URL " << url;
}
To copy to clipboard, switch view to plain text mode
Bookmarks