<div dir="ltr"><div>Hi Phil,<br><br></div>From the docs I read that<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You will probably also want to set at least one of the scroll
bar modes to <tt>AlwaysOn. </tt><br>All widgets set here will be deleted by the scroll area when it
is destroyed unless you separately reparent the widget after
setting some other corner widget (or 0).</blockquote><div><div><div><div class="gmail_extra"><br></div><div class="gmail_extra">It's a strange behavior that, when I resize the widget it disappears. Are the scroll areas get destroyed when such resizing happens? Is that a bug? Why my question alone went unanswered? Can you please help me?<br></div><div class="gmail_extra"><div class="gmail_quote"><span dir="ltr"></span><br></div><div class="gmail_quote">- TFA<br><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank"><wbr><wbr></a><a href="mailto:pyqt-request@riverbankcomputing.com"><wbr></a><a href="mailto:pyqt-owner@riverbankcomputing.com"><wbr></a>I'm posting the question here again since the people here might've failed<br>
to notice it before. I'm trying to display files and folders like column<br>
view in Mac finder.<br>
<br>
[image: Inline image 1]<br>
<br>
I was able get the basic structure with the help of ListViews and<br>
QFileSystemModel. Then I set the splitter handle as a corner widget for the<br>
scroll area. I encounter two issues here<br>
<br>
- When I resize the listview, the splitter handle disappears.<br>
- Even after setting the splitter handle width to 0, I see spacing<br>
between listviews.<br>
<br>
Please refer the code below<br>
<br>
# -*- coding: utf-8 -*-<br>
<br>
from PyQt4 import QtCore, QtGuiimport os<br>
try:<br>
_fromUtf8 = QtCore.QString.fromUtf8<br>
except AttributeError:<br>
def _fromUtf8(s):<br>
return s<br>
try:<br>
_encoding = QtGui.QApplication.UnicodeUTF8<br>
def _translate(context, text, disambig):<br>
return QtGui.QApplication.translate(<wbr>context, text, disambig, _encoding)<br>
except AttributeError:<br>
def _translate(context, text, disambig):<br>
return QtGui.QApplication.translate(<wbr>context, text, disambig)<br>
class PopulateList(QtGui.QDialog):<br>
def __init__(self,parent=None):<br>
super().__init__(parent)<br>
self.ui = Ui_Form()<br>
self.ui.setupUi(self)<br>
self.setModel()<br>
self.show()<br>
<br>
self.ui.splitter.<wbr>setHandleWidth(0)#not working<br>
self.ui.listView.<wbr>setVerticalScrollBarPolicy(<wbr>QtCore.Qt.ScrollBarAlwaysOn)<br>
self.ui.listView.<wbr>setCornerWidget(self.<wbr>getCornerWidget(self.ui.<wbr>splitter))<br>
<br>
self.ui.closePushButton.<wbr>clicked.connect(self.close)<br>
self.ui.listView.clicked.<wbr>connect(self.showSubFiles)<br>
<br>
def getCornerWidget(self, splitter):<br>
self.handle=splitter.handle(1)<br>
layout=QtGui.QHBoxLayout(self.<wbr>handle)<br>
layout.setSpacing(0)<br>
layout.setMargin(0)<br>
<br>
for i in range(0,2):<br>
line = QtGui.QFrame(self.handle)<br>
line.setFrameShape(QtGui.<wbr>QFrame.VLine)<br>
layout.addWidget(line)<br>
<br>
return self.handle<br>
<br>
def showSubFiles(self, index):<br>
root_path = self.model.fileInfo(index).<wbr>absoluteFilePath()<br>
self.model1=QtGui.<wbr>QFileSystemModel()<br>
self.model1.setRootPath(root_<wbr>path)<br>
self.ui.listView_1.setModel(<wbr>self.model1)<br>
self.ui.listView_1.<wbr>setRootIndex(self.model1.<wbr>index(root_path))<br>
<br>
def setModel(self):<br>
root_path=os.path.expanduser("<wbr>~")<br>
self.model=QtGui.<wbr>QFileSystemModel()<br>
self.model.setRootPath(root_<wbr>path)<br>
self.model.setFilter(QtCore.<wbr>QDir.NoDotAndDotDot | QtCore.QDir.Dirs)<br>
self.ui.listView.setModel(<wbr>self.model)<br>
self.ui.listView.setRootIndex(<wbr>self.model.index(root_path))<br>
class Ui_Form(object):<br>
def setupUi(self, Form):<br>
Form.setObjectName(_fromUtf8("<wbr>Form"))<br>
Form.resize(602, 365)<br>
self.verticalLayout = QtGui.QVBoxLayout(Form)<br>
self.verticalLayout.<wbr>setObjectName(_fromUtf8("<wbr>verticalLayout"))<br>
self.splitter = QtGui.QSplitter(Form)<br>
self.splitter.setOrientation(<wbr>QtCore.Qt.Horizontal)<br>
self.splitter.setObjectName(_<wbr>fromUtf8("splitter"))<br>
self.listView = QtGui.QListView(self.splitter)<br>
self.listView.setObjectName(_<wbr>fromUtf8("listView"))<br>
self.listView_1 = QtGui.QListView(self.splitter)<br>
self.listView_1.setObjectName(<wbr>_fromUtf8("listView_1"))<br>
self.verticalLayout.addWidget(<wbr>self.splitter)<br>
self.horizontalLayout = QtGui.QHBoxLayout()<br>
self.horizontalLayout.<wbr>setObjectName(_fromUtf8("<wbr>horizontalLayout"))<br>
spacerItem = QtGui.QSpacerItem(40, 20,<br>
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)<br>
self.horizontalLayout.addItem(<wbr>spacerItem)<br>
self.closePushButton = QtGui.QPushButton(Form)<br>
self.closePushButton.<wbr>setObjectName(_fromUtf8("<wbr>closePushButton"))<br>
self.horizontalLayout.<wbr>addWidget(self.<wbr>closePushButton)<br>
self.verticalLayout.addLayout(<wbr>self.horizontalLayout)<br>
self.verticalLayout.<wbr>setStretch(0, 1)<br>
<br>
self.retranslateUi(Form)<br>
QtCore.QMetaObject.<wbr>connectSlotsByName(Form)<br>
<br>
def retranslateUi(self, Form):<br>
Form.setWindowTitle(_<wbr>translate("Form", "Form", None))<br>
self.closePushButton.setText(_<wbr>translate("Form", "Close", None))<br>
<br>
if __name__ == "__main__":<br>
import sys<br>
app = QtGui.QApplication(sys.argv)<br>
listView=PopulateList()<br>
sys.exit(app.exec_())<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170209/cc9a0db7/attachment.html" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>pipermail/pyqt/attachments/<wbr>20170209/cc9a0db7/attachment.<wbr>html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: image.png<br>
Type: image/png<br>
Size: 28914 bytes<br>
Desc: not available<br>
URL: <<a href="https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170209/cc9a0db7/attachment.png" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>pipermail/pyqt/attachments/<wbr>20170209/cc9a0db7/attachment.<wbr>png</a>><br></blockquote></div><br></div></div></div></div></div>