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. error: no member named 'addWidget' in 'QFrame'
QtWS25 Last Chance

error: no member named 'addWidget' in 'QFrame'

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 4 Posters 4.1k 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.
  • L Offline
    L Offline
    lse123
    wrote on 2 Nov 2019, 18:21 last edited by
    #1

    Hands-On GUI Programming with C++ and Qt5, Packt, Lee Zhi Eng ch 9 - camera (c) April 2018
    F:\Qt-Projects\Webcam\mainwindow.cpp:44: error: no member named 'addWidget' in 'QFrame'
    I am getting an error --- how to add Widget in the current Qt version????

    mainWindow.cpp

    void MainWindow::connectCamera()
    {
    	QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
    	foreach (const QCameraInfo &cameraInfo, cameras)
    	{
    		qDebug() << cameraInfo.description() << ui->deviceSelection->currentText();
    
    		if (cameraInfo.description() == ui->deviceSelection->currentText())
    		{
    			camera = new QCamera(cameraInfo);
    			viewfinder = new QCameraViewfinder(this);
    			camera->setViewfinder(viewfinder);
    			ui->webcamLayout->addWidget(viewfinder);  // line 44
    
    			connect(camera, SIGNAL(error(QCamera::Error)), this, SLOT(cameraError(QCamera::Error)));
    
    			connected = true;
    			ui->connectButton->setText("Disconnect");
    
    			camera->start();
    
    			return;
    		}
    	}
    }
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Nov 2019, 18:26 last edited by
      #2

      Hi,

      Based on the name, it should be a layout and not a QFrame.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 2 Nov 2019, 19:47 last edited by
        #3

        Hi
        From the code here
        https://github.com/PacktPublishing/Hands-On-GUI-Programming-with-CPP-and-Qt5

        its a
        QVBoxLayout *webcam about;
        (and code just compiles)

        so maybe bug in book or something like that ?

        1 Reply Last reply
        1
        • L Offline
          L Offline
          lse123
          wrote on 3 Nov 2019, 06:25 last edited by lse123 11 Mar 2019, 06:26
          #4

          I ran code from the source code download of the book and getting this time: // but file exist ... well ?

          :-1: error: dependent '..\Chapter09\mainwindow.ui' does not exist.

          2019-11-03_08-23-37.png

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 3 Nov 2019, 10:28 last edited by
            #5

            Hi
            That is super odd.
            it really is included in the download
            alt text

            Did you move the files around or anything like that ?

            I can see it says

            '..\Chapter09\mainwindow.ui'

            Like its relative to the pro file
            However, the .PRO file says

            FORMS +=
            mainwindow.ui

            so I wondered if you moved the .pro file or anything ?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lse123
              wrote on 3 Nov 2019, 13:24 last edited by
              #6

              what is having two projects with same name...?

              In the first try alone I make two files ui
              mainwindow.ui
              mainwindow2.ui

              after I opened the project from book code files

              well????

              M 1 Reply Last reply 3 Nov 2019, 14:14
              0
              • L lse123
                3 Nov 2019, 13:24

                what is having two projects with same name...?

                In the first try alone I make two files ui
                mainwindow.ui
                mainwindow2.ui

                after I opened the project from book code files

                well????

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 3 Nov 2019, 14:14 last edited by
                #7

                @lse123
                Im not sure what you mean but if
                the projects are in different folder, its not an issue that
                they have same names.

                But you really didnt answer if you did anything to the files after download as they do compile fine here?

                So if you are not using the project as it, please tell what you do.

                1 Reply Last reply
                1
                • L Offline
                  L Offline
                  lse123
                  wrote on 4 Nov 2019, 05:05 last edited by
                  #8

                  2019-11-04_07-03-34.png

                  the file structure is above --- because I think i have also and VS created a new file only but in Qt not seem.
                  well?

                  still getting
                  :-1: error: dependent '..\Chapter09\mainwindow.ui' does not exist.
                  well?

                  J 1 Reply Last reply 4 Nov 2019, 05:30
                  0
                  • L lse123
                    4 Nov 2019, 05:05

                    2019-11-04_07-03-34.png

                    the file structure is above --- because I think i have also and VS created a new file only but in Qt not seem.
                    well?

                    still getting
                    :-1: error: dependent '..\Chapter09\mainwindow.ui' does not exist.
                    well?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 4 Nov 2019, 05:30 last edited by
                    #9

                    @lse123 I can build Chapter09 without issues - but I only opened Chapter09 project. But I noticed that there is Webcam.pro.user after git clone - this should not be part of the repository!
                    Try to delete Webcam.pro.user file, delete build directory and rebuild.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • L Offline
                      L Offline
                      lse123
                      wrote on 4 Nov 2019, 05:32 last edited by
                      #10

                      I also went update Qt Creator --- but stays on 0% Do Not download anything for the update even for 20+ min... after I stopped it...

                      J 1 Reply Last reply 4 Nov 2019, 05:33
                      0
                      • L lse123
                        4 Nov 2019, 05:32

                        I also went update Qt Creator --- but stays on 0% Do Not download anything for the update even for 20+ min... after I stopped it...

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 4 Nov 2019, 05:33 last edited by
                        #11

                        @lse123 said in error: no member named 'addWidget' in 'QFrame':

                        but stays on 0%

                        Do you use Qt Maintenance Tool?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lse123
                          wrote on 4 Nov 2019, 10:33 last edited by
                          #12

                          @jsulm said in error: no member named 'addWidget' in 'QFrame':

                          Qt Maintenance Tool?

                          I am trying Qt Maintenance Tool
                          seems update now works

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            lse123
                            wrote on 4 Nov 2019, 10:36 last edited by lse123 11 Apr 2019, 10:36
                            #13

                            Again went to 0.00 bytes/sec... what to do???

                            2019-11-04_12-35-21.png

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 4 Nov 2019, 10:37 last edited by
                              #14

                              I would try to change the mirror, you might be hitting a faulty one.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              1
                              • L Offline
                                L Offline
                                lse123
                                wrote on 4 Nov 2019, 10:49 last edited by
                                #15

                                where can do this???

                                J 1 Reply Last reply 4 Nov 2019, 11:32
                                0
                                • L lse123
                                  4 Nov 2019, 10:49

                                  where can do this???

                                  J Offline
                                  J Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 4 Nov 2019, 11:32 last edited by
                                  #16

                                  @lse123 There is this tool you can use to change the mirror: https://github.com/JKSH/QtSdkRepoChooser

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  3
                                  • L Offline
                                    L Offline
                                    lse123
                                    wrote on 4 Nov 2019, 16:26 last edited by
                                    #17

                                    exist any other way???

                                    M 1 Reply Last reply 4 Nov 2019, 16:43
                                    0
                                    • L lse123
                                      4 Nov 2019, 16:26

                                      exist any other way???

                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 4 Nov 2019, 16:43 last edited by
                                      #18

                                      @lse123
                                      Hi
                                      you can also download offline installer
                                      https://www.qt.io/offline-installers
                                      Its bigger up front download but the same things that gets installed.

                                      1 Reply Last reply
                                      1
                                      • L Offline
                                        L Offline
                                        lse123
                                        wrote on 4 Nov 2019, 19:39 last edited by
                                        #19

                                        this is for the update or install--- the offline installer???

                                        M 1 Reply Last reply 4 Nov 2019, 20:08
                                        0
                                        • L lse123
                                          4 Nov 2019, 19:39

                                          this is for the update or install--- the offline installer???

                                          M Offline
                                          M Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 4 Nov 2019, 20:08 last edited by
                                          #20

                                          @lse123
                                          Install.

                                          1 Reply Last reply
                                          0

                                          8/23

                                          4 Nov 2019, 05:05

                                          topic:navigator.unread, 15
                                          • Login

                                          • Login or register to search.
                                          8 out of 23
                                          • First post
                                            8/23
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved