Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, January 2007
Extending Qt4 designers templates


Message 1 in thread

Hi,

just found out that it is basically possible to provide one's own
templates for Qt4 designer. However this is limited as far as I can see
to .ui files based off Qt classes, like QWidget, QDialog or QMainWindow.

My question is: Does anybody have an idea if that really is right, or if
there's some way to extend that with a custom top-level-widget?

Andreas

-- 
 [ signature omitted ] 

Message 2 in thread

On Monday 01 January 2007 22:21, Andreas Pakulat wrote:
> Hi,
>
> just found out that it is basically possible to provide one's own
> templates for Qt4 designer. However this is limited as far as I can see
> to .ui files based off Qt classes, like QWidget, QDialog or QMainWindow.
>
> My question is: Does anybody have an idea if that really is right, or if
> there's some way to extend that with a custom top-level-widget?

I'm not sure if I understand correctly: Do you mean a top-level-widget that 
does not inherit QWidget?

Frank

--
 [ signature omitted ] 

Message 3 in thread

On 01.01.07 22:32:39, Frank Hemer wrote:
> On Monday 01 January 2007 22:21, Andreas Pakulat wrote:
> > Hi,
> >
> > just found out that it is basically possible to provide one's own
> > templates for Qt4 designer. However this is limited as far as I can see
> > to .ui files based off Qt classes, like QWidget, QDialog or QMainWindow.
> >
> > My question is: Does anybody have an idea if that really is right, or if
> > there's some way to extend that with a custom top-level-widget?
> 
> I'm not sure if I understand correctly: Do you mean a top-level-widget that 
> does not inherit QWidget?

No, I mean stuff like KAssistantDialog or any QWidget subclass that I
have and might want to use as base widget for new Ui's.

Using a .ui with the class put into the xml does work to some extent,
i.e. I get an empty form. But of course thats not very helpful.

Andreas

-- 
 [ signature omitted ] 

Message 4 in thread

On 1/1/07, Andreas Pakulat <apaku@xxxxxx> wrote:
> No, I mean stuff like KAssistantDialog or any QWidget subclass that I
> have and might want to use as base widget for new Ui's.
>
> Using a .ui with the class put into the xml does work to some extent,
> i.e. I get an empty form. But of course thats not very helpful.

This might help you:

http://doc.trolltech.com/qq/qq16-designer.html

Cheers

Rich.

--
 [ signature omitted ] 

Message 5 in thread

On 02.01.07 00:21:37, Richard Moore wrote:
> On 1/1/07, Andreas Pakulat <apaku@xxxxxx> wrote:
> >No, I mean stuff like KAssistantDialog or any QWidget subclass that I
> >have and might want to use as base widget for new Ui's.
> >
> >Using a .ui with the class put into the xml does work to some extent,
> >i.e. I get an empty form. But of course thats not very helpful.
> 
> This might help you:
> 
> http://doc.trolltech.com/qq/qq16-designer.html

Well, you could've been a bit more specific :) After all I missed the
isContainer function. I'll try to hack something together tomorrow to
try if what I'm thinking about actually works.

Thanks for pointing me to the docs.

Andreas

-- 
 [ signature omitted ] 

Message 6 in thread

On Monday 01 January 2007 23:42, Andreas Pakulat wrote:
> On 01.01.07 22:32:39, Frank Hemer wrote:
> > On Monday 01 January 2007 22:21, Andreas Pakulat wrote:
> > > Hi,
> > >
> > > just found out that it is basically possible to provide one's own
> > > templates for Qt4 designer. However this is limited as far as I can see
> > > to .ui files based off Qt classes, like QWidget, QDialog or
> > > QMainWindow.
> > >
> > > My question is: Does anybody have an idea if that really is right, or
> > > if there's some way to extend that with a custom top-level-widget?
> >
> > I'm not sure if I understand correctly: Do you mean a top-level-widget
> > that does not inherit QWidget?
>
> No, I mean stuff like KAssistantDialog or any QWidget subclass that I
> have and might want to use as base widget for new Ui's.
>
> Using a .ui with the class put into the xml does work to some extent,
> i.e. I get an empty form. But of course thats not very helpful.

Hmm, I managed to put my own template class into an xml and it works just 
fine.

You need to supply a plugin for your custom class though.
This plugin needs to be found by designer.

As the template xml, you need to create it manually by changing the default 
(i.e. QWidget) to your custom widget, and add its customwidget info.
Here is an example template xml:

<ui version="4.0" >
 <author>Frank Hemer</author>
 <class>Form</class>
 <widget class="ServiceWidget" name="Form" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>Form</string>
  </property>
 </widget>
 <customwidgets>
  <customwidget>
   <class>ServiceWidget</class>
   <extends>QWidget</extends>
   <header>ServiceWidget.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>


Hope that helps
Frank

--
 [ signature omitted ]