[Qt-creator] GUI-Suggestion
Danny Price
deepblue842 at googlemail.com
Fri Oct 16 16:12:36 CEST 2009
On Fri, Oct 16, 2009 at 3:01 PM, Andree Günther <guenther at mpanrw.de> wrote:
> Andre Poenitz schrieb:
> > On Wed, Oct 14, 2009 at 03:52:33PM +0200, Andree Günther wrote:
> >
> >> Hello List,
> >>
> >> wouldnt it be a good Idea to create a slot by - lets say -
> >> double-clicking a button?
> >>
> >
> > Try the item in the context menu under the somewhat misleading name
> > "Go to slot".
> Thats pretty much exactly what i wanted - thank you.
>
No, please don't do this. The standard behavior of the Designer has been to
set the name of a widget when double-clicking. It has been this way for some
time and is very convenient. This is also consistent with other GUI
designers such as Interface Builder. When the Trolls created the MSVC
plugin, they added the double-click-creates-slot behavor and
'on_xxx_clicked' syntax to appease VistualStudio users. When using the MSVC
Qt Plugin, I would often create a slot by mistake when expecting the
standard designer behaviour. Now that Nokia have removed the built-in
designer from the MSVC plugin, this behaviour is somewhat redundant.
Seperating the UI from the code is good design practice. Not only is the
'on_xxx_signal' syntax ugly, it is less powerful and tightly couples the
name of UI widgets to the code.
However, having it available via the menu is a nice compromise.
>
> I would suggest to select a default-Slot (ie Clicked() in case of the
> pushbutton) and set this
> as default-behaviour for doubleclicks. I think thats what people expect,
> isn't it?
>
That's fine for buttons but what abour everything else? Creator has awesome
signal-slot completion - use it :)
>
>
> I think i found a Bug with this:
>
> Creator doesnt remove the Metacall for the auto-generated Slot (for
> example "on_startButton_clicked") when
> the slot (and the Button in my case) is removed. Therfore compilation
> fails:
>
> undefined reference to `MainWindow::on_pushButton_clicked()'
>
Which is exactly why you should avoid doing this. Qt is NOT MFC.
>
> Dont know how to fix this, because the "MainWindow::qt_metacall" is not
> part of "my" code and im not supposed
> to twiddle with it, right?
>
>
> BTW: Just a thought: When i change the pushButtons name to lets say:
> startButton - it would be a good idea
> to automatically change all depending slotnames - ie.
> "on_pushButton_clicked".
>
>
> Andre
>
>
>
> ________________________________________
> Materialpruefungsamt Nordrhein-Westfalen
> Marsbruchstrasse 186
> D-44287 Dortmund
> Telefon: +49 (231) 4502-0
> Telefax: +49 (231) 458549
> E-mail: info at mpanrw.de
> Internet: www.mpanrw.de
> USt.-IdNr.: DE 124 728 648
>
> Brandpruefzentrum Erwitte
> Auf den Thraenen 2
> D-59597 Erwitte
>
> Telefon: +49 (2943) 897-0
> Telefax: +49 (2943) 897-33
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20091016/7611b776/attachment.html
More information about the Qt-creator-old
mailing list