[Qt-interest] setWindowTitle in parent class

andrew.m.goth at l-3com.com andrew.m.goth at l-3com.com
Thu Feb 5 01:52:44 CET 2009


Israel Brewster wrote:
> On Feb 4, 2009, at 12:41 PM, Robert Hairgrove wrote:
> > If not, you might be able to just add the code to the base class' 
> > constructor. Alternatively, you could manually edit the generated >
> > ui_... header file(s).
> 
> yeah, that works, with the caveat that they would need to be 
> re-edited anytime the UI changes at all :(

To customize the output of Designer, subclass.  Like this:

#include "ui_WhateverBase.h"
namespace Ui {
    class Whatever: public WhateverBase {
    public:
        void setupUi(QWidget* win)
        {
            /* Do stuff before calling base class */
            WhateverBase::setupUi(win);
            /* Do stuff after calling base class */
        }
    };
}

Then use Ui::Whatever in your program.

-- 
Andy Goth
<amgoth at link.com>




More information about the Qt-interest-old mailing list