Solution for fillData->clip->clipRect.isEmpty() in Qt

After long time I'm going to write another blog post.  This is regarding the Qt and it will detail a solution for the problem of fillData->clip->clipRect.isEmpty(). I got this problem as below cage while trying to create a 'title block' for the engineering drawing. 

Sample title block (copy rights)
I created a QPrintPreviewDialog which previews engineering drawings generated by the application. I draw rectangle to represent title block which consists details of the drawing. At some points length of the detail higher than the space of the rectangle. Then I got below run-time error.

ASSERT: "!fillData->clip->clipRect.isEmpty()" in file painting/qpaintengine_raster.cpp, line 4435

The simple answer is you are going to write the text in the rectangle which is not have enough space to show your content.

You can do following things.
1. Increase the size of Rectangle.
2. Decrease the font size.
3. Or use Qt.TextElideMode

enum Qt::TextElideMode

This enum specifies where the ellipsis should appear when displaying texts that don't fit:

Qt::ElideLeft0The ellipsis should appear at the beginning of the text.
Qt::ElideRight1The ellipsis should appear at the end of the text.
Qt::ElideMiddle2The ellipsis should appear in the middle of the text.
Qt::ElideNone3Ellipsis should NOT appear in the text.