MPannableViewport* StatusIndicatorMenuDropDownView::createPannableArea() { // Create pannable area contents statusIndicatorExtensionArea = createVerticalExtensionArea(); QGraphicsLinearLayout *contentLayout = new QGraphicsLinearLayout(Qt::Vertical); contentLayout->setContentsMargins(0, 0, 0, 0); contentLayout->setSpacing(0); contentLayout->addItem(statusIndicatorExtensionArea); MWidgetController *contentWidget = new MStylableWidget; contentWidget->setStyleName("StatusIndicatorMenuContentWidget"); contentWidget->setLayout(contentLayout); QGraphicsLinearLayout *pannableLayout = new QGraphicsLinearLayout(Qt::Vertical); pannableLayout->setContentsMargins(0, 0, 0, 0); pannableLayout->setSpacing(0); pannableLayout->addItem(contentWidget); QGraphicsWidget *closeButtonRow = createCloseButtonRow(); pannableLayout->addItem(closeButtonRow); pannableLayout->addStretch(); // Create a container widget for the pannable area PannedWidgetController *pannedWidget = new PannedWidgetController; pannedWidget->setLayout(pannableLayout); pannedWidget->setBottommostWidget(closeButtonRow); connect(pannedWidget, SIGNAL(positionOrSizeChanged()), this, SLOT(setPannabilityAndLayout())); connect(pannedWidget, SIGNAL(pressedOutSideContents()), controller, SIGNAL(hideRequested())); // Setup the pannable viewport MPannableViewport *pannableViewport = new MPannableViewport; pannableViewport->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pannableViewport->setWidget(pannedWidget); return pannableViewport; }
void PannedWidgetController::setGeometry(const QRectF &rect) { MWidgetController::setGeometry(rect); emit positionOrSizeChanged(); }