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 CreateEditPage::createContent(void) { MApplicationPage::createContent(); setStyleName("CommonApplicationPage"); setPannable(false); createActions(); QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout(); anchor->setContentsMargins(0, 0, 0, 0); anchor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); ViewHeader *header = new ViewHeader(m_tag == TagStorage::NULL_TAG ? tr("Create tag contents") : tr("Edit tag contents")); anchor->addCornerAnchors(header, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner); #ifdef LABEL_SIZE m_size = new MLabel(); m_size->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_size->setAlignment(Qt::AlignRight); anchor->addAnchor(m_size, Qt::AnchorBottom, anchor, Qt::AnchorBottom); anchor->addAnchor(m_size, Qt::AnchorRight, anchor, Qt::AnchorRight); #endif MWidget *layoutContainer = new MWidget(); layoutContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_layout = new QGraphicsLinearLayout(Qt::Vertical, layoutContainer); m_layout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_name = new LabeledTextEdit(tr("Ok"), LabeledTextEdit::SingleLineEditAndLabel); m_name->setLabel(tr("Tag name")); m_name->setPrompt(tr("Enter tag name")); m_name->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_layout->addItem(m_name); m_layout->setAlignment(m_name, Qt::AlignLeft); connect(m_name, SIGNAL(contentsChanged(void)), this, SLOT(nameChanged(void))); MSeparator *sep = new MSeparator; sep->setStyleName("CommonHorizontalSeparator"); sep->setOrientation(Qt::Horizontal); layout()->addItem(sep); createPageSpecificContent(); MPannableViewport *view = new MPannableViewport(); view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); view->setPanDirection(Qt::Vertical); view->setMinimumSize(100, 100); view->setWidget(layoutContainer); anchor->addAnchor(view, Qt::AnchorTop, header, Qt::AnchorBottom); #ifdef LABEL_SIZE anchor->addAnchor(view, Qt::AnchorBottom, m_size, Qt::AnchorTop); #else anchor->addAnchor(view, Qt::AnchorBottom, anchor, Qt::AnchorBottom); #endif anchor->addAnchor(view, Qt::AnchorLeft, anchor, Qt::AnchorLeft); anchor->addAnchor(view, Qt::AnchorRight, anchor, Qt::AnchorRight); centralWidget()->setLayout(anchor); if (m_tag == TagStorage::NULL_TAG) { setContentValidity(false); setNameValidity(false); setupNewData(); } else { load(); } }