Solved Using individual ui files
-
Hi,
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.
Thank you. -
Depends on your intensions. Possibly this is helping
-
@koahnig
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:
ui::
but in the dropdown display.ui is not listed. What am I missing? Thank you.
-
Hi,
I usually use one ui-file with one cpp-file and one header-file, like:
display.ui
display.h there use ui::DisplayClass or what the name is
display.cpp
and
mainwindow.ui
mainwindow.h there use ui::MainWindowClass or what the name is
mainwindow.cpp
I would not try to mix-up the two classes Display and MainWindow.
-Michael. -
@m.sue
Thank you.