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. Some of widget members visible in the comsuming class, while others are not

Some of widget members visible in the comsuming class, while others are not

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 614 Views
  • 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.
  • I Offline
    I Offline
    In Fo
    wrote on last edited by In Fo
    #1

    A project I worked on back in 2016 is throwing lots of someWidget is not a member of UI:someForm errors. Back then this was a working project, which compiled and ran without any errors. It was committed to source control, deployed to production, and never touched since. Today I am downloading a fresh copy of Qt 5.5.1 and trying to build it to work on a change, but errors like the above are raining on me like cats and dogs.

    Here is an example of the UI code:

    <widget class="QPushButton" name="btnSaveCurrent">
    <property name="geometry">
    <rect>
    <x>1030</x>
    <y>350</y>
    <width>75</width>
    <height>25</height>
    </rect>
    </property>
    <property name="text">
    <string>Sa&amp;ve</string>
    </property>
    </widget>
    <widget class="QComboBox" name="cmbMethod">
    <property name="geometry">
    <rect>
    <x>1160</x>
    <y>210</y>
    <width>131</width>
    <height>22</height>
    </rect>
    </property>
    </widget>
    

    This is one example of how the class uses the UI widgets:

    widget.cmbMethod->addItem(tr("Single-threaded"), QVariant(Methods::Single));
    widget.cmbMethod->addItem(tr("Parallel"), QVariant(Methods::Parallel));
    

    So we can see that btnSaveCurrent and cmbMethod are declared in the UI file. But if I put the cursor at the end of widget. and hit Ctrl-Space, we can see that btnSaveCurrent is actually visible in the consuming class, while cmbMethod is not.

    alt text

    alt text

    I tried dropping a brand new comboBox onto the form, but it was not visible in the code completion drop down either. After two years of not touching Qt my Qt-fu is rusty, so the first thing I checked was that QComboBox was not deprecated, and it apparently was not. Does anyone have a clue why only a portion of the UI would be visible to a consuming class?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Is widget the member which contains the ui elements ? If so you should delete the generated ui_FOO.h file so it's recreated.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      I 1 Reply Last reply
      4
      • Christian EhrlicherC Christian Ehrlicher

        Is widget the member which contains the ui elements ? If so you should delete the generated ui_FOO.h file so it's recreated.

        I Offline
        I Offline
        In Fo
        wrote on last edited by
        #3

        @Christian-Ehrlicher
        A rebuild did the trick.

        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