Proof of concept - QWebkit + Scrolling text on top



  • Hi,

    I want to create a proof of concept of the following:

    • In the background I need a webkit widget showing a web page in full screen.

    • On top of this webpage I need a smooth scrolling text.

    Can someone give me advise of which widgets (QLabel, QWebkit, ...?) and which technologies (QAnimation, QOpenGL, ...?) I best use to implement this proof of concept?

    Thanks in advance!
    Stijn.



  • Hi all,

    Is there no one who can help me futher with this?

    I implemented a scrolling text like this (see below), but it is very choppy. Does someone knows why, or could help me with this?

    @GLWidget::GLWidget(Helper *helper, QWidget *parent)
    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper)
    {
    elapsed = 0;
    setFixedSize(1080, 200);
    setAutoFillBackground(false);
    }
    //! [0]

    //! [1]
    void GLWidget::animate()
    {
    elapsed = (elapsed + qobject_cast<QTimer*>(sender())->interval()) % 1000;
    repaint();
    }
    //! [1]

    //! [2]
    void GLWidget::paintEvent(QPaintEvent *event)
    {
    QPainter painter;
    painter.begin(this);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    helper->paint(&painter, event, elapsed);
    painter.end();
    }@

    @Helper::Helper()
    {
    QLinearGradient gradient(QPointF(50, -20), QPointF(80, 20));
    gradient.setColorAt(0.0, Qt::white);
    gradient.setColorAt(1.0, QColor(0xa6, 0xce, 0x39));

    background = QBrush(QColor(64, 32, 64));
    circleBrush = QBrush(gradient);
    circlePen = QPen(Qt::black);
    circlePen.setWidth(1);
    textPen = QPen(Qt::white);
    textFont.setPixelSize(150);
    
    xpos = 0;
    

    }
    //! [0]

    //! [1]
    void Helper::paint(QPainter *painter, QPaintEvent *event, int elapsed)
    {
    QFontMetrics qfontmetrics = QFontMetrics(textFont);

    painter->fillRect(event->rect(), background);
    
    painter->setPen(textPen);
    painter->setFont(textFont);
    
    
    painter->drawText(1080 - xpos,120,"THIS IS SAMPLE TEXT");
    
    xpos++;
    
    if(xpos == (1080 + qfontmetrics.size(0, "THIS IS SAMPLE TEXT").width())) {
        xpos = 0;
    }
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.