Sunday, July 6th 2008, 4:17pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

R.M

Beginner

1

Sunday, May 4th 2008, 6:26pm

like painter program ,, problem in erasing from frame

Hello everyone ,,

I posted my problem in Qt Disigner but no one help me , may be I posted it a wrong place :(


I explain my problem in the link :

Problem in QPainter

any help is really really great appreciated ;(

Thanks in advance ,,

This post has been edited 1 times, last edit by "R.M" (May 4th 2008, 6:29pm)

  • Go to the top of the page

Messenger

Intermediate

Posts: 325

Location: Lt

2

Monday, May 5th 2008, 7:39am

RE: like painter program ,, problem in erasing from frame

Full compilable code would be nice.
Yes it is not related to Qt Designer.

Quoted

The problem was once I write on the frame and erase it ( using QWidget::erase())
and another window come over my window ,, all what was erased before is draw on the frame

You paint _buffer in paintEvent. Then other window travels over the window then the window recieves paintEvent and your buffered image is drawn.

Source code

1
2
3
4
5
6
7
void TextFrame :: paintEvent(QPaintEvent*)
{ 
    bitBlt(this , 0 , 0 , &_buffer) ;
// maybe better use
   // bitBlt(this, 0, 0, &_buffer, e->rect());
    
}

QWidget::erase() does not erases the _buffer. "Erase" _buffer too or just erase _buffer and update the frame. For example.

Source code

1
2
3
4
5
6
bufferpainter.begin(&_buffer);
bufferpainter.setPen...
... other setup...
bufferpainter.fill...Something(...
bufferpainter.end();
this->update(x, y, w, h); // update (repaint) changed rectangle.
Fighting fire with fire.

This post has been edited 1 times, last edit by "Messenger" (May 5th 2008, 7:40am)

  • Go to the top of the page

Rate this thread