How to make selected QTableWidget row bold in pyqt - pyqt4

I want to know is it possible to make a stylesheet to make the contents in selected row bold.
i am using self.tw.setSelectionBehavior(QAbstractItemView.SelectRows) to set table to select entire row instead of cell. But i dont want any backgroung color to be changed instead it font should be bold.
How can i achieve this....?

This is a python style code
font = QFont()
font.setBold(True)
self.ui.tableWidget.item(row_index, col_index).setFont(font)

In C++, we would create an onTableEdited() slot, connect it to the itemSelectionChanged() event, and then use table->item(x,y)->setFont() with something like
QFont font;
font.setBold(true);
font.setWeight(75);
You can also set a QTableWidget to only allow the selection of rows.

Related

How can i change color of text of spinner?

I want to change the color of the default text in the spinner in dialog mode. If the text is "Select Gender" only its color change and others will be set as default. Is this possible?
Yes it is possible. You don't show anything you've tried and perhaps that's because you don't know whee to begin?
Have a read of this, Beginners CSS
It will help you get started with styling elements in Html documents using Cascading Style Sheets (CSS).

how to hide table-column in lotus notes form?

pic
pic
ex. i have 2 column in this table if i write "if i = 1 then hide column 2" and when i = 1 , they hide only text, not hide table-column how can i hide all? thank you!
i weak in English.
The hide when has to include the whole column not only one cell.
In order to have full control of rows/cells hiding, you might want to write your own table in plain HTML.
There's no way to hide a table column when using the Notes client.
If you're going to display the table in a web browser then you could easily hide with css.
I currently am able to "hide" a column but it's for a very specific use case which is probably not helpful to you but may be to others. I would only use this if it's the last column in the table, the contents are there for programmatic control (buttons, etc) or non-essential information, and you're hiding for preview/read/print purposes.
Do the following on all cells of the column:
Define the hide-when
Set the border width to 0
Set the cell color to white (or whatever your form's background color is)
Of course, by doing this the border width and color will always be the same. There's no way to programmatically change those.

Change Background color of column in grid dynamically

Hi I don't know how to dynamically change the background color of the column inside the grid I tried looking here Changing column name dynamically but failed. I also tried looking for something like change but only changing of display name is applicable.
PXUIFieldAttribute.SetDisplayName<PMTran.description>(Base.Transactions.Cache,
row.ProjectID.HasValue ? "Description for Project Tran" : "Description");
Check this out for the answer:
How to change the cell colors

How to show rich text in the QCombobox.lineEdit()? or how to replace the lineedit in qcombobox with textedit?

i have this working example
now i want to be able to edit the QLineEdit and highlight items that are not in the dropdown listview,(eg. red background color) , and add auto complete feature. from my understanding, the only viable way is making a custom widget, with a QTextEdit and a listView ( since qlineedit can't display html ?)
edit: eg I have India,China in the lineEdit, but i only want China's bg color to be red since it's not in the dropdown items list
is there an easier way other than this? thanks !
the code is here: http://pastebin.com/WGrj3ud5
and here : http://www.barishcb.com/?p=426
For the auto-completion, you need to add a QCompleter to your QlineEdit
For the red background, you can dynamically change the style sheet of the QLineEdit:
# in case of item not in the dropdown listview:
self.lineEdit.setStyleSheet("background-color: rgb(255, 0, 0);")
# otherwise:
self.lineEdit.setStyleSheet("")

I wish to apply a background color to ONLY the cells in a specific dataGrid column?

I asked this question on the LiveCode email list. No response, so I figure it must not be possible. I know about editing the template graphic that enables alternating row colors. That doesn't help me.
This lesson is the closest to what I have found, but it only sets the overlay color to empty cells. It also had an unwanted affect, where any data that was present in the grid no longer shows up.
http://lessons.runrev.com/s/lessons/m/datagrid/l/7327-how-do-i-override-the-default-behavior-for-rendering-data-to-a-cell
As a little experiment, since the data became invisible (note that I'm on WinXP), I tried placing an opaque graphic over the column I wish to colorize. I set the ink of the graphic to AddMax or AddOver, and it looked nice, but the text in the cells disappeared. Then I tried setting the ink to AddMin, and it still looks good, but the test shows through!!!!
So, I think this will work fine visually, but how can I pass a double-click through this graphic to the cell underneath (to allow cell editing only within this column)?
Yes, you can do this.
This suggestion comes from Trevor DeVore at http://www.bluemangolearning.com/
Create a custom column template using the property inspector. From there you can edit the behavior of the column to colorize the background color of the field for that column or just edit the field in the template group to change the color.
The background color will only show up in rows that have data, however.

Resources