Results 1 to 6 of 6

Thread: Help w/ Graphical File Selection Screen

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Help w/ Graphical File Selection Screen

    I am working on a project that will use VLC to play files that a user selects from a external hard drive.

    I need to create a graphical file selection screen which will display the Alphabet. A user will use left or right arrows to navigate the letters. Whatever letter the user stops in will become enlarged to show selection and the files that stat with that letter will load up and the user can select which one to play.

    For example,

    t u v w x y z A b c d e f g h
    aaa.avi
    aab.avi
    acc.avi


    Can any help me out and tell me where and how to start with this?
    Thanks a lot, I appreciate it!

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help w/ Graphical File Selection Screen

    You could use a QLabel with HTML links for your letter selector. In its LinkActivated you handle the update of the file list.

    some (pseudo)code to get you started:

    Qt Code:
    1. void MyWidget::MyWidget(..)
    2. {
    3. // Initialization..
    4. connect(label,SIGNAL(linkActivated(QString),this,SLOT(OnLinkActivated(QString));
    5. OnLinkActivated('A');
    6. }
    7.  
    8. void MyWidget::UpdateLabel(QChar capitalLetter)
    9. {
    10. QString labeltext = "";
    11. through all letters c, where files exist..
    12. {
    13. QChar d = c;
    14. if (d == capitalLetter) d = d.toUpper();
    15. labeltext += "<a href="+c+" style=\"text-decoration:none;\">"+d+"</a>";
    16. }
    17. label.setText(labeltext);
    18. }
    19.  
    20. void MyWidget::OnLinkActivated(QString letter)
    21. {
    22. UpdateLabel(letter);
    23. // update your file list accordingly..
    24. }
    To copy to clipboard, switch view to plain text mode 

    Hope it get's you started..

    Good luck,

    Johannes

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Help w/ Graphical File Selection Screen

    Thanks a lot with the help.

  4. #4
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Help w/ Graphical File Selection Screen

    Does anybody else have any input on this? I am not very good at programming so I'm having a lot of trouble with this. Any help will be appreciated.
    Thanks

  5. #5
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Help w/ Graphical File Selection Screen

    I would go with MVC to do that what You want. Maybe two models, one for a-z and another one for file names. Although using one model for file names is probably not what You want, because lets say user select next z instead of b (i.e. [z]Abc) assuming that a is selected at first by default, so displaying z column content, depending on haw many files is there, would take some time, hence "lag".(You can connect signal to column selection, so that would trigger i.e. populating model). Probably better approach would be QList<QStandardItemModel>. Each model for each character, run in separate thread, to prevent GUI freeze. Custom TableView for characters and ListView for file names, or QGraphicsScene with custom display objects for characters. And what's nice with models, is that there is already i.e. QFileSystemModel that will gave You all file list, Views supports automatic sorting so You don't really need to write that code Yourself. Also some views, i.e. QListView supports layoutMode that allow You view item practically instantly, i.e. you have 2k files in directory, but display displays only 100, so normally You would need to wait for load to complete, with batched mode you can view i.e. first 100 that are already loaded.
    You can customize view, maybe with style sheet's (I assume You want some fancy GUI because it's front end for browsing files) or QGraphicsBlurEffect.
    That way You can display same data in multiple ways, i.e. here is my project that i work on, what You see is only one model:

    Snap1..jpg Snap2..jpg Snap3..jpg Snap4..jpg

    And with style sheet's or Effect you could make it look really nice.
    As before this is only how I would do that, maybe there is some better way that I don't know about.
    Best luck
    Last edited by Talei; 28th April 2010 at 06:38.

  6. #6
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help w/ Graphical File Selection Screen

    Hi!

    Quote Originally Posted by dsnuckel View Post
    Does anybody else have any input on this? I am not very good at programming so I'm having a lot of trouble with this. Any help will be appreciated.
    Thanks
    Could you be, a bit more specific as to where your problem is? It won't help you on the long run, if we write the program for you.

    Do you have a problem with the widget setup? Problem finding files? Handling key events?

    What have you got working so far?

    Johannes

Similar Threads

  1. Graphical representation of an array
    By ithinkso in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2010, 23:30
  2. graphical demonstration of .cpp qt files
    By navid in forum Newbie
    Replies: 1
    Last Post: 8th January 2010, 12:18
  3. QWebView -> load Default Splash Screen from .qrc File
    By RacePhase in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2009, 14:14
  4. Open file Window Screen
    By jano_alex_es in forum Newbie
    Replies: 3
    Last Post: 27th May 2009, 08:39
  5. graphical line
    By eleanor in forum Qt Programming
    Replies: 3
    Last Post: 3rd July 2008, 10:09

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.