Results 1 to 5 of 5

Thread: How does one get "make install" target to install "ui_" generated header files?

  1. #1
    Join Date
    Apr 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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.

  3. #3
    Join Date
    Apr 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How does one get "make install" target to install "ui_" generated header files?

    Quote Originally Posted by purplecoast View Post
    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.

    Qt Code:
    1. // header file
    2.  
    3. namespace Ui {
    4. class MyWidget;
    5. }
    6.  
    7. class MyWidget : public QWidget {
    8. public:
    9. MyWidget();
    10. ~MyWidget();
    11. QPushButton *button() const; // expose object
    12. private:
    13. Ui::MyWidget *ui;
    14. };
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. // implementation file
    2. #include "headerfile"
    3. #include "ui_mywidget.h"
    4.  
    5. MyWidget::MyWidget() : QWidget() {
    6. ui = new Ui::MyWidget;
    7. ui->setupUi(this);
    8. }
    9.  
    10. MyWidget::~MyWidget() { delete ui; }
    11.  
    12. QPushButton* MyWIdget::button() const { return ui->button; }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Apr 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

Similar Threads

  1. Replies: 2
    Last Post: 28th February 2010, 08:38
  2. "make install" and "make clean" on Windows for Qt
    By Berberis in forum Installation and Deployment
    Replies: 0
    Last Post: 30th November 2009, 00:02
  3. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05
  4. "make install" doesn't install binary
    By jiveaxe in forum Newbie
    Replies: 2
    Last Post: 2nd January 2008, 13:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.