Skip to content

Fix dialog titlebar button under Windows

Gary Wang requested to merge garywang/neochat:dialog-flags into master

Qt.Dialog imply only the close button will be shown, so no need to add Qt.WindowCloseButtonHint. Adding Qt.WindowCloseButtonHint will cause the dialog have no button under Windows, thus the dialog cannot be closed, so this patch removes the unnecessary Qt.WindowCloseButtonHint flag.

Since building NeoChat under Windows is hard, the following code (edited from the SonnetConfigPanel.qml file) can be used for testing:

import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15

QQC2.ApplicationWindow {
	id: window
	title: "Spell checking dictionary"
	width: 100
	height: 100
	visible: true
	flags: Qt.Dialog | Qt.WindowCloseButtonHint
	QQC2.ScrollView {
		anchors.fill: parent

		// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
		QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
	}
}

The above code:

image

If we remove Qt.WindowCloseButtonHint:

image

Edited by Gary Wang

Merge request reports