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