QTableWidget: different styles in *one* QTableWidgetItem? - qt

Is it possible to have a two-line element in a cell (QTableWidgetItem) of a QTableWidget with different styles per line? I want to have the first line bold and the second line not bold. Or can I add two QTableWidgetItems in one cell? Do a cellspan somehow?
Cheers
Matthias

Simple way :
Checkout the setCellWidget method of QTableWidget.
If you replace the default widget with QTextEdit, you can get rich text formatting capability.
Better way :
Use a custom QStyledItemDelegate. You can see an example here
I hope this helps.

Related

telegram bot ,How to make bigger buttons with emoj caption

I'm trying to make this kind of inlineKeyboardButtons :
http://i.stack.imgur.com/sHSTA.png
Which is bigger in width and has emojis inside it.
How can I do so ?
Thanks
You should use code of emoji in button caption. For getting codes take a look at this list.
If you want bigger width then only one element should be declared in the array of InlineKeyboardButton objects.
That is a inline keyboard where the button text contains an emoji.

How to display a QLabel under another QLabel?

I have some QLabels in a QWindow. They might have some space in common. I want to know how can I change label's depth. In default situation the label which defined later is on the previews ones.
You can define an indent for each widget and call raise_ function in sort of their indent.
for label in labels:
label.raise_()
you should use raise, like :
labelname.raise_()
All widgets have methods for this.
widget.stackUnder(another_widget) #relative postition
widget.lower() # send to the bottom
widget.raise_() # send to the top
See documentation on QWidget

Flex - combined bold and normal label in Button component

It is possible to bold some part of label in standard Button? example:
ICON - normal_normal_text BOLD_BOLD_text
Thanks for help :)
I don't think you can do this with a standard label, but FlexLib contains a CanvasButton component (http://flexlib.googlecode.com/svn/trunk/docs/flexlib/controls/CanvasButton.html) that allows you to add multiple children to a button that would work well to have two labels styled differently, or to better control the styling in a single label.
You're probably better off using a Text or a Label and skinning it look like a button. Each of those has an .htmlText property which will take rudimentary tags like <b></b> and <i></i>, etc. Remember to set the .buttonMode and .useHandCursor properties to true and .mouseChildren to false for best button simulation.

Individual QTreeWidgetItem indentation

Is it possible to have individual indentation of items in a QTreeWidget?
In specific, I have have a column containing both text, icon and for some of them a CheckBox. The items without a CheckBox gets shifted to the left so the indentation of the icon and the text is not inline with the others. Could maybe be fixed with a hidden CheckBox if that is possible?
Maybe the use of Delegates will give you a nice and proper implementation. You'll have the opportunity to re-implement the paint() and sizeHint() methods, and therefore, choose the way your QTreeWidgetItem are being drawn...
More documentation here : http://doc.trolltech.com/4.6/model-view-delegate.html
An example : http://doc.trolltech.com/4.6/itemviews-pixelator.html
Hope it helps a bit !
You can try using the QWidget::setContentMargins() on the widget returned by QTreeWidget::itemWidget().

Ghost/translucent caption inside text input?

First, what does one call the ghost caption that appears in a text edit if that edit has no real text?
Second, has anyone invented that particular wheel for Flex text components?
Thanks
It's called a Watermark.
I'm not an expert on Flex but here is one example:
http://labs.flexperiments.nl/writing-components-in-flex-part-2/

Resources