I'm working on an application which contains an editable QComboBox. I observe the following behavior when I enter some text in the edit field and press the dropdown arrow in the combobox:
My edit line ends up hidden behind the item "e#abc.com". I would like to have the combobox list popup below the edit field, like in the below screen:
The first screen above is taken on Ubuntu with Qt 4.5 while the second screen is from Suse 11 with Qt 4.4. I'm not aware of any differences regarding change of behavior of QComboBox popups between Qt 4.4 and Qt 4.5. Regardless, I would like the list to behave the same in both distributions.
This is a standard QComboBox with the editable property set to on - there are no stylesheets or special formatting applied to it.
How can I make the list popup below the editable field, like in the second screen?
This looks like a style issue, as the screenshots are taken with different styles. Perhaps you can start investigating by changing style on the failing desktop.
Related
I have designed the UI screen which consist a lot of push-buttons and I want to select or can say want to control application using tab key. When I select any particular key, it should change the color of that push-button accordingly.
As far as I know, the focus on using the tab key should work by default and the color of the buttons changes according to focus.
I tried to create a project with several buttons on QMainWIndow and it worked without any additional effort. I'm using Qt 5.15 with KDE on arch linux.
If you want to change the order of the buttons traversal, you can use the button that changes the designer mode in Qt Creator.
And if you want to change colors of the button, you should change the stylesheet of the button with css like code. Here you can see examples of stylesheet customization.
Basically, what I want to implement is, a sort of an "expandable statusbar" (not sure if there is another name for it); in essence, in "collapsed state", it would be just a plain statusbar, able to show text strings/messages - except it has a "button" for expanding, here a "+":
When the expanding button is clicked, then the statusbar expands into a panel, covering about 1/3rd of the window (however, not "pushing" the preexesting widgets in the window, just covering them) - and the button changes into a "-":
Of course, then I'd want different widgets in the expanded state panel; likewise, if here I click on "-", I go back to the collapsed statusbar state.
I was wandering:
Is there already an existing widget in Qt that would be especially applicable to implementing something like this?
If not, is it possible to somehow implement this widget with existing QtWidgets, such that: at least the collapsed state is shown in QtDesigner UI, - and toggling between collapsed and expanded state is shown in QtDesigner Preview (that is, without a standalone application)?
If previous is not possible - is it possible to code a custom widget (in a form of a .dll, maybe?) that, when imported in QtDesigner, would demonstrate toggling in QtDesigner preview?
Ignoring QtDesigner, what would be the recommended setup to implement something like this purely in code (say, in PyQt5)?
Turns out, there is already a post discussing this - it is here:
How to make an expandable/collapsable section widget in Qt
In Microsoft Word, if you want to use Bullets you have a combo box (If we can call it a combo box) to select the shape of the bullet (by clicking the little triangle) or you can just apply the default one by clicking the combo box's button.
Actually the combo box in Word has two parts. For an example let's consider a situation where I want to have a combo box in Qt that has these items as menu items:
"Restart", "Shutdown" and "Log off". User needs to choose one of them but he also can apply previously selected item by clicking its button exactly like Windows shutdown menu in start. You can click Shut down or select another option.
How can we achieve this in Qt?
If you are pursuing after a menu that looks like in the second picture, you can use QToolButton to achieve your goal. Use a QToolButton with popupMode set to MenuButtonPopup. It will render a control something similar to following.
Then you can style the look & feel further more using Qt Style Sheets. Read this example on how to style a QToolButton.
Create a QMenu dynamically, so you can attach it to the QToolButton at run-time in such a way that all items will be included in the menu except for the default item. Default action has to be assigned to the QToolButton itself.
You can use void QToolButton::setMenu (QMenu * menu) to assign a QMenu to your QToolButton at run-time.
If you are trying to design a control that is in your 1st screenshot, you will have to create a custom Qt control I guess. There is no default control available, which can yield that look & feel out of the box.
I have successfully added a dropdownlist(flextras) but its not working properly. Whenever I touch the dropdown, the list that pops up goes under the textboxes(which are placed below the dropdownlist). Therefore I'm not being able to select the item from list on top of the textbox, as the focus passes to the text box.
Pleased read this blog post on the subject.
The relevant quote:
The default skin for a TextInput in Flex 4.6 uses the
StyleableStageText. StageText is always drawn above the Flash
Display List, which is why the drop down's popup appears to be under
it. To quote the Adobe docs on StageText:
[start doc quote] Native text input fields cannot be clipped by other Flex content and
are rendered in a layer above the Stage. Because of this limitation,
components that use StageText-based skin classes will always appear to
be on top of other Flex components. Flex popups and drop-downs will
also be obscured by any visible native text fields. Finally, native
text fields' relative z-order cannot be controlled by the application. [end doc quote]
There are two possible solutions for this. The first is to architect
your mobile application so that popups never display above a
TextInput. This may be tough if you're building for multiple devices
with different screen sizes.
The second is to use the Flex 4.5 skin class for your TextInputs:
<textInput skinClass="spark.skins.mobile.TextInputSkin" />
I have a couple questions regarding JavaFX (1.3) and CSS. First of all, when I create a CheckBox node and set its styleclass, I can't actually get the checkbox to show up. It just looks like a text-label. Do I have to specify something specific to actually get the checkbox to appear?
Also, what is the CSS class/id I would use to modify all checkboxes in a program?
Have you read the JavaFX CSS Reference Guide?
http://download.oracle.com/docs/cd/E17802_01/javafx/javafx/1.3/docs/api/javafx.scene/doc-files/cssref.html
I think the place you need to look at is this forum post:
Styling a checkbox and also:
Checkbox in the UI controls
I had similar issues with ListBox where the control is constructed from a number of components and has a bunch of different pseudo classes to be 'configured' depending on what you need it do look-like.
The Styling a checkbox thread points you to the javaFX runtime: $lib\ext\jfxrt.jar.
If you look in: com/sun/javafx/scene/control/skin/
caspian/caspian.css
moderna/moderna.css
You get the full naked 'defaults' CSS for the your controls. That said I am on here today to find out
A method to algn JavaFX checkbox label text with the text on a line
... how to align the text base-line, so there's still work to do before it just magically looks right lol