How does one get "make install" target to install "ui_" generated header files?
In my PRO file for a library project I have ...
target.path += $$INSTALL_DIR/lib # get the library file
headers.path = $$INSTALL_DIR/include
headers.files = \
src/app/*.h \
generated/ui_myWindow.h
INSTALLS += headers target
This header does not even appear in the "make install" target like the other headers in the source tree. Maybe because when 'qmake' is called the "ui_myWindow.h" header does not exist because it is not generated until "uic" is called during make??
In any case, how does one get the generated UI headers to show up in the make install target?
Re: How does one get "make install" target to install "ui_" generated header files?
It won't and it shouldn't. This file is an intermediate file generated by uic - similar to moc_* files generated by moc. If you really really have to make it part of the install target, you need to manually provide a command (installtarget.commands=...) that will install the file in appropriate place.
Re: How does one get "make install" target to install "ui_" generated header files?
Thanks. I actually do need them because in my case I have a GUI-based library that another GUI application uses. And the GUI app needs to call method of the QtDesigner UI objects from the base library. This is a bit unusual I suppose, but it is definitely in the spririt of resuse of base-library-type functionality. I got it to work with the "extra" function of the target instead of the "command", namely with the following....
target.path += $$INSTALL_DIR/lib # get the library file
headers.path = $$INSTALL_DIR/include
headers.extra = "cp $$BUILD_DIR/ui_*.h $$INSTALL_DIR/include"
headers.files = \
src/app/*.h
INSTALLS += headers target
Re: How does one get "make install" target to install "ui_" generated header files?
Quote:
Originally Posted by
purplecoast
Thanks. I actually do need them because in my case I have a GUI-based library that another GUI application uses. And the GUI app needs to call method of the QtDesigner UI objects from the base library.
Either the file should be regenerated from the ui file or you should expose the objects in a proper header file as part of your class's interface. Doing it the way you are trying to do is not a pretty design.
Code:
// header file
namespace Ui {
class MyWidget;
}
public:
MyWidget();
~MyWidget();
private:
Ui::MyWidget *ui;
};
Code:
// implementation file
#include "headerfile"
#include "ui_mywidget.h"
ui = new Ui::MyWidget;
ui->setupUi(this);
}
MyWidget::~MyWidget() { delete ui; }
QPushButton* MyWIdget
::button() const { return ui
->button;
}
Re: How does one get "make install" target to install "ui_" generated header files?
Yes, the forward declaration and encapsulation is a much better design. I will do that instead of installing the generated header files.
Thanks for your help.