Results 1 to 2 of 2

Thread: Problems with directory display

  1. #1
    Join Date
    Jan 2014
    Posts
    9
    Qt products
    Platforms
    MacOS X Unix/X11

    Default Problems with directory display

    Hi all, I am encountering a problem with directories-reading. It is able to read it but it is not displaying correctly.
    Like it is reading from Source A but it displays the item from Source B instead of A

    When user types executes the program, it will display 2 ListWidgets respectively - refItemList and jobItemList, depending on what the user types in the LineEdit
    For example, if the user types testItemA, and hits the ShowItems button, it will displays all the folders only (test01 etc)
    I have placed an example output in the code below, hopefully it makes sense

    Qt Code:
    1. ''' Directory for users to compare refList folders to '''
    2. jobList = os.listdir("/u/ykt/Desktop/test/testItemA")
    3. # ['test01', 'test02', 'test03', 'test04', 'test05']
    4.  
    5. ''' Directory that users access and compare it to jobList folders '''
    6. refList = os.listdir("/user_data/testItemEx")
    7. #['test01', 'test02', 'test03', 'format01', 'format02.py', 'test.py']
    8.  
    9. refItems = []
    10. for item in jobList:
    11. if item in refList:
    12. refItems.append(item)
    13.  
    14. # Output in refList: ['test01', 'test02', 'test03']
    15. # Output in jobList: ['test01', 'test02', 'test03', 'test04', 'test05']
    16.  
    17. ''' Adding the items into the listWidgets '''
    18. self.jobItemList.addItems(jobList)
    19. self.refItemList.addItems(refItems)
    20.  
    21. ''' So that there can only be one selection between the 2 Lists '''
    22. self.itemsDict = {}
    23. self.itemsDict[self.refItemList] = self.jobItemList
    24. self.itemsDict[self.jobItemList] = self.refItemList
    25.  
    26. self.refItemList.clicked.connect(self.listSelect)
    27. self.jobItemList.clicked.connect(self.listSelect)
    28.  
    29. def listSelect(self):
    30. self.shotsDict[self.sender()].clearSelection()
    To copy to clipboard, switch view to plain text mode 

    But as there are some parts that I am using my school in-house modules to write on, I am encountering the problem where as I am printing out the item selected, it retains from the previous selection.

    For example, in test01, it contains itemD, itemE, itemF; test02 contains itemG, itemH, itemI
    It happens when I retype in the LineEdit to test02 (therefore reading test02 items in the jobList), and as I print it out, it is actually printing as 'test01, itemD' instead of 'test01, itemG'

    Are there anyways for me to force item read according to the jobList?
    I hope I am making sense here

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Problems with directory display

    Quote Originally Posted by salik89 View Post
    For example, in test01, it contains itemD, itemE, itemF; test02 contains itemG, itemH, itemI
    It happens when I retype in the LineEdit to test02 (therefore reading test02 items in the jobList), and as I print it out, it is actually printing as 'test01, itemD' instead of 'test01, itemG'

    Are there anyways for me to force item read according to the jobList?
    I hope I am making sense here
    No. What is "it" in "It happens"?
    Nothing in your code has anything to do with reading or outputting the content of a file. Nothing shows uses of a QLineEdit.

Similar Threads

  1. how to display files of a directory in a listview
    By sliverTwist in forum Newbie
    Replies: 2
    Last Post: 2nd April 2013, 06:29
  2. Replies: 3
    Last Post: 2nd September 2012, 04:29
  3. display a directory using qtreewidget
    By kamlmish in forum Newbie
    Replies: 2
    Last Post: 19th December 2010, 13:37
  4. How to display entire directory(Filesystem)
    By deepakn in forum Newbie
    Replies: 11
    Last Post: 10th November 2009, 10:58
  5. Display files of a Directory
    By mansu in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2009, 16:08

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.