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. forgot to setup the environment using 'qmake -projects'
Forum Updated to NodeBB v4.3 + New Features

forgot to setup the environment using 'qmake -projects'

Scheduled Pinned Locked Moved Solved General and Desktop
environment
23 Posts 4 Posters 2.8k Views 2 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #13

    Try to post a reduced version of the compiler error.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • U Offline
      U Offline
      uglybug
      wrote on last edited by uglybug
      #14

      new build error:
      regarding ".exactMatch" deprecated in Qt6 so i added #include QRegExp in mainwindow.h
      which required "core5compat" to be added to QT += core gui network core5compat in ImageViewer.pro

      original offending ".exactMatch" in mainwindow.cpp file.

      fileNames = dialog.selectedFiles();
      if(QRegExp(".+\.(png|bmp|jpg)").exactMatch(fileNames.at(0))) {
      currentImage->pixmap().save(fileNames.at(0));

      i tried to fix with: "(QRegExp::pattern(fileNames.at(0))) "
      which is causing Compile Output error of, a regular expression compatibility with a boolean.
      so should "(QRegularExpression(".+\.(png|bmp|jpg" be put inside of (QRegExp::pattern() ???

      [ maybe the proper solution is to build this book example in Qt5 instead of trying to adapt it to build in Qt6 ????]
      is that easy to do ???

      ".exactMatch" is discontinued in Qt6 so i am trying "QRegExp::pattern"

          if(QRegularExpression(".+\\.(png|bmp|jpg)") (QRegExp::pattern(fileNames.at(0))) {
              currentImage->pixmap().save(fileNames.at(0));
          } else {
              QMessageBox::information(this, "Information", "Save error: bad format or filename.");
      
      Pl45m4P 1 Reply Last reply
      0
      • U uglybug

        new build error:
        regarding ".exactMatch" deprecated in Qt6 so i added #include QRegExp in mainwindow.h
        which required "core5compat" to be added to QT += core gui network core5compat in ImageViewer.pro

        original offending ".exactMatch" in mainwindow.cpp file.

        fileNames = dialog.selectedFiles();
        if(QRegExp(".+\.(png|bmp|jpg)").exactMatch(fileNames.at(0))) {
        currentImage->pixmap().save(fileNames.at(0));

        i tried to fix with: "(QRegExp::pattern(fileNames.at(0))) "
        which is causing Compile Output error of, a regular expression compatibility with a boolean.
        so should "(QRegularExpression(".+\.(png|bmp|jpg" be put inside of (QRegExp::pattern() ???

        [ maybe the proper solution is to build this book example in Qt5 instead of trying to adapt it to build in Qt6 ????]
        is that easy to do ???

        ".exactMatch" is discontinued in Qt6 so i am trying "QRegExp::pattern"

            if(QRegularExpression(".+\\.(png|bmp|jpg)") (QRegExp::pattern(fileNames.at(0))) {
                currentImage->pixmap().save(fileNames.at(0));
            } else {
                QMessageBox::information(this, "Information", "Save error: bad format or filename.");
        
        Pl45m4P Online
        Pl45m4P Online
        Pl45m4
        wrote on last edited by
        #15

        @uglybug said in forgot to setup the environment using 'qmake -projects':

        regarding ".exactMatch" deprecated in Qt6 so i added #include QRegExp in mainwindow.h

        Try

        • https://doc.qt.io/qt-6/qregularexpression.html#anchoredPattern

        [ maybe the proper solution is to build this book example in Qt5 instead of trying to adapt it to build in Qt6 ????]
        is that easy to do ???

        There's nothing wrong with using Qt5 now... however in couple month and years more and more stuff will be deprecated and maybe even removed from Qt Framework.
        So why learning outdated things?!
        Usually you would follow up-to-date instructions and guides, right?!

        Most simple Qt5 code can be adapted to Qt6 quite easily even if some methods or modules don't exist anymore... there is never a downgrade (people will argue about that) :D
        When porting huge, existing Qt4 / Qt5 projects to Qt6, it's a different story... but for anything else you should be able to find a workaround / replacement.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        Pl45m4P 1 Reply Last reply
        0
        • U Offline
          U Offline
          uglybug
          wrote on last edited by
          #16

          @Pl45m4 thanks so much for your frank advice, i'll take it willingly by continuing to pursue Qt6.
          your help and support have made a huge difference in the progress that i've been able to have since starting this journey some 3 weeks ago. i very much look forward to mark these posting, solved !

          1 Reply Last reply
          0
          • U Offline
            U Offline
            uglybug
            wrote on last edited by
            #17

            ".exactMatch" is discontinued in Qt6 so i am trying to use a "wildcard".
            is this approach appropriate, that is am i on the right track ?

                QString wildcard =QRegularExpression::wildcardToRegularExpression("*.jpeg");
                if (const auto refs = QStringView{.QStringList = 'wildcard'}.tokenize(u'j'));
                    for (auto wildcard : wildcard) {
                        if (wildcard == '.+\\.(png|bmp|jpg')
                            return true;
            
            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #18

              Why do you insist to use a regexp at all? Simply use QString::endsWith() ...

              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
              0
              • Pl45m4P Pl45m4

                @uglybug said in forgot to setup the environment using 'qmake -projects':

                regarding ".exactMatch" deprecated in Qt6 so i added #include QRegExp in mainwindow.h

                Try

                • https://doc.qt.io/qt-6/qregularexpression.html#anchoredPattern

                [ maybe the proper solution is to build this book example in Qt5 instead of trying to adapt it to build in Qt6 ????]
                is that easy to do ???

                There's nothing wrong with using Qt5 now... however in couple month and years more and more stuff will be deprecated and maybe even removed from Qt Framework.
                So why learning outdated things?!
                Usually you would follow up-to-date instructions and guides, right?!

                Most simple Qt5 code can be adapted to Qt6 quite easily even if some methods or modules don't exist anymore... there is never a downgrade (people will argue about that) :D
                When porting huge, existing Qt4 / Qt5 projects to Qt6, it's a different story... but for anything else you should be able to find a workaround / replacement.

                Pl45m4P Online
                Pl45m4P Online
                Pl45m4
                wrote on last edited by
                #19

                @Pl45m4 said in forgot to setup the environment using 'qmake -projects':

                Try

                https://doc.qt.io/qt-6/qregularexpression.html#anchoredPattern

                I linked this above. It states something like "exact match" in the documentation


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  uglybug
                  wrote on last edited by uglybug
                  #20

                  @Pl45m4
                  yes i saw and read that previously to my 'wildcard' snippet.
                  i wasn't getting very far with that but it did lead me into an example using 'QStringList'
                  i will continue to reading, to get better at understanding the syntax shown in the Qt6 documents.
                  just wanted to give you an update as to what rabbit-hole i am currently traveling through.

                  @Christian-Ehrlicher
                  i am not insisting on anything 'regexp' , because i don't know anything as a beginner.
                  i guess i would have to say that my approach is 'solution via experimentation' .
                  thank you for "QString::endsWith() " i am looking that up now.

                  1 Reply Last reply
                  0
                  • U Offline
                    U Offline
                    uglybug
                    wrote on last edited by
                    #21

                    Success !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                    QStringList fileNames;
                    if (dialog.exec()) {
                    fileNames = dialog.selectedFiles();
                    // ".exactMatch" is discontinued in Qt6 so i am using @Christian-Ehrlicher suggestion ".
                    QStringList str = fileNames;
                    if (str.endsWith(".jpeg")){
                    return;
                    }
                    i don't want to break this now working windows program but, if i wanted to test for 'bmp' and 'png' file extensions
                    would it look something like:
                    if (str.endsWith(".jpeg"||".bmp"||".png"))

                    thanks to @SGaist @Pl45m4 @Christian-Ehrlicher for all the this help and to forum readers who didn't make snide remaks.

                    1 Reply Last reply
                    0
                    • U uglybug has marked this topic as solved on
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #22

                      You would either have multiple or statements using endsWith or use QRegularExpression.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • U Offline
                        U Offline
                        uglybug
                        wrote on last edited by
                        #23

                        @SGaist thank you for your answer. i am so appreciative of all the help i received on this forum. it's amazing how quickly the assistance arrives.

                        1 Reply Last reply
                        0

                        • Login

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