<html><head>
<style id="css_styles">
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] { list-style-position: inside;}
body { font-family: 'Segoe UI'; font-size: 12pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
a.em-mention[href] { text-decoration: none; color: inherit; border-radius: 3px; padding-left: 2px; padding-right: 2px; background-color: #e2e2e2; }
._em_placeholder {color: gray; border-bottom: 1px dotted lightblue;} ._em_placeholder:before{color:gray; content: '{{ ';} ._em_placeholder:after{color:gray; content: ' }}';}
</style>
</head>
<body>Hello again good PyQt folks.<div><br /></div><div>I'm having a deal of trouble consistently displaying the frame that (I think) should appear around a <font face="Consolas">QTreeView</font>, which is embedded in a <font face="Consolas" size="3" style="font-size: 16px;">QDialog</font>. I specify the frame as follows:</div><div><br /></div><div><font face="Consolas" size="3" style="font-size: 16px;"> self.treeView.setFrameStyle(
</font></div><div><font face="Consolas" size="3" style="font-size: 16px;"> QtWidgets.QFrame.Shape.StyledPanel|
</font></div><div><font face="Consolas" size="3" style="font-size: 16px;"> QtWidgets.QFrame.Shadow.Raised
</font></div><div><font face="Consolas" size="3" style="font-size: 16px;"> )
</font></div><div style="font-size: 16px;"><br /></div><div>Sometimes the frame doesn't display at all. Sometimes parts of it will display (for example, three sides but not the fourth).</div><div><br /></div><div>Attached is a sample script. It does two different things (controlled by setting the boolean variable on line #14).</div><div><br /></div><div>(1)</div><div>In one case, it creates a <font face="Consolas" size="3" style="font-size: 16px;">QTreeView</font>, places it inside a <font face="Consolas" size="3" style="font-size: 16px;">QHBoxLayout</font>, and puts the layout into the main layout for the <font face="Consolas" size="3" style="font-size: 16px;">QDialog</font>. On my computer, what I get in this case is frame on both sides and the bottom of the tree view, but not the top.</div><div><br /></div><div>(2)</div><div>In the other case, the script creates the <font face="Consolas" size="3" style="font-size: 16px;">QTreeView</font>, puts the tree view into a <font face="Consolas" size="3" style="font-size: 16px;">QHBoxLayout</font>, then puts that layout into a <font face="Consolas" size="3" style="font-size: 16px;">QFrame</font> and adds the frame to the dialog's main layout. In that case, I get no frame around the tree view at all.</div><div><br /></div><div>(Toggle between case 1 and case 2 by setting the boolean on line #14 to <font face="Consolas" size="3" style="font-size: 16px;">False</font> or <font face="Consolas" size="3" style="font-size: 16px;">True</font>, respectively).</div><div><br /></div><div>Am I doing something wrong here?</div><div><br /></div><div>BTW, this is Windows 11, and I have the <font face="Consolas" size="3" style="font-size: 16px;">System>Display</font> Scale setting to 125%. It this possibly the cause of the problem?</div><div><br /></div><div>Thanks again!</div><div><br /></div><div>/John</div></body></html>