QTableWidget colors, styles - qt

I'm quite new to Qt and I'd appreciate the ability to customize a QTableWidget. I found a nice CSS-like interface using the stylesheets as shown here
http://doc.trolltech.com/4.3/stylesheet-examples.html#customizing-qtablewidget
However, I need to change some more specific styles (like grid color, items background color and so on).
I couldn't find any documentation describing the properties that might be changed via stylesheets.
Thanks for any help.
EDIT
Thanks, it helped a bit...however i still missed some other properties as grid thickness, but i "solved" it by inserting a row/column with 1px height/width to double the gridline :) And the QTableWidgetItem::setBackgroundColor() was also helpful.
However, I'm still facing some issues with QTableWidgetItem, the text keeps hiding if the column is too slim...only 3 dots appear. Dont you have an idea? I need the text to be visible, even if a bit clipped, but from the problem definition I cannot resize the column.

Isn't
http://doc.trolltech.com/4.3/stylesheet-reference.html#list-of-properties
the list you are looking for?

Related

Custom shaped menu with shadow in Qt

I'd like to create a context menu looking similar to this one:
I read suggestions on the web that QWidget::setMask() should be used to create a shape. But how can it fit the variable number of items then? Moreover, the same menu item may take more or less screen space on different machines.
Another question is how to create a shadow around this custom shape? As far as I understand, the mask allows to crop the widget, but not to make it semi-transparent.
I don’t found an easy way to do that! But here goes a way!
Instead of using the Qt mask API, I've used a frame-less widget with transparency enabled!
To draw the shadow, I've used radial gradient!
You can change the size of the menu before opening it, however you can’t resize it after opened (for example resize with mouse).
It’s quite easy add or remove widgets, just respect the layout margin to not draw outside the bounds destined to widgets. To simplify your life I created an inherited class of QPushButton with colors you can easily customize with style sheet.
See the result:
You can browse the source
Hope that helps!

How to limit QPushButton from bieng smaller then the size of its text?

Unexpectedly for myself I found out that buttons impudently ignore the size of the text and easily cut it with a decrease.
Is there something like sizeAdjustPolicy as at QComboBox? If not, what is the correct decision?
In Google and other places I didn't find anything intelligible.
Thanks in advance!
edit2:
I used Qt Style Sheets, cleaned - works fine. Have to give up beauty.
Solution: it was in Qt Style Sheets. If there to use min-width property then something spoils and the button ignores the text size.
To prevent a button from getting too small, set its horizontal size policy to MinimumExpanding. I don't see a reason to use stylesheets for that.
If you wish to manage the size of the button yourself, you can get the minimum size hint of any control by using the minimumSizeHint method.
It was in Qt Style Sheets. If there to use min-width property then something spoils and the button ignores the text size.
You can refer to this question to determine the text size and set the button width according to it using QFontMetrics.

How do I get rid of the three small dots in a split-pane-divider within a pane-divider in JavaFX 2?

I am working in a style sheet, I had no major problems with styling until now. I need to remove the three little dots in the middle of the split-pane-divider.
I found no information about those three dots in the JavaFX Reference Guide.
I cant upload a picture to make it clearer, with the resources found on the reference guide I managed to change the background color, borders, and orientation, but the small dots in the enter remain there.
Have a look at the caspian.css file in the jfxrt.jar
Maybe you see there how they styled the split-pane-divider and then you could override it.
Edit:
The OP suggests now the following solution:
.split-pane *.horizontal-grabber {-fx-background-color: transparent, transparent;}
https://stackoverflow.com/review/suggested-edits/2290698

Set Flex Titlewindow background to transparent

I have a modal Flex dialog and want to make the background not of the window itself, but the semitransparent modal indicator transparent. (Yes I tried to convince the client they don't want to do this, but apparently they really want to do it). Is this even possible?
(prefer a solution using Flex 3's TitleWindow, but Spark/Flex 4 TitleWindow is acceptable)
Yeah, I think I phrased the question wrong, but this is the answer I was looking for:
http://www.learnosity.com/techblog/index.cfm/2007/4/25/Disable-the-blur-effect-in-Flex-PopupManager-modal-background
to paraphrase add:
global{
modalTransparencyBlur: 0;
}
to the flex CSS and you're good; You can also make the modalTransparency 0 which will actually do what I said I wanted, but I think I'm going to try to convince my client that disabling the blur is all they needed (they want to be able to read the text under the popups)
(I wanted to disable the background of the PopUpManager not the TitleWindow)
Thanks for the help though.
Sorry not to have a definite answer, but have you tried setting the property
backgroundAlpha="0"
?
For flex 3; have you tried specifying the alpha on the TitleWindow? Based on a quick review of the code; it does not appear to pass the alpha down to the children (such as the close button, title bar, or title bar background.
Using the Spark Architecture; you should be able to do this easily with a custom skin.

Removing arrows from scrollbar in Qt

I'm using a small black and white screen and need the scrollbar to just be a black slider in a black outer frame. I got what I wanted using style sheets but including them in the configuration when installing takes up too much space so I can't use them. Is it possible to remove the arrows by inheriting from QStyle or something?
thanks
You should create a subclass of a QStyle (or some subclass like QCommonStyle) and reimplement its drawComplexControl() function to paint CC_ScrollBar element by yourself.
Read QStyle's documentation for more.
This might be a dumb answer but would it help if you just specified the style sheet itself in code as a QString argument to setStyleSheet rather than maintain a separate file for it?
You can try to change palette settings for your scroll bar (according to designer scroll bar arrow color is "button text" color), but this approach looks lick little hack...
More "heavy" approach, is inherit from scroll bar widget and reimplement paint method, but there are it is looks like overkill...
So, you must choose little hack vs overkill :). Though maybe there are exist another solution

Resources