[RFC] KInformationLabel

Aaron J. Seigo aseigo at kde.org
Mon Mar 12 18:15:19 GMT 2007


On March 12, 2007, Michaël Larouche wrote:
> Le March 12, 2007 04:15, Simon Hausmann a écrit :
> > On Monday 12 March 2007 03:17:41 Michaël Larouche wrote:
> > > Le March 3, 2007 12:56, Michaël Larouche a écrit :
> > > > I have been working (slowy) on a new widget for kdelibs.
> > > >
> > > > It is a small label to display message in a dialog. The label is
> > > > first hidden when instancied and only show up when a message is
> > > > affected to the label. This is similiar to the ErrorNotifier control
> > > > in Windows Forms. This widget will be useful to replace message box
> > > > in dialog like Ask Password dialog and other non-modal dialogs.
> > > >
> > > > This is a work in progress of course and not all planned features are
> > > > not implemented. I would like to add a autohide timeout to the
> > > > widget. I tried to add FadeIn animation.
> > > >
> > > > I would like comments and suggestion about for this widget.
> > >
> > > Here a updated patch ready to be comitted on tomorrow (kdelibs
> > > breakage)
> >
> > Looks okay to me. Here's some more feedback on the API:
> >
> > * I suggest to replace setIconName(const QString &name) with just a
> > second setIcon overload that takes a QIcon. It's nice if a property
> > called "icon" also takes the native icon type :)
> >
> > * I also wouldn't make setIcon a slot. I've never seen a signal that
> > emits an icon :)
> >
> > * I suggest to rename the timeout property (what's a timeout a label?) to
> > autoHideTimeout (aha!).
> >
> > And of course the obligatory question for kdelibs inclusion at the end:
> > Which applications are using this widget (either at the moment or in the
> > near future)?
> >
> >
> > Simon
>
> New patch based on your suggestion Simon.
>
> I'll try to make use of this widget where it is needed to replace modal
> message box used in wrong contextes. I needed that for a dialog in Kopete
> at least and kdesu will make good use of it :)
>
> Just think every dialog that ask a password, it will be able to display the
> error meessage right in the dialog in a nice way.

i actually did exactly this in kpassworddialog recently:

http://aseigo.blogspot.com/2007/02/nested-dialogs-suck.html

so there's one more use case =)

as for this:

+    setFrameShape(QFrame::StyledPanel);
+    setFrameShadow(QFrame::Plain);
+    setBackgroundRole(QPalette::Base);

it's getting used a fair amount as the magic "pimp my information widget". my 
fear is that we'll change our mind on how this should be done in the future 
and then have to track down all instances of these three lines. perhaps 
better would be a KDialog static method that would take a QWidget* and style 
it properly, e.g.:

void KDialog::styleInformationDisplay( QWidget* w ) {
    QFrame* frame = qobject_cast<QFrame*>(w);
    if ( frame ) {
        setFrameShape(QFrame::StyledPanel);
        setFrameShadow(QFrame::Plain);
        setBackgroundRole(QPalette::Base);
    }
}

finally, i hate to be the style nazi, but please ensure that code meant for 
kdelibs follows the kde style guidelines:

	http://techbase.kde.org/Policies/Kdelibs_Coding_Style

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

Full time KDE developer sponsored by Trolltech (http://www.trolltech.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070312/9f1196a3/attachment.sig>


More information about the kde-core-devel mailing list