QImage WebbrowserThumbnailGenerator::generate(const QString& url) const
{
    auto image = createGradientImage(Qt::darkCyan, Qt::white);
    auto host = QUrl{url}.host();
    if (host.startsWith("www."))
        host.remove(0, 4);
    paintText(image, host.isEmpty() ? "Webbrowser" : host);
    return image;
}
Exemplo n.º 2
0
QImage FolderThumbnailGenerator::_createFolderImage(
    const QDir& dir, const bool generateThumbnails) const
{
    QImage img = createGradientImage(Qt::black, Qt::white);

    const QFileInfoList& fileList = _getSupportedFilesInDir(dir);

    if (generateThumbnails && fileList.size() > 0)
        _paintThumbnailsMosaic(img, fileList);
    else
        paintText(img, FOLDER_TEXT);

    return img;
}
Exemplo n.º 3
0
void
QvisOpacitySlider::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    int mid = thickness()/2 + sliderLength() / 8;

    // Draw the gradient pixmap.
    if(gradientImage == 0)
        createGradientImage();
    p.drawImage(0, tickOffset, *gradientImage);

    // Draw the groove on which the slider slides.    
    drawSliderGroove(&p, 0, tickOffset, imageWidth(), thickness(), mid);

    // Figure out the interval between the tick marks.
    int interval = tickInt;
    if(interval <= 0)
    {
        interval = singleStep();
        if(positionFromValue(interval) - positionFromValue(0) < 3)
            interval = pageStep();
    }

    // Draw the tick marks.
    p.fillRect(0, 0, imageWidth(), tickOffset,
               palette().brush(QPalette::Background));
    p.fillRect(0, tickOffset + thickness(), imageWidth(), height(),
               palette().brush(QPalette::Background));
    drawTicks(&p, palette(), 0, tickOffset - 2, interval);

    // Draw the slider
    paintSlider(&p, palette(), sliderRect());

    // Draw the value text.
    paintValueText(&p, palette(), imageWidth(), height());

    // If this widget has focus, draw the focus rectangle.
    if(hasFocus())
    {
        QStyleOptionFocusRect so;
        so.initFrom(this);
        style()->drawPrimitive(QStyle::PE_FrameFocusRect, 
                               &so,
                               &p);
    }
}
Exemplo n.º 4
0
QImage ImageThumbnailGenerator::_createLargeImagePlaceholder() const
{
    QImage img = createGradientImage( Qt::darkBlue, Qt::white );
    paintText( img, "LARGE\nIMAGE" );
    return img;
}
void ConfigureSystemGraphics::on_bDefaultDisabledBottomColor_colorChanged(QColor color)
{
    QImage gradient = createGradientImage(bDefaultDisabledTopColor->getColor(), color, lblDefaultDisabledColor->width() - 4, lblDefaultDisabledColor->height() - 4);
    lblDefaultDisabledColor->setPixmap(QPixmap::fromImage(gradient));
}