Solved : Problems using QGLWidget as base to promote to own class

  • Hi all!
    To add some graph plotting to a widget I want to use QGLWidget as base widget in designer and promote to my own derived class. But QGLWidget does not show up in the list. So I tried to promote from QWidget directly but the resulting code does not compile.
    As i presume the error is somewhere else, (i am exporting my code into a library first), my first question is:

    • is the way i described it the way it should work (e.g. use of the base class should work, too?)
      And secondly:
    • why is QGLWidget not available for selection to promote from in design mode? (using QtCreator2.8.1).

    any help would be appreciated.

  • Moderators

    In Designer you can use a QWidget as a placeholder and RMB on it to promote it as explained "in this article":

    I haven't done it with QGLwidget myself though, but should work.

    hope this helps

  • Ok, thx.
    So i'll check for the library inclusion first.

  • Hmm. I found that the linker explicitly seeks for a directly QWidget-derived class, so without being able to choose QGLWidget as base, I think I will not be able to use the designer ui-file and thus need to code the ui manually again :-(.
    Is it generally impossible to promote through more than one level of inheritance?

    After finding out some more about the use of libraries under Qt,Win32 and MSVC, I can confirm that use of QWidget as placeholder is possible, so multiple levels of inheritance work here and designer can be used as I hoped without knowing the one-below-top-level derived class.

  • Moderators

    Thanks for confirming your findings to the forum

    happy coding!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.