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. problem with userdefined widget with qtcreator ...
Forum Updated to NodeBB v4.3 + New Features

problem with userdefined widget with qtcreator ...

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 407 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.
  • D Offline
    D Offline
    django.Reinhard
    wrote on last edited by
    #1

    Hi,

    I extended a widget and so I used the qtcreator feature "use widget as placeholder for userdefined widget".

    But when I build the app, my widget class will not be found.
    Headers can be found by include paths added to qmake, but it looks like moc does not use include paths

    error-message is kind of unspecific:

    QFormBuilder was unable to create a custom widget ...
    

    What am I missing?

    I then tried to delete the widget created by formbuilder and replace it with a widget created by myself - but that was a big desaster :(

    eyllanescE 1 Reply Last reply
    0
    • D django.Reinhard

      Hi,

      I extended a widget and so I used the qtcreator feature "use widget as placeholder for userdefined widget".

      But when I build the app, my widget class will not be found.
      Headers can be found by include paths added to qmake, but it looks like moc does not use include paths

      error-message is kind of unspecific:

      QFormBuilder was unable to create a custom widget ...
      

      What am I missing?

      I then tried to delete the widget created by formbuilder and replace it with a widget created by myself - but that was a big desaster :(

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @django-Reinhard please provide a minimal and reproducible example

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1
      • D Offline
        D Offline
        django.Reinhard
        wrote on last edited by
        #3

        @eyllanesc said in problem with userdefined widget with qtcreator ...:

        please provide a minimal and reproducible example

        That's not that easy as I don't know, what plays a role and what not.

        Anyway - my workaround is:
        Change the placeholder of custom widget to QWidget. Then in class I create my custom widget, add it to the layout and then hide the placeholder widget.
        Its far from being elegant, but it works :)

        mrjjM 1 Reply Last reply
        0
        • D django.Reinhard

          @eyllanesc said in problem with userdefined widget with qtcreator ...:

          please provide a minimal and reproducible example

          That's not that easy as I don't know, what plays a role and what not.

          Anyway - my workaround is:
          Change the placeholder of custom widget to QWidget. Then in class I create my custom widget, add it to the layout and then hide the placeholder widget.
          Its far from being elegant, but it works :)

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

          @django-Reinhard
          Hi
          Your custom widget must have the standard constructor so that could be one reason
          why Promotion didn't work.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            django.Reinhard
            wrote on last edited by
            #5

            Hi,

            thank you for your attention!

            Yes, I already supposed that. My subclass of QTextEdit has of cause the usual standard constructor (with parent parameter set to default nullptr).

            I suppose, that it has to do with the directory layout of my project, where all files live in separate subdirectories. But that's just a guess - far from any knowledge.

            mrjjM 1 Reply Last reply
            0
            • D django.Reinhard

              Hi,

              thank you for your attention!

              Yes, I already supposed that. My subclass of QTextEdit has of cause the usual standard constructor (with parent parameter set to default nullptr).

              I suppose, that it has to do with the directory layout of my project, where all files live in separate subdirectories. But that's just a guess - far from any knowledge.

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

              @django-Reinhard
              Hi
              If the file (the .h file) with the custom widget is not directly with the .PRO file then you
              must add the relative path to the place where you give it the .h when you promote

              like
              subfolder/mywidget.h

              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