Skip to content

Commit 4fd8fce

Browse files
committed
Styling changes for the subwindow decoration
1 parent 47f5b25 commit 4fd8fce

File tree

3 files changed

+31
-26
lines changed

3 files changed

+31
-26
lines changed

data/themes/default/style.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ QToolButton#stopButton {
409409
/* all tool buttons */
410410

411411
QToolButton:hover {
412-
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #c0cdd3, stop:1 #71797d);
413-
color: white;
412+
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #c0cdd3, stop:1 #71797d);
413+
color: white;
414414
}
415415

416416
QToolButton:pressed {
@@ -540,7 +540,7 @@ BBTCOView {
540540
qproperty-textColor: rgb( 255, 255, 255 );
541541
}
542542

543-
/* subwindows in MDI-Area */
543+
/* Subwindows in MDI-Area */
544544
SubWindow {
545545
color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
546546
stop: 0 #4b525c, stop: 1.0 #31363d);
@@ -550,28 +550,28 @@ SubWindow {
550550
qproperty-borderColor: rgb( 0, 0, 0 );
551551
}
552552

553-
/*SubWindow Title Text */
553+
/* Subwindow title text */
554554
SubWindow > QLabel {
555555
color: rgb( 255, 255, 255 );
556556
font-size: 12px;
557557
font-style: normal;
558-
}
558+
}
559559

560-
/*SubWindow titlebar button */
560+
/* SubWindow titlebar button */
561561
SubWindow > QPushButton {
562562
background-color: rgba( 255, 255, 255, 0% );
563563
border-width: 0px;
564564
border-color: none;
565565
border-style: none;
566-
}
566+
}
567567

568568
SubWindow > QPushButton:hover{
569569
background-color: rgba( 255, 255, 255, 15% );
570570
border-width: 1px;
571571
border-color: rgba( 0, 0, 0, 20% );
572572
border-style: solid;
573573
border-radius: 2px;
574-
}
574+
}
575575

576576

577577
/* Plugins */

include/SubWindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class EXPORT SubWindow : public QMdiSubWindow
7878
QPoint m_position;
7979
QRect m_trackedNormalGeom;
8080
QLabel * m_windowTitle;
81-
QGraphicsDropShadowEffect* m_shadow;
81+
QGraphicsDropShadowEffect * m_shadow;
8282

8383
static void elideText( QLabel *label, QString text );
8484
};

src/gui/SubWindow.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

194194
void 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

Comments
 (0)