setupUi is not a member of my QT application
-
@JoeCFD
throws an error at{ ui->setupUi(this); }"C2664: 'Ui_Ui_Pathloss::setupUi': cannot convert parameter 1 from 'Ui_Pathloss *const' to 'QFrame *'
-
Beside what wrote @JoeCFD, it seems you are piling up the various suggestions you got.
You should go back to your starting state before doing anything else.
You should also take the time to read the Qt Designer documentation to understand what you should get.
-
Your ui file looks similar like this:
https://doc.qt.io/archives/3.3/designer-manual-16.html
Widgets
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>WinIntroPage</class>
<widget class="QWidget">
<property name="name">
<cstring>WinIntroPage</cstring>
</property>see the class tag: change it from f_pathloss to Pathloss
That is the only thing you need to do. Then recompile your code. -
Your ui file looks similar like this:
https://doc.qt.io/archives/3.3/designer-manual-16.html
Widgets
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>WinIntroPage</class>
<widget class="QWidget">
<property name="name">
<cstring>WinIntroPage</cstring>
</property>see the class tag: change it from f_pathloss to Pathloss
That is the only thing you need to do. Then recompile your code. -
@lfreeman6490 said in setupUi is not a member of my QT application:
ui_Pathloss.h
do not change ui_Pathloss.h because it is generated. Change pathloss.ui or Pathloss.ui file
Your class name has to match to the name defined in
<class>*****</class> in pathloss.ui or Pathloss.ui file -
Depending on what that interface contains, it could be simpler to just rebuilt it from scratch and be done with it.
-
Depending on what that interface contains, it could be simpler to just rebuilt it from scratch and be done with it.
-
======================TestWidget.h============================
#include <QWidget>#include "ui_TestWidget.h"
class TestWidget : public QWidget
{
Q_OBJECTpublic:
explicit TestWidget(QWidget *parent = 0);
~TestWidget() {}private:
Ui::TestWidget ui;
}; -
==================TestWidget.ui file
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>TestWidget</class> <widget class="QWidget" name="TestWidget"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>1037</width> <height>664</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>GroupBox</string> </property> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QScrollArea" name="scrollArea"> <property name="widgetResizable"> <bool>true</bool> </property> <widget class="QWidget" name="scrollAreaWidgetContents"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>1175</width> <height>584</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QLabel" name="label"> <property name="text"> <string>Testing</string> </property> </widget> </item> </layout> </widget> </widget> </item> </layout> </item> </layout> </widget> </item> </layout> </widget> <resources/> <connections/> </ui> -
============================ui_TestWidget.h <=== this file is generated and you do not change it.
#ifndef UI_TESTWIDGET_H
#define UI_TESTWIDGET_H#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>QT_BEGIN_NAMESPACE
class Ui_TestWidget
{
public:
QVBoxLayout *verticalLayout_2;
QGroupBox *groupBox;
QHBoxLayout *horizontalLayout;
QVBoxLayout *verticalLayout;
QScrollArea *scrollArea;
QWidget *scrollAreaWidgetContents;
QVBoxLayout *verticalLayout_3;
QLabel *label;void setupUi(QWidget *TestWidget) { if (TestWidget->objectName().isEmpty()) TestWidget->setObjectName(QString::fromUtf8("TestWidget")); TestWidget->resize(1037, 664); verticalLayout_2 = new QVBoxLayout(TestWidget); verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); groupBox = new QGroupBox(TestWidget); groupBox->setObjectName(QString::fromUtf8("groupBox")); horizontalLayout = new QHBoxLayout(groupBox); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); verticalLayout = new QVBoxLayout(); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); scrollArea = new QScrollArea(groupBox); scrollArea->setObjectName(QString::fromUtf8("scrollArea")); scrollArea->setWidgetResizable(true); scrollAreaWidgetContents = new QWidget(); scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents")); scrollAreaWidgetContents->setGeometry(QRect(0, 0, 1175, 584)); verticalLayout_3 = new QVBoxLayout(scrollAreaWidgetContents); verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); label = new QLabel(scrollAreaWidgetContents); label->setObjectName(QString::fromUtf8("label")); verticalLayout_3->addWidget(label); scrollArea->setWidget(scrollAreaWidgetContents); verticalLayout->addWidget(scrollArea); horizontalLayout->addLayout(verticalLayout); verticalLayout_2->addWidget(groupBox); retranslateUi(TestWidget); QMetaObject::connectSlotsByName(TestWidget); } // setupUi void retranslateUi(QWidget *TestWidget) { TestWidget->setWindowTitle(QCoreApplication::translate("TestWidget", "Form", nullptr)); groupBox->setTitle(QCoreApplication::translate("TestWidget", "GroupBox", nullptr)); label->setText(QCoreApplication::translate("TestWidget", "Testing", nullptr)); } // retranslateUi};
namespace Ui {
class TestWidget: public Ui_TestWidget {};
} // namespace UiQT_END_NAMESPACE
#endif // UI_TESTWIDGET_
-
============================ui_TestWidget.h <=== this file is generated and you do not change it.
#ifndef UI_TESTWIDGET_H
#define UI_TESTWIDGET_H#include <QtCore/QVariant>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>QT_BEGIN_NAMESPACE
class Ui_TestWidget
{
public:
QVBoxLayout *verticalLayout_2;
QGroupBox *groupBox;
QHBoxLayout *horizontalLayout;
QVBoxLayout *verticalLayout;
QScrollArea *scrollArea;
QWidget *scrollAreaWidgetContents;
QVBoxLayout *verticalLayout_3;
QLabel *label;void setupUi(QWidget *TestWidget) { if (TestWidget->objectName().isEmpty()) TestWidget->setObjectName(QString::fromUtf8("TestWidget")); TestWidget->resize(1037, 664); verticalLayout_2 = new QVBoxLayout(TestWidget); verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); groupBox = new QGroupBox(TestWidget); groupBox->setObjectName(QString::fromUtf8("groupBox")); horizontalLayout = new QHBoxLayout(groupBox); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); verticalLayout = new QVBoxLayout(); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); scrollArea = new QScrollArea(groupBox); scrollArea->setObjectName(QString::fromUtf8("scrollArea")); scrollArea->setWidgetResizable(true); scrollAreaWidgetContents = new QWidget(); scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents")); scrollAreaWidgetContents->setGeometry(QRect(0, 0, 1175, 584)); verticalLayout_3 = new QVBoxLayout(scrollAreaWidgetContents); verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); label = new QLabel(scrollAreaWidgetContents); label->setObjectName(QString::fromUtf8("label")); verticalLayout_3->addWidget(label); scrollArea->setWidget(scrollAreaWidgetContents); verticalLayout->addWidget(scrollArea); horizontalLayout->addLayout(verticalLayout); verticalLayout_2->addWidget(groupBox); retranslateUi(TestWidget); QMetaObject::connectSlotsByName(TestWidget); } // setupUi void retranslateUi(QWidget *TestWidget) { TestWidget->setWindowTitle(QCoreApplication::translate("TestWidget", "Form", nullptr)); groupBox->setTitle(QCoreApplication::translate("TestWidget", "GroupBox", nullptr)); label->setText(QCoreApplication::translate("TestWidget", "Testing", nullptr)); } // retranslateUi};
namespace Ui {
class TestWidget: public Ui_TestWidget {};
} // namespace UiQT_END_NAMESPACE
#endif // UI_TESTWIDGET_
@JoeCFD I have it all the same except for one line in my pathloss.ui file. It has my widget class as a "QFrame" and it has to be changed in the design mode it says
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <author>free</author> <class>pathloss</class> <widget class="QFrame" name="pathloss"> <property name="geometry"> -
use upper case
<class>pathloss</class> ===> <class>Pathloss</class>
<widget class="QFrame" name="Pathloss"> <====not critical@JoeCFD I was able to edit the xml and change my widgets section to be a QWidget and I'm dealing with some other errors from here. Thanks