Beispiel #1
0
void ThemePreview::doPreview()
{
    if (!themedView)
        return;
    ThemeItem *page = themedView->findItem(m_name, ThemedView::Page);
    if (page)
        m_preview = QPixmap::grabWidget(themedView, page->rect());
    emit previewReady(m_preview.scaledToWidth((int)(m_width * 0.55), Qt::SmoothTransformation));
}
Beispiel #2
0
void ThemeItemPreview::getPixmap(QPixmap *pixmap, int width, int height, QSoftMenuBar::LabelType labelType)
{
    m_themedView->loadSource(m_xmlSourcePath);
    m_themedView->resize(width, height);

    if (labelType != QSoftMenuBar::LabelType(-1)) {
        bool useIcon = (labelType == QSoftMenuBar::IconLabel);
        QList<QSoftMenuBar::StandardLabel> labels;
        if (QApplication::isLeftToRight())
            labels << QSoftMenuBar::Options << QSoftMenuBar::Select << QSoftMenuBar::Back;
        else
            labels << QSoftMenuBar::Back << QSoftMenuBar::Select << QSoftMenuBar::Options;
        for (int i=0; i<labels.size(); i++)
            resetButton(useIcon, i, labels[i]);
    }

    ThemeItem *page = m_themedView->findItem(m_pageItemName, ThemedView::Page);
    if (page)
        *pixmap = QPixmap::grabWidget(m_themedView, page->rect());
}