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. No member named 'stackedWidget' in Ui::MainWindow
QtWS25 Last Chance

No member named 'stackedWidget' in Ui::MainWindow

Scheduled Pinned Locked Moved Solved General and Desktop
stackedwidgetqmake
8 Posts 3 Posters 3.9k 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.
  • A Offline
    A Offline
    arjun98
    wrote on last edited by
    #1

    MainWindow is defined as follows:

    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::on_login_button_clicked()
    {
        ui->stackedWidget->setCurrentIndex(1);
    }
    

    This is the error message:
    mainwindow.cpp:21: error: no member named 'stackedWidget' in 'Ui::MainWindow'

    The following are warning messages:
    :-1: warning: Project WARNING: Qt has only been tested with version 10.15 of the platform SDK, you're using 11.1.
    :-1: warning: Project WARNING: This is an unsupported configuration. You may experience build issues, and by using
    :-1: warning: Project WARNING: the 11.1 SDK you are opting in to new features that Qt has not been prepared for.
    :-1: warning: Project WARNING: Please downgrade the SDK you use to build your app to version 10.15, or configure
    :-1: warning: Project WARNING: with CONFIG+=sdk_no_version_check when running qmake to silence this warning.
    :-1: warning: "/Library/Developer/CommandLineTools/usr/bin/clang" is used by qmake, but "/usr/bin/clang" is configured in the kit.
    Please update your kit (Desktop Qt 5.15.2 clang 64bit) or choose a mkspec for qmake that matches your target environment better.
    :-1: warning: "/Library/Developer/CommandLineTools/usr/bin/clang++" is used by qmake, but "/usr/bin/clang++" is configured in the kit.
    Please update your kit (Desktop Qt 5.15.2 clang 64bit) or choose a mkspec for qmake that matches your target environment better.

    The solution I found on other forums was to clean the project, rebuild the qmake, the run in debug, this did not help.

    Thank you,
    Arjun

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

      When the compiler says there there is no such member then I would guess it's right. Make sure that you really have such a widget in your ui file and that the ui_mainwindow.h is regenerated afterwards (delete it to be sure)

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

      A 2 Replies Last reply
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Also check that none of the build files ended up in the project folder.

        Did you try one of Creators' examples ? Can they run ?

        Seems you are on macOS and using another Xcode/sdk than
        expected ?

        A 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          When the compiler says there there is no such member then I would guess it's right. Make sure that you really have such a widget in your ui file and that the ui_mainwindow.h is regenerated afterwards (delete it to be sure)

          A Offline
          A Offline
          arjun98
          wrote on last edited by
          #4

          @Christian-Ehrlicher My apologies, I did not fully understand your answer.Screen Shot 2021-03-17 at 11.48.07 AM.png
          Is this what you mean by have such a widget? And what do you mean regenerate the ui_mainwindow.h?

          mrjjM 1 Reply Last reply
          0
          • A arjun98

            @Christian-Ehrlicher My apologies, I did not fully understand your answer.Screen Shot 2021-03-17 at 11.48.07 AM.png
            Is this what you mean by have such a widget? And what do you mean regenerate the ui_mainwindow.h?

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

            @arjun98
            Hi

            • what do you mean regenerate the ui_mainwindow.h?

            Delete any ui_xxx files in build folder (or just all files)
            make sure no ui_xxx files are in the project folder.
            Then run qmake from build menu

            And then check file been recreated.

            A 1 Reply Last reply
            1
            • mrjjM mrjj

              Hi
              Also check that none of the build files ended up in the project folder.

              Did you try one of Creators' examples ? Can they run ?

              Seems you are on macOS and using another Xcode/sdk than
              expected ?

              A Offline
              A Offline
              arjun98
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • mrjjM mrjj

                @arjun98
                Hi

                • what do you mean regenerate the ui_mainwindow.h?

                Delete any ui_xxx files in build folder (or just all files)
                make sure no ui_xxx files are in the project folder.
                Then run qmake from build menu

                And then check file been recreated.

                A Offline
                A Offline
                arjun98
                wrote on last edited by
                #7

                @mrjj Thank you

                1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  When the compiler says there there is no such member then I would guess it's right. Make sure that you really have such a widget in your ui file and that the ui_mainwindow.h is regenerated afterwards (delete it to be sure)

                  A Offline
                  A Offline
                  arjun98
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher Thank you, I had a typo in the widget name in the ui file which I was able to find in the ui_mainwindow.h file.

                  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