Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, May 2007
Porting from Qt3 : NotXorROP


Message 1 in thread

I am porting application from qt3 to qt4

I tried to find an alternative to

QPainter::setRasterOp( Qt::NotXorROP );

Docs says the rasterOp was replaced by QPainter::CompositionMode,
however, there is only "regular" xor (QPainter::CompositionMode_Xor),
which is equivalent to Qt::XorROP in qt3 - dst = src XOR dst.

However, I need something equivalent Qt::NotXorROP - dst = (NOT src)
XOR dst, I found nothing like that in QPainter::CompositionMode.

Is there some simpler alternative other than negating source
colors/images in all the repaint events? (which mean rewrite all the
repaint code to handle "negated" and "nonnegated" case)

Martin Petricek

--
 [ signature omitted ] 

Message 2 in thread

if you just need to show a selection on top of a bitmap, without
destroying that, use QRubberBand.

also note that CompositionMode_Xor is not the same as the bitwise Xor.
(it's only affecting alpha channel)

Cheers,
Peter

> -----Original Message-----
> From: BH [mailto:singularita@xxxxxxxxx]
> Sent: Wednesday, May 23, 2007 1:38 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Porting from Qt3 : NotXorROP
> 
> I am porting application from qt3 to qt4
> 
> I tried to find an alternative to
> 
> QPainter::setRasterOp( Qt::NotXorROP );
> 
> Docs says the rasterOp was replaced by QPainter::CompositionMode,
> however, there is only "regular" xor (QPainter::CompositionMode_Xor),
> which is equivalent to Qt::XorROP in qt3 - dst = src XOR dst.
> 
> However, I need something equivalent Qt::NotXorROP - dst = (NOT src)
> XOR dst, I found nothing like that in QPainter::CompositionMode.
> 
> Is there some simpler alternative other than negating source
> colors/images in all the repaint events? (which mean rewrite all the
> repaint code to handle "negated" and "nonnegated" case)
> 
> Martin Petricek

--
 [ signature omitted ] 

Message 3 in thread

QRubberBand have disadvantage of allowing only line and rectangle shapes.
While on some modes QRubberBand is sufficient, some modes use
arbitrary set of rectangles (few hundred or thousand in common cases)
to show selected objects or more weird shapes (like when selecting a
text in text editor. The "selected" rectangles can even go outside the
rectangle between the start and end points).

Now I noticed:
Warning: You can only set the composition mode for QPainter objects
that operates on a QImage.

Too bad, I'm drawing directly on screen :(

So there is no way in qt4 to use XOR or notXOR when drawing with QPainter?

Martin Petricek

On 5/23/07, Peter Prade <prade@xxxxxxxxxxx> wrote:
> if you just need to show a selection on top of a bitmap, without
> destroying that, use QRubberBand.
>
> also note that CompositionMode_Xor is not the same as the bitwise Xor.
> (it's only affecting alpha channel)
>
> Cheers,
> Peter
>
> > -----Original Message-----
> > From: BH [mailto:singularita@xxxxxxxxx]
> > Sent: Wednesday, May 23, 2007 1:38 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: Porting from Qt3 : NotXorROP
> >
> > I am porting application from qt3 to qt4
> >
> > I tried to find an alternative to
> >
> > QPainter::setRasterOp( Qt::NotXorROP );
> >
> > Docs says the rasterOp was replaced by QPainter::CompositionMode,
> > however, there is only "regular" xor (QPainter::CompositionMode_Xor),
> > which is equivalent to Qt::XorROP in qt3 - dst = src XOR dst.
> >
> > However, I need something equivalent Qt::NotXorROP - dst = (NOT src)
> > XOR dst, I found nothing like that in QPainter::CompositionMode.
> >
> > Is there some simpler alternative other than negating source
> > colors/images in all the repaint events? (which mean rewrite all the
> > repaint code to handle "negated" and "nonnegated" case)
> >
> > Martin Petricek
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 4 in thread

> So there is no way in qt4 to use XOR or notXOR when drawing with
QPainter?

nope.

but see suggestion #89727 in tasktracker (place 4 of the top 10
suggestions)
http://trolltech.com/customer/task-tracker/index_html?method=entry&id=89
727

go and vote for it if you have a commercial license ;)
(hmm, voting seems to be disabled? whats this? hope it's only temporary)

Cheers,
Peter

--
 [ signature omitted ] 

Message 5 in thread

> but see suggestion #89727 in tasktracker (place 4 of the top 10
> suggestions)
> http://trolltech.com/customer/task-tracker/index_html?method=entry&id=89
> 727
> 
> go and vote for it if you have a commercial license ;)
> (hmm, voting seems to be disabled? whats this? hope it's only temporary)


Indeed, and the tracked bugs/suggestions are also gone. Furthermore the 
URL changed from "www.trolltech.com/..." to "trolltech.com/...", so my 
password manager doesn't recognize the page anymore :-(
Strange things are going on... Could we have a statement from the 
Trolls' webmaster, please?

Martin

-- 
 [ signature omitted ] 

Message 6 in thread

Martin Gebert schrieb:
>> ...
> URL changed from "www.trolltech.com/..." to "trolltech.com/...", so my 
> password manager doesn't recognize the page anymore :-(
> Strange things are going on... Could we have a statement from the 
> Trolls' webmaster, please?

Maybe they stick to the new-hype-no-www-because-it's-so-cool movement:

   http://no-www.org/

;)

