@@ -47,11 +47,11 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
4747 m_textShadowColor = Qt::black;
4848 m_borderColor = Qt::black;
4949
50- // close, minimize, maximize and restore(after minimize ) buttons
50+ // close, minimize, maximize and restore (after minimizing ) buttons
5151 m_closeBtn = new QPushButton ( embed::getIconPixmap ( " close" ), QString::null, this );
5252 m_closeBtn->resize ( m_buttonSize );
5353 m_closeBtn->setFocusPolicy ( Qt::NoFocus );
54- m_closeBtn->setToolTip (tr ( " Close" ));
54+ m_closeBtn->setToolTip ( tr ( " Close" ) );
5555 connect ( m_closeBtn, SIGNAL ( clicked ( bool ) ), this , SLOT ( close () ) );
5656
5757 m_maximizeBtn = new QPushButton ( embed::getIconPixmap ( " maximize" ), QString::null, this );
@@ -72,7 +72,7 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
7272 m_restoreBtn->setToolTip ( tr ( " Restore" ) );
7373 connect ( m_restoreBtn, SIGNAL ( clicked ( bool ) ), this , SLOT ( showNormal () ) );
7474
75- // QLabel for window title and shadow effect
75+ // QLabel for the window title and the shadow effect
7676 m_shadow = new QGraphicsDropShadowEffect ();
7777 m_shadow->setColor ( m_textShadowColor );
7878 m_shadow->setXOffset ( 1 );
@@ -102,7 +102,7 @@ void SubWindow::paintEvent( QPaintEvent * )
102102 p.drawLine ( 0 , m_titleBarHeight, 0 , height () - 1 );
103103 p.drawLine ( width () - 1 , m_titleBarHeight, width () - 1 , height () - 1 );
104104
105- // window icon
105+ // window icon
106106 QPixmap winicon ( widget ()->windowIcon ().pixmap ( m_buttonSize ) );
107107 p.drawPixmap ( 3 , 3 , m_buttonSize.width (), m_buttonSize.height (), winicon );
108108}
@@ -181,7 +181,7 @@ void SubWindow::moveEvent( QMoveEvent * event )
181181{
182182 QMdiSubWindow::moveEvent ( event );
183183 // if the window was moved and ISN'T minimized/maximized/fullscreen,
184- // then save the current position
184+ // then save the current position
185185 if ( !isMaximized () && !isMinimized () && !isFullScreen () )
186186 {
187187 m_trackedNormalGeom.moveTopLeft ( event->pos () );
@@ -193,7 +193,7 @@ void SubWindow::moveEvent( QMoveEvent * event )
193193
194194void SubWindow::resizeEvent ( QResizeEvent * event )
195195{
196- /* button adjustments*/
196+ // button adjustments
197197 m_minimizeBtn->hide ();
198198 m_maximizeBtn->hide ();
199199 m_restoreBtn->hide ();
@@ -206,22 +206,23 @@ void SubWindow::resizeEvent( QResizeEvent * event )
206206 QPoint middleButtonPos ( width () - rightSpace - ( 2 * m_buttonSize.width () ) - buttonGap, 3 );
207207 QPoint leftButtonPos ( width () - rightSpace - ( 3 * m_buttonSize.width () ) - ( 2 * buttonGap ), 3 );
208208
209- // The buttonBarWidth relates on the count of button .
210- // We need it to calculate the width of window title label
209+ // the buttonBarWidth depends on the number of buttons .
210+ // we need it to calculate the width of window title label
211211 int buttonBarWidth = rightSpace + m_buttonSize.width ();
212212
213- // set the buttons on their positions.
214- // the close button is ever needed and on the rightButtonPos
213+ // set the buttons on their positions.
214+ // the close button is always needed and on the rightButtonPos
215215 m_closeBtn->move ( rightButtonPos );
216216
217- // here we ask: is the Subwindow maximizable and/or minimizable
218- // then we set the buttons and show them if needed
217+ // here we ask: is the Subwindow maximizable and/or minimizable
218+ // then we set the buttons and show them if needed
219219 if ( windowFlags () & Qt::WindowMaximizeButtonHint )
220220 {
221221 buttonBarWidth = buttonBarWidth + m_buttonSize.width () + buttonGap;
222222 m_maximizeBtn->move ( middleButtonPos );
223223 m_maximizeBtn->show ();
224224 }
225+
225226 if ( windowFlags () & Qt::WindowMinimizeButtonHint )
226227 {
227228 buttonBarWidth = buttonBarWidth + m_buttonSize.width () + buttonGap;
@@ -253,21 +254,25 @@ void SubWindow::resizeEvent( QResizeEvent * event )
253254 // title QLabel adjustments
254255 m_windowTitle->setAlignment ( Qt::AlignHCenter );
255256 m_windowTitle->setFixedWidth ( widget ()->width () - ( menuButtonSpace + buttonBarWidth ) );
256- m_windowTitle->move ( menuButtonSpace, ( m_titleBarHeight / 2 ) - ( m_windowTitle->sizeHint ().height () / 2 ) - 1 );
257- // if minimized we can't use widget()->width(). We have to set the width hard coded
258- // the width of all minimized windows is the same.
257+ m_windowTitle->move ( menuButtonSpace,
258+ ( m_titleBarHeight / 2 ) - ( m_windowTitle->sizeHint ().height () / 2 ) - 1 );
259+
260+ // if minimized we can't use widget()->width(). We have to hard code the width,
261+ // as the width of all minimized windows is the same.
259262 if ( isMinimized () )
260263 {
261264 m_windowTitle->setFixedWidth ( 120 );
262265 }
263- // for truncate the Label String if the window is to small. Adds "..."
266+
267+ // truncate the label string if the window is to small. Adds "..."
264268 elideText ( m_windowTitle, widget ()->windowTitle () );
265269 m_windowTitle->setTextInteractionFlags ( Qt::NoTextInteraction );
266270 m_windowTitle->adjustSize ();
267271
268272 QMdiSubWindow::resizeEvent ( event );
273+
269274 // if the window was resized and ISN'T minimized/maximized/fullscreen,
270- // then save the current size
275+ // then save the current size
271276 if ( !isMaximized () && !isMinimized () && !isFullScreen () )
272277 {
273278 m_trackedNormalGeom.setSize ( event->size () );
0 commit comments