Как сделать Qt графический эффект или эффект шейдера пакетным - PullRequest
0 голосов
/ 23 июня 2019

Я хочу использовать графический эффект внутри делегата.Но я также хочу, чтобы мой компонент быстро отображался.Поэтому я хочу, чтобы номер моего пакета был ниже 10 (как рекомендует Qt здесь: https://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph-renderer.html).

Я сделал небольшой пример:

Column{
    Repeater {
        model: 6;
        Rectangle {
            color: "black";
            id: img;
            width: 30;
            height: 30;

            layer.enabled: true;
            layer.effect: ColorOverlay {
                color: "white";
                cached: true;
            }
        }
    }
}

Когда я его запускаю, я получаю это:

Renderer::render() QSGAbstractRenderer(0x2bd6dc98e00) "rebuild: full"
Rendering:
 -> Opaque: 0 nodes in 0 batches...
 -> Alpha: 6 nodes in 6 batches...
 - 0x2bd76a793c0 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 - 0x2bd76a79460 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 - 0x2bd76a78d80 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 - 0x2bd76a78e20 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 - 0x2bd76a78ce0 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 - 0x2bd76a78ec0 [  upload] [noclip] [ alpha] [  merged]  Nodes:    1  Vertices:     4  Indices:     6  root: 0x0 opacity: 1
 -> times: build: 0, prepare(opaque/alpha): 0/0, sorting: 0, upload(opaque/alpha): 0/0, render: 8

Не так хорошо, как вы можете видеть.

Однако, если я включаю слой не активированным, я получаю следующее:

 -> Opaque: 6 nodes in 1 batches...
 -> Alpha: 0 nodes in 0 batches...
 - 0x1e5fc4499c0 [  upload] [noclip] [opaque] [  merged]  Nodes:    6  Vertices:    24  Indices:    36  root: 0x0

Есть лиспособ достижения этого? Даже если мне нужно написать код C ++?

Спасибо!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...