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 and buffered device
Forum Updated to NodeBB v4.3 + New Features

QFile and buffered device

Scheduled Pinned Locked Moved General and Desktop
13 Posts 5 Posters 8.1k 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.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #4

    I am not a real expert in signal-slot connections.
    My first guess would be that you have to register your custom class.
    "Have a look to qRegisterMetaType":http://doc.qt.nokia.com/4.7/qmetatype.html#qRegisterMetaType
    May be this is solving your issue, because the error sais QFile::printData not found. However, I could find the logic for the register requirement yet.

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #5

      You must add Q_OBJECT macro to you class header.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Naouali
        wrote on last edited by
        #6

        this is the error i get when i added the Q_OBJECT
        /home/aladin/Projects/Qt/gps/qcustomfile.cpp:-1: error: undefined reference to `vtable for QcustomFile'

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #7

          Try to rerun qmake and make.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jacol
            wrote on last edited by
            #8

            Are you clean your project?
            in h file constructor:

            @explicit QcustomFile(const QString &name, QObject *parent = 0);@

            in cpp :
            @QcustomFile::QcustomFile(const QString &name, QObject *parent) :
            QFile(parent)
            {
            }@
            Of course you must add Q_OBJECT macro.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Naouali
              wrote on last edited by
              #9

              @ Jacol: still get the same
              @Denis Kormalev : after running qmake and make i didn't get an executable .

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Naouali
                wrote on last edited by
                #10

                Thanks for all you guys , i remove all the unnecessary files and it works :)

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Jacol
                  wrote on last edited by
                  #11

                  Try remove all files from debug/release directory and all makefiles and built again. If this does not help that I have no idea.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Naouali
                    wrote on last edited by
                    #12

                    that's what i've done and it works fine ,thank you all .

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      goetz
                      wrote on last edited by
                      #13

                      Ah, yes, and add the QObject parent pointer parameters to the constructor, as Jacol suggested. It's always good to mimic the base class' constructors if you want to use your own class as a drop in replacement.

                      And if you get some weird or unexpected compiler errors, it is always a good idea to completely clean the project, delete the makefiles and re-run qmake and do a full rebuild. The same holds for erratic crashes (eg. after you have added a member to a class).

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      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