Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezetoolsareamanager.cpp
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 168 | if (toolbar) { | |||
---|---|---|---|---|---|
182 | connect(toolbar, &QToolBar::orientationChanged, | 182 | connect(toolbar, &QToolBar::orientationChanged, | ||
183 | this, [this]() { | 183 | this, [this]() { | ||
184 | emit toolbarUpdated(); | 184 | emit toolbarUpdated(); | ||
185 | }); | 185 | }); | ||
186 | connect(toolbar, &QToolBar::topLevelChanged, | 186 | connect(toolbar, &QToolBar::topLevelChanged, | ||
187 | this, [this]() { | 187 | this, [this]() { | ||
188 | emit toolbarUpdated(); | 188 | emit toolbarUpdated(); | ||
189 | }); | 189 | }); | ||
190 | <<<<<<< HEAD | | |||
191 | toolbar->installEventFilter(this); | | |||
192 | ======= | | |||
193 | >>>>>>> c2487fc1... [kstyle] Tools area | | |||
194 | } | 190 | } | ||
195 | connect(widget, &QObject::destroyed, | 191 | connect(widget, &QObject::destroyed, | ||
196 | this, [this, widget]() { | 192 | this, [this, widget]() { | ||
197 | unregisterWidget(widget); | 193 | unregisterWidget(widget); | ||
198 | }); | 194 | }); | ||
199 | registerAnimation(widget); | 195 | registerAnimation(widget); | ||
200 | _registeredWidgets << widget; | 196 | _registeredWidgets << widget; | ||
201 | emit toolbarUpdated(); | 197 | emit toolbarUpdated(); | ||
202 | } | 198 | } | ||
203 | 199 | | |||
204 | bool ToolsAreaManager::widgetHasCorrectPaletteSet(const QWidget *widget) | 200 | bool ToolsAreaManager::widgetHasCorrectPaletteSet(const QWidget *widget) | ||
205 | { | 201 | { | ||
206 | if (animationRunning(widget)) return true; | 202 | if (animationRunning(widget)) return true; | ||
207 | return ( | 203 | return ( | ||
208 | widget->palette().color(QPalette::Window) == background(widget) | 204 | widget->palette().color(QPalette::Window) == background(widget) | ||
209 | && | 205 | && | ||
210 | widget->palette().color(QPalette::WindowText) == foreground(widget) | 206 | widget->palette().color(QPalette::WindowText) == foreground(widget) | ||
211 | ); | 207 | ); | ||
212 | } | 208 | } | ||
213 | 209 | | |||
214 | void ToolsAreaManager::unregisterWidget(QWidget *widget) | 210 | void ToolsAreaManager::unregisterWidget(QWidget *widget) | ||
215 | { | 211 | { | ||
216 | <<<<<<< HEAD | | |||
217 | if (qobject_cast<QToolBar*>(widget)) { | | |||
218 | widget->setContentsMargins(0,0,0,0); | | |||
219 | widget->removeEventFilter(this); | | |||
220 | } | | |||
221 | ======= | | |||
222 | if (qobject_cast<QToolBar*>(widget)) widget->setContentsMargins(0,0,0,0); | 212 | if (qobject_cast<QToolBar*>(widget)) widget->setContentsMargins(0,0,0,0); | ||
223 | >>>>>>> c2487fc1... [kstyle] Tools area | | |||
224 | _registeredWidgets.remove(widget); | 213 | _registeredWidgets.remove(widget); | ||
225 | QList<QWindow*> toRemove; | 214 | QList<QWindow*> toRemove; | ||
226 | for (auto window : animationMap.keys()) { | 215 | for (auto window : animationMap.keys()) { | ||
227 | if (std::none_of(_registeredWidgets.begin(), _registeredWidgets.end(), [window](QWidget *widget) { | 216 | if (std::none_of(_registeredWidgets.begin(), _registeredWidgets.end(), [window](QWidget *widget) { | ||
228 | return window == widget->window()->windowHandle(); | 217 | return window == widget->window()->windowHandle(); | ||
229 | })) { | 218 | })) { | ||
230 | delete animationMap[window].foregroundColorAnimation; | 219 | delete animationMap[window].foregroundColorAnimation; | ||
231 | delete animationMap[window].backgroundColorAnimation; | 220 | delete animationMap[window].backgroundColorAnimation; | ||
232 | toRemove << window; | 221 | toRemove << window; | ||
233 | } | 222 | } | ||
234 | } | 223 | } | ||
235 | for (auto entry : toRemove) { | 224 | for (auto entry : toRemove) { | ||
236 | animationMap.remove(entry); | 225 | animationMap.remove(entry); | ||
237 | } | 226 | } | ||
238 | } | 227 | } | ||
239 | } | 228 | } |