Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Help translate Qt(C++) to Pyside6
Qt 6.11 is out! See what's new in the release blog

Help translate Qt(C++) to Pyside6

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 760 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    KaiZER
    wrote on last edited by
    #1
    // main.cpp
    #include <QtGui>
     
    class AnimatedTextEdit : public QTextEdit
    {
        Q_OBJECT
     
    public:
        AnimatedTextEdit(QWidget* parent = 0)
            : QTextEdit(parent) { }
     
        void addAnimation(const QUrl& url, const QString& fileName)
        {
            QMovie* movie = new QMovie(this);
            movie->setFileName(fileName);
            urls.insert(movie, url);
            connect(movie, SIGNAL(frameChanged(int)), this, SLOT(animate()));
            movie->start();
        }
     
    private slots:
        void animate()
        {
            if (QMovie* movie = qobject_cast<QMovie*>(sender()))
            {
                document()->addResource(QTextDocument::ImageResource,
                    urls.value(movie), movie->currentPixmap());
                setLineWrapColumnOrWidth(lineWrapColumnOrWidth()); // causes reload
            }
        }
     
    private:
        QHash<QMovie*, QUrl> urls;
    };
     
    int main(int argc, char* argv[])
    {
        QApplication app(argc, argv);
        AnimatedTextEdit textEdit;
        textEdit.setHtml("<img src='bart-url'/><img src='homer-url'/>");
        textEdit.addAnimation(QUrl("bart-url"), "bart.gif");
        textEdit.addAnimation(QUrl("homer-url"), "homer.gif");
        textEdit.show();
        return app.exec();
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you asking to learn how to translate this to Python or that somebody does the job for you ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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