Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved GtkDialog mapped without a transient parent. This is discouraged.

    General and Desktop
    3
    3
    651
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      deleted286 last edited by

      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;
      
        }
      }
      }
      
      1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        See https://bugreports.qt.io/browse/QTBUG-73815

        Qt has to stay free or it will die.

        1 Reply Last reply Reply Quote 2
        • mrjj
          mrjj Lifetime Qt Champion last edited by mrjj

          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 :)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post