[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: function of setButtons( Close ) of class KDialog
From: Kevin Krammer <kevin.krammer () gmx ! at>
Date: 2012-02-05 10:26:23
Message-ID: 201202051126.38700.kevin.krammer () gmx ! at
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Hi,
On Sunday, 2012-02-05, Rahul Sharma wrote:
> Hi,
> I was going through the source code of *Kmplot . *And at a place I got
> stuck with it when i found that in a class inherited from KDialog, a
> function setButtons( Close ) was used.
> I understand that it creates a close button in the window but I was willing
> to know that when the button is clicked, does it call close() slot (as
> normally we would do when we create a close pushbutton we connect the
> clicked() signal to the close() slot) or it just simply emits close event
> signal.
It does not call QWidget::close() but QDialog::done()
From lxr.kde.org [1]
914 case Close:
915 emit closeClicked();
916 done(Close); // KDE5: call reject() instead; more QDialog-like.
917 break;
This is necessary because a dialog might be run using QDialog::exec() which
returns an exit code allowing the caller to do different things depening on
result.
> And one more query, what is the name of the button, simpy close or
> something else ( as in QPushButton* closeButton, I can say that I created a
> PushButton named closeButton ).
It is not a member of the KDialog class if that is what you are asking.
It gets added to an internal button map with KDialog::Close being the key.
Again from lxr.kde.org
155 KPushButton *button = new KPushButton( item );
156 mButtonBox->addButton( button, role );
157
158 mButtonList.insert( key, button );
See KDialog::button(ButtonCode)
Cheers,
Kevin
[1] http://lxr.kde.org/source/kde/kdelibs/kdeui/dialogs/kdialog.cpp
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
["signature.asc" (application/pgp-signature)]
>> 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