77 default property alias contents: placeholder .data
88
99 required property int resizeHandleSize
10+ required property int titleBarHeight
1011 property bool isWindows: Qt .platform .os === " windows"
1112
1213 property bool isMaximized: false
@@ -22,14 +23,14 @@ Window {
2223 property int windowLastWidth: 0
2324
2425 property int windowLastHeight: 0
25-
26- property int titleBarHeight: 32
2726 visible: true
2827 color: " #00000000"
2928 flags: isWindows ? (Qt .FramelessWindowHint | Qt .Window | Qt .WindowSystemMenuHint | Qt .WindowMinimizeButtonHint | Qt .WindowMaximizeButtonHint ) : Qt .Window
3029
3130 Loader {
31+ id: windowsTitleBarLoader
3232 active: window .isWindows
33+ anchors .fill : parent
3334 sourceComponent: Component {
3435 Rectangle {
3536 z: 1
@@ -241,41 +242,34 @@ Window {
241242 }
242243 }
243244 }
244-
245245 Loader {
246+ id: macTitleLoader
246247 active: ! window .isWindows
248+ anchors .top : parent .top
249+ anchors .left : parent .left
250+ anchors .right : parent .right
251+ height: window .titleBarHeight
247252 sourceComponent: Component {
248253 Rectangle {
249- visible: ! window .isWindows
250- height: window .titleBarHeight
254+ anchors .fill : parent
251255 color: " #20202a"
252- anchors .top : parent .top
253- anchors .topMargin : 0
254- anchors .left : parent .left
255- anchors .leftMargin : 0
256- anchors .right : parent .right
257- anchors .rightMargin : 0
258256
259257 Text {
260258 id: macTitleText
261- y: 3
262259 height: 16
260+ anchors .fill : parent
263261 color: " #DDDDDD"
264262 text: window .title
265263 verticalAlignment: Text .AlignVCenter
264+ horizontalAlignment: Text .AlignHCenter
266265 font .weight : Font .Medium
267266 elide: Text .ElideRight
268- anchors .left : parent .left
269- anchors .leftMargin : 0
270- anchors .right : parent .right
271- anchors .rightMargin : 0
272- horizontalAlignment: Text .AlignHCenter
273267 font .pixelSize : 12
268+ renderType: Text .NativeRendering
274269 }
275270 }
276271 }
277272 }
278-
279273 Item {
280274 id: placeholder
281275 anchors .fill : parent
@@ -285,7 +279,6 @@ Window {
285279 anchors .bottomMargin : window .isWindows ? 1 : 0
286280 clip: true
287281 }
288-
289282 Loader {
290283 active: window .isWindows && window .canResize
291284 sourceComponent: Component {
@@ -294,8 +287,6 @@ Window {
294287 anchors .fill : parent
295288 hoverEnabled: window .isWindows && window .canResize
296289 cursorShape: {
297- console .log (" MouseArea::cursorShape" )
298- console .log (" window.isWindows && window.canResize: " + (window .isWindows && window .canResize ))
299290 const pos = Qt .point (mouseX, mouseY);
300291 const offset = resizeHandleSize;
301292 if ((pos .x < offset) && (pos .y >= (height - offset))) {
@@ -314,9 +305,6 @@ Window {
314305 return Qt .SizeVerCursor ;
315306 }
316307 }
317- onClicked: {
318- console .log (" width: " + width + " height: " + height)
319- }
320308 acceptedButtons: Qt .NoButton
321309 }
322310 }
0 commit comments