Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Proof of concept - QWebkit + Scrolling text on top
QtWS25 Last Chance

Proof of concept - QWebkit + Scrolling text on top

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stijn
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stijn
      wrote on last edited by
      #2

      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;
      }
      

      }@

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved