Bug 96185 - application exits when trying to edit a "lookahead" widget
Summary: application exits when trying to edit a "lookahead" widget
Alias: None
Product: kregexpeditor
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Jesper Pedersen
Depends on:
Reported: 2005-01-02 21:41 UTC by Jesus Roncero
Modified: 2005-01-02 22:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Jesus Roncero 2005-01-02 21:41:36 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 3.3 
OS:                Linux

A debian user filed a bug [#287811 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287811 ] report against kregexpeditor noting the following behaviour:

1. run kregexpeditor
2. click a button of `Positive Look Ahead' or `Negative Look Ahead'
   in the toolbar
3. click in the gray area
4. right click the `Pos. Look Ahead' (or `Neg. Look Ahread')
5. select `Edit' in the context menu
Then kregexpeditor writes `This method should be overridden if needed!' to the console and exits.

I have downloaded the source code (from kde 3.3.2 and CVS) and it happens on both versions. I have read a little bit the source code and have found that it happens on RegExpWidget::edit(), a virtual function which needs to be reimplemented by one of its childer classes, right?

But, if you follow the procedure above it executes the parent edit windows, which in fact simply call to qFatal("This method should be overridden if needed!");

I haven't looked that far away in the source code, but I guess it needs to be reimplemented to deal with the lookahead widget. 

What I have done to avoid the application exiting, is adding something like this:

Index: regexpwidget.cpp
RCS file: /home/kde/kdeutils/kregexpeditor/regexpwidget.cpp,v
retrieving revision 1.13
diff -u -3 -p -r1.13 regexpwidget.cpp
--- regexpwidget.cpp    23 Dec 2004 02:50:40 -0000      1.13
+++ regexpwidget.cpp    2 Jan 2005 20:39:26 -0000
@@ -26,6 +26,7 @@
 #include <iostream>
 #include <qpainter.h>
 #include <qcursor.h>
+#include <qmessagebox.h>
 #include "concwidget.h"
 #include "dragaccepter.h"

@@ -110,7 +111,11 @@ RegExp* RegExpWidget::selection() const

 int RegExpWidget::edit()
-  qFatal("This method should be overridden if needed!");
+  //qFatal("This method should be overridden if needed!");
+  QMessageBox::warning(this, tr("Not implemented yet"),
+                 tr("Not implemented yet.<br>\n"),
+                tr("Ok") );
   return 0; // Compiler shut up

So, showing a dialog instead of exiting. But I don't know if that is a good solution.

Comment 1 Jesper Pedersen 2005-01-02 22:15:17 UTC
Well it shouldn't be editable at all, so the right fix is to override findWidgetToEdit to say:

RegExpWidget* LookAheadWidget::findWidgetToEdit( QPoint globalPos )
    return _child->findWidgetToEdit( globalPos );

Thanks for reporting.