PDA

View Full Version : Not working custom deginer widget + container based on QWidget!



qlands
27th July 2011, 15:09
Hi,

I created a custom Designer widget that I want to use as container.

I indicated that it is a container with:



bool myWidget::isContainer() const
{
return true;
}


However, even when Designer loads the custom widget and I can it to a ui... The widget is not a container! What else I need to do?

Thanks,
Carlos.

MarekR22
27th July 2011, 15:34
it should be MyWidgetDesignerFactory::isContainer not myWidget::isContainer. See http://techbase.kde.org/Development/Tutorials/Writing_Qt_Designer_Plugins.

qlands
27th July 2011, 15:49
Hi,
myWidget is the plugin declared like


class myWidget : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)

public:
myWidget(QObject *parent = 0);

bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);

private:
bool m_initialized;
};


Thus I have:


bool myWidget::isContainer() const
{
return true;
}


Carlos.