diff --git a/Packages/Qt_widget/doc_tex/Qt_widget_ref/Qt_widget.tex b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Qt_widget.tex index c67733acd50..879fc783139 100644 --- a/Packages/Qt_widget/doc_tex/Qt_widget_ref/Qt_widget.tex +++ b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Qt_widget.tex @@ -153,14 +153,14 @@ s it's a pointer to an existing layer.} \ccHeading{public slots:} \ccMethod{void redraw();}{If you derive from \ccc{Qt_widget} you have to overload this function and put your code for drawing here if you don't use -\ccc{layers}. Redraw the layers situated in the list. Before -redraw the layers, clears the screen. At the end is emitted the signal -\ccc{custom_redraw()}.} +\ccc{layers}. The best way is to attach layers to the widget and +call this method. This method redraws the layers attached and +active. Before drawing the layers, redraw clear the screen and emit +\ccc{redraw_on_back()}. Emit \ccc{redraw_on_front()} at the end.} \ccMethod{void print_to_ps();}{Redraws all the attached and active -layers into a Postscript device. It could be a file or a printer. If -you use the signal \ccc{custom_redraw()}, the painting that you do -using this signal will be drawn on top.} +layers into a Postscript device. It could be a file or a +printer. This method also use signals as \ccc{redraw_on_back()} or \ccc{redraw_on_front()}.} %Cgal \ccHeading{New CGAL Objects} @@ -285,8 +285,12 @@ function to receive the event.} \ccMethod{void new_cgal_object(CGAL::Object);}{Triggered when a new object from a tool is received. The user should catch this signal if it's working with tools that provide \cgal\ objects as input.} -\ccMethod{void custom_redraw();}{Emitted in the redraw() function after -the layers are drawn.} +\ccMethod{void custom_redraw();}{Deprecated: Emitted in the redraw() +function after the layers are drawn.} +\ccMethod{void redraw_on_back();}{Emmitted in redraw() method before +calling layer's redraw.} +\ccMethod{void redraw_on_front();}{Emmitted in redraw() method after +calling layer's redraw.} \input{Qt_widget_ref/Operators_for_output.tex} \input{Qt_widget_ref/Manipulators.tex} diff --git a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Qt_widget.tex b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Qt_widget.tex index c67733acd50..879fc783139 100644 --- a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Qt_widget.tex +++ b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Qt_widget.tex @@ -153,14 +153,14 @@ s it's a pointer to an existing layer.} \ccHeading{public slots:} \ccMethod{void redraw();}{If you derive from \ccc{Qt_widget} you have to overload this function and put your code for drawing here if you don't use -\ccc{layers}. Redraw the layers situated in the list. Before -redraw the layers, clears the screen. At the end is emitted the signal -\ccc{custom_redraw()}.} +\ccc{layers}. The best way is to attach layers to the widget and +call this method. This method redraws the layers attached and +active. Before drawing the layers, redraw clear the screen and emit +\ccc{redraw_on_back()}. Emit \ccc{redraw_on_front()} at the end.} \ccMethod{void print_to_ps();}{Redraws all the attached and active -layers into a Postscript device. It could be a file or a printer. If -you use the signal \ccc{custom_redraw()}, the painting that you do -using this signal will be drawn on top.} +layers into a Postscript device. It could be a file or a +printer. This method also use signals as \ccc{redraw_on_back()} or \ccc{redraw_on_front()}.} %Cgal \ccHeading{New CGAL Objects} @@ -285,8 +285,12 @@ function to receive the event.} \ccMethod{void new_cgal_object(CGAL::Object);}{Triggered when a new object from a tool is received. The user should catch this signal if it's working with tools that provide \cgal\ objects as input.} -\ccMethod{void custom_redraw();}{Emitted in the redraw() function after -the layers are drawn.} +\ccMethod{void custom_redraw();}{Deprecated: Emitted in the redraw() +function after the layers are drawn.} +\ccMethod{void redraw_on_back();}{Emmitted in redraw() method before +calling layer's redraw.} +\ccMethod{void redraw_on_front();}{Emmitted in redraw() method after +calling layer's redraw.} \input{Qt_widget_ref/Operators_for_output.tex} \input{Qt_widget_ref/Manipulators.tex} diff --git a/Packages/Qt_widget/include/CGAL/IO/Qt_widget.h b/Packages/Qt_widget/include/CGAL/IO/Qt_widget.h index 34358f37a2a..aa665b36dd8 100644 --- a/Packages/Qt_widget/include/CGAL/IO/Qt_widget.h +++ b/Packages/Qt_widget/include/CGAL/IO/Qt_widget.h @@ -195,7 +195,12 @@ signals: void s_leaveEvent(QEvent *e); void s_event(QEvent *e); - void custom_redraw(); // if user want to draw something after layers + void custom_redraw(); //deprecated: if user want to draw something + //after layers replaced by redraw_on_front + void redraw_on_front(); //called by redraw at the end + void redraw_on_back(); //called by redraw at the beginning + + void new_cgal_object(CGAL::Object); //this signal is emited every time an //attached tool constructed an object @@ -468,52 +473,52 @@ Qt_widget& operator<<(Qt_widget& w, const Point_2& p) { case PIXEL: { - w.get_painter().drawPoint(x,y); - break; + w.get_painter().drawPoint(x,y); + break; } case CROSS: { - w.get_painter().drawLine(x-size/2, y-size/2, x+size/2, y+size/2); - w.get_painter().drawLine(x-size/2, y+size/2, x+size/2, y-size/2); - break; + w.get_painter().drawLine(x-size/2, y-size/2, x+size/2, y+size/2); + w.get_painter().drawLine(x-size/2, y+size/2, x+size/2, y-size/2); + break; } case PLUS: { - w.get_painter().drawLine(x, y-size/2, x, y+size/2); - w.get_painter().drawLine(x-size/2, y, x+size/2, y); - break; + w.get_painter().drawLine(x, y-size/2, x, y+size/2); + w.get_painter().drawLine(x-size/2, y, x+size/2, y); + break; } case CIRCLE: { - QBrush old_brush=w.get_painter().brush(); - w.get_painter().setBrush(QBrush()); - w.get_painter().drawEllipse(x-size/2, y-size/2, size, size); - w.get_painter().setBrush(old_brush); - break; + QBrush old_brush=w.get_painter().brush(); + w.get_painter().setBrush(QBrush()); + w.get_painter().drawEllipse(x-size/2, y-size/2, size, size); + w.get_painter().setBrush(old_brush); + break; } case DISC: { - QBrush old_brush=w.get_painter().brush(); - w.get_painter().setBrush(w.get_painter().pen().color()); - w.get_painter().drawEllipse(x-size/2, y-size/2, size, size); - w.get_painter().setBrush(old_brush); - break; + QBrush old_brush=w.get_painter().brush(); + w.get_painter().setBrush(w.get_painter().pen().color()); + w.get_painter().drawEllipse(x-size/2, y-size/2, size, size); + w.get_painter().setBrush(old_brush); + break; } case RECT: { - QBrush old_brush=w.get_painter().brush(); - w.get_painter().setBrush(QBrush()); - w.get_painter().drawRect(x-size/2, y-size/2, size, size); - w.get_painter().setBrush(old_brush); - break; + QBrush old_brush=w.get_painter().brush(); + w.get_painter().setBrush(QBrush()); + w.get_painter().drawRect(x-size/2, y-size/2, size, size); + w.get_painter().setBrush(old_brush); + break; } case BOX: { - QBrush old_brush=w.get_painter().brush(); - w.get_painter().setBrush(w.get_painter().pen().color()); - w.get_painter().drawRect(x-size/2, y-size/2, size, size); - w.get_painter().setBrush(old_brush); - break; + QBrush old_brush=w.get_painter().brush(); + w.get_painter().setBrush(w.get_painter().pen().color()); + w.get_painter().drawRect(x-size/2, y-size/2, size, size); + w.get_painter().setBrush(old_brush); + break; } }; w.do_paint(); diff --git a/Packages/Qt_widget/src/CGALQt/Qt_widget.C b/Packages/Qt_widget/src/CGALQt/Qt_widget.C index 87da790515c..13f7bb345c2 100644 --- a/Packages/Qt_widget/src/CGALQt/Qt_widget.C +++ b/Packages/Qt_widget/src/CGALQt/Qt_widget.C @@ -520,11 +520,13 @@ void Qt_widget::clear() { painter->setClipping(true); painter->setClipRect(rect()); lock(); + emit(redraw_on_back()); std::list::iterator it; for(it = qt_layers.begin(); it!= qt_layers.end(); it++) if((*it)->is_active()) (*it)->draw(); - emit(custom_redraw()); + emit(custom_redraw()); //deprecated, should use the following: + emit(redraw_on_front()); unlock(); delete painter; painter = ptemp; @@ -537,15 +539,17 @@ void Qt_widget::clear() { { clear(); lock(); + emit(redraw_on_back()); std::list::iterator it; - for(it = qt_layers.begin(); it!= qt_layers.end(); it++) - if((*it)->is_active()) - (*it)->draw(); + for(it = qt_layers.begin(); it!= qt_layers.end(); it++) + if((*it)->is_active()) + (*it)->draw(); for(it = qt_standard_layers.begin(); it!= qt_standard_layers.end(); it++) - if((*it)->is_active()) - (*it)->draw(); - emit(custom_redraw()); + if((*it)->is_active()) + (*it)->draw(); + emit(custom_redraw()); //deprecated, should use the following: + emit(redraw_on_front()); unlock(); } };