Changeset View
Changeset View
Standalone View
Standalone View
sublime/idealbuttonbarwidget.cpp
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Line(s) | 186 | if (wasEmpty) { | |||
---|---|---|---|---|---|
187 | emit emptyChanged(); | 187 | emit emptyChanged(); | ||
188 | } | 188 | } | ||
189 | } | 189 | } | ||
190 | 190 | | |||
191 | void IdealButtonBarWidget::removeAction(QAction* widgetAction) | 191 | void IdealButtonBarWidget::removeAction(QAction* widgetAction) | ||
192 | { | 192 | { | ||
193 | QWidget::removeAction(widgetAction); | 193 | QWidget::removeAction(widgetAction); | ||
194 | 194 | | |||
195 | auto action = dynamic_cast<ToolViewAction*>(widgetAction); | 195 | auto action = static_cast<ToolViewAction*>(widgetAction); | ||
196 | action->button()->deleteLater(); | 196 | action->button()->deleteLater(); | ||
197 | delete action; | 197 | delete action; | ||
198 | 198 | | |||
199 | if (layout()->isEmpty()) { | 199 | if (layout()->isEmpty()) { | ||
200 | emit emptyChanged(); | 200 | emit emptyChanged(); | ||
201 | } | 201 | } | ||
202 | } | 202 | } | ||
203 | 203 | | |||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 324 | { | |||
327 | QAction *action = qobject_cast<QAction *>(sender()); | 327 | QAction *action = qobject_cast<QAction *>(sender()); | ||
328 | Q_ASSERT(action); | 328 | Q_ASSERT(action); | ||
329 | 329 | | |||
330 | showWidget(action, checked); | 330 | showWidget(action, checked); | ||
331 | } | 331 | } | ||
332 | 332 | | |||
333 | void IdealButtonBarWidget::showWidget(QAction *action, bool checked) | 333 | void IdealButtonBarWidget::showWidget(QAction *action, bool checked) | ||
334 | { | 334 | { | ||
335 | auto widgetAction = dynamic_cast<ToolViewAction*>(action); | 335 | auto widgetAction = static_cast<ToolViewAction*>(action); | ||
336 | 336 | | |||
337 | IdealToolButton* button = widgetAction->button(); | 337 | IdealToolButton* button = widgetAction->button(); | ||
338 | Q_ASSERT(button); | 338 | Q_ASSERT(button); | ||
339 | 339 | | |||
340 | if (checked) { | 340 | if (checked) { | ||
341 | if ( !QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) ) { | 341 | if ( !QApplication::keyboardModifiers().testFlag(Qt::ControlModifier) ) { | ||
342 | // Make sure only one widget is visible at any time. | 342 | // Make sure only one widget is visible at any time. | ||
343 | // The alternative to use a QActionCollection and setting that to "exclusive" | 343 | // The alternative to use a QActionCollection and setting that to "exclusive" | ||
Show All 10 Lines | |||||
354 | 354 | | |||
355 | m_controller->showDockWidget(widgetAction->dockWidget(), checked); | 355 | m_controller->showDockWidget(widgetAction->dockWidget(), checked); | ||
356 | widgetAction->setChecked(checked); | 356 | widgetAction->setChecked(checked); | ||
357 | button->setChecked(checked); | 357 | button->setChecked(checked); | ||
358 | } | 358 | } | ||
359 | 359 | | |||
360 | IdealDockWidget * IdealButtonBarWidget::widgetForAction(QAction *_action) const | 360 | IdealDockWidget * IdealButtonBarWidget::widgetForAction(QAction *_action) const | ||
361 | { | 361 | { | ||
362 | return dynamic_cast<ToolViewAction *>(_action)->dockWidget(); | 362 | return static_cast<ToolViewAction*>(_action)->dockWidget(); | ||
363 | } | 363 | } | ||
364 | 364 | | |||
365 | #include "idealbuttonbarwidget.moc" | 365 | #include "idealbuttonbarwidget.moc" |