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. QFile, QDir, QXmlStreamWriter and other classes from QtCore in plain C++ project.
Forum Updated to NodeBB v4.3 + New Features

QFile, QDir, QXmlStreamWriter and other classes from QtCore in plain C++ project.

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 2.3k Views 1 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.
  • Q Offline
    Q Offline
    QLab
    wrote on last edited by QLab
    #1

    Hi,

    It is possible to use classes from QtCore, especially QFile, QFileInfo, QDir, QXmlStreamWritter, QXmlStreamReader, QMimeDatabase, QMimeType and some other in plain c++ project without any problems?

    Then i only need QtCore5.dll, i am right?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      In theory yes.
      But you might need platforms plugin too.

      Should be fast to test.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QLab
        wrote on last edited by
        #3

        Ok, but what with signals and slots?

        When some Qt classes from QtCore emit signal, and in my project I do not have QApplication instance, it will not be a problem?

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          Yes it will. you need to supply event loop for signals to work.
          http://stackoverflow.com/questions/12718296/is-there-a-way-to-use-qt-without-qapplicationexec

          I think Qt::DirectConnection might work without event loop.

          Can I ask why you want to use Qt and then not?
          You could get nice file handling with pure c++and
          xml with pugixml and have no dlls what so ever.

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            QLab
            wrote on last edited by QLab
            #5

            I prefer Qt classes for filesystem / xml because I already have some code which use this classes but in Qt project.

            I can use boost for filesystem / xml ( propertytree? ), but then I also need dll but from boost so it nothing changes.

            "You could get nice file handling with pure c++"
            I think that this is not possible ;)

            mrjjM 1 Reply Last reply
            1
            • Q QLab

              I prefer Qt classes for filesystem / xml because I already have some code which use this classes but in Qt project.

              I can use boost for filesystem / xml ( propertytree? ), but then I also need dll but from boost so it nothing changes.

              "You could get nice file handling with pure c++"
              I think that this is not possible ;)

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @QLab
              Ok. but why not just use it ?
              and not worry if 1 or 2 dlls?
              But yes, if you cut back on what class you use,
              you should be able to cut some of the DLLS too.

              C++ io not so bad. (IMHO) :)

                      list data;
                      string line;       
                      ifstream myfile ("test.txt");
                      if (myfile.is_open())    {
                          for(line; getline(myfile, line);){
                              data.push_back(line);
                          }
                          myfile.close();
                      }
              
              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                QLab
                wrote on last edited by QLab
                #7

                It is more complicated ;)

                One example - detect mime type for file?
                And many more which using Qt is simple but without Qt can take much more time.

                I ask because sometimes simple task can works but later when i writed more code i can make troubles and then it will horrible.
                Maybe someone know about problems using QtCore in plain c++ project. Only that ;)

                I do not worry about dlls, but i do not want segfault or crash when i run my application which using some Qt classes in plain c++ project.

                mrjjM 1 Reply Last reply
                1
                • Q QLab

                  It is more complicated ;)

                  One example - detect mime type for file?
                  And many more which using Qt is simple but without Qt can take much more time.

                  I ask because sometimes simple task can works but later when i writed more code i can make troubles and then it will horrible.
                  Maybe someone know about problems using QtCore in plain c++ project. Only that ;)

                  I do not worry about dlls, but i do not want segfault or crash when i run my application which using some Qt classes in plain c++ project.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @QLab
                  Ok. I see your point.
                  Well I don't think you can really get in trouble using only core.
                  But with no default event loop, you might get a few surprises. :)
                  Good luck

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    QLab
                    wrote on last edited by QLab
                    #9

                    "But with no default event loop, you might get a few surprises"

                    Oh you know somethink more? ;) Please tell me ;)
                    I will have a trouble even if i do not connect signals?

                    mrjjM 1 Reply Last reply
                    0
                    • Q QLab

                      "But with no default event loop, you might get a few surprises"

                      Oh you know somethink more? ;) Please tell me ;)
                      I will have a trouble even if i do not connect signals?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @QLab
                      HI
                      No No :) It's just that Qt uses signals
                      all over so some functions might use a signal to inform you of something or
                      two Qt objects might use signal internally.

                      But currently I made a small console project using QFile and to my surprise
                      it ask for no DLL when i click it, so i'm a bit ??:)

                      mrjjM 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @QLab
                        HI
                        No No :) It's just that Qt uses signals
                        all over so some functions might use a signal to inform you of something or
                        two Qt objects might use signal internally.

                        But currently I made a small console project using QFile and to my surprise
                        it ask for no DLL when i click it, so i'm a bit ??:)

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #11

                        Hi
                        I must do something wrong as for console app with Qfile it wants
                        (win 7 , mingw compiler)
                        icudt52.dll
                        icuin52.dll
                        icuuc52.dll
                        libgcc_s_dw2-1.dll
                        libstdc++-6.dll
                        libwinpthread-1.dll
                        Qt5Cored.dll
                        on a clean machine (virtual)
                        Not as tiny as i had hoped for :)

                        1 Reply Last reply
                        1

                        • Login

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