[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KStatusBar::insertItem() ... not temporary label ?
From: "dave selby" <dave6502 () googlemail ! com>
Date: 2007-06-07 18:27:50
Message-ID: f52017b60706071127u6034450h9a350474dee81c43 () mail ! gmail ! com
[Download RAW message or body]
In KDE 3.5 & 4.0 APIs it states that ...
A special type of item is a message which is a temporary text-message
displayed on top of other items in full-width. Messages are visible
for specified time, or until you call the slot QStatusBar::clear().
See QStatusBar::message for details.
This worked fine in the KDE 3.5 version of kcron because ...
In KDE 3.5 API KStatusbar::insertItem is coded as ...
00078 void KStatusBar::insertItem( const QString& text, int id, int
stretch, bool permanent)
00079 {
00080 if (items[id])
00081 kdDebug() << "KStatusBar::insertItem: item id " << id << "
already exists." << endl;
00082
00083 KStatusBarLabel *l = new KStatusBarLabel (text, id, this);
00084 l->setFixedHeight(fontMetrics().height()+2);
00085 items.insert(id, l);
00086 addWidget (l, stretch, permanent);
00087 l->show();
00088 }
Passing the permanent flag to 'addWidget'
However In KDE 4.0 API KStatusbar::insertItem has been split into
KStatusbar::insertItem and KStatusbar::insertPermanentItem and is
coded as ...
00090 void KStatusBar::insertItem( const QString& text, int id, int stretch)
00091 {
00092 if ( d->items[id] ) {
00093 kDebug() << "KStatusBar::insertItem: item id " << id <<
" already exists." << endl;
00094 }
00095
00096 KSqueezedTextLabel *l = new KSqueezedTextLabel( text, this );
00097 l->installEventFilter( this );
00098 l->setFixedHeight( fontMetrics().height() + 2 );
00099 l->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
00100 d->items.insert( id, l );
00101 addPermanentWidget( l, stretch );
00102 l->show();
00103 }
00104
00105 void KStatusBar::insertFixedItem( const QString& text, int id )
00106 {
00107 insertItem( text, id, 0 );
00108 setItemFixed( id );
00109 }
00110
00111
00112 void KStatusBar::insertPermanentItem( const QString& text, int
id, int stretch)
00113 {
00114 if (d->items[id]) {
00115 kDebug() << "KStatusBar::insertPermanentItem: item id "
<< id << " already exists." << endl;
00116 }
00117
00118 QLabel *l = new QLabel( text, this );
00119 l->installEventFilter( this );
00120 l->setFixedHeight( fontMetrics().height() + 2 );
00121 l->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
00122 d->items.insert( id, l );
00123 addPermanentWidget( l, stretch );
00124 l->show();
Should not line 0101 have been
000101 addWidget( l, stretch );
instead of ...
000101 addPermanentWidget( l, stretch );
to allow KStatusBar::insertItem to add a fixed width temporary text
label into the status bar as opposed to a fixed width permanent text
label into status bar. So ...
statusBar()->insertItem(i18n("Ready."), statusMessage, 1);
statusBar()->showMessage(text, 2000);
would work as expected ? - ie back drop of "ready" and two second
flash of text as a help message.
OK I am probably speaking baloney - and have b0rked out :)
If no one replies I will assume I have totally lost it - and wait for
my "C++ GUI Programming with QT 4" to arrive, read it thoroughly, and
know more what I am talking about when I next post here :)
Thanks for your patience
Dave
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic