QLineEdit: Change clearButton - qlineedit

When I set clearButtonEnabled= true, clearButton looks blurry. Is there any way to change the size of clearButton or to customize it with another icon?

For anyone interested, I found this workaround:
QHBoxLayout *pSearchLayout = new QHBoxLayout();
pSearchLayout->addStretch();
pSearchLayout->addWidget(ui->pushButton);
pSearchLayout->setSpacing(0);
pSearchLayout->setContentsMargins(0, 0, 0, 0);
ui->lineEditSearch->setLayout(pSearchLayout);

Related

Codename one set remove Accordion border

I am working on a codename one application. I need to remove the border for Accordion component. (or) Is there anyway to change the Accordion's border color..
Can someone guide me...
The black border shown in the image
In your theme.res, just add a UIID with no border and set this UIID for accordeon.Otherwise , you can override accordeon UIID and set empty border like this :
And then uncheck derive and select border "empty"
To remove(hide) the border of an accordion from the code you can define it's border colour to be the same as the background colour and to be as narrow as possible.
Border border = Border.createCompoundBorder(Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff));
my_accordion = new Accordion(ifont_keyboard_right, ifont_keyboard_down);
my_accordion.getAllStyles().setBgColor(0xffffff);
my_accordion.getAllStyles().setBgTransparency(255);
my_accordion.getAllStyles().setPadding(0, 0, 0, 0);
my_accordion.getAllStyles().setMargin(0, 0, 0, 0);
my_accordion.getAllStyles().setBorder(border);

NSTextField non-system-font content clipped when usesSingleLineMode is true

Setting usesSingleLineMode to true for a non-system font causes the top of the text to be clipped.
I've created 3 very simple test cases that illustrate this:
good : non-system font, with usesSingleLineMode = false. Works fine.
bad : non-system font with usesSingleLineMode = true. Does not work.
system : system font with usesSingleLineMode = true. Works fine.
Add the following to the viewDidLoad() method of a new Cocoa OSX application:
// Do any additional setup after loading the view.
let good = NSTextField(frame: NSRect(x: 0, y: 0, width: 800, height: 55))
good.usesSingleLineMode = false
good.font = NSFont(name: "HelveticaNeue-UltraLight", size: 24)
good.stringValue = "Good usesSingleLineMode false "
self.view.addSubview(good)
let bad = NSTextField(frame: NSRect(x: 0, y: 100, width: 800, height: 55))
bad.usesSingleLineMode = true
bad.font = NSFont(name: "HelveticaNeue-UltraLight", size: 24)
bad.stringValue = "Bad usesSingleLineMode true"
self.view.addSubview(bad)
let system = NSTextField(frame: NSRect(x: 0, y: 200, width: 800, height: 55))
system.usesSingleLineMode = true
system.font = NSFont.systemFontOfSize(24)
system.stringValue = "Good usesSingleLineMode true, System Font"
self.view.addSubview(system)
If I create the same bad NSTextField using Interface Builder in a storyboard, set the font in IB and check Uses Single Line Mode in IB it works fine! But, it would be impractical to build the overall view in IB, thus I want to programmatically create it.
Why is this happening? Have I missed some important setting (I've tried adjusting many NSTextField and NSTextFieldCell parameters to no avail? Is there a workaround?
According to Apple themselves, this is correct and even desired behavior:
Engineering has determined that this issue behaves as intended based
on the following information:
This behaves correctly according to the documentation for NSCell:
Cells in the single line mode use the fixed baseline layout. The text
baseline position is determined solely by the control size regardless
of content font style or size.
Source: http://www.openradar.me/13813516
What the documentation says is really correct but the important detail here is what the documentation does not say. It does say that the "text baseline position is determined solely by the control size" but it does not explain in detail how this is done. And it is a known fact, that the baseline always seems to fit correctly to the system font, yet it hardly ever fits to any other font on your system. The problem is that Apple speaks of "the fixed baseline layout", as if that would be something known and well documented, but it isn't. I haven't found any document, not even among the legacy ones, that would explain the fixed baseline layout.
I solved it the problem by setting usesSingleLineMode to false.

Make Firefox Panel fit content

I'm manually porting an extension I wrote in Chrome over to Firefox. I'm attaching a panel to a widget, and setting the content of that panel as an HTML file. How can I make the panel shrink and grow with the content? There's a lot of unsightly scroll bars and grey background right now.
var data = require("self").data;
var text_entry = require("panel").Panel({
width: 320,
height: 181,
contentURL: data.url("text-entry.html"),
contentScriptFile: data.url("get-text.js")
});
require("widget").Widget({
label: "Text entry",
id: "text-entry",
contentURL: "http://www.mozilla.org/favicon.ico",
panel: text_entry
});
Not setting the height property of the panel makes it quite tall.
You might want to check out this example that resizes the panel based on the document loaded. If you want to resize based on changes to the content size, at least on initial load:
https://builder.addons.mozilla.org/package/150225/latest/
( sorry for the delay in respinding, been afk travelling )

How can I attach an image to an infobox in bing maps?

Is there a way to put images on an infobox in bing maps? Thanks everyone.
Yes, supply your own html via the htmlContent Property. You can make the infobox appear however you'd like.
You can add HTML through the htmlContent Property, which is added in the options hash. For example:
var infoboxOptions = {
width :200,
height :100,
showCloseButton: true,
zIndex: 0,
offset:new Microsoft.Maps.Point(10,0),
showPointer: true,
htmlContent:'<img src="source/of/image></img>"'
};

Toolbar button style

I create toolbar with gtkuimanager in my gtk+ application. How can i change style of toolbar button?
Thank you.
# set a vertical toolbar to the left
self.tools = gtk.Toolbar()
toolbar_item = gtk.ToolButton()
toolbar_item.set_stock_id(gtk.STOCK_APPLY)
toolbar_item.set_label("Show Levels")
toolbar_item.show()
self.tools.insert(toolbar_item, -1)
self.tools.set_orientation(gtk.ORIENTATION_VERTICAL)
containerH.pack_start(self.tools, False, False, 0)