Problem with QMessageBox and Windows 7



  • hi!

    i have a problem with QMessageBox and Windows 7:

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onActionAbout()));
    
    void MainWindow::onActionAbout() {
        QMessageBox::about(this, "About", qApp->applicationName() +
                           ": Test.<br><br>"
                           "Autore: " + QString(qApp->organizationName()).replace("_"," ") +
                           "<br><br>"
                           "Web site: <a href='" + qApp->organizationDomain() +
                           "'>................it</a><br><br>"
                           "Licenza: <a href='................'>Creative Commons</a><br><br>"
                           "Linguaggio: C++/Qt<br><br>"
                           "Versione: " + qApp->applicationVersion() +
                           "<br><br>"
                           "Versione Qt: " + QT_VERSION_STR);
    }
    

    this code works on Linux and Windows 10, but not in Windows 7.
    when I run this code in Windows 7, the program crashes.
    do you know why?


  • Moderators

    @fermatqt Did you try to debug your app on Windows 7? To see where exactly it is crashing and to get stack trace.



  • @jsulm said in Problem with QMessageBox and Windows 7:

    @fermatqt Did you try to debug your app on Windows 7? To see where exactly it is crashing and to get stack trace.

    unfortunately I do not have a car with which to install Windows 7 on QtCreator.
    is there a way to debug without installing QtCreator?



  • however this works without problems:

    void MainWindow::onActionAboutQt() {
        QMessageBox::aboutQt(this, "About Qt");
    }
    


  • 210/5000
    ok, I installed QtCreator on a machine with Windows 7 64bit.
    I run the program from QtCreator, and everything worked.
    so the problem is that when I use a compiled binary for Windows 10?
    possible?


  • Moderators

    @fermatqt It should work fine on Windows 7.
    "when I run this code in Windows 7, the program crashes" - what exactly happens? Any error message?



  • @jsulm said in Problem with QMessageBox and Windows 7:

    @fermatqt It should work fine on Windows 7.
    "when I run this code in Windows 7, the program crashes" - what exactly happens? Any error message?

    the program closes, and it appears the windows error "Programs Has Stopped Working".


  • Lifetime Qt Champion

    Hi,

    How did you deploy the application ?



  • @SGaist said in Problem with QMessageBox and Windows 7:

    Hi,

    How did you deploy the application ?

    i used windpeplyqt!!


  • Lifetime Qt Champion

    Which version of Qt ?



  • @SGaist

    5.8 and QtCreator 4.2.2-2


  • Lifetime Qt Champion

    What compiler are you using ?



  • @SGaist
    i'm using msvc2015


  • Lifetime Qt Champion

    Since the 5.9 betas are available, can you check them to see if you still encounter that problem ?



  • @SGaist said in Problem with QMessageBox and Windows 7:

    Since the 5.9 betas are available, can you check them to see if you still encounter that problem ?

    hi!
    I also tried with Qt 5.9, but I have the same problem.
    Even this code does not work:

    #ifndef SAVEDIALOG_H
    #define SAVEDIALOG_H
    
    #include <QObject>
    #include <QStringList>
    #include <QFileDialog>
    
    inline QString saveDialog() {
        QString fileName;
        QStringList filters;
        filters << "CSV(*.csv)" << "XLS(*.xls)" << "PDF(*.pdf)" << "All files(*.*)";
        QFileDialog fd(0, QObject::tr("Salva"), QDir::homePath());
        fd.setAcceptMode(QFileDialog::AcceptSave);
        fd.setNameFilters(filters);
        if (fd.exec() == QDialog::Accepted) {
            fileName = fd.selectedFiles()[0];
        }
        return fileName;
    }
    


  • instead, this line works:

    QMessageBox::aboutQt(this);
    

Log in to reply