void ToolBar::updateMenu() { QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget()); Q_ASSERT(mainWindow != 0); const Qt::ToolBarArea area = mainWindow->toolBarArea(this); const Qt::ToolBarAreas areas = allowedAreas(); movableAction->setChecked(isMovable()); allowLeftAction->setChecked(isAreaAllowed(Qt::LeftToolBarArea)); allowRightAction->setChecked(isAreaAllowed(Qt::RightToolBarArea)); allowTopAction->setChecked(isAreaAllowed(Qt::TopToolBarArea)); allowBottomAction->setChecked(isAreaAllowed(Qt::BottomToolBarArea)); if (allowedAreasActions->isEnabled()) { allowLeftAction->setEnabled(area != Qt::LeftToolBarArea); allowRightAction->setEnabled(area != Qt::RightToolBarArea); allowTopAction->setEnabled(area != Qt::TopToolBarArea); allowBottomAction->setEnabled(area != Qt::BottomToolBarArea); } leftAction->setChecked(area == Qt::LeftToolBarArea); rightAction->setChecked(area == Qt::RightToolBarArea); topAction->setChecked(area == Qt::TopToolBarArea); bottomAction->setChecked(area == Qt::BottomToolBarArea); if (areaActions->isEnabled()) { leftAction->setEnabled(areas & Qt::LeftToolBarArea); rightAction->setEnabled(areas & Qt::RightToolBarArea); topAction->setEnabled(areas & Qt::TopToolBarArea); bottomAction->setEnabled(areas & Qt::BottomToolBarArea); } }
bool DockWidget::event(QEvent *event) { if (event->type() == QEvent::MouseButtonDblClick && allowedAreas() == Qt::NoDockWidgetArea) { return QWidget::event(event); } return QDockWidget::event(event); }
int QToolBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isMovable(); break; case 1: *reinterpret_cast< Qt::ToolBarAreas*>(_v) = allowedAreas(); break; case 2: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break; case 3: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 4: *reinterpret_cast< Qt::ToolButtonStyle*>(_v) = toolButtonStyle(); break; case 5: *reinterpret_cast< bool*>(_v) = isFloating(); break; case 6: *reinterpret_cast< bool*>(_v) = isFloatable(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setMovable(*reinterpret_cast< bool*>(_v)); break; case 1: setAllowedAreas(*reinterpret_cast< Qt::ToolBarAreas*>(_v)); break; case 2: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break; case 3: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 4: setToolButtonStyle(*reinterpret_cast< Qt::ToolButtonStyle*>(_v)); break; case 6: setFloatable(*reinterpret_cast< bool*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { bool *_b = reinterpret_cast<bool*>(_a[0]); switch (_id) { case 0: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break; case 1: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break; case 2: *_b = (qobject_cast<QMainWindow*>(parentWidget())==0); break; } _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void ToolBar::allow(Qt::ToolBarArea area, bool a) { Qt::ToolBarAreas areas = allowedAreas(); areas = a ? areas | area : areas & ~area; setAllowedAreas(areas); if (areaActions->isEnabled()) { leftAction->setEnabled(areas & Qt::LeftToolBarArea); rightAction->setEnabled(areas & Qt::RightToolBarArea); topAction->setEnabled(areas & Qt::TopToolBarArea); bottomAction->setEnabled(areas & Qt::BottomToolBarArea); } }
int QToolBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: actionTriggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 1: movableChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: allowedAreasChanged((*reinterpret_cast< Qt::ToolBarAreas(*)>(_a[1]))); break; case 3: orientationChanged((*reinterpret_cast< Qt::Orientation(*)>(_a[1]))); break; case 4: iconSizeChanged((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 5: toolButtonStyleChanged((*reinterpret_cast< Qt::ToolButtonStyle(*)>(_a[1]))); break; case 6: topLevelChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 8: setToolButtonStyle((*reinterpret_cast< Qt::ToolButtonStyle(*)>(_a[1]))); break; case 9: d_func()->_q_toggleView((*reinterpret_cast< bool(*)>(_a[1]))); break; case 10: d_func()->_q_updateIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break; case 11: d_func()->_q_updateToolButtonStyle((*reinterpret_cast< Qt::ToolButtonStyle(*)>(_a[1]))); break; default: ; } _id -= 12; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isMovable(); break; case 1: *reinterpret_cast< Qt::ToolBarAreas*>(_v) = allowedAreas(); break; case 2: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break; case 3: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 4: *reinterpret_cast< Qt::ToolButtonStyle*>(_v) = toolButtonStyle(); break; case 5: *reinterpret_cast< bool*>(_v) = isFloating(); break; case 6: *reinterpret_cast< bool*>(_v) = isFloatable(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setMovable(*reinterpret_cast< bool*>(_v)); break; case 1: setAllowedAreas(*reinterpret_cast< Qt::ToolBarAreas*>(_v)); break; case 2: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break; case 3: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 4: setToolButtonStyle(*reinterpret_cast< Qt::ToolButtonStyle*>(_v)); break; case 6: setFloatable(*reinterpret_cast< bool*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { bool *_b = reinterpret_cast<bool*>(_a[0]); switch (_id) { case 0: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break; case 1: *_b = (qobject_cast<QMainWindow*>(parentWidget())!=0); break; case 2: *_b = (qobject_cast<QMainWindow*>(parentWidget())==0); break; } _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }