本文整理汇总了C++中MLayout类的典型用法代码示例。如果您正苦于以下问题:C++ MLayout类的具体用法?C++ MLayout怎么用?C++ MLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MLayout
void Ut_MGridLayoutPolicy::testLayoutInLayoutRefresh()
{
m_policy->setSpacing(0);
m_mockLayout->activate();
QGraphicsWidget *widget = new QGraphicsWidget;
MLayout *layout = new MLayout(widget);
layout->setContentsMargins(0,0,0,0);
MGridLayoutPolicy *policy = new MGridLayoutPolicy(layout);
m_policy->addItem(widget,0,0);
QGraphicsWidget *leftSpacerWithWidget = new QGraphicsWidget;
policy->addItem(leftSpacerWithWidget, 0, 0);
policy->addItem(m_mockItem100, 0, 1);
policy->addItem(new QGraphicsWidget, 0, 2);
policy->addItem(m_mockItem200, 0, 3);
m_form->resize(400,200);
qApp->processEvents();
qApp->processEvents();
QCOMPARE(m_mockItem100->geometry(), QRectF(50,0,100,100));
QCOMPARE(m_mockItem200->geometry(), QRectF(200,0,200,200));
leftSpacerWithWidget->setMaximumWidth(0);
qApp->processEvents();
QCOMPARE(m_mockItem100->geometry(), QRectF(0,0,100,100));
QCOMPARE(m_mockItem200->geometry(), QRectF(200,0,200,200));
}
示例2: pannableViewport
void ApplicationMenuPage::createContent()
{
MApplicationPage::createContent();
pannableViewport()->setAcceptGesturesFromAnyDirection(true);
setStyleName(inv("CommonApplicationPage"));
QGraphicsWidget *panel = centralWidget();
infoLabel = new MLabel(panel);
infoLabel->setObjectName("infoLabel");
infoLabel->setStyleName(inv("CommonBodyText"));
infoLabel->setWordWrap(true);
infoLabel->setAlignment(Qt::AlignTop);
actionItalic = new MAction(panel);
actionItalic->setObjectName("actionItalic");
actionItalic->setLocation(MAction::ApplicationMenuLocation);
addAction(actionItalic);
connect(actionItalic, SIGNAL(triggered()), this, SLOT(makeTextItalic()));
actionNormal = new MAction(panel);
actionNormal->setObjectName("actionNormal");
actionNormal->setLocation(MAction::ApplicationMenuLocation);
addAction(actionNormal);
connect(actionNormal, SIGNAL(triggered()), this, SLOT(makeTextNormal()));
MWidgetAction *widgetAction = new MWidgetAction(panel);
widgetAction->setLocation(MAction::ApplicationMenuLocation);
QStringList list;
for (int i = 0; i < 5; ++i) {
list << QString::number(100 + i);
}
comboBox = new MComboBox;
comboBox->setObjectName("comboBox");
comboBox->addItems(list);
comboBox->setIconVisible(false);
comboBox->setTitle("ComboBox");
comboBox->setCurrentIndex(0);
widgetAction->setWidget(comboBox);
addAction(widgetAction);
MLayout *layout = new MLayout(panel);
layout->setContentsMargins(0, 0, 0, 0);
panel->setLayout(layout);
policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
policy->setContentsMargins(0, 0, 0, 0);
policy->setSpacing(0);
policy->addItem(infoLabel);
retranslateUi();
}
示例3: MLinearLayoutPolicy
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);
}
示例4: MLabel
// ----------------------------------------------------------------------------
// 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);
}
示例5: MStylableWidget
ImageLabel::ImageLabel(MWidget *parent): MStylableWidget(parent)
{
MLayout *layout = new MLayout();
layout->setAnimation(NULL);
m_policy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
setLayout(layout);
m_image = NULL;
m_label = new MLabel;
m_label->setTextElide(true);
m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_policy->addItem(m_label);
}
示例6: widget1
void Ut_LauncherPageView::testUpdateData()
{
QSharedPointer<LauncherButton> widget1(new LauncherButton(""));
QSharedPointer<LauncherButton> widget2(new LauncherButton(""));
LauncherPageModel::LauncherButtonList widgets;
widgets.append(widget1);
widgets.append(widget2);
controller->model()->setLauncherButtons(widgets);
MLayout* mainLayout = dynamic_cast<MLayout *>(controller->layout());
QVERIFY(mainLayout != NULL);
QCOMPARE(mainLayout->count(), 2);
mainLayout->removeItem(widget1.data());
mainLayout->removeItem(widget2.data());
QCOMPARE(mainLayout->count(), 0);
QList<const char*> modifications;
modifications.append(LauncherPageModel::LauncherButtons);
emit updateDataRequested(modifications);
QCOMPARE(mainLayout->count(), 2);
mainLayout->removeItem(widget1.data());
mainLayout->removeItem(widget2.data());
QCOMPARE(mainLayout->count(), 0);
QList<const char*> modifications2;
modifications.append("does not match");
emit updateDataRequested(modifications2);
QCOMPARE(mainLayout->count(), 0);
}
示例7: MLinearLayoutPolicy
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);
}
示例8: centralWidget
void SheetsPage::createContent()
{
MApplicationPage::createContent();
QGraphicsWidget *panel = centralWidget();
MLayout *layout = new MLayout(panel);
layout->setContentsMargins(0, 0, 0, 0);
panel->setLayout(layout);
policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
policy->setContentsMargins(0, 0, 0, 0);
policy->setSpacing(0);
populateLayout();
retranslateUi();
}
示例9: init
void MMashupCanvasViewPrivate::init()
{
MLayout *dl = new MLayout;
dl->setAnimation(NULL);
layout = dl;
mainLayout->addItem(layout);
layoutPolicy = new MFlowLayoutPolicy(dl);
appletInventoryButton = new MButton;
appletInventory = new MAppletInventory;
appletInventoryWindow = new MModalSceneWindow;
appletInventoryViewport = new MPannableViewport(appletInventoryWindow);
// Put the applet inventory inside a viewport
appletInventoryViewport->setWidget(appletInventory);
// TODO: FIXME - this needs to have the scene specified,
// temporarily uses currently active MWindow's scene.
QSize sceneSize = MApplication::activeWindow()->visibleSceneSize();
appletInventoryViewport->setMinimumSize(sceneSize);
appletInventoryViewport->setMaximumSize(sceneSize);
// Create a dialog layout
QGraphicsLinearLayout *dialogLayout = new QGraphicsLinearLayout();
dialogLayout->setContentsMargins(0, 0, 0, 0);
dialogLayout->addItem(appletInventoryViewport);
appletInventoryWindow->setLayout(dialogLayout);
appletInventoryWindow->setObjectName("MAppletInventoryWindow");
// Create an applet inventory button
appletInventoryButton->setObjectName("MAppletInventoryButton");
//~ uispec-document ??? FIXME
//% "Applet Library"
appletInventoryButton->setText(qtTrId("qtn_appl_inventory"));
// Add the applet inventory button to a horizontal layout for centering
QGraphicsLinearLayout *l = new QGraphicsLinearLayout(Qt::Horizontal);
l->setContentsMargins(0, 0, 0, 0);
l->addStretch();
l->addItem(appletInventoryButton);
l->addStretch();
// Add the horizontal layout to the main layout
mainLayout->addItem(l);
}
示例10: main
int main(int argc, char **argv)
{
MApplication app(argc, argv);
MApplicationWindow window;
MApplicationPage page;
MTheme::loadCSS("twocolumns.css");
/* Create a MLayout that we set the policy for */
MLayout *layout = new MLayout(page.centralWidget());
MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
/* Setup first layout with a label and text edit */
MLayout *nameLayout = new MLayout;
MLinearLayoutPolicy *namePolicy = new MLinearLayoutPolicy(nameLayout, Qt::Horizontal);
MLabel *textEditLabel = new MLabel("Name:");
MTextEdit *textEdit = new MTextEdit(MTextEditModel::MultiLine);
namePolicy->addItem(textEditLabel); //Add the label and textedit
namePolicy->addItem(textEdit);
textEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
/* Setup second layout with a large label */
MLayout *labelLayout = new MLayout;
MLinearLayoutPolicy *labelPolicy = new MLinearLayoutPolicy(labelLayout, Qt::Horizontal);
MLabel *label = new MLabel("Enter the name of the person who likes to listen to music while sorting their socks!");
label->setObjectName("nameLabel");
labelPolicy->addItem(label);
label->setWordWrap(true);
/* Add the two layouts to the layout */
policy->addItem(nameLayout);
policy->addItem(labelLayout);
/* Make the two layouts have an equal preferred size, so that they get an equal amount of space */
nameLayout->setPreferredWidth(1);
labelLayout->setPreferredWidth(1);
page.appear(&window);
window.show();
return app.exec();
}
示例11: CountryModel
void CountryPage::createContent()
{
if (m_pageMode == CountryModel::BY_ARTIST)
m_countryModel = new CountryModel(m_dbStorage, m_artistID);
else
m_countryModel = new CountryModel(m_dbStorage);
QGraphicsWidget *panel = centralWidget();
MLayout *layout = new MLayout(panel);
layout->setAnimation(NULL);
panel->setLayout(layout);
m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
// No country label
m_noCountryLabel = new MLabel(tr("No events to show.<br/>"
"Possible reasons:<br/>"
"<ul>"
"<li>None of your artist is on tour.</li>"
"<li>You don't have added an artist yet.</li>"
"</ul>"));
m_noCountryLabel->setAlignment(Qt::AlignJustify);
if (m_countryModel->rowCount() == 0) {
m_policy->addItem(m_noCountryLabel);
m_noCountryLabelVisible = true;
} else
m_noCountryLabelVisible = false;
MList *countryList = new MList();
countryList->setSelectionMode(MList::SingleSelection);
CountryItemCreator *cellCreator = new CountryItemCreator();
countryList->setCellCreator(cellCreator);
countryList->setItemModel(m_countryModel);
m_policy->addItem(countryList);
connect (countryList, SIGNAL(itemClicked(QModelIndex)),
this, SLOT(slotCountryClicked(QModelIndex)));
connect (DBManager::instance(m_dbStorage), SIGNAL(locationCreated(int)),
this, SLOT(slotLocationCreated(int)));
}
示例12: main
int main(int argc, char **argv)
{
MApplication app(argc, argv);
MTheme::loadCSS("layout_inside_layout.css");
MApplicationWindow window;
MApplicationPage page;
/* Create a MLayout that we set the policies for */
MLayout *layout = new MLayout;
MLinearLayoutPolicy *portraitPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
MLinearLayoutPolicy *landscapePolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
for (int i = 0; i < 3; ++i) {
MLabel *label = new MLabel(QString("Item %1").arg(i + 1));
label->setAlignment(Qt::AlignCenter);
label->setObjectName("item"); //Set CSS name for styling
portraitPolicy->addItem(label);
landscapePolicy->addItem(label);
}
/* Create a widget to hold the inner layout and to put inside the policy */
QGraphicsWidget *widget = new QGraphicsWidget;
/* Create an inner layout. A QGraphicsGridLayout is used since we don't require
* multiple policies here, but using a MLayout would also work. */
QGraphicsGridLayout *innerLayout = new QGraphicsGridLayout(widget);
for (int i = 0; i < 4; ++i) {
MLabel *label = new MLabel(QString("Inner Item %1").arg(i + 1));
label->setAlignment(Qt::AlignCenter);
label->setObjectName("inneritem"); //Set CSS name for styling
innerLayout->addItem(label, i / 2, i % 2);
}
/* Now add the widget to the landscape policy only, so that the innerLayout is hidden when device is rotated */
landscapePolicy->addItem(widget);
layout->setLandscapePolicy(landscapePolicy);
layout->setPortraitPolicy(portraitPolicy);
/* Attach the layout to the page */
page.centralWidget()->setLayout(layout);
page.appear(&window);
window.show();
return app.exec();
}
示例13: createContent
void AlbumPage::createContent()
{
MLayout *layout = new MLayout;
centralWidget()->setLayout(layout);
// Build a vertical layout that holds the cover art and the "By: Artist" label.
QGraphicsLinearLayout *coverAndArtistLayout = new QGraphicsLinearLayout(Qt::Vertical);
MImageWidget *albumCover = new MImageWidget(new QImage(album->coverArtFilename));
coverAndArtistLayout->addItem(albumCover);
QString byArtist = QString("By: %1").arg(album->artist);
coverAndArtistLayout->addItem(new MLabel(byArtist));
// Build a vertical layout that will hold the list of songs.
QGraphicsLinearLayout *songsLayout = new QGraphicsLinearLayout(Qt::Vertical);
songsLayout->addItem(new MLabel("Songs:"));
MLabel *songLabel;
for (int i = 0; i < album->songs.count(); i++) {
songLabel = new MLabel(album->songs.at(i));
songsLayout->addItem(songLabel);
}
// When in landscape orientation, have the cover and the songs list
// side-by-side.
MLinearLayoutPolicy *landscapePolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
landscapePolicy->addItem(coverAndArtistLayout);
landscapePolicy->addItem(songsLayout);
layout->setLandscapePolicy(landscapePolicy);
// When in portrait orientation, have the cover and the songs list
// on top of each other.
MLinearLayoutPolicy *portraitPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical);
portraitPolicy->addItem(coverAndArtistLayout);
portraitPolicy->addItem(songsLayout);
layout->setPortraitPolicy(portraitPolicy);
}
示例14: q_ptr
MColorListViewPrivate::MColorListViewPrivate(MColorListView *p, MColorList *controller)
: q_ptr(p), controller(controller), landscapePolicy(0), portraitPolicy(0), buttonGroup(0)
{
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
controller->setLayout(layout);
MStylableWidget* container = new MStylableWidget();
container->setStyleName("ColorSelectionContainer");
MLayout *containerLayout = new MLayout();
container->setLayout(containerLayout);
landscapePolicy = new MGridLayoutPolicy(containerLayout);
landscapePolicy->setContentsMargins(0, 0, 0, 0);
landscapePolicy->setSpacing(0);
containerLayout->setLandscapePolicy(landscapePolicy);
portraitPolicy = new MGridLayoutPolicy(containerLayout);
portraitPolicy->setContentsMargins(0, 0, 0, 0);
portraitPolicy->setSpacing(0);
containerLayout->setPortraitPolicy(portraitPolicy);
layout->addItem(container, 0, 0);
// Current color list
colors << QColor(0x95, 0xE8, 0x5D);
colors << QColor(0x73, 0xC0, 0xF5);
colors << QColor(0xCB, 0xA4, 0xDE);
colors << QColor(0xE9, 0x48, 0xA3);
colors << QColor(0xFF, 0x9E, 0x9E);
colors << QColor(0xFF, 0xF6, 0x57);
colors << QColor(0x9C, 0x9C, 0x9C);
colors << QColor(0x74, 0xD9, 0x41);
colors << QColor(0x31, 0xB0, 0xDE);
colors << QColor(0xBC, 0x79, 0xDE);
colors << QColor(0xE9, 0x48, 0xA3);
colors << QColor(0xFF, 0x79, 0x4D);
colors << QColor(0xFB, 0xFF, 0x14);
colors << QColor(0x80, 0x80, 0x80);
colors << QColor(0x55, 0xD5, 0x00);
colors << QColor(0x00, 0x88, 0xE6);
colors << QColor(0xAE, 0x4E, 0xDE);
colors << QColor(0xE9, 0x48, 0xA3);
colors << QColor(0xFF, 0x40, 0x00);
colors << QColor(0xFF, 0xE6, 0x00);
colors << QColor(0x4D, 0x4D, 0x4D);
colors << QColor(0x45, 0x90, 0x27);
colors << QColor(0x00, 0x6F, 0xBA);
colors << QColor(0x89, 0x3D, 0xAF);
colors << QColor(0xE9, 0x48, 0xA3);
colors << QColor(0xCC, 0x33, 0x00);
colors << QColor(0xFF, 0x90, 0x00);
colors << QColor(0x33, 0x33, 0x33);
colors << QColor(0x00, 0x73, 0x00);
colors << QColor(0x00, 0x41, 0x82);
colors << QColor(0x5E, 0x2A, 0x78);
colors << QColor(0xE9, 0x48, 0xA3);
colors << QColor(0xB5, 0x2D, 0x00);
colors << QColor(0xFF, 0x6A, 0x00);
colors << QColor(0x1A, 0x1A, 0x1A);
}
示例15: setLayoutDirection
CalculatorWidget::CalculatorWidget()
{
mValue = 0;
//Prevent the layout from changing in right-to-left.
//The calculation line will still be reversed however.
setLayoutDirection(Qt::LeftToRight);
/* Create a MLayout attached to this widget */
MLayout *layout = new MLayout(this);
MGridLayoutPolicy *landscapePolicy = new MGridLayoutPolicy(layout);
MGridLayoutPolicy *portraitPolicy = new MGridLayoutPolicy(layout);
layout->setPortraitPolicy(portraitPolicy);
layout->setLandscapePolicy(landscapePolicy);
landscapePolicy->setObjectName("calculatorLandscape");
portraitPolicy->setObjectName("calculatorPortrait");
mCalculationLine = new MLabel;
mCalculationLine->setObjectName("calculationLine");
mCalculationLine->setAlignment(Qt::AlignRight);
QList<CalculatorButton *> buttons;
CalculatorButton *button;
for (int i = 0; i < 10; i++) {
button = new CalculatorButton(CalculatorButton::Button((int)CalculatorButton::Num0 + i), this);
if (i == 0) {
landscapePolicy->addItem(button, 3, 4);
portraitPolicy->addItem(button, 6, 0);
} else {
landscapePolicy->addItem(button, 2 - (i - 1) / 3, 4 + (i - 1) % 3);
portraitPolicy->addItem(button, 5 - (i - 1) / 3, (i - 1) % 3);
}
}
CalculatorButton *buttonC = new CalculatorButton(CalculatorButton::Clear, this);
CalculatorButton *buttonBackspace = new CalculatorButton(CalculatorButton::Backspace, this);
CalculatorButton *buttonSign = new CalculatorButton(CalculatorButton::Sign, this);
CalculatorButton *buttonDecimal = new CalculatorButton(CalculatorButton::Decimal, this);
CalculatorButton *buttonReciprocal = new CalculatorButton(CalculatorButton::Reciprocal, this);
CalculatorButton *buttonPower = new CalculatorButton(CalculatorButton::Power, this);
CalculatorButton *buttonSqrt = new CalculatorButton(CalculatorButton::Sqrt, this);
CalculatorButton *buttonPercentage = new CalculatorButton(CalculatorButton::Percentage, this);
CalculatorButton *buttonDivide = new CalculatorButton(CalculatorButton::Divide, this);
CalculatorButton *buttonMultiply = new CalculatorButton(CalculatorButton::Multiply, this);
CalculatorButton *buttonSubtract = new CalculatorButton(CalculatorButton::Subtract, this);
CalculatorButton *buttonAdd = new CalculatorButton(CalculatorButton::Add, this);
CalculatorButton *buttonEquals = new CalculatorButton(CalculatorButton::Equals, this);
buttonEquals->setObjectName("calculatorButtonEquals");
landscapePolicy->addItem(mCalculationLine, 0, 0, 1, 4);
landscapePolicy->addItem(buttonC, 1, 0);
landscapePolicy->addItem(buttonBackspace, 1, 1);
landscapePolicy->addItem(buttonSign, 1, 2);
landscapePolicy->addItem(buttonDecimal, 1, 3);
landscapePolicy->addItem(buttonReciprocal, 2, 0);
landscapePolicy->addItem(buttonPower, 2, 1);
landscapePolicy->addItem(buttonSqrt, 2, 2);
landscapePolicy->addItem(buttonPercentage, 2, 3);
landscapePolicy->addItem(buttonDivide, 3, 0);
landscapePolicy->addItem(buttonMultiply, 3, 1);
landscapePolicy->addItem(buttonSubtract, 3, 2);
landscapePolicy->addItem(buttonAdd, 3, 3);
landscapePolicy->addItem(buttonEquals, 3, 5, 1, 2);
portraitPolicy->addItem(mCalculationLine, 0, 0, 1, 4);
portraitPolicy->addItem(buttonC, 1, 0);
portraitPolicy->addItem(buttonBackspace, 1, 1);
portraitPolicy->addItem(buttonReciprocal, 1, 2);
portraitPolicy->addItem(buttonDivide, 1, 3);
portraitPolicy->addItem(buttonPower, 2, 0);
portraitPolicy->addItem(buttonSqrt, 2, 1);
portraitPolicy->addItem(buttonPercentage, 2, 2);
portraitPolicy->addItem(buttonMultiply, 2, 3);
portraitPolicy->addItem(buttonSubtract, 3, 3);
portraitPolicy->addItem(buttonAdd, 4, 3);
portraitPolicy->addItem(buttonEquals, 5, 3, 2, 1);
portraitPolicy->addItem(buttonDecimal, 6, 1);
portraitPolicy->addItem(buttonSign, 6, 2);
setValue(mValue);
}