int main(int argc, char **argv) { /* The base class of all DirectUI applications */ MApplication app(argc, argv); /* The application window is a top-level window that contains the Home and Back/Close framework controls, Navigation bar, View menu and Toolbar components */ MApplicationWindow w; w.show(); /* Pages represent one "view" of an application, into which you can add your application's contents. An application can have any number of pages with transitions between them */ MApplicationPage p; p.appear(&w); /* Let's add a simple push button to our page */ MButton b(p.centralWidget()); /* The (optional) constructor parameter causes our button to be a child of the central widget of the page. This pattern can be used with all MWidgets */ b.setText("Hello World!"); return app.exec(); }
int main (int argc, char **argv) { MApplication app (argc, argv); MApplicationWindow * window = new MApplicationWindow(); window->show(); Page * page = new Page(); page->appear (window); return app.exec(); }
int main(int argc, char *argv[]) { int exitCode = 0; MApplication nApp(argc, argv); MApplicationWindow *nMainWin = new MApplicationWindow(); nMainWin->setStyleName("CommonNKaistaWindow"); NMainPage *nMainPage = new NMainPage() ; nMainWin->sceneManager()->appearSceneWindowNow(nMainPage); nMainWin->show(); exitCode = nApp.exec(); return exitCode; }
int main(int argc, char **argv) { MApplication app(argc, argv); MTheme::loadCSS("calculator.css"); //Load the example svg file in the same directory MTheme::addPixmapDirectory(".", M::NonRecursive); MApplicationWindow window; MApplicationPage page; CalculatorWidget *calculatorWidget = new CalculatorWidget; page.setCentralWidget(calculatorWidget); page.appear(&window); window.show(); return app.exec(); }
int main(int argc, char **argv) { MApplication app(argc, argv); MApplicationWindow window; MainPage *mainPage; // That's the data that will be displayed by our application. // For the sake of keeping the example as simple as possible we use // a very simplistic data structure. QList<Artist *> artistsList; fillOutData(artistsList); mainPage = new MainPage(artistsList); mainPage->appear(&window); window.show(); return app.exec(); }
int main(int argc, char **argv) { /* The base class of all DirectUI applications */ MApplication app(argc, argv); /* The application window is a top-level window that contains the Home and Back/Close framework controls, Navigation bar, View menu and Toolbar components */ MApplicationWindow w; /* Pages represent one "view" of an application, into which you can add your application's contents. An application can have any number of pages with transitions between them */ TrackerGridPage p; p.appear(&w); w.show(); return app.exec(); }
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(); }
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(); }