QTextEdit widget Pyside6, setHtml, how to place 2 div side by side

59 Views Asked by At

First, let me apologize for my rusted English.

I want to display 2 html div in a QTextEdit widget (python, PySide6). Here is my code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>About</title>
</head>
<body>
    <div style="display: flex; border: 1px solid">
        <div style="flex: 1; text-align: right; margin-right: 10px;">
            RIGHT DIV :<br/>
            header 1 :<br/>
            head 02 : <br/>
            header :<br/>
            head 003 :<br/>
            last header :<br/>
        </div>
        <div style="flex: 2; margin-right: 10px;">
            LEFT DIV<br/>
            content 1<br/>
            content 2<br/>
            content 3<br/>
            content 4<br/>
            <span style="font-style: italic;">last content</span>
        </div>
    </div>
</body>
</html>

When loaded in a browser, this code produces the result I want:

side by side div

However, in the Qt widget, the div are one on the top of the other:

div 1 on the top of div 2

I have tried a lot of flex / inline-block / float, etc combinations but the div are always one on the top of the other.

Any suggestion?

0

There are 0 best solutions below