Multiple UI Files Compile Error



  • Hi.

    I'm trying to edit an existing app for personal use which has 2 .ui files, but I'm getting one error when building a new project in Qt Creator.

    Here a list of files in the project:

    ExtendFrame.h
    MiniFrame.h
    ui_ExtendFrame.h
    ui_MiniFrame.h

    ExtendFrame.cpp
    main.cpp
    MiniFrame.cpp

    ExtendFrame.ui
    MiniFrame.ui

    The Error is in MiniFrame.cpp

    #include "MiniFrame.h"
    #include "ui_MiniFrame.h"
    
    miniplugin_bgwidget::miniplugin_bgwidget(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::miniplugin_bgwidget)
    {
        ui->setupUi(this);
    }
    
    miniplugin_bgwidget::~miniplugin_bgwidget()
    {
        delete ui;
    }
    

    Error Message:

    ..\MiniFrame.cpp:8: error: no matching function for call to 'Ui::miniplugin_bgwidget::setupUi(miniplugin_bgwidget*)'
    ui->setupUi(this);
    ^

    In file included from ..\MiniFrame.cpp:2:0:

    ..\ui_MiniFrame.h:45: candidate: void Ui_miniplugin_bgwidget::setupUi(QFrame*)
    void setupUi(QFrame *miniplugin_bgwidget)
    ^

    ..\ui_MiniFrame.h:45: note: no known conversion for argument 1 from 'miniplugin_bgwidget*' to 'QFrame*'.

    Line 45 in ui_MiniFrame.h

    void setupUi(QFrame *miniplugin_bgwidget)
    

    Any advise how to fix this error would be very much appreciated.

    Thanks in advance for any feedback.


  • Qt Champions 2016

    Hmm it sounds like you first based your widget on QFrame and later edit files to
    inherited QWidgets.
    Maybe just try again and generate them?
    normally it just works if you use the wizard.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.