Is it possible show a tree view in a tooltip in Qt? - qt

Is it possible show a tree view in a tooltip in Qt? Or represent a tree view with a QString and then show it in a tooltip?

doc states:
The tip is a short piece of text reminding the user of the widget's function. It is drawn immediately below the given position in a distinctive black-on-yellow color combination. The tip can be any rich text formatted string.
Rich text displayed in a tool tip is implicitly word-wrapped unless specified differently with <p style='white-space:pre'>.
Then I would suggest the simplest way could be to use a nested HTML list, something like <ul><li>...<ul><li>...</ul>...</ul> that could be easy to get from your structure

I think you need create treeview dynamically and show it when user stop moving mouse.
Create widget containing QTreeView and name like ToolTipTree
Make TooltipTree to follow mouse
When user stop moving mouse, set ToolTipTree shown. I user move mouse again, hide ToolTipTree

Related

Text in flash button symbols all change at once (Actionscript 2)

I have reached an impass which means I have to spend many hours doing something in a very tedious way because I can't work out a way to do it quickly, here is my problem.
In flash if I make a button that consists of a rectangle and a text field then make it all a button symbol, if I then copy the symbol to multiple instances on screen and change the text in one of them, it changes in all of them because I am changing the symbol.
How can I overcome this, perhaps with actionscript? I tried writing.
button1.text1.text = "test change button text"; on the main canvas (and giving one button a name of button one and the text field within it text1) but it doesn't work.
The only thing I found that works was to make multiple symbol copies of the button but then if I want to change the colour or dimensions of all the buttons it takes ages.
Is there a better way? Using actionscript 2 perhaps, or just some property of the button to allow individual text?
I attempted your situation... and I didn't run into your problem. Text boxes are individual values, provided that the text box is dynamic or input
I think that what may solve your problem is checking what kind of text boxes you are working with. Look in the properties panel; does it say "dynamic"?

QTextEdit word blocks and text formatting

I need to make a QLineEdit with non-editable word blocks.
For instance, imagine I drop a word (that actually represents a value) in a QLineEdit.
I would like to write normally on the QLineEdit, BUT if I try to move the cursor inside a word it would move over it, ie, place the cursor at the end/begining of the word.
Also, I would like the word to always show a certain highlight over it, with different colors (to emulate a box that would wrap it).
Any ideas on how to do this? Would a QTextArea be better for this? I was thinking of a QLineEdit because it would actually be inside a QTableWidget cell, so I think it may have more or less the same capabilities, am I wrong?
UPDATE I found these two functions that actually might be helpful for QLineEdit: cursorWordBackward() and cursorWordForward(), so this might help move over the words. Anyone has examples of this?
UPDATE 2 As QLineEdit does not support rich-text, the "highlight" feature I required can only be achieved with a QTextEdit. This has other issues: QTextEdit does not have the functions I mentioned in the first update above, and I don't know if it is possible to put a QTextEdit inside a QTableWidget cell.
QLineEdit can contain only plain text and certainly can't do this. I was thinking about QTextEdit, it can display HTML. But looking at the documentation, I realized that there is no way to insert non-editable block in QTextDocument (which is used by QTextEdit). I think there is no simple solution.
You can try to implement it manually. Catch textChanged() and cursorPositionChanged() signals of QTextEdit, analyze its content and cursor position and modify them if user moved the cursor into non-editable block or changed its content.
Maybe you could achieve this by using an inputMask...

How to use Qt's Model-View programming

I'm trying to display some cards into a QListView but I'm really having trouble understanding how to use Qt's model/view pattern, and I can't find any simple examples.
Basically, I have two classes:
Card - my "model" which contains the name of the card, id, etc.
CardWidget - can load and render a Card object (display the card name and other info)
So how can I use Card and CardWidget to display a list of cards into a ListView? Do I need to change something to my classes, or should QListView be able to display them directly?
If someone could show me the basic steps or point me in the right direction that would be perfect.
See the documentation of QAbstractItemDelegate, which has an example of rendering items in a QTableView.
Its not obvious what you are trying to do here - in a list view, you can render a view of an item which is not the same as having a widget in every cell.
An item delegate can provide a widget as an editor and also how to render a cell's contents.
If you actually want fixed widgets in the view, you could use QListView::openPersistentEditor on all the cells you want a fixed widget for. The item delegate should outline how to create an editor for the cell in question.

How do create this gmail app effect on Honeycomb

Attached is the screenshot of the UI that I would like to have in my app. When I click on the listitems on the fragment on the left side I see a arrow pointing(question mark in red) on the list item which was clicked, I would like to know how can we achieve this in UI layout. Any special settings to be set?
I was looking at the same feature.
To implement similar, I'd suggest showing an image on the selected item in the list, this would require code rather than Layout XML, It would be controlled by the list fragment when an item is selected. That way you get the visual effect that the two fragments are related via the arrow image.
Did you end up giving it a go for yourself?

Tree Show toolTip during drag

I am denying a user the ability to drop into my tree during certain conditions, it's all going well, but I want to tell the user why I'm denying the drop. I would prefer to do it with a toolTip, but it doesn't seem to work. Can I not have a toolTip during a drag operation? How can I force one?
Flex seems to treat toolTips as a property of the UI component, with the component deciding when and if to show it. I would like it to force it to be like doing one in javaScript where it was always just like saying "Show it now" "stop showing it now"
Does anyone know about doing this during drag?
Thanks
~Mike
What you could try is to show the tooltip yourself with the mx.managers.ToolTipManager. Create for example a VBox that implements mx.controls.ToolTip and displays the message you want to show to the user.
You can see a working example at FlexExamples.
Another idea is to show a programmatic mouse cursor when the drop is denied. I've just read an article about that on Inside Ria.

Resources