Thanks a lot Kevin.
That really helped, but one more question, does the QDialog::done() emits a
close event signal as QWidget::close() in order to close the window (or
dialog) ?

Regards
-Rahul Sharma
On Sun, Feb 5, 2012 at 3:56 PM, Kevin Krammer <[email protected]> wrote:

> 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
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to