Ok. Here is another example.
main.qml:
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
ApplicationWindow {visible: true; width: 640; height: 480;
Window{ height: 100; width: 100; visible: true; objectName: "w1"; id:w1; }
Window{ height: 100; width: 100; visible: true; objectName: "w2"; id:w2; }
Window{ height: 100; width: 100; visible: true; objectName: "w3"; id:w3; }
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
ApplicationWindow {visible: true; width: 640; height: 480;
Window{ height: 100; width: 100; visible: true; objectName: "w1"; id:w1; }
Window{ height: 100; width: 100; visible: true; objectName: "w2"; id:w2; }
Window{ height: 100; width: 100; visible: true; objectName: "w3"; id:w3; }
}
To copy to clipboard, switch view to plain text mode
main.cpp:
#include <QApplication>
#include <QQmlApplicationEngine>
#include "worker.h"
QQmlApplicationEngine* engine;
int main(int argc, char *argv[])
{
//putenv("LIBGL_ALWAYS_SOFTWARE=1");
engine
= new QQmlApplicationEngine
(QUrl("qrc:/main.qml"));
worker = new Worker();
worker->setConnections();
return app.exec();
}
#include <QApplication>
#include <QQmlApplicationEngine>
#include "worker.h"
QQmlApplicationEngine* engine;
int main(int argc, char *argv[])
{
//putenv("LIBGL_ALWAYS_SOFTWARE=1");
QApplication app(argc, argv);
engine = new QQmlApplicationEngine(QUrl("qrc:/main.qml"));
worker = new Worker();
worker->setConnections();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
worker.h:
#ifndef WORKER_H
#define WORKER_H
#include <QObject>
#include "QTimer"
{
Q_OBJECT
public:
explicit Worker
(QObject *parent
= 0);
public slots:
void setConnections();
void reset();
};
extern Worker* worker;
#endif // WORKER_H
#ifndef WORKER_H
#define WORKER_H
#include <QObject>
#include "QTimer"
class Worker : public QObject
{
Q_OBJECT
public:
explicit Worker(QObject *parent = 0);
QTimer timer;
public slots:
void setConnections();
void reset();
};
extern Worker* worker;
extern QObject *root;
#endif // WORKER_H
To copy to clipboard, switch view to plain text mode
worker.cpp:
#include "worker.h"
#include "QtQuick/QQuickView"
#include "QtQml/QQmlApplicationEngine"
#include "QQuickWindow"
Worker* worker;
extern QQmlApplicationEngine* engine;
QQuickWindow *w1,*w2,*w3;
{
root = engine->rootObjects().first();
w1
= root
->findChild<QQuickWindow
*>
(QString("w1"));
w2
= root
->findChild<QQuickWindow
*>
(QString("w2"));
w3
= root
->findChild<QQuickWindow
*>
(QString("w3"));
timer.setInterval(30);
timer.start();
}
void Worker::setConnections(){ connect(&this->timer,SIGNAL(timeout()),this,SLOT(reset())); }
void Worker::reset(){
w1->update();
w2->update();
w3->update();
}
#include "worker.h"
#include "QtQuick/QQuickView"
#include "QtQml/QQmlApplicationEngine"
#include "QQuickWindow"
Worker* worker;
extern QQmlApplicationEngine* engine;
QQuickWindow *w1,*w2,*w3;
QObject *root;
Worker::Worker(QObject *parent) :
QObject(parent)
{
root = engine->rootObjects().first();
w1 = root->findChild<QQuickWindow*>(QString("w1"));
w2 = root->findChild<QQuickWindow*>(QString("w2"));
w3 = root->findChild<QQuickWindow*>(QString("w3"));
timer.setInterval(30);
timer.start();
}
void Worker::setConnections(){ connect(&this->timer,SIGNAL(timeout()),this,SLOT(reset())); }
void Worker::reset(){
w1->update();
w2->update();
w3->update();
}
To copy to clipboard, switch view to plain text mode
it shows all the same results.
In stackoverflow forum Ansh helped me to find out that this it opensource-driver-related issue, but I can't use proprietary driver because it does not support my target PC's videoadapter radeon x300 and Intel builtin graphics.
I compiled most fresh mesa release (10.5.8) but it did not helped.
I don't know what to do now.
Bookmarks