Сбой диалоговых окон файлов при компиляции со статической версией Qt - PullRequest
1 голос
/ 06 июля 2019

У меня есть проект Rust с интерфейсом C ++ Qt. Я скомпилировал версию Linux для Mint 19 со статической версией Qt. Мне сообщили (https://github.com/spieglt/Cloaker/issues/2), что диалоговое окно файла вылетает при выборе Computer в левой боковой панели или при вводе / в качестве пути. Я обнаружил, что диалоговое окно файла отображается при использовании статической версии Qt (https://imgur.com/a/4grBpVY) отличается от того, что я вижу при компиляции со стандартной динамически связанной версией (https://imgur.com/a/lzhOnkA), созданной установщиком Qt.

Вывод на компьютере пользователя был:

./Cloaker.run 
QApplication: invalid style override passed, ignoring it.
    Available styles: Windows, Fusion
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Case insensitive sorting unsupported in the posix collation implementation
Numeric mode unsupported in the posix collation implementation
Segmentation fault (core dumped)

Я попытался скомпилировать статическую версию Qt в Ubuntu. Когда я это делаю, программа не падает, когда появляется диалоговое окно с разбитым файлом, но Computer является единственным элементом на боковых и верхних панелях, не выделенных серым цветом, и вывод


    QPixmap::scaleWidth: Pixmap is a null pixmap
    QPixmap::scaleWidth: Pixmap is a null pixmap
    QPixmap::scaleWidth: Pixmap is a null pixmap
    QPixmap::scaleWidth: Pixmap is a null pixmap
    Case insensitive sorting unsupported in the posix collation implementation
    Numeric mode unsupported in the posix collation implementation
    QPixmap::scaleWidth: Pixmap is a null pixmap
    QPixmap::scaleWidth: Pixmap is a null pixmap
    QPixmap::scaleWidth: Pixmap is a null pixmap
    Case insensitive sorting unsupported in the posix collation implementation
    Numeric mode unsupported in the posix collation implementation
    Case insensitive sorting unsupported in the posix collation implementation
    Numeric mode unsupported in the posix collation implementation
    Empty filename passed to function
    QPainter::begin: Paint device returned engine == 0, type: 3
    QPainter::setCompositionMode: Painter not active
    QPainter::end: Painter not active, aborted
    Case insensitive sorting unsupported in the posix collation implementation
    Numeric mode unsupported in the posix collation implementation

Оригинальная команда конфигурирования Mint: ~/Qt/5.12.3/Src/configure -prefix ~/qt-static/5.12.3 -static -release -opensource -confirm-license -skip multimedia -no-compile-examples -nomake examples -no-openssl -no-libpng -skip wayland -qt-xcb

Команда Ubuntu configure: ~/Qt/5.13.0/Src/configure -static -release -prefix ~/qt-static/install -opensource -confirm-license -no-compile-examples -nomake examples -no-openssl -no-libpng -fontconfig

Код файла диалога:

    if (mode == Encrypt) { // encrypt, append extension
        inFile += QString::fromUtf8(FILE_EXTENSION);
        return QFileDialog::getSaveFileName(nullptr, "Save encrypted file", inFile, "", nullptr, QFileDialog::DontConfirmOverwrite);
    } else { // decrypt, chop off extension if there, otherwise prepend decrypted.
        if (inFile.endsWith(FILE_EXTENSION, Qt::CaseInsensitive)) {
            inFile = inFile.left(inFile.length() - strlen(FILE_EXTENSION));
        } else {
            inFile += QString::fromUtf8("_decrypted");
        }
        // save as dialog, return path
        return QFileDialog::getSaveFileName(nullptr, "Save decrypted file", inFile, "", nullptr, QFileDialog::DontConfirmOverwrite);
    }

Я хотел бы, если возможно, получить нормальный диалог файла GNOME при статической привязке Qt. Если это невозможно, будет ли у AppImage такая же проблема?

1 Ответ

0 голосов
/ 07 июля 2019

Оказывается, я только что неправильно построил статическую версию Qt.Чтобы построить статический Qt с диалоговыми окнами рабочих файлов (виджеты Qt, стиль QFileDialog; не в стиле GTK) на Mint:

$ mkdir ~/qt-static && cd ~/qt-static
$ mkdir build install; cd build
$ ~/Qt/5.12.3/Src/configure -prefix ~/qt-static/install -static -release -opensource -confirm-license -skip multimedia -skip webengine -skip wayland -no-compile-examples -nomake examples -no-openssl -ico -gtk -gif -qt-xcb
$ make -j8

Ubuntu такая же, только без -qt-xcb и с -fontconfig.

...