SelectionCheckBox::SelectionCheckBox(Container * parent) : CustomControl(parent) { // The title is stored in the custom control so that we can present which olive // has been added or removed from the mix. So we initialize the title to an empty QString. mTitle = QString(""); // A colored rectangle representing the olive color and the // CheckBox is aligned to the Right side of the component. Container *checkBoxContainer = Container::create().top(43.0f).bottom(43.0f); StackLayout *checkBoxLayout = new StackLayout(); checkBoxLayout->setOrientation(LayoutOrientation::LeftToRight); checkBoxContainer->setLayout(checkBoxLayout); mColorContainer = new Container(); mColorContainer->setBackground(Color::Black); mColorContainer->setPreferredSize(42, 42); mColorContainer->setRightMargin(33.0f); mColorContainer->setVerticalAlignment(VerticalAlignment::Center); // The CheckBox which will tell if the olive should be part of the // olive mix or not. mOliveCheckBox = new CheckBox(); mOliveCheckBox->setObjectName("checkBox"); mOliveCheckBox->setLayoutProperties(StackLayoutProperties::create().spaceQuota(1)); connect(mOliveCheckBox, SIGNAL(checkedChanged(bool)), this, SLOT(onCheckedChanged(bool))); checkBoxContainer->add(mOliveCheckBox); checkBoxContainer->add(mColorContainer); setRoot(checkBoxContainer); }
AlbumItem::AlbumItem(Container *parent) : CustomControl(parent) { // Dock layout with margins inside Container *itemContainer = new Container(); DockLayout *itemLayout = new DockLayout(); itemContainer->setLayout(itemLayout); itemContainer->setBackground(ImagePaint(QUrl("asset:///images/customcomponents/list_background.png"), RepeatPattern::XY)); itemContainer->setHorizontalAlignment(HorizontalAlignment::Center); itemContainer->setMinHeight(212); itemContainer->setPreferredWidth(740); // Sub item container Container *subItemContainer = Container::create(); StackLayout *stackLayout = new StackLayout(); stackLayout->setOrientation( LayoutOrientation::LeftToRight ); subItemContainer->setLayout(stackLayout); subItemContainer->setTopPadding(10); subItemContainer->setLeftPadding(10); subItemContainer->setRightPadding(10); subItemContainer->setBottomPadding(13); subItemContainer->setHorizontalAlignment(HorizontalAlignment::Fill); subItemContainer->setVerticalAlignment(VerticalAlignment::Fill); // A Colored Container will be used to show if an item is highlighted mHighlighContainer = Container::create().background(Color::fromARGB(0xff75b5d3)).opacity(0.0); mHighlighContainer->setHorizontalAlignment(HorizontalAlignment::Fill); mHighlighContainer->setVerticalAlignment(VerticalAlignment::Fill); // The list item image, the actual image is set in updateItem mItemImage = ImageView::create("asset:///images/loading.jpg"); //mItemImage->setHorizontalAlignment(HorizontalAlignment::Left); mItemImage->setVerticalAlignment(VerticalAlignment::Center); mItemImage->setPreferredSize(144.0, 192.0); mItemTitle = Label::create("Title"); mItemTitle->setLayoutProperties(StackLayoutProperties::create().spaceQuota(1)); mItemTitle->textStyle()->setColor(Color::DarkGray); //mItemTitle->setHorizontalAlignment(HorizontalAlignment::Center); mItemTitle->setVerticalAlignment(VerticalAlignment::Center); mItemDescription = Label::create("Description"); mItemDescription->textStyle()->setBase(SystemDefaults::TextStyles::subtitleText()); mItemDescription->setHorizontalAlignment(HorizontalAlignment::Center); mItemDescription->setVerticalAlignment(VerticalAlignment::Center); mItemDescription->setMultiline(true); // Add the shopitem details to the subitem container subItemContainer->add(mItemImage); subItemContainer->add(mItemTitle); subItemContainer->add(mItemDescription); // Add the background image and the content to the full item container. itemContainer->add(mHighlighContainer); itemContainer->add(subItemContainer); setRoot(itemContainer); }
RepeatedImage::RepeatedImage(Container *parent) : CustomControl(parent) , m_count(0) , m_imageWidth(0) , m_imageHeight(0) { StackLayout *pStackLayout = new StackLayout(); pStackLayout->setOrientation( LayoutOrientation::LeftToRight ); m_rootContainer = Container::create().layout(pStackLayout); setRoot(m_rootContainer); }
ChannelListItem::ChannelListItem(Container *parent) : CustomControl(parent) { // A background Container that will hold a background image and an item content Container Container *itemContainer = new Container(); DockLayout *itemLayout = new DockLayout(); itemContainer->setLayout(itemLayout); itemContainer->setPreferredWidth(768.0f); // The white background image for an item ImageView *bkgImage = ImageView::create("asset:///images/white_photo.png").preferredSize(768.0f, 173.0f); // A Colored Container will be used to show if an item is highlighted m_highlighContainer = new Container(); m_highlighContainer->setBackground(Color::fromARGB(0xff75b5d3)); m_highlighContainer->setHorizontalAlignment(HorizontalAlignment::Center); m_highlighContainer->setOpacity(0.0); m_highlighContainer->setPreferredWidth(760.0f); m_highlighContainer->setPreferredHeight(168.0f); // Content Container containing an image and label with padding for the alignment // on background image. Note that we disable implicit layout animations to avoid // unsynchronized animations on the list items as the item image is asynchronously loaded. Container *contentContainer = new Container(); StackLayout *contentLayout = new StackLayout(); contentLayout->setOrientation(LayoutOrientation::LeftToRight); contentContainer->setLeftPadding(3.0f); contentContainer->setLayout(contentLayout); contentContainer->setImplicitLayoutAnimationsEnabled(false); // A list item label, docked to the center, the text is set in updateItem. m_itemLabel = Label::create().text(" "); m_itemLabel->setVerticalAlignment(VerticalAlignment::Center); m_itemLabel->setLeftMargin(30.0f); m_itemLabel->textStyle()->setBase(SystemDefaults::TextStyles::titleText()); m_itemLabel->textStyle()->setColor(Color::Black); m_itemLabel->setImplicitLayoutAnimationsEnabled(false); contentContainer->add(m_itemLabel); // Add the background image and the content to the full item container. itemContainer->add(bkgImage); itemContainer->add(m_highlighContainer); itemContainer->add(contentContainer); setRoot(itemContainer); }
LeadingVisual::LeadingVisual(): Container(), _resetUpdater(new QTimer(this)), _updateDone(new QTimer(this)), _activity(NULL), _loadingLabel(NULL), _refreshLabel(NULL) { _resetUpdater->setSingleShot(true); _updateDone->setSingleShot(true); connect(_resetUpdater, SIGNAL(timeout()), this, SLOT(resetUpdaterTimeout())); connect(_updateDone, SIGNAL(timeout()), this, SLOT(updateDoneTimeout())); this->setPreferredSize(768, 100); this->setLayout(new DockLayout()); Container* container = new Container(this); StackLayout* layout = new StackLayout; layout->setOrientation(LayoutOrientation::LeftToRight); container->setLayout(layout); container->setVerticalAlignment(VerticalAlignment::Center); container->setHorizontalAlignment(HorizontalAlignment::Center); _activity = new ActivityIndicator(container); connect(_activity, SIGNAL(runningChanged(bool)), this, SLOT(activityStatusChanged(bool))); _loadingLabel = new Label(container); _loadingLabel->setText("Loading..."); _loadingLabel->setVisible(false); _refreshLabel = new Label(container); _refreshLabel->setText("Pull down to refresh..."); _refreshLabel->setVisible(true); LayoutUpdateHandler::create(this).onLayoutFrameChanged(this, SLOT(handleLayoutFrameUpdated(QRectF))); }