I have a TreeView in a QtGui. But I want it to display only one folder at 'F:\Qt\GUI\files'
I have tries a tutorial on youtube (http://www.youtube.com/watch?v=M0PZDrDwdHM) but I read on qt-project.org that QDirModel is obselete now. And I don't know how to do this now. The end result needs to be the same as in the youtube video but than without all the other drives and folders on the pc.
Thank you so much! :)
You just need to use QFileSystemModel instead of QDirModel. To set directory you want to be displayed use the setRootPath method. For example, to display MyComputer content use an empty string as a parameter value.
Related
I've seen answers for this all over the place but not for non-MFC C++. I already know how to populate a listbox with the contents of a folder - that's not what I want. I need a listbox to have a small folder picker so I can display the contents of the selected item (the files therein) in a separate list box. Again, I know how to achieve all of this except for having a folder picker inside a listbox.
I've looked at all the listbox functions on MSDN and there was only like four or five functions there and none of them seem to do this.
I don't really have any relevant code to post related to this question, so I hope what I have explained here is good enough.
Here's a picture of what I'm trying to replicate:
Thanks!
I'm making a game with C++/SFML on a windows platform(7). I have saving and loading down but currently if you want to load a world you must type the name of the folder that world is saved in exactly. My goal is to have the game display a list of the folders within the "saves" directory and have the player select one, loading the correct world. What I need help with is the displaying the folders part, How would i search the "saves" directory and then get the names of all the folders in there, all I need is the name of all the folders.
if its necessary, or would help, here is my current build:
https://docs.google.com/file/d/0BwIyLLkXSiakSUxuM2FpWGhUdGc/edit
click: file->download, or ctrl+s, to download
In Windows, you can use the FindFirstFile() and FindNextFile() API functions.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365200%28v=vs.85%29.aspx
i like to display image from server without downloading it , sure i can use qwebkit.
but i like to be able to display the image in some kind of list . what option do i have ?
I know that QTextEdit supports img tags, and I use them in lists. However, I don't know if it actually supports full URLs for those images, I just use images from the resource file. You could however give it a try.
Use setHTML() to set the HTML source code, setText() assumes plain-text.
You -have to- download the image manually and load it into a QPixmap to show it. You can use libcurl to download the image, it's pretty solid and works on virtually any platform. And really easy to use.
Right now I am displaying the result in QTextBrowser. Results will be something like /home/User/, /media/Arena/ etc i.e path to different folders. Now I want to open the folder in a window by clicking on this result which is displayed in QTextBrowser. But I have no ideas how to do that. So can anyone let me know how to do it.
Thanx in advance.
P.S. I am using QtCreator & see the image http://i53.tinypic.com/qyxp1s.png.
can you insert html rather than plain text into the QTextBrowser widget? then you can use a URL to describe the paths.
BasementCat's right. You can use setHtml QTextBrowser's method to set HTML into the widget. You'll then probably need to call setOpenLinks(false) to disable default behavior and connect custom slot to widget's anchorClicked(QUrl const&) signal to handle links.
Can anyone please tell me how to create a combobox like following with Gtk (on Linux)? (I already ask this question for win32 API).
A code example or tutorial will be very helpful. I have tried searching this over the internet, but unfortunately documentations/tutorials aren't that much rich for Gtk. Thank you very much.
Regards,
I know how to do this in C, but I'll try to wing it in C++. First of all, use a ComboBox to display your menu, which you will fill using a TreeModel.
Create a TreeModelColumnRecord following the example here; you will need just one Gdk::Pixbuf column to display your line images.
Pass the TreeModelColumnRecord to the constructor of ListStore. Fill your ListStore with Gdk::Pixbuf images of your line patterns, and pass that to the constructor of your ComboBox (ListStore inherits from TreeModel).