Skip to content

Commit d04c386

Browse files
Splitted stylesheets into default and focus_highlighting to properly support both use cases
1 parent 6a25de3 commit d04c386

File tree

6 files changed

+325
-134
lines changed

6 files changed

+325
-134
lines changed

src/DockManager.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,14 @@ void DockManagerPrivate::loadStylesheet()
181181
{
182182
initResource();
183183
QString Result;
184+
QString FileName = ":ads/stylesheets/";
185+
FileName += CDockManager::testConfigFlag(CDockManager::FocusHighlighting)
186+
? "focus_highlighting" : "default";
184187
#ifdef Q_OS_LINUX
185-
QFile StyleSheetFile(":ads/stylesheets/default_linux.css");
186-
#else
187-
QFile StyleSheetFile(":ads/stylesheets/default.css");
188+
FileName += "_linux";
188189
#endif
190+
FileName += ".css";
191+
QFile StyleSheetFile(FileName);
189192
StyleSheetFile.open(QIODevice::ReadOnly);
190193
QTextStream StyleSheetStream(&StyleSheetFile);
191194
Result = StyleSheetStream.readAll();

src/ads.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
<file>images/close-button-disabled.svg</file>
66
<file>stylesheets/default_linux.css</file>
77
<file>images/close-button-focused.svg</file>
8+
<file>stylesheets/focus_highlighting.css</file>
9+
<file>stylesheets/focus_highlighting_linux.css</file>
810
</qresource>
911
</RCC>

src/stylesheets/default.css

Lines changed: 7 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11

22
/*
33
* Default style sheet on Windows Platforms
4-
* Note: Always use CSS-classes with and without "ads--" namespace to support Qt4 & Qt5
54
*/
65

76
ads--CDockContainerWidget
87
{
98
background: palette(dark);
109
}
1110

11+
ads--CDockContainerWidget QSplitter::handle
12+
{
13+
background: palette(dark);
14+
}
1215

1316
ads--CDockAreaWidget
1417
{
@@ -78,74 +81,13 @@ QScrollArea#dockWidgetScrollArea
7881

7982
#tabCloseButton:hover
8083
{
81-
/*border: 1px solid rgba(0, 0, 0, 32);*/
82-
background: rgba(0, 0, 0, 24);
84+
border: 1px solid rgba(0, 0, 0, 32);
85+
background: rgba(0, 0, 0, 16);
8386
}
8487

8588
#tabCloseButton:pressed
8689
{
87-
background: rgba(0, 0, 0, 48);
88-
}
89-
90-
#tabCloseButton
91-
{
92-
qproperty-icon: url(:/ads/images/close-button.svg);
93-
qproperty-iconSize: 16px;
90+
background: rgba(0, 0, 0, 32);
9491
}
9592

9693

97-
ads--CDockSplitter::handle
98-
{
99-
background-color: palette(dark);
100-
/* uncomment the following line if you would like to change the size of
101-
the splitter handles */
102-
/* height: 1px; */
103-
}
104-
105-
106-
/* Focus related styling */
107-
ads--CDockWidgetTab[focused="true"]
108-
{
109-
background: palette(highlight);
110-
border-color: palette(highlight);
111-
}
112-
113-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton
114-
{
115-
qproperty-icon: url(:/ads/images/close-button-focused.svg)
116-
}
117-
118-
119-
120-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover
121-
{
122-
background: rgba(255, 255, 255, 48);
123-
}
124-
125-
126-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed
127-
{
128-
background: rgba(255, 255, 255, 92);
129-
}
130-
131-
132-
ads--CDockWidgetTab[focused="true"] QLabel
133-
{
134-
color: palette(light);
135-
}
136-
137-
138-
ads--CDockAreaTitleBar
139-
{
140-
background: transparent;
141-
border-bottom: 2px solid palette(light);
142-
padding-bottom: 0px;
143-
}
144-
145-
ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar
146-
{
147-
background: transparent;
148-
border-bottom: 2px solid palette(highlight);
149-
padding-bottom: 0px;
150-
}
151-

src/stylesheets/default_linux.css

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
/*
3-
* Default style sheet on Windows Platforms
4-
* Note: Always use CSS-classes with and without "ads--" namespace to support Qt4 & Qt5
3+
* Default style sheet on Linux Platforms
54
*/
65

76
ads--CDockContainerWidget
@@ -84,74 +83,13 @@ QScrollArea#dockWidgetScrollArea
8483

8584
#tabCloseButton:hover
8685
{
87-
/*border: 1px solid rgba(0, 0, 0, 32);*/
88-
background: rgba(0, 0, 0, 24);
86+
border: 1px solid rgba(0, 0, 0, 32);
87+
background: rgba(0, 0, 0, 16);
8988
}
9089

9190
#tabCloseButton:pressed
9291
{
93-
background: rgba(0, 0, 0, 48);
92+
background: rgba(0, 0, 0, 32);
9493
}
9594

96-
#tabCloseButton
97-
{
98-
qproperty-icon: url(:/ads/images/close-button.svg);
99-
qproperty-iconSize: 16px;
100-
}
101-
102-
/* Focus related styling */
103-
ads--CDockWidgetTab[focused="true"]
104-
{
105-
background: palette(highlight);
106-
border-color: palette(highlight);
107-
}
108-
109-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton
110-
{
111-
qproperty-icon: url(:/ads/images/close-button-focused.svg)
112-
}
113-
114-
115-
116-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover
117-
{
118-
background: rgba(255, 255, 255, 48);
119-
}
120-
121-
122-
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed
123-
{
124-
background: rgba(255, 255, 255, 92);
125-
}
12695

127-
ads--CDockWidgetTab[focused="true"] QLabel
128-
{
129-
color: palette(light);
130-
}
131-
132-
133-
ads--CDockAreaTitleBar
134-
{
135-
background: transparent;
136-
border-bottom: 2px solid palette(light);
137-
padding-bottom: 0px;
138-
}
139-
140-
ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar
141-
{
142-
background: transparent;
143-
border-bottom: 2px solid palette(highlight);
144-
padding-bottom: 0px;
145-
}
146-
147-
148-
ads--CFloatingDockContainer[isActiveWindow="true"] ads--CFloatingWidgetTitleBar
149-
{
150-
background: palette(highlight);
151-
}
152-
153-
154-
ads--CFloatingDockContainer[isActiveWindow="true"] ads--CFloatingWidgetTitleBar > QLabel
155-
{
156-
color: palette(light);
157-
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
2+
/*
3+
* Default style sheet on Windows Platforms with focus highlighting flag enabled
4+
*/
5+
6+
ads--CDockContainerWidget
7+
{
8+
background: palette(dark);
9+
}
10+
11+
12+
ads--CDockAreaWidget
13+
{
14+
background: palette(window);
15+
border: 1px solid white;
16+
}
17+
18+
ads--CDockAreaWidget #tabsMenuButton::menu-indicator
19+
{
20+
image: none;
21+
}
22+
23+
24+
ads--CDockWidgetTab
25+
{
26+
background: palette(window);
27+
border-color: palette(light);
28+
border-style: solid;
29+
border-width: 0 1px 0 0;
30+
padding: 0 0px;
31+
}
32+
33+
ads--CDockWidgetTab[activeTab="true"]
34+
{
35+
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:0.5, stop:0 palette(window), stop:1 palette(light));
36+
/*background: palette(highlight);*/
37+
}
38+
39+
ads--CDockWidgetTab QLabel
40+
{
41+
color: palette(dark);
42+
}
43+
44+
ads--CDockWidgetTab[activeTab="true"] QLabel
45+
{
46+
color: palette(foreground);
47+
}
48+
49+
ads--CDockWidget
50+
{
51+
background: palette(light);
52+
border-color: palette(light);
53+
border-style: solid;
54+
border-width: 1px 0 0 0;
55+
}
56+
57+
ads--CTitleBarButton
58+
{
59+
padding: 0px 0px;
60+
}
61+
62+
63+
QScrollArea#dockWidgetScrollArea
64+
{
65+
padding: 0px;
66+
border: none;
67+
}
68+
69+
70+
#tabCloseButton
71+
{
72+
margin-top: 2px;
73+
background: none;
74+
border: none;
75+
padding: 0px -2px;
76+
}
77+
78+
#tabCloseButton:hover
79+
{
80+
/*border: 1px solid rgba(0, 0, 0, 32);*/
81+
background: rgba(0, 0, 0, 24);
82+
}
83+
84+
#tabCloseButton:pressed
85+
{
86+
background: rgba(0, 0, 0, 48);
87+
}
88+
89+
#tabCloseButton
90+
{
91+
qproperty-icon: url(:/ads/images/close-button.svg);
92+
qproperty-iconSize: 16px;
93+
}
94+
95+
96+
ads--CDockSplitter::handle
97+
{
98+
background-color: palette(dark);
99+
/* uncomment the following line if you would like to change the size of
100+
the splitter handles */
101+
/* height: 1px; */
102+
}
103+
104+
105+
/* Focus related styling */
106+
ads--CDockWidgetTab[focused="true"]
107+
{
108+
background: palette(highlight);
109+
border-color: palette(highlight);
110+
}
111+
112+
ads--CDockWidgetTab[focused="true"] > #tabCloseButton
113+
{
114+
qproperty-icon: url(:/ads/images/close-button-focused.svg)
115+
}
116+
117+
118+
119+
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover
120+
{
121+
background: rgba(255, 255, 255, 48);
122+
}
123+
124+
125+
ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed
126+
{
127+
background: rgba(255, 255, 255, 92);
128+
}
129+
130+
131+
ads--CDockWidgetTab[focused="true"] QLabel
132+
{
133+
color: palette(light);
134+
}
135+
136+
137+
ads--CDockAreaTitleBar
138+
{
139+
background: transparent;
140+
border-bottom: 2px solid palette(light);
141+
padding-bottom: 0px;
142+
}
143+
144+
ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar
145+
{
146+
background: transparent;
147+
border-bottom: 2px solid palette(highlight);
148+
padding-bottom: 0px;
149+
}
150+

0 commit comments

Comments
 (0)