Ejemplo n.º 1
0
millionSec::millionSec()
{
    // Obtain a QMLDocument and load it into the qml variable, using build patterns.
    QmlDocument *qml = QmlDocument::create("asset:///second.qml");
    qml->setParent(this);
    NavigationPane *nav = qml->createRootObject<NavigationPane>();

    // If the QML document is valid, we process it.
    if (!qml->hasErrors()) {

        // Create the application Page from QMLDocument.
        //Page *appPage = qml->createRootObject<Page>();

        if (nav) {
            // Set the main scene for the application to the Page.
            Application::instance()->setScene(nav);
            DropDown *day = DropDown::create();
            int date = day->selectedIndex();

            DropDown *month = DropDown::create();
            month->add(Option::create().text("Jan"));
            month->add(Option::create().text("Feb"));
        }
    }
}
ImagePaintRecipe::ImagePaintRecipe(Container *parent) :
    CustomControl(parent)
{
  mRecipeContainer = Container::create().top(50.0f).left(50.0f).right(50.0f);
  mRecipeContainer->setLayout(DockLayout::create());
  mRecipeContainer->setPreferredSize(768, 1280);

  // ImagePaint defines which image to paint with and which
  // repeat pattern that should be used (both X and Y direction in this
  // case). The provided image needs to have a width and height that
  // is a power of two, for optimization purposes. Furthermore, the image
  // has to be accompanied by a meta file (with file ending .amd)
  // with the "repeatable" property set to true. Please note that the
  // .png format extension has been dropped on the file name in order for the matching
  // images/imagepaint/Tile_nistri_16x16.amd file to be found.
  ImagePaint paint(QUrl("asset:///images/imagepaint/Tile_nistri_16x16.amd"), RepeatPattern::XY);
  mRecipeContainer->setBackground(paint);

  // A drop down control with a couple of different tile images, all of
  // various power of two dimensions.
  DropDown *dropDown = new DropDown();
  dropDown->setTitle("Select tile");

  // Set up Options and add it to the DropDown.
  dropDown->add(
      Option::create().text("Nistri").image(
          QUrl("asset:///images/imagepaint/Tile_nistri_16x16.amd")));
  dropDown->add(
      Option::create().text("Pyamas").image(
          QUrl("asset:///images/imagepaint/Tile_pyamas_16x16.amd")));
  dropDown->add(
      Option::create().text("Tactile").image(
          QUrl("asset:///images/imagepaint/Tile_tactile_stripes_16x16.amd")));
  dropDown->add(
      Option::create().text("White Stripes").image(
          QUrl("asset:///images/imagepaint/Tile_white_stripes_16x16.amd")));
  dropDown->add(
      Option::create().text("Scribble Light").image(
          QUrl("asset:///images/imagepaint/Tile_scribble_light_256x256.amd")));
  dropDown->add(
      Option::create().text("Light Toast").image(
          QUrl("asset:///images/imagepaint/Tile_light_toast_128x128.amd")));
  dropDown->add(
      Option::create().text("Tile Gplay").image(
          QUrl("asset:///images/imagepaint/Tile_gplay_256x256.amd")));

  // Connect to the signal for index changes, so that we can update the recipe when a new selection is made.
  connect(dropDown, SIGNAL(selectedIndexChanged(int)), this,
      SLOT(onSelectedIndexChanged(int)));

  mRecipeContainer->add(dropDown);
  setRoot(mRecipeContainer);
}
Ejemplo n.º 3
0
void PgcMessages::addAccounts(QObject* dropDownObject) const
{
    DropDown* dropDown = qobject_cast<DropDown*>(dropDownObject);

    bool selected = true;
    foreach (const Account &account, m_accountList) {
        const QString name = (account.displayName().isEmpty() ? tr("No Name") : account.displayName());

        Option::Builder option = Option::create().text(tr("%1 (%2)").arg(name, account.provider().name()))
                                                 .value(QVariant::fromValue(account.id()))
                                                 .selected(selected);

        selected = false;

        dropDown->add(option);
    }
}