Cheers, Oliver

--
 [ signature omitted ] 

Message 7 in thread

> Maybe they stick to the new-hype-no-www-because-it's-so-cool movement:
> 
>   http://no-www.org/
> 
> ;)
> 
> Cheers, Oliver

Oh great, another techireligious issue the world doesn't need or even 
care of...

http://www.codinghorror.com/blog/archives/000247.html

Martin

-- 
 [ signature omitted ] 

Message 8 in thread

On May 23, 2007, Martin Gebert wrote:
> > Maybe they stick to the new-hype-no-www-because-it's-so-cool movement:
> >
> >   http://no-www.org/
> >
> > ;)
> >
> > Cheers, Oliver
>
> Oh great, another techireligious issue the world doesn't need or even
> care of...
>
> http://www.codinghorror.com/blog/archives/000247.html
>
> Martin

Not true, I think its a pita if a site doesn't work without the www. bit. its 
a whole line in an apache config. ServerAlias www.site.com  not exactly hard 
to do, and it helps usability somewhat.

-- 
 [ signature omitted ] 

Message 9 in thread

On 5/23/07, Peter Prade <prade@xxxxxxxxxxx> wrote:
...
> but see suggestion #89727 in tasktracker (place 4 of the top 10
> suggestions)
> http://trolltech.com/customer/task-tracker/index_html?method=entry&id=89
> 727
>
> go and vote for it if you have a commercial license ;)
> (hmm, voting seems to be disabled? whats this? hope it's only temporary)

Actually, I am developing GPL'ed software and thus I am using the GPL version.
Unfortunately, I can't see the suggestion.
What is this suggestion about?

Martin Petricek

--
 [ signature omitted ] 

Message 10 in thread

i'm sorry, i posted the commercial link.
you can still look up the issue on the task tracker here:
http://trolltech.com/developer/task-tracker/index_html?id=89727+&method=
entry

you won't be able to vote on it though.

and yes, i agree, this can be a major hurdle in porting from Qt3 to 4.
(TT should hurry to implement this, before all the people that need it
waste large amounts of time to work around this)

Cheers,
Peter
> -----Original Message-----
> From: BH [mailto:singularita@xxxxxxxxx]
> Sent: Thursday, May 24, 2007 2:38 AM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Re: Porting from Qt3 : NotXorROP
> 
> On 5/23/07, Peter Prade <prade@xxxxxxxxxxx> wrote:
> ...
> > but see suggestion #89727 in tasktracker (place 4 of the top 10
> > suggestions)
> >
http://trolltech.com/customer/task-tracker/index_html?method=entry&id=89
> > 727
> >
> > go and vote for it if you have a commercial license ;)
> > (hmm, voting seems to be disabled? whats this? hope it's only
temporary)
> 
> Actually, I am developing GPL'ed software and thus I am using the GPL
> version.
> Unfortunately, I can't see the suggestion.
> What is this suggestion about?
> 
> Martin Petricek
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 11 in thread

BH wrote:
>
> So there is no way in qt4 to use XOR or notXOR when drawing with 
> QPainter?

What are you trying to do with XOR/notXOR?

If it's drawing a selection box, then the only way I know in Qt4 using 
QPainter is to
render the box to a pixmap with transparent background during the 
mouseMoveEvent()
and draw  that on top of your data in paintEvent().

It will eat up all your CPU as you move your mouse about compared to 
using XOR in
Qt3 of course. The alternative is to move to openGL...

- Keith



--
 [ signature omitted ] 

Message 12 in thread

On 5/23/07, Keith Sabine <keith@xxxxxxxxxxxxxx> wrote:
> BH wrote:
> >
> > So there is no way in qt4 to use XOR or notXOR when drawing with
> > QPainter?
>
> What are you trying to do with XOR/notXOR?

Drawing multiple selected shape overlays (usually they are boxes, but
not always) (and sometimes the selection box too)

> If it's drawing a selection box, then the only way I know in Qt4 using
> QPainter is to
> render the box to a pixmap with transparent background during the
> mouseMoveEvent()
> and draw  that on top of your data in paintEvent().
>
> It will eat up all your CPU as you move your mouse about compared to
> using XOR in
> Qt3 of course. The alternative is to move to openGL...

I can't rely on working OpenGL support on target machines (it is not
always available and may be slow or problematic in virtual machines or
over remote connections (X11/VNC). Unfortunately, I use VM's and
remote connections while developing and testing ...).

Maybe I can read the pixels, xor them "manually" and write them back ...
That may be slower, but since the content of widget is available as
image (cached image as result of drawing part of PDF page) I may save
reading the pixels from the widget ....

Hmmm ... either way it is quite large rewrite of existing code ... sigh .. :(

I wonder why this feature was dropped from Qt4 ...

Martin Petricek

--
 [ signature omitted ]