Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2008
Re: QWebView::setCursor doesn't work as expected


Message 1 in thread

On Monday 31 March 2008 21.25:50 Holger Freyther wrote:
> On Monday 31 March 2008 16:26:38 Bernhard Rosenkränzer wrote:
> > When using QWebView::setCursor, the cursor isn't actually used, because
> > WebKit bits select different cursors depending on what HTML widget the
> > cursor is over.
> >
> > I think a widget that does this needs something like
> > QApplication::setOverrideCursor and QApplication::restoreOverrideCursor
> > (except it affects the widget's range only).
>
> Would you always want to use the cursor you set? For images, zooming, text
> selection, plugins loaded, scrolling...?

In this particular case, yes:

QWebView *a;
a->setCursor(Qt::WaitCursor);
a->evaluateJavaScript("Some JavaScript code that takes ages to complete");
a->setCursor(Qt::ArrowCursor); //<--- this should actually go back to the 
default set of cursors, so a per-widget variant of QApplication::
{set,restore}OverrideCursor really makes more sense.

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx


Message 2 in thread

On Tuesday 01 April 2008 15:31:40 Bernhard Rosenkränzer wrote:
> On Monday 31 March 2008 21.25:50 Holger Freyther wrote:
> > On Monday 31 March 2008 16:26:38 Bernhard Rosenkränzer wrote:
> > > When using QWebView::setCursor, the cursor isn't actually used, because
> > > WebKit bits select different cursors depending on what HTML widget the
> > > cursor is over.
> > >
> > > I think a widget that does this needs something like
> > > QApplication::setOverrideCursor and QApplication::restoreOverrideCursor
> > > (except it affects the widget's range only).
> >
> > Would you always want to use the cursor you set? For images, zooming,
> > text selection, plugins loaded, scrolling...?
>
> In this particular case, yes:
>
> QWebView *a;
> a->setCursor(Qt::WaitCursor);
> a->evaluateJavaScript("Some JavaScript code that takes ages to complete");
> a->setCursor(Qt::ArrowCursor); //<--- this should actually go back to the
> default set of cursors, so a per-widget variant of QApplication::
> {set,restore}OverrideCursor really makes more sense.

No, setCursor is the right API. It's a bug that it doesn't override the 
cursors specified in the HTML. There's a QWidget::unsetCursor() method as 
well, and that one should revert to the default behavior.

Cheers,
Lars

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx


Message 3 in thread

On Wednesday 02 April 2008, Bernhard Rosenkränzer wrote:
> On Wednesday 02 April 2008 20.06:13 Lars Knoll wrote:
> > > > Would you always want to use the cursor you set? For images, zooming,
> > > > text selection, plugins loaded, scrolling...?
> >
> > No, setCursor is the right API. It's a bug that it doesn't override the
> > cursors specified in the HTML. There's a QWidget::unsetCursor() method as
> > well, and that one should revert to the default behavior.
>
> Right... But there's still a need for another method -- probably best done
> as a setCursor() with different arguments:
>
> webview->setCursor(Qt::PointingHand, QCursor(QPixmap("somefile.png")));
>
> Basically, this would tell WebKit "change the cursor as you like, but if
> the stylesheet or context wants to switch to the PointingHand cursor, make
> it look like somefile.png".

To be honest, I currently don't really see the point of having such a method. 
Different cursor types should match the rest of your application.

Cheers,
Lars

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx