| 94 | |
| 95 | |
| 96 | void SubWindow::paintEvent( QPaintEvent * ) |
| 97 | { |
| 98 | QPainter p( this ); |
| 99 | QRect rect( 0, 0, width(), m_titleBarHeight ); |
| 100 | |
| 101 | bool isActive = mdiArea() |
| 102 | ? mdiArea()->activeSubWindow() == this |
| 103 | : false; |
| 104 | |
| 105 | p.fillRect( rect, isActive ? activeColor() : p.pen().brush() ); |
| 106 | |
| 107 | // window border |
| 108 | p.setPen( borderColor() ); |
| 109 | |
| 110 | // bottom, left, and right lines |
| 111 | p.drawLine( 0, height() - 1, width(), height() - 1 ); |
| 112 | p.drawLine( 0, m_titleBarHeight, 0, height() - 1 ); |
| 113 | p.drawLine( width() - 1, m_titleBarHeight, width() - 1, height() - 1 ); |
| 114 | |
| 115 | // window icon |
| 116 | if( widget() ) |
| 117 | { |
| 118 | QPixmap winicon( widget()->windowIcon().pixmap( m_buttonSize ) ); |
| 119 | p.drawPixmap( 3, 3, m_buttonSize.width(), m_buttonSize.height(), winicon ); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | |
| 124 | |