Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

GtkDialog mapped without a transient parent. This is discouraged.



  • Im on ubuntu 18.04. Im trying to read my json files. When i run it, i got this error. Here is my code

    int main(int argc, char *argv[])
    {
    
        QApplication a(argc, argv);
        QStringList fileNamesJson;
        fileNamesJson = QFileDialog::getOpenFileNames(nullptr,
                                                      ("Uçuş Planı Seçiniz"), "/home/ilknur/yi/UcusPlani/", ("Uçuş Planı(*.upd *.json)"));
    
        for(auto xfile : fileNamesJson)
        {
            QFile file(xfile);
            file.open(QIODevice::ReadOnly | QIODevice::Text);
            QByteArray data = file.readAll();
    
    
            QJsonParseError error;
            QJsonDocument doc = QJsonDocument::fromJson(data, &error);
            if(doc.isNull())
            {
                qDebug() << "parse failed";
            }
    
            QJsonObject root = doc.object();
            QJsonArray planArray = root.value("ucus plani").toArray();
    //    for(const auto &value : planArray )
    //    {
    //        QJsonObject object = value.toObject();
    //        qDebug()<< value;
    
    //   }
    
           //for(int i=0; i< planArray.size(); i++)
    
      for(const auto &value : planArray) {
          double enlem = value.toObject().value("enl").toDouble();
          double boylam = value.toObject().value("byl").toDouble();
          int grv = value.toObject().value("grv").toDouble();
          double irtifa = value.toObject().value("irtifa").toDouble();
          int no= value.toObject().value("no").toDouble();
          int snrk = value.toObject().value("snrk").toDouble();
         double yaricap = value.toObject().value("yrcp").toDouble();
    
        int bslngc = value.toObject().value("bslngc").toDouble();
        int dgsm =  value.toObject().value("dgsm").toDouble();
        int rtno =  value.toObject().value("rtno").toDouble();
        int tplm =  value.toObject().value("tplm").toDouble();
    
      qDebug() << "bslngc" << bslngc;
      qDebug() << "dgsm" << dgsm;
      qDebug() << "rtno" << rtno;
      qDebug() << "tplm" << tplm;
    
      qDebug () << "enlem:"<< enlem;
      qDebug () << "boylam" << boylam;
      qDebug () << "grv:" << grv;
      qDebug () << "irtifa:" << irtifa;
      qDebug () << "no:" << no;
      qDebug () << "snrk:" << snrk;
      qDebug () << "yaricap:" << yaricap;
    
      }
    }
    }
    

  • Lifetime Qt Champion


  • Lifetime Qt Champion

    Hi
    I think it comes from the dialog - having no parent.

    QFileDialog::getOpenFileNames(nullptr <<< no parent

    So not much to do about it since you seems to have no window that could be parent :)

    Ahh Mr Ehrlicher even has a bug report about it :)


Log in to reply