summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-09-28 15:46:45 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-10-03 07:30:26 +0000
commitbccbb52b7a96b3cba4dc5c9977792ed0223d5a83 (patch)
tree29bd67eb30fcc03a4b1978c80bac346d52f4fe25 /src/gui/kernel/qwindow.cpp
parentd89229240918c567c915c1e444d5b60f2f4c958d (diff)
macOS: Tighten up window icon and represented filename handling
Window icons on macOS are tied to document windows, and should not show up unless a represented filename has also been set according to the HIG. We follow this, and no longer create a document button based on the window title if one did no exists. We also fall back to using the filename of the file if a title has not been set, including being able to restore this default title after setting a custom title. The icon is no longer reset to nil after setting a QIcon(), which would remove the icon completely, but instead we restore the default behavior of showing the default filetype icon of the file. Finally, the two callbacks in QNSWindowDelegate dealing with the document icon/title popups and drags have been taught to look for spaces in the represented filename. This allows clients who really want the old behavior of setting an icon without caring about the filename to set the filename to a single space character, which will prevent the dropdowna and drag from occurring. The reason for not tying this behavior to the existence of the file in the filesystem is that being able to represent a file that is yet to be saved is a valid usecase. Task-number: QTBUG-63338 Change-Id: I7d4377c6358226fb6058f8c2b3c28588eec77ce5 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 6dbba8b433..b4e2b47c03 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -971,6 +971,11 @@ QString QWindow::filePath() const
The window icon might be used by the windowing system for example to
decorate the window, and/or in the task switcher.
+
+ \note On \macos, the window title bar icon is meant for windows representing
+ documents, and will only show up if a file path is also set.
+
+ \sa setFilePath()
*/
void QWindow::setIcon(const QIcon &icon)
{
@@ -983,7 +988,7 @@ void QWindow::setIcon(const QIcon &icon)
}
/*!
- \brief Sets the window's icon in the windowing system
+ \brief Returns the window's icon in the windowing system
\sa setIcon()
*/