pyqt setting colour to QMenuBar - pyqt

I'm trying to change the colour to my menubar but it doesn't seem to be working. Not sure what I did wrong.
self.menuBar = QtGui.QMenuBar()
self.menuBar.setStyleSheet("color: rgb(255, 255, 255);")
Thanks!

If you are on OSX, this will have no effect as it uses the systems menu.
For other platforms, you might need to be setting it on the item subcontrol:
self.menuBar.setStyleSheet("QMenuBar::item { color: rgb(255, 255, 255); }")

Related

iOS 15 - UITableViewCell accessoryView Frame issue

I have a custom UIView containing UILabel as cell.accessoryView = containerView. It was working fine until iOS 14 but as of iOS 15, the containerView is changing its frame on tableView reload. It is displaying properly on the first load but reloading causes the accessoryView to change its frame. My code is
let notificationLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
let containerView = UIView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
containerView.clipsToBounds = true
containerView.backgroundColor = .clear
containerView.addSubview(notificationLabel!)
cell.accessoryView = containerView
I am changing the frame of the container based on text in UILabel in cellForRowAtIndexPath.
It seems the frame code for containerView is messing up. But this is working fine in iOS 14.
I guess there are some changes and the accessoryView position is allowed to be changed in iOS 15.
Any suggestions to make it work without giving exact x-axis or y-axis in iOS 15?
It's possible what your seeing is the extra "by default" padding added to the section header.
In your Viewdidload add
if (#available(iOS 15.0, *)) {
[self.tableViewName setSectionHeaderTopPadding:0.0f];
}
I could not find a solution for this either. So I gave up on iOS 15's cell.accessoryView.
Instead, my cellForRowAtIndexPath handler calls:
[cell.contentView removeAllSubviews]
[cell.contentView addSubView:myCustomView]

Change ComboBox Color of the Drop Down Button

Im actually working on a VBA Excel Project. We have some requirements for the Color style of the whole sheet.
I designed a UserForm and it was possible to change all colors, except from the Drop Down Button of the ComboBox.
With these commands i can set the colors of Foreground, Background and Border:
Controls("ComboBox1").ForeColor = RGB(255, 255, 255)
Controls("ComboBox1").BackColor = RGB(0, 0, 0)
Controls("ComboBox1").BorderColor = RGB(160, 131, 101)
But i am not able to change the Drop Down button itself.. I searched a while but cant find anything..
Does anyone have an idea how to change this? Or is it set by Windows and not possible to change? Like this it looks a little ugly..
Thanks in Adance & best regards

nodejs Sharp: transparent into white

I am using Nodejs Sharp to transcode/resize png images into jpg. Is there way to replace transparent with white (or other light color) rather than black? I found solution for an older library but Sharp seems to be fastest and greatest.
.background does not work
.then( data => Sharp(data.Body)
.resize(SIZES[resize_type].width, SIZES[resize_type].height)
.max()
.withoutEnlargement()
.background("white")
.toFormat('jpeg')
.toBuffer()
)
On version ^0.23 you can use flatten(options) as api document here: https://sharp.readthedocs.io/en/stable/api-operation/#flatten
sharp('input.png').flatten({ background: { r: 255, g: 255, b: 255 } })
from the sharp documentation as it states that you can use the background for color manipulations and it states that
The default background is {r: 0, g: 0, b: 0, alpha: 1}, black without transparency.
so inorder to get white simply use
.background({r: 255, g: 255, b: 255, alpha: 1})
by the document, we should do the way as Msalam suggest but unluckily that is not enough. I figured out We should add .flatten(true) before ".resize(...)" to make it work correctly.
Just add :
.flatten({ background: '#fff' })

Fabric.js how to set opacity of lines

Using the fabric.js library, I can set line width and color as follows:
canvas.freeDrawingBrush.width = 5;
canvas.freeDrawingBrush.color = "#f00";
Is there a way to set the opacity too? Couldn't find anything in the documentation, neither on the net anywhere.
Instead of using a hexadecimal color code, you can set color to use rgba, like below:
canvas.freeDrawingBrush.color = 'rgba(255, 0, 0, 0.1)';
Demo JSFiddle

How to Add a CMFCPropertyGridCtrl to a Dialog

Can someone give me an example for adding a CMFCPropertyGridCtrl to a Dialog. I tried to create a dialog and add a CMFCPropertyGridCtrl. But it gives me errors. A tutorial or a working code is highly appreciated.
Thanks.
Finally I learned to add a CMFCPropertyGridCtrl. Here is the code..
CMFCPropertyGridCtrl m_wndPropList1;
m_wndPropList1.Create( WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, rectPropList1, this, MY_GRID_CTRL_ID);
m_wndPropList1.EnableHeaderCtrl();
//m_wndPropList.EnableDescriptionArea();
m_wndPropList1.SetVSDotNetLook(TRUE);
m_wndPropList1.MarkModifiedProperties(TRUE);
m_wndPropList1.SetAlphabeticMode(!TRUE);
m_wndPropList1.SetShowDragContext(TRUE);
CMFCPropertyGridProperty* pGroupFont = new CMFCPropertyGridProperty(_T("Theme Header Text Properties"));
LOGFONT lf;
CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
font->GetLogFont(&lf);
lstrcpy(lf.lfFaceName, _T("Arial"));
COLORREF col = RGB(0 , 0 ,0);
pGroupFont->AddSubItem(new CMFCPropertyGridFontProperty(_T("Header Font"), lf,
CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the dialog") , IDC_PROPERTY_GRID1_FONT , col) );
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Header Font Color"),
RGB(0, 0, 0), NULL, _T("Specifies the default dialog font color") , IDC_PROPERTY_GRID1_FONT_COLOR);
pColorProp->EnableOtherButton(_T("Other..."));
pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE));
pGroupFont->AddSubItem(pColorProp);
CMFCPropertyGridColorProperty* pColorProp2 = new CMFCPropertyGridColorProperty(_T("Header Back Color"),
RGB(255, 255, 255), NULL, _T("Specifies the default dialog background color") , IDC_PROPERTY_GRID1_BACK_COLOR);
pColorProp2->EnableOtherButton(_T("Other..."));
pColorProp2->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE));
pGroupFont->AddSubItem(pColorProp2);
m_wndPropList1.AddProperty(pGroupFont);

Resources