error: no member named 'addWidget' in 'QFrame'
-
wrote on 2 Nov 2019, 18:21 last edited by
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; } } }
-
Hi,
Based on the name, it should be a layout and not a QFrame.
-
Hi
From the code here
https://github.com/PacktPublishing/Hands-On-GUI-Programming-with-CPP-and-Qt5its a
QVBoxLayout *webcam about;
(and code just compiles)so maybe bug in book or something like that ?
-
wrote on 3 Nov 2019, 06:25 last edited by lse123 11 Mar 2019, 06:26
-
Hi
That is super odd.
it really is included in the download
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 saysFORMS +=
mainwindow.uiso I wondered if you moved the .pro file or anything ?
-
wrote on 3 Nov 2019, 13:24 last edited by
what is having two projects with same name...?
In the first try alone I make two files ui
mainwindow.ui
mainwindow2.uiafter I opened the project from book code files
well????
-
what is having two projects with same name...?
In the first try alone I make two files ui
mainwindow.ui
mainwindow2.uiafter I opened the project from book code files
well????
@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.
-
wrote on 4 Nov 2019, 05:05 last edited by
-
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?@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. -
wrote on 4 Nov 2019, 05:32 last edited by
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...
-
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...
@lse123 said in error: no member named 'addWidget' in 'QFrame':
but stays on 0%
Do you use Qt Maintenance Tool?
-
wrote on 4 Nov 2019, 10:33 last edited by
@jsulm said in error: no member named 'addWidget' in 'QFrame':
Qt Maintenance Tool?
I am trying Qt Maintenance Tool
seems update now works -
wrote on 4 Nov 2019, 10:36 last edited by lse123 11 Apr 2019, 10:36
-
I would try to change the mirror, you might be hitting a faulty one.
-
wrote on 4 Nov 2019, 10:49 last edited by
where can do this???
-
@lse123 There is this tool you can use to change the mirror: https://github.com/JKSH/QtSdkRepoChooser
-
wrote on 4 Nov 2019, 16:26 last edited by
exist any other way???
-
@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. -
wrote on 4 Nov 2019, 19:39 last edited by
this is for the update or install--- the offline installer???
-
@lse123
Install.
7/23