Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt6 migration issue
Forum Updated to NodeBB v4.3 + New Features

qt6 migration issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
35 Posts 4 Posters 3.5k Views
  • 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.
  • A Offline
    A Offline
    Actarus
    wrote on 16 Jul 2023, 10:11 last edited by Actarus
    #1

    Hi, I'm trying to migrate a project from Q5 to Q6 but trying to build it I get around 1500 errors all related to invalid conversions of all types:

    Here an example of the error message:

    D:\Development\TestProject\Test\Sampling\Sampling.cpp:11091: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
    In file included from D:/Qt/6.5.0/mingw_64/include/QtCore/qstring.h:14,
    from D:/Qt/6.5.0/mingw_64/include/QtCore/qobject.h:11,
    from D:/Qt/6.5.0/mingw_64/include/QtWidgets/qwidget.h:9,
    from D:/Qt/6.5.0/mingw_64/include/QtWidgets/qmainwindow.h:8,
    from D:/Qt/6.5.0/mingw_64/include/QtWidgets/QMainWindow:1,
    from ..\Test\Sampling\Sampling.h:4,
    from ..\Test\Sampling\Sampling.cpp:1:
    D:/Qt/6.5.0/mingw_64/include/QtCore/qchar.h:90:45: note: candidate: 'constexpr QChar::QChar(char)' (near match)
    90 | QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { }
    | ^~~~~
    D:/Qt/6.5.0/mingw_64/include/QtCore/qchar.h:90:45: note: conversion of argument 1 would be ill-formed:
    ..\Test\Sampling\Sampling.cpp:11091:42: error: invalid conversion from 'const char*' to 'char' [-fpermissive]

    Beeing so many errors all of the same type I assume there is something I made wrong or missing in the environment configuration or installation.

    I have the same error also for const char to wchar_t, for const char to short int and many other.

    I'm new to sw development so any help is really welcome.

    Thanks.

    C 1 Reply Last reply 16 Jul 2023, 10:48
    0
    • A Actarus
      16 Jul 2023, 10:11

      Hi, I'm trying to migrate a project from Q5 to Q6 but trying to build it I get around 1500 errors all related to invalid conversions of all types:

      Here an example of the error message:

      D:\Development\TestProject\Test\Sampling\Sampling.cpp:11091: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
      In file included from D:/Qt/6.5.0/mingw_64/include/QtCore/qstring.h:14,
      from D:/Qt/6.5.0/mingw_64/include/QtCore/qobject.h:11,
      from D:/Qt/6.5.0/mingw_64/include/QtWidgets/qwidget.h:9,
      from D:/Qt/6.5.0/mingw_64/include/QtWidgets/qmainwindow.h:8,
      from D:/Qt/6.5.0/mingw_64/include/QtWidgets/QMainWindow:1,
      from ..\Test\Sampling\Sampling.h:4,
      from ..\Test\Sampling\Sampling.cpp:1:
      D:/Qt/6.5.0/mingw_64/include/QtCore/qchar.h:90:45: note: candidate: 'constexpr QChar::QChar(char)' (near match)
      90 | QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { }
      | ^~~~~
      D:/Qt/6.5.0/mingw_64/include/QtCore/qchar.h:90:45: note: conversion of argument 1 would be ill-formed:
      ..\Test\Sampling\Sampling.cpp:11091:42: error: invalid conversion from 'const char*' to 'char' [-fpermissive]

      Beeing so many errors all of the same type I assume there is something I made wrong or missing in the environment configuration or installation.

      I have the same error also for const char to wchar_t, for const char to short int and many other.

      I'm new to sw development so any help is really welcome.

      Thanks.

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 16 Jul 2023, 10:48 last edited by
      #2

      Please provide a minimal, compileable example of your problem - from the error message I don't see how this should have compiled with Qt5 either - you can not convert a char to a char*.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      A 1 Reply Last reply 16 Jul 2023, 11:19
      1
      • C Christian Ehrlicher
        16 Jul 2023, 10:48

        Please provide a minimal, compileable example of your problem - from the error message I don't see how this should have compiled with Qt5 either - you can not convert a char to a char*.

        A Offline
        A Offline
        Actarus
        wrote on 16 Jul 2023, 11:19 last edited by
        #3

        @Christian-Ehrlicher Thanks Christian, yes, in QT5 it compiles and runs flowlessly.
        Here a piece of code where the error stays in: if(nome.at(c) == " "). error: conversion from 'const char [2]' to 'QChar' is ambiguous

        bool ColorRange::on_buttonSalva_pressed()
        {
            if(controlloValore())
            {
                if(!ui->checkBoxAutomatico->isChecked())
                    cambioDecimali();
        
                QFile file(folder + /*ui->comboBoxCanali->currentText()*/channelName +".xml");
                if(file.open(QIODevice::WriteOnly))
                {
                               QString nome = channelName;//ui->comboBoxCanali->currentText();
                    if(nome.contains(" "))
                    {
                        for(int c = 0; c < nome.size(); c++)
                            if(nome.at(c) == " ")
                                nome.remove(c, 1);
                    }
        
                    QDomDocument xmlDoc(nome);
                    QDomElement root = xmlDoc.createElement("root");
                    xmlDoc.appendChild(root);
        
                    QDomNode tagAuto = xmlDoc.createElement("Auto");
                    root.appendChild(tagAuto);
        
                    QDomText txtAuto;
                    if(ui->checkBoxAutomatico->isChecked())
                        txtAuto = xmlDoc.createTextNode("1");
                    else
                        txtAuto = xmlDoc.createTextNode("0");
                    tagAuto.appendChild(txtAuto);
        
                    QDomNode tagDecimali = xmlDoc.createElement("Decimali");
                    root.appendChild(tagDecimali);
        
                    QDomText txtDecimali = xmlDoc.createTextNode(ui->comboBoxDecimali->currentText());
                    tagDecimali.appendChild(txtDecimali);
        
                    for(int i = 0; i <= N_ROWS; i++)
                    {
                                        if(!ui->table->item(i, 1)->data(Qt::DisplayRole).toString().isEmpty() && ui->table->item(i,0) != nullptr && ui->table->item(i, 2)->checkState() == Qt::CheckState::Checked)
                        {
                            QDomNode row = xmlDoc.createElement("Row_" + QString::number(i));
                            root.appendChild(row);
        
                            QDomElement tagRed = xmlDoc.createElement("R");
                            row.appendChild(tagRed);
                            QDomText txtRed = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().red()));
                            tagRed.appendChild(txtRed);
        
                            QDomElement tagGreen = xmlDoc.createElement("G");
                            row.appendChild(tagGreen);
                            QDomText txtGreen = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().green()));
                            tagGreen.appendChild(txtGreen);
        
                            QDomElement tagBlue = xmlDoc.createElement("B");
                            row.appendChild(tagBlue);
                            QDomText txtBlue = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().blue()));
                            tagBlue.appendChild(txtBlue);
        
                            QDomElement tagValue = xmlDoc.createElement("Valore");
                            row.appendChild(tagValue);
                            QDomText txtValue = xmlDoc.createTextNode(ui->table->item(i, 1)->text());
                            tagValue.appendChild(txtValue);
                        }
                    }
                    file.resize(0);
                    QTextStream write(&file);
                    xmlDoc.save(write, 3);
                }
                file.close();
        
                saved = true;
            }
            else
            {
                qDebug()<<"errore nei valori inseriti "<<ui->comboBoxCanali->currentText();
                saved = false;
            }
            return saved;
        }
        ``
        C JonBJ 2 Replies Last reply 16 Jul 2023, 11:23
        0
        • A Actarus
          16 Jul 2023, 11:19

          @Christian-Ehrlicher Thanks Christian, yes, in QT5 it compiles and runs flowlessly.
          Here a piece of code where the error stays in: if(nome.at(c) == " "). error: conversion from 'const char [2]' to 'QChar' is ambiguous

          bool ColorRange::on_buttonSalva_pressed()
          {
              if(controlloValore())
              {
                  if(!ui->checkBoxAutomatico->isChecked())
                      cambioDecimali();
          
                  QFile file(folder + /*ui->comboBoxCanali->currentText()*/channelName +".xml");
                  if(file.open(QIODevice::WriteOnly))
                  {
                                 QString nome = channelName;//ui->comboBoxCanali->currentText();
                      if(nome.contains(" "))
                      {
                          for(int c = 0; c < nome.size(); c++)
                              if(nome.at(c) == " ")
                                  nome.remove(c, 1);
                      }
          
                      QDomDocument xmlDoc(nome);
                      QDomElement root = xmlDoc.createElement("root");
                      xmlDoc.appendChild(root);
          
                      QDomNode tagAuto = xmlDoc.createElement("Auto");
                      root.appendChild(tagAuto);
          
                      QDomText txtAuto;
                      if(ui->checkBoxAutomatico->isChecked())
                          txtAuto = xmlDoc.createTextNode("1");
                      else
                          txtAuto = xmlDoc.createTextNode("0");
                      tagAuto.appendChild(txtAuto);
          
                      QDomNode tagDecimali = xmlDoc.createElement("Decimali");
                      root.appendChild(tagDecimali);
          
                      QDomText txtDecimali = xmlDoc.createTextNode(ui->comboBoxDecimali->currentText());
                      tagDecimali.appendChild(txtDecimali);
          
                      for(int i = 0; i <= N_ROWS; i++)
                      {
                                          if(!ui->table->item(i, 1)->data(Qt::DisplayRole).toString().isEmpty() && ui->table->item(i,0) != nullptr && ui->table->item(i, 2)->checkState() == Qt::CheckState::Checked)
                          {
                              QDomNode row = xmlDoc.createElement("Row_" + QString::number(i));
                              root.appendChild(row);
          
                              QDomElement tagRed = xmlDoc.createElement("R");
                              row.appendChild(tagRed);
                              QDomText txtRed = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().red()));
                              tagRed.appendChild(txtRed);
          
                              QDomElement tagGreen = xmlDoc.createElement("G");
                              row.appendChild(tagGreen);
                              QDomText txtGreen = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().green()));
                              tagGreen.appendChild(txtGreen);
          
                              QDomElement tagBlue = xmlDoc.createElement("B");
                              row.appendChild(tagBlue);
                              QDomText txtBlue = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().blue()));
                              tagBlue.appendChild(txtBlue);
          
                              QDomElement tagValue = xmlDoc.createElement("Valore");
                              row.appendChild(tagValue);
                              QDomText txtValue = xmlDoc.createTextNode(ui->table->item(i, 1)->text());
                              tagValue.appendChild(txtValue);
                          }
                      }
                      file.resize(0);
                      QTextStream write(&file);
                      xmlDoc.save(write, 3);
                  }
                  file.close();
          
                  saved = true;
              }
              else
              {
                  qDebug()<<"errore nei valori inseriti "<<ui->comboBoxCanali->currentText();
                  saved = false;
              }
              return saved;
          }
          ``
          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 16 Jul 2023, 11:23 last edited by Christian Ehrlicher
          #4

          Even in Qt5 this is ... strange - looks like a deprecated conversion jumps in. QString:.at() returns a char, not a char*/string/whatever - imho this would never evaluate to the stuff you expect.
          You have to compare it with a char

          if(nome.at(c) == ' ')

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • A Actarus
            16 Jul 2023, 11:19

            @Christian-Ehrlicher Thanks Christian, yes, in QT5 it compiles and runs flowlessly.
            Here a piece of code where the error stays in: if(nome.at(c) == " "). error: conversion from 'const char [2]' to 'QChar' is ambiguous

            bool ColorRange::on_buttonSalva_pressed()
            {
                if(controlloValore())
                {
                    if(!ui->checkBoxAutomatico->isChecked())
                        cambioDecimali();
            
                    QFile file(folder + /*ui->comboBoxCanali->currentText()*/channelName +".xml");
                    if(file.open(QIODevice::WriteOnly))
                    {
                                   QString nome = channelName;//ui->comboBoxCanali->currentText();
                        if(nome.contains(" "))
                        {
                            for(int c = 0; c < nome.size(); c++)
                                if(nome.at(c) == " ")
                                    nome.remove(c, 1);
                        }
            
                        QDomDocument xmlDoc(nome);
                        QDomElement root = xmlDoc.createElement("root");
                        xmlDoc.appendChild(root);
            
                        QDomNode tagAuto = xmlDoc.createElement("Auto");
                        root.appendChild(tagAuto);
            
                        QDomText txtAuto;
                        if(ui->checkBoxAutomatico->isChecked())
                            txtAuto = xmlDoc.createTextNode("1");
                        else
                            txtAuto = xmlDoc.createTextNode("0");
                        tagAuto.appendChild(txtAuto);
            
                        QDomNode tagDecimali = xmlDoc.createElement("Decimali");
                        root.appendChild(tagDecimali);
            
                        QDomText txtDecimali = xmlDoc.createTextNode(ui->comboBoxDecimali->currentText());
                        tagDecimali.appendChild(txtDecimali);
            
                        for(int i = 0; i <= N_ROWS; i++)
                        {
                                            if(!ui->table->item(i, 1)->data(Qt::DisplayRole).toString().isEmpty() && ui->table->item(i,0) != nullptr && ui->table->item(i, 2)->checkState() == Qt::CheckState::Checked)
                            {
                                QDomNode row = xmlDoc.createElement("Row_" + QString::number(i));
                                root.appendChild(row);
            
                                QDomElement tagRed = xmlDoc.createElement("R");
                                row.appendChild(tagRed);
                                QDomText txtRed = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().red()));
                                tagRed.appendChild(txtRed);
            
                                QDomElement tagGreen = xmlDoc.createElement("G");
                                row.appendChild(tagGreen);
                                QDomText txtGreen = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().green()));
                                tagGreen.appendChild(txtGreen);
            
                                QDomElement tagBlue = xmlDoc.createElement("B");
                                row.appendChild(tagBlue);
                                QDomText txtBlue = xmlDoc.createTextNode(QString::number(ui->table->item(i,0)->backgroundColor().blue()));
                                tagBlue.appendChild(txtBlue);
            
                                QDomElement tagValue = xmlDoc.createElement("Valore");
                                row.appendChild(tagValue);
                                QDomText txtValue = xmlDoc.createTextNode(ui->table->item(i, 1)->text());
                                tagValue.appendChild(txtValue);
                            }
                        }
                        file.resize(0);
                        QTextStream write(&file);
                        xmlDoc.save(write, 3);
                    }
                    file.close();
            
                    saved = true;
                }
                else
                {
                    qDebug()<<"errore nei valori inseriti "<<ui->comboBoxCanali->currentText();
                    saved = false;
                }
                return saved;
            }
            ``
            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on 16 Jul 2023, 12:09 last edited by JonB
            #5

            @Actarus
            Absolutely as @Christian-Ehrlicher says, don't know what this did in Qt5.

            The sad thing is that whole loop can just be replaced (presumably a lot more efficiently) with:

            nome.remove(' ');
            

            :)

            A 1 Reply Last reply 16 Jul 2023, 12:30
            1
            • JonBJ JonB
              16 Jul 2023, 12:09

              @Actarus
              Absolutely as @Christian-Ehrlicher says, don't know what this did in Qt5.

              The sad thing is that whole loop can just be replaced (presumably a lot more efficiently) with:

              nome.remove(' ');
              

              :)

              A Offline
              A Offline
              Actarus
              wrote on 16 Jul 2023, 12:30 last edited by
              #6

              @JonB You both are right but all this is absolutely weird. I recompiled it now on another machine with the original QT5 and no error at all, everything runs perfectly and looking at the code it's exaclty the same.

              Also, in QT6, if I compile in release mode it shows me only like 10 of these errors, if I switch to Debug and compile they jump to around 1500 errors of this type.

              A 1 Reply Last reply 16 Jul 2023, 12:56
              0
              • A Actarus
                16 Jul 2023, 12:30

                @JonB You both are right but all this is absolutely weird. I recompiled it now on another machine with the original QT5 and no error at all, everything runs perfectly and looking at the code it's exaclty the same.

                Also, in QT6, if I compile in release mode it shows me only like 10 of these errors, if I switch to Debug and compile they jump to around 1500 errors of this type.

                A Offline
                A Offline
                Actarus
                wrote on 16 Jul 2023, 12:56 last edited by Actarus
                #7

                @Actarus For example this is another error I get in QT6:
                ad1d48d4-a976-4447-9fad-33c54d96a2d9-image.png

                while in debug mode in QT5 I get the following, even if it compiles with no error in release mode in QT5:

                5dc04e3c-1d1f-490b-b3da-a461c3ec52e7-image.png

                C 1 Reply Last reply 16 Jul 2023, 13:05
                0
                • A Actarus
                  16 Jul 2023, 12:56

                  @Actarus For example this is another error I get in QT6:
                  ad1d48d4-a976-4447-9fad-33c54d96a2d9-image.png

                  while in debug mode in QT5 I get the following, even if it compiles with no error in release mode in QT5:

                  5dc04e3c-1d1f-490b-b3da-a461c3ec52e7-image.png

                  C Offline
                  C Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on 16 Jul 2023, 13:05 last edited by
                  #8

                  Yes, because it has changed - see the documentation to QWidget::enterEvent() and fix your code accordingly.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  A 1 Reply Last reply 16 Jul 2023, 14:48
                  1
                  • C Christian Ehrlicher
                    16 Jul 2023, 13:05

                    Yes, because it has changed - see the documentation to QWidget::enterEvent() and fix your code accordingly.

                    A Offline
                    A Offline
                    Actarus
                    wrote on 16 Jul 2023, 14:48 last edited by
                    #9

                    @Christian-Ehrlicher Thanks, that has been fixed. Now trying to figure out the first issue and guessing why in QT5 it can work.

                    C 1 Reply Last reply 16 Jul 2023, 15:09
                    0
                    • A Actarus
                      16 Jul 2023, 14:48

                      @Christian-Ehrlicher Thanks, that has been fixed. Now trying to figure out the first issue and guessing why in QT5 it can work.

                      C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 16 Jul 2023, 15:09 last edited by Christian Ehrlicher
                      #10

                      @Actarus said in qt6 migration issue:

                      guessing why in QT5 it can work.

                      Implictly converting a char* into a QString is wrong so... don't think about it but fix it.

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      A 1 Reply Last reply 16 Jul 2023, 16:14
                      1
                      • C Christian Ehrlicher
                        16 Jul 2023, 15:09

                        @Actarus said in qt6 migration issue:

                        guessing why in QT5 it can work.

                        Implictly converting a char* into a QString is wrong so... don't think about it but fix it.

                        A Offline
                        A Offline
                        Actarus
                        wrote on 16 Jul 2023, 16:14 last edited by
                        #11

                        @Christian-Ehrlicher I'll do. Now I fixed another issue about the following where I changed X, that was deprecated, to position

                        //if ((0 == m_ChartViewer) || (!isOnPlotArea(event->x(), event->y())))
                            if ((0 == m_ChartViewer) || (!isOnPlotArea(event->position().x(), event->position().y())))
                                event->ignore();
                        

                        but now it shows me the following error on that line:
                        bf5bf85a-6e7f-4c3e-90bb-8e624c97e211-image.png

                        JonBJ 1 Reply Last reply 16 Jul 2023, 17:11
                        0
                        • A Actarus
                          16 Jul 2023, 16:14

                          @Christian-Ehrlicher I'll do. Now I fixed another issue about the following where I changed X, that was deprecated, to position

                          //if ((0 == m_ChartViewer) || (!isOnPlotArea(event->x(), event->y())))
                              if ((0 == m_ChartViewer) || (!isOnPlotArea(event->position().x(), event->position().y())))
                                  event->ignore();
                          

                          but now it shows me the following error on that line:
                          bf5bf85a-6e7f-4c3e-90bb-8e624c97e211-image.png

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on 16 Jul 2023, 17:11 last edited by JonB
                          #12

                          @Actarus
                          The implication is that isOnPlotArea() only accepts a QPointF. (Documentation seemingly at https://www.advsofteng.com/doc/cdcppdoc/ViewPortControlBase.isOnPlotArea.htm notwithstanding.)
                          Put your cursor in that method name and press F2. Does it take you to the header file? What overloads of isOnPlotArea() are there?
                          Also does this error occur when you compile or only visible within Creator?

                          A 1 Reply Last reply 16 Jul 2023, 18:57
                          1
                          • JonBJ JonB
                            16 Jul 2023, 17:11

                            @Actarus
                            The implication is that isOnPlotArea() only accepts a QPointF. (Documentation seemingly at https://www.advsofteng.com/doc/cdcppdoc/ViewPortControlBase.isOnPlotArea.htm notwithstanding.)
                            Put your cursor in that method name and press F2. Does it take you to the header file? What overloads of isOnPlotArea() are there?
                            Also does this error occur when you compile or only visible within Creator?

                            A Offline
                            A Offline
                            Actarus
                            wrote on 16 Jul 2023, 18:57 last edited by
                            #13

                            @JonB Thanks Jon, fixed, pressing F2 it jumped to the header where I had:
                            bool isOnPlotArea(QPointF x, QPointF y)

                            changed to: bool isOnPlotArea(double x, double y) and now it's fine.

                            JonBJ 1 Reply Last reply 16 Jul 2023, 20:10
                            0
                            • A Actarus
                              16 Jul 2023, 18:57

                              @JonB Thanks Jon, fixed, pressing F2 it jumped to the header where I had:
                              bool isOnPlotArea(QPointF x, QPointF y)

                              changed to: bool isOnPlotArea(double x, double y) and now it's fine.

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on 16 Jul 2023, 20:10 last edited by JonB
                              #14

                              @Actarus said in qt6 migration issue:

                              changed to: bool isOnPlotArea(double x, double y) and now it's fine.

                              Ummm, gulp :) Your header file or Qt's??

                              A 1 Reply Last reply 16 Jul 2023, 21:45
                              0
                              • JonBJ JonB
                                16 Jul 2023, 20:10

                                @Actarus said in qt6 migration issue:

                                changed to: bool isOnPlotArea(double x, double y) and now it's fine.

                                Ummm, gulp :) Your header file or Qt's??

                                A Offline
                                A Offline
                                Actarus
                                wrote on 16 Jul 2023, 21:45 last edited by
                                #15

                                @JonB Mine, it had been edited wrongly to fix a previous error message.

                                I have fixed tons of parts now but I'm still struggling with around 15 errors like this:

                                error: qualified-id in declaration before '(' token
                                error: qualified-id in declaration before '(' token
                                | void ChartsAxis::sectionHasBeenClicked(int logicalIndex)
                                |

                                Here the example code:

                                void ChartsAxis::sectionHasBeenClicked(int logicalIndex)
                                {
                                    if((isComp)&&(logicalIndex > 0))
                                    {
                                        bool found = false;
                                        int index = 0;
                                        for(int is = 0; is < pStructComp->size(); is++)
                                        {
                                            for(int il = 0; il < pStructComp->at(is)->giri.size(); il++)
                                            {
                                                index++;
                                                if(index == logicalIndex)
                                                {
                                                    QFont f;
                                                    f.setBold(true);
                                                    if(this->width()-frame->width() >= 600)
                                                    {
                                                        labelOffset->setGeometry((this->width()-frame->width())/2 - 300, 0, 600, 20);
                                                        f.setPixelSize(15);
                                                    }
                                                    else if(this->width()-frame->width() >= 380)
                                                    {
                                                        labelOffset->setGeometry((this->width()-frame->width())/2 - 190, 0, 380, 20);
                                                        f.setPixelSize(11);
                                                    }
                                                    else
                                                    {
                                                        labelOffset->setGeometry(0, 0, (this->width()-frame->width()), 20);
                                                        f.setPixelSize(11);
                                                    }
                                                    labelOffset->setFont(f);
                                                    labelOffset->show();
                                                    found = true;
                                                    emit setOffsetIndex(is, il);
                                                    break;
                                                }
                                            }
                                            if(found)
                                                break;
                                        }
                                    }
                                }
                                

                                838bf5ff-e5f9-493b-90ec-c1172a822e6a-image.png

                                JonBJ 1 Reply Last reply 17 Jul 2023, 07:26
                                0
                                • A Actarus
                                  16 Jul 2023, 21:45

                                  @JonB Mine, it had been edited wrongly to fix a previous error message.

                                  I have fixed tons of parts now but I'm still struggling with around 15 errors like this:

                                  error: qualified-id in declaration before '(' token
                                  error: qualified-id in declaration before '(' token
                                  | void ChartsAxis::sectionHasBeenClicked(int logicalIndex)
                                  |

                                  Here the example code:

                                  void ChartsAxis::sectionHasBeenClicked(int logicalIndex)
                                  {
                                      if((isComp)&&(logicalIndex > 0))
                                      {
                                          bool found = false;
                                          int index = 0;
                                          for(int is = 0; is < pStructComp->size(); is++)
                                          {
                                              for(int il = 0; il < pStructComp->at(is)->giri.size(); il++)
                                              {
                                                  index++;
                                                  if(index == logicalIndex)
                                                  {
                                                      QFont f;
                                                      f.setBold(true);
                                                      if(this->width()-frame->width() >= 600)
                                                      {
                                                          labelOffset->setGeometry((this->width()-frame->width())/2 - 300, 0, 600, 20);
                                                          f.setPixelSize(15);
                                                      }
                                                      else if(this->width()-frame->width() >= 380)
                                                      {
                                                          labelOffset->setGeometry((this->width()-frame->width())/2 - 190, 0, 380, 20);
                                                          f.setPixelSize(11);
                                                      }
                                                      else
                                                      {
                                                          labelOffset->setGeometry(0, 0, (this->width()-frame->width()), 20);
                                                          f.setPixelSize(11);
                                                      }
                                                      labelOffset->setFont(f);
                                                      labelOffset->show();
                                                      found = true;
                                                      emit setOffsetIndex(is, il);
                                                      break;
                                                  }
                                              }
                                              if(found)
                                                  break;
                                          }
                                      }
                                  }
                                  

                                  838bf5ff-e5f9-493b-90ec-c1172a822e6a-image.png

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on 17 Jul 2023, 07:26 last edited by
                                  #16

                                  @Actarus
                                  The error message is complaining on the method definition line, so showing its body is not relevant as it does not get that far. For "Function definition not allowed here" you may have to look back a few lines for context, e.g. (only an example) if previous function not properly terminated with a } it might generate this message. Make sure it marries with the included header declaration too.

                                  A 1 Reply Last reply 17 Jul 2023, 21:40
                                  0
                                  • JonBJ JonB
                                    17 Jul 2023, 07:26

                                    @Actarus
                                    The error message is complaining on the method definition line, so showing its body is not relevant as it does not get that far. For "Function definition not allowed here" you may have to look back a few lines for context, e.g. (only an example) if previous function not properly terminated with a } it might generate this message. Make sure it marries with the included header declaration too.

                                    A Offline
                                    A Offline
                                    Actarus
                                    wrote on 17 Jul 2023, 21:40 last edited by Actarus
                                    #17

                                    @JonB Thanks Jon, all sorted with } a few lines above.

                                    Can you help in correcting the sintax for QT6 for the following line of QTableWidgetItem:

                                    colorPicker = new QColorDialog(ui->table->item(r, 0)->backgroundColor(), nullptr
                                    

                                    I corrected replacing backgroundColor with background, but I can't get the correct sintax.

                                    I still have only 2 last errors to fix, the first is the one above and the last one is this below, for which I can't find anything online:

                                    d5bd3b9d-3904-456a-a5bb-156d8d73442a-image.png

                                    Thanks

                                    jsulmJ 1 Reply Last reply 18 Jul 2023, 05:16
                                    0
                                    • A Actarus
                                      17 Jul 2023, 21:40

                                      @JonB Thanks Jon, all sorted with } a few lines above.

                                      Can you help in correcting the sintax for QT6 for the following line of QTableWidgetItem:

                                      colorPicker = new QColorDialog(ui->table->item(r, 0)->backgroundColor(), nullptr
                                      

                                      I corrected replacing backgroundColor with background, but I can't get the correct sintax.

                                      I still have only 2 last errors to fix, the first is the one above and the last one is this below, for which I can't find anything online:

                                      d5bd3b9d-3904-456a-a5bb-156d8d73442a-image.png

                                      Thanks

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on 18 Jul 2023, 05:16 last edited by
                                      #18

                                      @Actarus said in qt6 migration issue:

                                      and the last one is this below

                                      This is not the error message.
                                      Please post the real error which is above that line...
                                      It is also better to post error as text not images.

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      A 1 Reply Last reply 18 Jul 2023, 19:23
                                      1
                                      • jsulmJ jsulm
                                        18 Jul 2023, 05:16

                                        @Actarus said in qt6 migration issue:

                                        and the last one is this below

                                        This is not the error message.
                                        Please post the real error which is above that line...
                                        It is also better to post error as text not images.

                                        A Offline
                                        A Offline
                                        Actarus
                                        wrote on 18 Jul 2023, 19:23 last edited by
                                        #19

                                        @jsulm This is what above that line in Compile Output window:

                                        g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DCHARTDIR_HIDE_OBSOLETE -D_CRT_SECURE_NO_WARNINGS -DQT_PRINTSUPPORT_LIB -DQT_QUICKWIDGETS_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE5COMPAT_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QMLINTEGRATION_LIB -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_SERIALPORT_LIB -DQT_POSITIONING_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Test -I. -I../Test/Charts -I../Test/Charts/Tables -I../Test/Charts/JSONObjects -I../Test/Archivio -I../Test/Comp -I../Test/Parse -I../Test/Bluetooth -I../Test/MD5 -I../Test/Devs -I../Test/Devs/DevicesFactory -I../Test/Conf -I../Test/Usb -I../Test/Triggers -I../Test/SubClass -I../Test/Server -I../Test/Exporter -I../Test/Wifi -IC:/Projects/QT_Project/Test/ZipPack/include -IC:/Projects/QT_Project/Test/LimeReport/Release/include -I../include -I../../../Qt/6.5.0/mingw_64/include -I../../../Qt/6.5.0/mingw_64/include/QtPrintSupport -I../../../Qt/6.5.0/mingw_64/include/QtQuickWidgets -I../../../Qt/6.5.0/mingw_64/include/QtWidgets -I../../../Qt/6.5.0/mingw_64/include/QtQuick -I../../../Qt/6.5.0/mingw_64/include/QtOpenGL -I../../../Qt/6.5.0/mingw_64/include/QtGui -I../../../Qt/6.5.0/mingw_64/include/QtCore5Compat -I../../../Qt/6.5.0/mingw_64/include/QtQmlModels -I../../../Qt/6.5.0/mingw_64/include/QtQml -I../../../Qt/6.5.0/mingw_64/include/QtQmlIntegration -I../../../Qt/6.5.0/mingw_64/include/QtBluetooth -I../../../Qt/6.5.0/mingw_64/include/QtNetwork -I../../../Qt/6.5.0/mingw_64/include/QtSql -I../../../Qt/6.5.0/mingw_64/include/QtSerialPort -I../../../Qt/6.5.0/mingw_64/include/QtPositioning -I../../../Qt/6.5.0/mingw_64/include/QtXml -I../../../Qt/6.5.0/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../Qt/6.5.0/mingw_64/mkspecs/win32-g++ -o debug\chartmappa.o ..\Test\Charts\chartmappa.cpp
                                        mingw32-make[1]: *** [Makefile.Debug:32897: debug/colorrange.o] Error 1

                                        JonBJ 1 Reply Last reply 18 Jul 2023, 19:32
                                        0
                                        • A Actarus
                                          18 Jul 2023, 19:23

                                          @jsulm This is what above that line in Compile Output window:

                                          g++ -c -fno-keep-inline-dllexport -g -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DCHARTDIR_HIDE_OBSOLETE -D_CRT_SECURE_NO_WARNINGS -DQT_PRINTSUPPORT_LIB -DQT_QUICKWIDGETS_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE5COMPAT_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QMLINTEGRATION_LIB -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_SERIALPORT_LIB -DQT_POSITIONING_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../Test -I. -I../Test/Charts -I../Test/Charts/Tables -I../Test/Charts/JSONObjects -I../Test/Archivio -I../Test/Comp -I../Test/Parse -I../Test/Bluetooth -I../Test/MD5 -I../Test/Devs -I../Test/Devs/DevicesFactory -I../Test/Conf -I../Test/Usb -I../Test/Triggers -I../Test/SubClass -I../Test/Server -I../Test/Exporter -I../Test/Wifi -IC:/Projects/QT_Project/Test/ZipPack/include -IC:/Projects/QT_Project/Test/LimeReport/Release/include -I../include -I../../../Qt/6.5.0/mingw_64/include -I../../../Qt/6.5.0/mingw_64/include/QtPrintSupport -I../../../Qt/6.5.0/mingw_64/include/QtQuickWidgets -I../../../Qt/6.5.0/mingw_64/include/QtWidgets -I../../../Qt/6.5.0/mingw_64/include/QtQuick -I../../../Qt/6.5.0/mingw_64/include/QtOpenGL -I../../../Qt/6.5.0/mingw_64/include/QtGui -I../../../Qt/6.5.0/mingw_64/include/QtCore5Compat -I../../../Qt/6.5.0/mingw_64/include/QtQmlModels -I../../../Qt/6.5.0/mingw_64/include/QtQml -I../../../Qt/6.5.0/mingw_64/include/QtQmlIntegration -I../../../Qt/6.5.0/mingw_64/include/QtBluetooth -I../../../Qt/6.5.0/mingw_64/include/QtNetwork -I../../../Qt/6.5.0/mingw_64/include/QtSql -I../../../Qt/6.5.0/mingw_64/include/QtSerialPort -I../../../Qt/6.5.0/mingw_64/include/QtPositioning -I../../../Qt/6.5.0/mingw_64/include/QtXml -I../../../Qt/6.5.0/mingw_64/include/QtCore -Idebug -I. -I/include -I../../../Qt/6.5.0/mingw_64/mkspecs/win32-g++ -o debug\chartmappa.o ..\Test\Charts\chartmappa.cpp
                                          mingw32-make[1]: *** [Makefile.Debug:32897: debug/colorrange.o] Error 1

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on 18 Jul 2023, 19:32 last edited by
                                          #20

                                          @Actarus said in qt6 migration issue:

                                          debug/colorrange.o] Error 1

                                          Strange, because that colorrage.o file is not even mentioned on the previous line, which may have been completed successfully. make may be moving on to build the next file alphabetically. Errno 1 would be "EPERM". Does debug/colorrange.o already exist? Are you able to delete it?

                                          A 2 Replies Last reply 18 Jul 2023, 19:37
                                          0

                                          1/35

                                          16 Jul 2023, 10:11

                                          • Login

                                          • Login or register to search.
                                          1 out of 35
                                          • First post
                                            1/35
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved