Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using individual ui files
I created a ui file using Qt Creator. I would like to use it to display labels. How can I use it from an existing class? I checked the examples available online but unfortunately none of the worked.
koahnig last edited by
Unfortunately this didn't help as it is about custom widgets.
Created a ui named display.ui using File ->New File in Creator.
The pro file section looks like this:
FORMS += \ additem.ui \ review.ui \ mainwindow.ui \ imagedisplay.ui \ display.ui
and the header of the file mainwindow.cpp where I want to use the form looks like this:
#include "mainwindow.h" #include "ui_mainwindow.h" #include "ui_display.h" #include <imagedisplay.h>
When I try to use display.ui from mainwindow.h I use:
but in the dropdown display.ui is not listed. What am I missing? Thank you.
m.sue last edited by m.sue
I usually use one ui-file with one cpp-file and one header-file, like:
display.h there use ui::DisplayClass or what the name is
mainwindow.h there use ui::MainWindowClass or what the name is
I would not try to mix-up the two classes Display and MainWindow.