Is "About Qt" dialog HTML or text content available in Qt5 API?



  • This public static method shows a dialog with Qt version and licensing information:

    Within our Qt application, we need to get our hands on the HTML (or at least text) string displayed in that dialog. Is there a way to do this?

    Aside: We really do need what I mentioned above. But short of that, it would be good if the content of the "About Qt" dialog was selectable and copyable. (Currently, it apparently isn't).

    We're using Qt 5.5.1 on Windows with Visual Studio 2010 SP1.


  • Moderators

    This text is not exposed by any public API. There's also no direct programmatic way to get a pointer to the message box (apart from some ugly tricks with top level windows list). If you want to you can copy the text from the sources and show however you like.
    The message box uses default text interaction flags which depend on the style. If you want a message box with selectable text you can roll your own and set Qt::TextSelectableByMouse flag on it.


  • administrators

    Hi @Phil_W
    I just have to ask what you would change in the About Qt text?
    I mean what is the specific need? And is it something more common, as I haven't run into this before.



  • We have a requirement to provide information about all of our 3rd party libraries in a copyable form. (A read-only QTextEdit, with basic HTML formatting). That is, so that it can be selected, copied and pasted (e.g. into an e-mail message). We don't need to change anything in the About Qt text, as such.

    This image shows just the top portion of such a document (in a read-only QTextEdit widget). Notice that, for now, the Qt information can't be included in the document. Instead, we can show the Qt information only with a button (see, at bottom).

    About RiverWare Dialog


  • Qt Champions 2016

    HI
    You can just grab it from the qmessagebox.cpp

    void QMessageBox::aboutQt(QWidget *parent, const QString &title)
    {
        QString translatedTextAboutQtCaption;
        translatedTextAboutQtCaption = QMessageBox::tr(
            "<h3>About Qt</h3>"
            "<p>This program uses Qt version %1.</p>"
            ).arg(QLatin1String(QT_VERSION_STR));
        QString translatedTextAboutQtText;
        translatedTextAboutQtText = QMessageBox::tr(
            "<p>Qt is a C++ toolkit for cross-platform application "
            "development.</p>"
            "<p>Qt provides single-source portability across all major desktop "
            "operating systems. It is also available for embedded Linux and other "
            "embedded and mobile operating systems.</p>"
            "<p>Qt is available under three different licensing options designed "
            "to accommodate the needs of our various users.</p>"
            "<p>Qt licensed under our commercial license agreement is appropriate "
            "for development of proprietary/commercial software where you do not "
            "want to share any source code with third parties or otherwise cannot "
            "comply with the terms of the GNU LGPL version 3 or GNU LGPL version 2.1.</p>"
            "<p>Qt licensed under the GNU LGPL version 3 is appropriate for the "
            "development of Qt&nbsp;applications provided you can comply with the terms "
            "and conditions of the GNU LGPL version 3.</p>"
            "<p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the "
            "development of Qt&nbsp;applications provided you can comply with the terms "
            "and conditions of the GNU LGPL version 2.1.</p>"
            "<p>Please see <a href=\"http://%2/\">%2</a> "
            "for an overview of Qt licensing.</p>"
            "<p>Copyright (C) %1 The Qt Company Ltd and other "
            "contributors.</p>"
            "<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>"
            "<p>Qt is The Qt Company Ltd product developed as an open source "
            "project. See <a href=\"http://%3/\">%3</a> for more information.</p>"
            ).arg(QLatin1String("2015"),
                  QLatin1String("qt.io/licensing"),
                  QLatin1String("qt.io"));
        QMessageBox *msgBox = new QMessageBox(parent);
        msgBox->setAttribute(Qt::WA_DeleteOnClose);
        msgBox->setWindowTitle(title.isEmpty() ? tr("About Qt") : title);
        msgBox->setText(translatedTextAboutQtCaption);
        msgBox->setInformativeText(translatedTextAboutQtText);
    
        QPixmap pm(QLatin1String(":/trolltech/qmessagebox/images/qtlogo-64.png"));
    


  • Thanks, that's what we'll do. If nothing is added to Qt in future versions to support this, we'll just have to manually grab this text each time we upgrade to a new version of Qt.

    There might also be some use in having this "About Qt" content at a permanent URL on a public Qt website, distinct for each version (or perhaps with a visible "GET" argument in the URL with the QT_VERSION_STR / qVersion() text).

    It might also be good to have the text in the About Qt dialog selectable (copyable) -- but read-only, of course.


  • Qt Champions 2016

    @Phil_W
    Well its the first time I ever saw anyone ask for it so unless you open report and vote for it,
    it's unlikely it will change in newer versions.

    Also, it should possible to grab from code but it will fiddle with internal
    objects and might break anyway on next upgrade so maybe just taking the lines
    is the best solution.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.