Cell::Cell(MWidget *parent) : MListItem(parent) { MLayout *layout = new MLayout(this); MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical); policy->setContentsMargins(0, 0, 0, 0); policy->setSpacing(0); policy->setNotifyWidgetsOfLayoutPositionEnabled(true); line1 = new MLabel(); line2 = new MLabel(); line3 = new MLabel(); date = new MLabel(); line1->setWordWrap(false); line2->setWordWrap(false); line3->setWordWrap(false); date->setWordWrap(false); line1->setTextElide(true); line2->setTextElide(true); line3->setTextElide(true); date->setTextElide(true); policy->addItem(line1); policy->addItem(line2); policy->addItem(line3); policy->addItem(date); this->setStyleName("NotesPopupListItem"); }
void ResetWidget::createContent () { MLayout *layout; MLinearLayoutPolicy *policy; MButton *restoreButton; MButton *clearButton; MSeparator *spacer; /* * */ layout = new MLayout; policy = new MLinearLayoutPolicy (layout, Qt::Vertical); policy->setContentsMargins (0., 0., 0., 0.); policy->setSpacing (0.); /* * */ spacer = new MSeparator; // Using this one instead of "CommonSpacer", margins look even. spacer->setStyleName ("CommonLargeSpacer"); policy->addItem (spacer); /* * The first button. */ //% "Restore original settings" restoreButton = new MButton (qtTrId("qtn_rset_restore")); restoreButton->setStyleName ("CommonSingleButtonInverted"); restoreButton->setObjectName ("ResetAppletRFSButton"); connect (restoreButton, SIGNAL(clicked()), this, SLOT(restoreActivated())); /* * The second button. */ //% "Clear device" clearButton = new MButton (qtTrId("qtn_rset_clear")); clearButton->setStyleName ("CommonSingleButtonInverted"); clearButton->setObjectName ("ResetAppletCUDButton"); connect (clearButton, SIGNAL(clicked()), this, SLOT(clearActivated())); addButtonContainer (policy, restoreButton, clearButton); policy->addStretch(); /* * */ layout->setPolicy (policy); setLayout (layout); }
void WarrantyWidget::createContent () { MLayout *layout; MLinearLayoutPolicy *policy; layout = new MLayout; layout->setContentsMargins (0,0,0,0); policy = new MLinearLayoutPolicy (layout, Qt::Vertical); policy->setContentsMargins (0., 0., 0., 0.); policy->setSpacing (0.); /* * Add the title-bar */ addHeaderContainer (policy); #ifdef APP_TITLE_USES_SPACER addStretcher (policy, APP_TITLE_DIVIDER_STYLE_NAME); #endif if (m_warrantyTimer) { // The label that shows the expiration date m_labelExpiration = new MLabel; m_labelExpiration->setObjectName ("WarrantyAppletExpirationLabel"); m_labelExpiration->setStyleName ("CommonTitleInverted"); m_labelExpiration->setWordWrap (true); } // The label that shows the terms of the warranty m_labelTerms = new MLabel; m_labelTerms->setObjectName ("WarrantyAppletTermsLabel"); m_labelTerms->setStyleName ("CommonBodyTextInverted"); m_labelTerms->setWordWrap (true); /* * Adding the two labels with a new container */ addLabelContainer (policy, m_labelExpiration, m_labelTerms); policy->addStretch (); retranslateUi (); layout->setPolicy (policy); setLayout (layout); }
void ScreenShotPage::createContent() { TemplatePage::createContent(); QGraphicsWidget *panel = centralWidget(); panel->setContentsMargins(0,0,0,0); setContentsMargins(0,0,0,0); layout = new MLayout(panel); layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); layoutPolicy->setSpacing(0); layoutPolicy->setContentsMargins(0,0,0,0); layout->setPortraitPolicy(layoutPolicy); layout->setLandscapePolicy(layoutPolicy); MLayout * elementsLayout = new MLayout; MLinearLayoutPolicy* elementsPolicyL = new MLinearLayoutPolicy(elementsLayout,Qt::Vertical); elementsLayout->setLandscapePolicy(elementsPolicyL); elementsPolicyL->setSpacing(0); elementsPolicyL->setContentsMargins(0, 0, 0, 0); MLinearLayoutPolicy* elementsPolicyP = new MLinearLayoutPolicy(elementsLayout,Qt::Vertical); elementsLayout->setLandscapePolicy(elementsPolicyP); elementsPolicyP->setSpacing(0); elementsPolicyP->setContentsMargins(0, 0, 0, 0); label1 = new MLabel ("Take a screenshot"); label1->setObjectName("label1"); label1->setStyleName(inv("CommonApplicationHeader")); elementsPolicyL->addItem(label1); elementsPolicyP->addItem(label1); labelDescription = new MLabel (); labelDescription->setObjectName("descriptionLabel"); labelDescription->setWordWrap(true); labelDescription->setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); labelDescription->setStyleName(inv("CommonBodyText")); elementsPolicyL->addItem(labelDescription); elementsPolicyP->addItem(labelDescription); QGraphicsGridLayout * gridSecs = new QGraphicsGridLayout(); entrySeconds = new MTextEdit(MTextEditModel::SingleLine,""); entrySeconds->setObjectName("secondsTextEntry"); entrySeconds->setMaxLength(2); entrySeconds->setStyleName(inv("CommonSingleInputField")); entrySeconds->setContentType(M::NumberContentType); entrySeconds->setText("8"); entrySeconds->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); MLabel * secsLabel = new MLabel(); secsLabel->setObjectName("secsLabel"); secsLabel->setText("seconds"); secsLabel->setStyleName(inv("CommonSingleTitle")); gridSecs->addItem(entrySeconds, 0 , 0 , Qt::AlignVCenter); gridSecs->addItem(secsLabel, 0 , 1, Qt::AlignVCenter); elementsPolicyL->addItem(gridSecs); elementsPolicyP->addItem(gridSecs); buttonScreenshot = new MButton("Take it!"); buttonScreenshot->setObjectName("screenshotButton"); buttonScreenshot->setStyleName(inv("CommonSingleButton")); elementsPolicyL->addItem(buttonScreenshot); elementsPolicyP->addItem(buttonScreenshot); connect(buttonScreenshot, SIGNAL(clicked()), this, SLOT(screenshotDelay())); elementsPolicyL->addStretch(); elementsPolicyP->addStretch(); layoutPolicy->addItem(elementsLayout); retranslateUi(); }
OpenDialog::OpenDialog(QGraphicsWidget*, const QString ¤tFileName) { MWidget *centralWidget = new MWidget; MLayout *layout = new MLayout(); layout->setContentsMargins(0,0,0,0); MLinearLayoutPolicy* landscapePolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); MLinearLayoutPolicy* portraitPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); // m_itemSize.setWidth(100); // m_itemSize.setHeight(100); m_columnsPortrait = 4; m_columnsLandscape = 5; m_columnsLandscapeSlider = 0; m_columnsPortraitSlider = 0; list = new MList(this); list->setObjectName("list"); landscapePolicy->addItem(list); portraitPolicy->addItem(list); landscapePolicy->setContentsMargins(20, 12, 20, 0); portraitPolicy->setContentsMargins(20, 24, 20, 0); layout->setLandscapePolicy(landscapePolicy); layout->setPortraitPolicy(portraitPolicy); //int initialWidth = MApplication::activeWindow()->visibleSceneSize().width(); /* if(MApplication::activeWindow()->orientation() == M::Portrait) { list->setColumns(m_columnsPortrait); m_itemSize.setWidth(initialWidth / m_columnsPortrait); m_itemSize.setHeight(m_itemSize.width()); } else { list->setColumns(m_columnsLandscape); m_itemSize.setWidth(initialWidth / m_columnsLandscape); m_itemSize.setHeight(m_itemSize.width()); }*/ m_itemSize.setWidth(110); m_itemSize.setHeight(110); ContentItemCreator *cellCreator = new ContentItemCreator(this); list->setCellCreator(cellCreator); QStringList mediaDirs; mediaDirs << APP_CATALOG; model = new OpenDialogModel(this, m_itemSize.toSize(), mediaDirs, currentFileName); model->setObjectName("gridModel"); list->setItemModel(model); connect(list, SIGNAL(itemClicked(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); connect(list, SIGNAL(panningStarted()), this, SLOT(pauseLoaders())); connect(list, SIGNAL(panningStopped()), this, SLOT(resumeLoaders())); centralWidget->setLayout(layout); this->setTitle("Choose an image"); this->setModal(true); this->setCentralWidget(centralWidget); }