void CalendarPage::createPageSpecificContent(void) { QList<MButton *> buttons; MButton *eButton = new MButton(); eButton->setText(tr("Calendar event")); eButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect(eButton, SIGNAL(clicked()), this, SLOT(chooseEvent())); buttons << eButton; MButton *tButton = new MButton(); tButton->setText(tr("Calendar to-do item")); tButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect(tButton, SIGNAL(clicked()), this, SLOT(chooseTodo())); buttons << tButton; m_calendarDetails = new LabelOrList(m_model, _getCreator, tr("Select a calendar entry"), true, false, buttons); m_calendarDetails->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); layout()->addItem(m_calendarDetails); layout()->setAlignment(m_calendarDetails, Qt::AlignCenter); }
// ---------------------------------------------------------------------------- // CReporterPrivacySettingsWidget::initWidget // ---------------------------------------------------------------------------- void CReporterPrivacySettingsWidget::initWidget() { //% "Crash Reporter" MLabel *titleLabel = new MLabel(qtTrId("qtn_dcp_crash_reporter").arg(QString(CREPORTERVERSION))); titleLabel->setStyleName("CommonApplicationHeaderInverted"); //% "Version %1" MLabel *versionLabel = new MLabel(qtTrId("qtn_dcp_version_%1").arg(QString(CREPORTERVERSION))); versionLabel->setStyleName("CommonSubTitleInverted"); // Create containers. CReporterMonitorSettingsContainer *monitorSettings = new CReporterMonitorSettingsContainer(this); CReporterIncludeSettingsContainer *includeSettings = new CReporterIncludeSettingsContainer(this); // Button for showing privacy statement. MButton *showPrivacyButton = new MButton(this); showPrivacyButton->setObjectName("ShowPrivacyButton"); showPrivacyButton->setStyleName("CommonSingleButtonInverted"); //% "Privacy Disclaimer" showPrivacyButton->setText(qtTrId("qtn_dcp_privacy_statement_button")); connect(showPrivacyButton, SIGNAL(clicked()), this, SLOT(openPrivacyDisclaimerDialog())); // Button for sending cores via selection MButton *sendSelectButton = new MButton(this); sendSelectButton->setObjectName("SendSelectButton"); sendSelectButton->setStyleName("CommonSingleButtonInverted"); //% "Send/Delete Reports" sendSelectButton->setText(qtTrId("qtn_dcp_send_delete_button_text")); connect(sendSelectButton, SIGNAL(clicked()), this, SLOT (handleSendSelectButtonClicked()), Qt::DirectConnection); connect(sendSelectButton, SIGNAL(clicked()), monitorSettings, SLOT(updateButtons()), Qt::QueuedConnection); // Create main layout and policy. MLayout *mainLayout = new MLayout(this); MLinearLayoutPolicy *mainLayoutPolicy = new MLinearLayoutPolicy(mainLayout, Qt::Vertical); mainLayoutPolicy->setObjectName("PageMainLayout"); mainLayout->setPolicy(mainLayoutPolicy); mainLayout->setContentsMargins(0,0,0,0); mainLayoutPolicy->addItem(titleLabel, Qt::AlignLeft); mainLayoutPolicy->addItem(versionLabel, Qt::AlignLeft); mainLayoutPolicy->addItem(monitorSettings, Qt::AlignCenter); mainLayoutPolicy->addItem(includeSettings, Qt::AlignCenter); // mainLayoutPolicy->addItem(bottomLayout, Qt::AlignCenter); mainLayoutPolicy->addStretch(); mainLayoutPolicy->addItem(showPrivacyButton, Qt::AlignCenter); mainLayoutPolicy->addItem(sendSelectButton, Qt::AlignCenter); }
void Pt_MButton::initTestCase() { static int argc = 1; char *argv[1] = { (char *) "./pt_mbutton" }; app = new MApplication(argc, argv); //warmup QPixmap pixmap(W, H); QPainter painter(&pixmap); MButton warmupButton; warmupButton.setText("text"); warmupButton.setIconID("icon-m-framework-home"); warmupButton.setToggledIconID("icon-m-framework-close"); warmupButton.setGeometry(QRectF(0, 0, W, H)); while (MTheme::hasPendingRequests()) { usleep(10000); QCoreApplication::processEvents(); } warmupButton.paint(&painter, NULL); }
void ArtistPage::createContent() { QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); centralWidget()->setLayout(layout); layout->addItem(new MLabel("Albums:")); MButtonGroup *buttonGroup = new MButtonGroup(this); Album *album; MButton *albumButton; for (int i = 0; i < artist->albums.count(); i++) { album = artist->albums[i]; albumButton = new MButton; albumButton->setText(album->title); layout->addItem(albumButton); buttonGroup->addButton(albumButton, i); } connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(displayAlbum(int))); }