KHTMLView and QToolTip

View: New views
4 Messages — Rating Filter:   Alert me  

KHTMLView and QToolTip

by Bugzilla from kollix@aon.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

in checking https://bugs.kde.org/show_bug.cgi?id=95628
I found that KHTMLView/Part does not hide the tooltip when a new HTML page is
passed to it.
So I propose the following:

Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp      (Revision 1016745)
+++ khtml_part.cpp      (Arbeitskopie)
@@ -114,6 +114,7 @@
 #include <kurllabel.h>

 #include <QtGui/QClipboard>
+#include <QtGui/QToolTip>
 #include <QtCore/QFile>
 #include <QtCore/QMetaEnum>
 #include <QtGui/QTextDocument>
@@ -1987,6 +1988,9 @@

 void KHTMLPart::begin( const KUrl &url, int xOffset, int yOffset )
 {
+  if ( d->m_view->underMouse() )
+    QToolTip::hideText();  // in case a previous tooltip is still shown
+
   // No need to show this for a new page until an error is triggered
   if (!parentPart()) {
     removeJSErrorExtension();


But there is also the problem that the ToolTip does not hide when one moves
the content e.g. via the
keyboard.
I didn't find the correct place to add QToolTip::hideText(); ...

Any ideas ?
Is the above fix ok ?

--
Best regards/Schöne Grüße

Martin    ()  ascii ribbon campaign - against html mail
          /\                        - against microsoft attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at


signature.asc (196 bytes) Download Attachment

Re: KHTMLView and QToolTip

by Bugzilla from kollix@aon.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sunday 13 September 2009 19:43:07 Martin Koller wrote:

> Hi,
>
> in checking https://bugs.kde.org/show_bug.cgi?id=95628
> I found that KHTMLView/Part does not hide the tooltip when a new HTML page
>  is passed to it.
> So I propose the following:
>
> Index: khtml_part.cpp
> ===================================================================
> --- khtml_part.cpp      (Revision 1016745)
> +++ khtml_part.cpp      (Arbeitskopie)
> @@ -114,6 +114,7 @@
>  #include <kurllabel.h>
>
>  #include <QtGui/QClipboard>
> +#include <QtGui/QToolTip>
>  #include <QtCore/QFile>
>  #include <QtCore/QMetaEnum>
>  #include <QtGui/QTextDocument>
> @@ -1987,6 +1988,9 @@
>
>  void KHTMLPart::begin( const KUrl &url, int xOffset, int yOffset )
>  {
> +  if ( d->m_view->underMouse() )
> +    QToolTip::hideText();  // in case a previous tooltip is still shown
> +
>    // No need to show this for a new page until an error is triggered
>    if (!parentPart()) {
>      removeJSErrorExtension();
Thanks to David Faure I got a go for this patch.
Still, the following questions remain.

Anybody ?

>
>
> But there is also the problem that the ToolTip does not hide when one moves
> the content e.g. via the
> keyboard.
> I didn't find the correct place to add QToolTip::hideText(); ...
>
> Any ideas ?

--
Best regards/Schöne Grüße

Martin    ()  ascii ribbon campaign - against html mail
          /\                        - against microsoft attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at


signature.asc (196 bytes) Download Attachment

Re: KHTMLView and QToolTip

by Bugzilla from germain@ebooksfrance.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le lundi 14 septembre 2009, Martin Koller a écrit :

> On Sunday 13 September 2009 19:43:07 Martin Koller wrote:
> > Hi,
> >
> > in checking https://bugs.kde.org/show_bug.cgi?id=95628
> > I found that KHTMLView/Part does not hide the tooltip when a new HTML
> > page is passed to it.
> > So I propose the following:
> >
> > Index: khtml_part.cpp
> > ===================================================================
> > --- khtml_part.cpp      (Revision 1016745)
> > +++ khtml_part.cpp      (Arbeitskopie)
> > @@ -114,6 +114,7 @@
> >  #include <kurllabel.h>
> >
> >  #include <QtGui/QClipboard>
> > +#include <QtGui/QToolTip>
> >  #include <QtCore/QFile>
> >  #include <QtCore/QMetaEnum>
> >  #include <QtGui/QTextDocument>
> > @@ -1987,6 +1988,9 @@
> >
> >  void KHTMLPart::begin( const KUrl &url, int xOffset, int yOffset )
> >  {
> > +  if ( d->m_view->underMouse() )
> > +    QToolTip::hideText();  // in case a previous tooltip is still shown
> > +
> >    // No need to show this for a new page until an error is triggered
> >    if (!parentPart()) {
> >      removeJSErrorExtension();
>
> Thanks to David Faure I got a go for this patch.
> Still, the following questions remain.
Hi Martin,

for this you could use a similar check in KHTMLView::scrollContentsBy (see
attached for IMO best spot.)

Thanks,
Germain


[patch]

diff --git a/khtml/khtmlview.cpp b/khtml/khtmlview.cpp
index 2e9daae..0fbdefd 100644
--- a/khtml/khtmlview.cpp
+++ b/khtml/khtmlview.cpp
@@ -3878,6 +3878,9 @@ void KHTMLView::scrollContentsBy( int dx, int dy )
         }
     }
 
+    if ( underMouse() && QToolTip::isVisible() )
+        QToolTip::hideText();
+
     if ( d->shouldSmoothScroll && d->smoothScrollMode != SSMDisabled && m_part->xmlDocImpl() &&
           m_part->xmlDocImpl()->renderer() && (d->smoothScrollMode != SSMWhenEfficient || d->smoothScrollMissedDeadlines != sWayTooMany)) {
 


Re: KHTMLView and QToolTip

by Bugzilla from germain@ebooksfrance.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le mardi 15 septembre 2009, Germain Garand a écrit :
> Le lundi 14 septembre 2009, Martin Koller a écrit :
> (see
> attached for IMO best spot.)

sorry, on second thought, it'd be better after the check for smooth
scrolling... (as in attached.)




[patch2]

diff --git a/khtml/khtmlview.cpp b/khtml/khtmlview.cpp
index 2e9daae..75447c8 100644
--- a/khtml/khtmlview.cpp
+++ b/khtml/khtmlview.cpp
@@ -3899,6 +3899,9 @@ void KHTMLView::scrollContentsBy( int dx, int dy )
         }
     }
 
+    if ( underMouse() && QToolTip::isVisible() )
+        QToolTip::hideText();
+
     if (!d->scrollingSelf) {
         d->scrollBarMoved = true;
         d->contentsMoving = true;