[Qt-creator] Custom widget in Qt Creator (Designer)
Ladnar, Marc
Marc.Ladnar at ksab.kroschu.com
Mon Jun 8 07:07:09 CEST 2009
No,
youo just place a placeholder for your widget marking the inline
position (use a QWidget or your base class for that).
Riightclick your widget an tell it "Promote to...".
A Dialog pops up where you now can enter your classname, its header and
press add.
Now it apperas on the upper list in the dialog, you select it and press
"promote" button. Your placeholder widget is from now on a widget of
your class type. No Plugins, no trying, just add your class to your
project and averything's fine.
You can do this promoting with any kind of widget, so e.g. for tabs in
QTabWidget oder for the pages in QStackedWidget, too. Here you first
have to go to the pages menu (Page X of Y...) and inside there is your
"Promote to..."
I managed to do everything I wanted by promting placeholder widgets.
Even if you want to access you properties you can go to the properties
toolwindow and add dynamic properties caled like yours and pass them the
values you want to have. They then should be added into the ui_X.h like
->setProperty()...
Hope that resolves the whole problem.
Have a nice day,
Marc Ladnar
-----Ursprüngliche Nachricht-----
Von: Lorenzo Bettini [mailto:bettini at dsi.unifi.it]
Gesendet: Sonntag, 7. Juni 2009 10:26
An: qt-creator at trolltech.com
Betreff: Re: [Qt-creator] Custom widget in Qt Creator (Designer)
Jonathan Neuhaus wrote:
> In this case, you need to create a custom widget that uses the widget
> in order to have a plugin inserted in the designer.
> Then, you simply have to drag and drop the custom widget on the form.
>
> Check this link : http://doc.qtsoftware.com/4.5/qtdesigner.html
> It explains how to create Qt Designer plugins. If you are using Qt
> Creator, you will need to compile the plugin with msvc to make it
works.
>
>
mh... I remember well, in qt3 designer you could simply specify to add
to a form a widget you created (e.g., with designer itself) by
specifying the name of the class; then the widget was not rendered
correctly inside designer, but it was actually inserted in the generated
class. Thus, this does not hold anymore in qt4 designer? You're forced
to build a qt designer plugin?
thanks
Lorenzo
> 2009/6/5 Lorenzo Bettini
> <bettini at dsi.unifi.it
> <mailto:bettini at dsi.unifi.it>>
>
> Jonathan Neuhaus wrote:
> > In your case, you just need to add LIBS +=
> > "path_to_your_dll/your_dll.dll" in your .pro and then use your
> widget.
> >
> > * Does anyone have an answer to my previous problem
(compilation
> from a
> > custom widget on mac for Qt Creator)? It actually crashes and I
can't
> > manage to find out why.
> > * Does someone knows which compiler was used to compile
QtCreator?
> >
>
> so I need to have a library for my widget?
> I meant to use a widget defined in the same project: say I have
defined
> a customized button MyButton.ui and I want to reuse it from
designer to
> insert it in another form of my project.
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
> HOME: http://www.lorenzobettini.it MUSIC:
http://www.purplesucker.com
> http://www.myspace.com/supertrouperabba
> BLOGS: http://tronprog.blogspot.com
http://longlivemusic.blogspot.com
> http://www.gnu.org/software/src-highlite
> http://www.gnu.org/software/gengetopt
> http://www.gnu.org/software/gengen
> http://doublecpp.sourceforge.net
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> <mailto:Qt-creator at trolltech.com>
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
_______________________________________________
Qt-creator mailing list
Qt-creator at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator
More information about the Qt-creator-old
mailing list