Results 1 to 4 of 4

Thread: Subclass from Qt Ui Form Class, invalid use of incomplete type

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Subclass from Qt Ui Form Class, invalid use of incomplete type

    The includes are all Ok, to make it clear:

    The base class is a Qt Form Class located in subdir ui/
    ui/ui_calib_base.h
    ui/ui_calib_base.cpp
    ui/ui_calib_base.ui

    This is the derived class from the base class
    calib_analog.h
    calib_analog.cpp

    In my calib_analog i have no access to the ui pointer of the base class although i moved it into the protected section in "ui/ui_calib_base.h".

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,324
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Subclass from Qt Ui Form Class, invalid use of incomplete type

    In my calib_analog i have no access to the ui pointer of the base class although i moved it into the protected section in "ui/ui_calib_base.h".
    You -do- have access to it. As I said, this code:

    Qt Code:
    1. namespace Ui {
    2. class ui_calib_base;
    3. }
    To copy to clipboard, switch view to plain text mode 

    only declares a forward reference to the Ui:: ui_calib_base class; it does not define the class. You need to include that actual header file that defines the Ui:: class. This file is created by MOC when it processes your .ui file.

    The compiler is telling you that you are trying to use methods and variables of the Ui:: class in a place where all it knows is the name of the class (via the forward declaration) because it hasn't seen the actual definition. That's an "invalid use of an incomplete type".
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. invalid use of incomplete type 'struct MSG'
    By libed in forum Qt Programming
    Replies: 5
    Last Post: 21st February 2019, 12:32
  2. Replies: 1
    Last Post: 11th October 2016, 18:49
  3. invalid use of incomplete type 'class QWebFrame'
    By rahulvishwakarma in forum Qt Programming
    Replies: 1
    Last Post: 30th April 2016, 16:46
  4. Replies: 9
    Last Post: 29th August 2010, 14:30
  5. error: invalid use of incomplete type 'struct QMetaEnum'
    By dyngoman in forum Qt Programming
    Replies: 3
    Last Post: 12th March 2010, 13:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.