Changeset View
Changeset View
Standalone View
Standalone View
abstract_client.cpp
Show First 20 Lines • Show All 3098 Lines • ▼ Show 20 Line(s) | |||||
3099 | QSize AbstractClient::adjustedSize() const | 3099 | QSize AbstractClient::adjustedSize() const | ||
3100 | { | 3100 | { | ||
3101 | const QSize constrainedClientSize = constrainClientSize(clientSize()); | 3101 | const QSize constrainedClientSize = constrainClientSize(clientSize()); | ||
3102 | return clientSizeToFrameSize(constrainedClientSize); | 3102 | return clientSizeToFrameSize(constrainedClientSize); | ||
3103 | } | 3103 | } | ||
3104 | 3104 | | |||
3105 | /** | 3105 | /** | ||
3106 | * Constrains the desired client size @p size according to a set the window's size hints. | 3106 | * Constrains the desired client size @p size according to a set the window's size hints. | ||
3107 | * | ||||
3108 | * Default implementation applies only minimum and maximum size constraints. | ||||
3107 | */ | 3109 | */ | ||
3108 | QSize AbstractClient::constrainClientSize(const QSize &size, SizeMode mode) const | 3110 | QSize AbstractClient::constrainClientSize(const QSize &size, SizeMode mode) const | ||
3109 | { | 3111 | { | ||
3110 | Q_UNUSED(mode) | 3112 | Q_UNUSED(mode) | ||
3111 | 3113 | | |||
3112 | int width = size.width(); | 3114 | int width = size.width(); | ||
3113 | int height = size.height(); | 3115 | int height = size.height(); | ||
3114 | 3116 | | |||
3115 | // When user is resizing the window, the move resize geometry may have negative width or | 3117 | // When user is resizing the window, the move resize geometry may have negative width or | ||
3116 | // height. In which case, we need to set negative dimensions to reasonable values. | 3118 | // height. In which case, we need to set negative dimensions to reasonable values. | ||
3117 | if (width < 1) { | 3119 | if (width < 1) { | ||
3118 | width = 1; | 3120 | width = 1; | ||
3119 | } | 3121 | } | ||
3120 | if (height < 1) { | 3122 | if (height < 1) { | ||
3121 | height = 1; | 3123 | height = 1; | ||
3122 | } | 3124 | } | ||
3123 | 3125 | | |||
3126 | const QSize minimumSize = minSize(); | ||||
3127 | const QSize maximumSize = maxSize(); | ||||
3128 | | ||||
3129 | width = qBound(minimumSize.width(), width, maximumSize.width()); | ||||
3130 | height = qBound(minimumSize.height(), height, maximumSize.height()); | ||||
3131 | | ||||
3124 | return QSize(width, height); | 3132 | return QSize(width, height); | ||
3125 | } | 3133 | } | ||
3126 | 3134 | | |||
3127 | /** | 3135 | /** | ||
3128 | * Constrains the desired frame size @p size according to a set of the window's size hints. | 3136 | * Constrains the desired frame size @p size according to a set of the window's size hints. | ||
3129 | */ | 3137 | */ | ||
3130 | QSize AbstractClient::constrainFrameSize(const QSize &size, SizeMode mode) const | 3138 | QSize AbstractClient::constrainFrameSize(const QSize &size, SizeMode mode) const | ||
3131 | { | 3139 | { | ||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |