[PATCH] KReplace - Prompt on replace broken

Thomas McGuire thomas.mcguire at gmx.net
Fri Nov 9 14:45:19 CET 2007


On Friday 09 November 2007, David Faure wrote:
> On Thursday 08 November 2007, Thomas McGuire wrote:
> > Hi,
> >
> > KReplace is broken for me, the prompt on replace dialog is never shown,
> > because it has size 0.
> >
> > To reproduce:
> > 1. Open Konqueor on dot.kde.org, go to some story, and reply.
> > 2. Enter "asdf" in the comment area
> > 3. Right-click, then "Replace"
> > 4. Text to find: "asdf". Make sure "Prompt on replace" is checked
> > 5. You now should see a prompt dialog (Close/Replace/Skip/Cancel), but
> > you don't, because that dialog has size 0 and is therefore invisible
> >
> > The reason is resize(minimumSize()) in
> > KReplaceNextDialog::KReplaceNextDialog(). minimumSize() here returns 0.
>
> Indeed I get 0x0 for minimumSize here too. But I stepped into that resize()
> call and qwidget_x11.cpp says:
> 2115            if (w == 0 || h == 0) {
> 2116                q->setAttribute(Qt::WA_OutsideWSRange, true);  // we
> get there 
> q->testAttribute(Qt::WA_Mapped)) 2118                    hide_sys(); // we
> don't get there
> and the show() call goes into QDialog::setVisible(true) which shows it with
> (gdb) p rect()
> $18 = {x1 = 0, y1 = 0, x2 = 368, y2 = 81}
I was curious and tried the same. Interestingly, rect() has the about the same 
values for me, but the window is not shown despite that. I wonder why, but I 
don't care too much now that replacing works for me again.

> But yeah, I agree that asking for minimumSize() makes no sense. The one who
> wrote this forgot that
>  - minimumSizeHint/sizeHint is what the _widget_ thinks
>  - mimumSize/maximumSize/fixedSize is what the _user_ of the widget thinks.
> And in this case the user code didn't set anything so minimumSize is
> obviously 0x0.
>
> Hmm, the author might have been me, it seems. Oh well, I was young and
> inexperienced :-)
>
> > The attached patch simpy removes the line with resize().
>
> Please commit.
OK, commited.

Regards,
Thomas




More information about the Kdelibs-bugs mailing list