void CharactersWidget::paintEvent(TQPaintEvent *e) { TQSize mySize = sizeHint(); TQPainter painter(this); drawPossibleSelection( painter, mySize ); int center = _textSize.height()/2; int offset = 0; // draw the horizontal line and the label painter.drawLine(pw,center, bdSize,center); offset += pw + 2*bdSize; painter.drawText(offset, 0, _textSize.width(), _textSize.height(), 0, title()); offset += _textSize.width() + bdSize; painter.drawLine(offset, center, mySize.width(), center); // Draw the rest of the lines int y = mySize.width() - pw; int x = mySize.height() -pw; painter.drawLine(0,center,0,mySize.height()); painter.drawLine(y,center,y,mySize.height()); painter.drawLine(0,x,y,x); // Draw the text painter.drawText(bdSize, bdSize+_textSize.height(), _contentSize.width(), _contentSize.height(), 0, text()); RegExpWidget::paintEvent(e); }
void LookAheadWidget::paintEvent( QPaintEvent *e ) { // TODO: Merge with RepeatWidget::paintEvent QSize mySize = sizeHint(); QPainter painter(this); drawPossibleSelection( painter, mySize ); // move the child to its position and resize it. _child->move(pw,_textSize.height()+bdSize); _child->resize(mySize.width() - 2*pw, _childSize.height()); // Draw the border and the text. int startY = _textSize.height()/2; // Top lines and text painter.drawLine(pw,startY,bdSize,startY); painter.drawText(pw+2*bdSize,0,_textSize.width(), _textSize.height(),0, _text); int offset = pw + 3*bdSize + _textSize.width(); painter.drawLine(offset,startY,mySize.width()-pw,startY); // horizontal lines painter.drawLine(0,startY,0,mySize.height()-pw); painter.drawLine(mySize.width()-pw,startY,mySize.width()-pw, mySize.height()-pw); // buttom line painter.drawLine(0, mySize.height()-pw, mySize.width()-pw, mySize.height()-pw); SingleContainerWidget::paintEvent(e); }
void RepeatWidget::paintEvent( QPaintEvent *e ) { // TODO: Merge with LookAheadWidget::paintEvent QSize mySize = sizeHint(); QPainter painter(this); drawPossibleSelection( painter, mySize ); // move the child to its position and resize it. _child->move(pw,_textSize.height()+bdSize); QSize curChildSize = _child->size(); QSize newChildSize = QSize(mySize.width() - 2*pw, _childSize.height()); if ( curChildSize != newChildSize ) { _child->resize(newChildSize); // I resized the child, so give it a chance to relect thus. _child->update(); } // Draw the border and the text. int startY = _textSize.height()/2; // Top lines and text painter.drawLine(pw,startY,bdSize,startY); painter.drawText(pw+2*bdSize,0,_textSize.width(), _textSize.height(),0, _content->text()); int offset = pw + 3*bdSize + _textSize.width(); painter.drawLine(offset,startY,mySize.width()-pw,startY); // horizontal lines painter.drawLine(0,startY,0,mySize.height()-pw); painter.drawLine(mySize.width()-pw,startY,mySize.width()-pw, mySize.height()-pw); // buttom line painter.drawLine(0, mySize.height()-pw, mySize.width()-pw, mySize.height()-pw); SingleContainerWidget::paintEvent(e); }