This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KDialog::exec() is returning wrong values

Tags: None
(comma "," separated)
User avatar
Arjun AK
Registered Member
Posts
10
Karma
0
KDialog::exec() in katesavemodifieddialog.cpp is returning wrong values (128 and 256) even when 'done(42)' is called. can someone tell me what is happening here? According to the Qt documentation, exec is supposed to return the dialogcode. Does this have anything to do with this
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
How do you check that it returns the wrong value?


I'm working on the KDevelop IDE.
User avatar
Arjun AK
Registered Member
Posts
10
Karma
0
scummos wrote:How do you check that it returns the wrong value?


Using gdb
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
And more exactly?

Also, does it actually cause issues?


I'm working on the KDevelop IDE.
User avatar
Arjun AK
Registered Member
Posts
10
Karma
0
scummos wrote:And more exactly?

Code: Select all
int returnValue = dialog.exec();

and then examining "returnValue"

Also, does it actually cause issues?

yes, value returned by exec() is not equal to either QDialog::Accepted or QDialog::Rejected, when accepted() or rejected() are called
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
... yes, but what real-world issue does this supposed bug cause, effectively?


I'm working on the KDevelop IDE.
User avatar
Arjun AK
Registered Member
Posts
10
Karma
0
scummos wrote:... yes, but what real-world issue does this supposed bug cause, effectively?


We need the return value to know whether the user clicked on the ok button or the cancel button.
Code: Select all
int returnValue = dialog.exec();
if (KDialog::Accept == returnValue) {
    // user pressed the ok button
} else if (KDialog::Rejected == returnValue) {
    // user pressed the cancel button
} else {
    // this is not supposed to happen, unless we call done();
}


Can you reproduce the issue?
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
I have used KDialog::exec before and never had this issue. Can you provide a minimal example of it not working?


I'm working on the KDevelop IDE.


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], Yahoo [Bot]