disable editing in QSpinbox but enable arrows - pyqt

I have a QSpinBox in which I want to enable the arrows (for up and down values) but disable inserting data by the user.
I've tried using this:
QtGui.QSpinBox.setReadOnly(True)
But it doesn't work. All is disabled and the arrows are 'stuck'.

If you set the spin-box readonly, it will disable eveything. Instead, just set the line-edit readonly, and then buttons will still work:
spinbox.lineEdit().setReadOnly(True)

you can block spinboxes editor by QtGui.QSpinBox.lineEdit().setEnabled(False).
edit: and set font color and background-color:
spinbox.lineEdit().setStyleSheet('color: black; background-color: white;')

In case someone looking for an answer for this problem in C++ come here (like me), the other answers are not straightforward because QSpinBox::lineEdit() is a protected member (so it would require to also extend the class).
What worked for me was:
auto l1SpinBox = new QSpinBox(this);
auto lineEdit = l1SpinBox->findChild<QLineEdit*>();
lineEdit->setReadOnly(true);
lineEdit->setFocusPolicy(Qt::NoFocus);
connect(l1SpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), l1SpinBox,
[&, lineEdit](){lineEdit->deselect();}, Qt::QueuedConnection);
setReadOnly alone may do the trick for you. However in my case, I wanted to improve UI making it also not focusable, and then hiding the selection when the value changes.

Related

Highlight current item in inner post menu in WordPress

WordPress has a built in feature that assigns the class “current-menu-item” to the current navigation item.
Nevertheless, that feature only works for contextual menus; and not for the ones inside the post content.
You can see in this page that the first level parent item OBRAS is highlighted, but not the third level child GRÁFIKA located left in the inner page menu.
Looking for a method to accomplish this highlight feature in the inner menu.
Thanks
I asked this question based on 2 facts:
– The menu is created by WordPress.
– The plugin; all it does is generate a shortcut to insert the menu inside the post.
So the question is not Theme related, and not plugin related. It´s WordPress related.
Nevertheless, I asked the Theme developer and the Plugin developer, without response.
In addition, no answer from WordPress.Org Forum. All they say is “ask the theme or plugin developer”.
Therefore, once I found a solution, not the ideal one but at least one that will allow the highlight effect without any core modification, I felt I had to post it here:
I used Wordpress Add Custom CSS plugin to add css per each page.
Then I added the individual code for the first inner menu item and it worked:
li#menu-item-981 a {
color: #FEBF46 !important;
font-weight: bold !important;
text-shadow: 1px 0 #FEBF46;
}
And that was it; not an ideal automatic solution, but a simple and clean one.
Thanks for your attention.

CQ5 component with class flex-wrap in edit mode

I set div with style flex-wrap: wrap, but in edit mode, the two parsys don't side by side, but I modify wrap to nowrap, them display side by side.
But when I add this style in html page, the style is work, but it doesn't work as expected, then I modify nowrap to wrap, it doesn't work as the first image, finally, I modify wrap to nowrap again, then it works as expected.
Try setting the containers to
display: inline-block;
I used this approach when I needed to make a 2-column display where each column contained a parsys, and that sounds similar to what you want to do.

How can I modify the style when hovering over a combo's option? [duplicate]

This question already has answers here:
Change Select List Option background colour on hover
(13 answers)
Closed 9 years ago.
This sounds so very simple:
hovering over the options of an Xpages comboBox they get some blue-ish background and white text color. Trying to alter this is driving me nuts. It obviously is NOT a simple css statement as in
select option:hover{background-color: green;}
as it would be for some standard html code (that's why I didn't tag this with css and the like...). But what is it then? Firebug or Chrome's developer tools didn't help me much, really, although I'm sure I'm missing something
Edit (after question was closed):
I'm aware that there are numerous questions regarding similar topics. But none of them is dealing with xsp combo boxes. The one question linked by some of youo gives an interesting solution by recommending a box-shadow instead of a background-color. This is nice but not quite what I'm looking for:
opening the combo the selected value still has the default
background; only whil hovering the background appears to be changed
using this method I only can "cast" a shadow but cannot alter the
text color which - depending on the shadow color - can be necessary
to make the options legible
But I like Knut's answer as it seems to be pointing in the right direction; some alterations are needed though; if the question hadn't been closed I could post my solution as an own answer; but so I put it down as a comment to Knut's answer
You can't change this style for xp:comboBox. But, if you use xe:djComboBox from ExtLib then you can change style with:
.tundra .dijitMenuItemSelected {
background-color: green;
}

Highlight for Current Menu Item not highlighting correctly

I would like the current menu item to stay highlighted when a user is in that section. I set up styles for .current-menu-item. For some reason some styles work and some don't. I used all of these for testing purposes:
.current-menu-item {
color:#F90;
border-bottom:2px solid #fco;
text-decoration:line-through;
background:#000;
}
Background and Text-Decorationare the only styles that work. Any clues why the others do not? I really only want the text color to stay orange (highlighted #f90).
Thanks in advance for any help :)
sandra :)
Your color rule is likely being overridden by a more specific rule. You can investigate this further, using 'Inspect Element' in google chrome, and looking at the styles in the inspector.

Text Alignment problem

How to control a running text? This is a user generated content, where user used to give with out giving space to the text. for example:
abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh
This goes beyond the specific block. Is there is a way to wrap the text? how can i control it and i also want that to be worked in ie6 also...
You can make strings with no spaces wrap by using the following CSS property:
word-wrap: break-word;
According to the MDC page on the word-wrap property, it is supported in IE 5.5+, Firefox 3.5+, and Safari 1.0+ (but not Opera).
You could use overflow:scroll; in your CSS, this would put a horizontal scroll bar. Should work in IE.

Resources