Qt C++ - displaying the links in QText Browser - c++

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.

Related

How can I select a href tags in a QTextBrowser from QSS?

I would like to format my clickable URLs inside a QTextBrowser. In a QSS file that I set for the entire application, I've tried QTextBrowser::text.a and QTextBrowser.a, but neither worked. Am I actually expected to manually format every link using the Qt Creator editor, or is there a way around this?
You can’t use QSS for that, but QTextBrowser supports a subset of CSS, so you can make it part of the displayed HTML, or set a default stylesheet: QTextDocument::defaultStyleSheet.

How do I get a folder displayed in TreeView Qt

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.

How to display list of opened tabs in Qt 4.8 on Ctrl+Tab

Is there any straightforward (without listening to key events) way to display the list of opened tabs in Qt, like following (in Visual Studio). I just want to make sure Qt does not offer such a feature, before implementing such a widget by myself.
At least in a primitive way like in NotePad++ (meant no offense). Now, when I am using QTabBar and press Ctrl+Tab it shows something like this,
And I don't know actually what is that !
The default behaviour of ctrl-tab is to cycle through the tabs. You will need to customize that to display your own dialog. You don't need to connect to any signals to do this, simply pass a reference to the tab widget/bar into the dialog. You can then use that reference to retrieve the names and to change the tab.

Display html page?

I want to load static web page from resource and to display it as dialog, not like its loaded in internet explorer but like dialog without any menus or borders if possible.
I want to use this page as "GUI", pretty crazy idea yes.
Someone can explain me how to achieve this ? (I dont want any dependencies on my executable).
Thanks in advance.
You can use a webbrowser like this:
http://www.adp-gmbh.ch/win/misc/mshtml/index.html
http://support.microsoft.com/kb/315617/es

custom combobox win32

I am trying to implement an auto-suggest feature in an win32 combobox (C++). I want to achieve a behaviour that is similar to the google auto suggest function. When the user types something into the edit-control of the combobox, its listbox opens and shows all possible matches. The Problem is the default behaviour of a win32 combobox is to always select the closest match and put the complete text (selected) into the edit control when the list is opened. I need to avoid this behaviour. The list should just open - dont select something and dont change the text in the edit-control!
I have tried to subclass the combobox and catch the CBN_DROPDOWN message, but this changes nothing on the default behavior.
Does anyone have a further idea? I dont want the auto-complete feature that just completes the text in the edit-control without opening the list.
Thx in advance
Greets, Michael