QML SpinBox - How to enable entering numbers when minimumValue is large? - qml

If you create a SpinBox with a minimumValue of 100, it is difficult to manually enter numbers because validation happens as you type so any temporary value in the edit field that is outside the range bounds is prohibited.
Take a SpinBox supporting the range of 100-500:
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
ApplicationWindow {
width: 300; height: 200
SpinBox {
anchors.centerIn: parent
minimumValue: 100; maximumValue: 500
}
}
If you click into the input box, the entire value is selected and typing any number key would replace the current value with a single digit, which is less than 100 and therefore prevented. This renders pretty much any minimumValue above 1 useless.
But I really like all the other behavior I get from the SpinBox. Any suggestions?

BaCaRoZzo answered this: it's a QML defect that has been addressed as of Qt 5.4.1 and can no longer be reproduced.

Related

Datatables placing down arrow too cramped in length box

I have some datatables (as in datatables.net) running in PHP within a Laravel 9 framework. Everything works fine but the select length drop down is too small and results in the down arrow impinging on the number as below:
I have tried to find the css class which appears to be:
div.dataTables_wrapper div.dataTables_length select {
width: auto;
display: inline-block;
}
but changing this seems to have no effect - min-width etc. And I did clear all caches!
The rest of it is perfect.
Thanks!

qml: ExclusiveGroup is not a type

I import QtQuick.Controls 2.15, to use ExclusiveGroup QML Type, but the error occur! saying "ExclusiveGroup is not a type", is there anyone know?
I recommend avoiding QtQuick.Controls 1, and moving to QtQuick.Controls 2, if you can. There is no ExclusiveGroup in v2, but there is something called ButtonGroup that should do what you want.
According to Qt documentation for the ExclusiveGroup QML Type the correct import statement is
import QtQuick.Controls 1.4

Create custom grid system width defined column widths

The bootstrap 3 grid system targets 4 different screen resolutions, depending on their width:
Large / col-lg (>= 1200px width)
Medium / col-md (992px - 1199px)
Small / col-sm (768px - 991px)
Extra Small / col-xs (<768px)
I find that these resolutions do not represent the user group of my webapp. For example Medium and Small combined is used by less than 5 % of my user base (meaning less than 5 % of my users have a screen resolution width of 768px to 1199px).
I would rather target the following 4 different resolutions:
ExtraLarge (>= 1600px width)
Large (1200px - 1599px)
SmallMedium (600 - 1199px)
MobileSmall (<= 599px)
So I not only like to add an extra large set but also change / replace the medium, small and extra small one.
Has anybody run into similiar issues? I would love to use a grid generator where I input my custom grid widths and get out the CSS code.
You can customize pretty much every aspect of Bootstrap using the customization section of the official site.
http://getbootstrap.com/customize/#grid-system
That link takes you directly to the grid system items.
Enter your values, and download your custom version of Bootstrap. Even includes a JSON file with your settings so you can re-import them later and make adjustments.
This is for the Bootstrap 4 users, who are using SCSS and like to create their own grid system using bootstrap mixins and variables.
#import '../../../bower_components/bootstrap/scss/variables';
#import '../../../bower_components/bootstrap/scss/mixins';
// Create custom variables to supply it for bootstrap's mixins
$grid-gutter-width-10: 10px;
$grid-gutter-widths-10: (
xs: $grid-gutter-width-10,
sm: $grid-gutter-width-10,
md: $grid-gutter-width-10,
lg: $grid-gutter-width-10,
xl: $grid-gutter-width-10
);
.row-xs {
#include make-row($gutters: $grid-gutter-widths-10);
#include make-grid-columns($columns: $grid-columns, $gutters: $grid-gutter-widths-10, $breakpoints: $grid-breakpoints)
}

Change pace in Slider JavaFx possible?

Maybe, im just blind but i got an slider and i need to know if there is any way to change the paces.
Example:
Slider from 7.5 to 13.0
Pace 0.5
When i set the value in the label, i would like to have something like this:
7.5;
8.0;
8.5
For every movement with the slider i get something like this at this moment:
7.5;
7.51
Tried everything. Any idea?
Set the tick unit for the slider and snap it's value to the ticks.
For the sample values you give in your question:
import javafx.scene.control.Slider;
...
Slider slider = new Slider(7.5, 13, 7.5);
slider.setMajorTickUnit(0.5);
slider.setMinorTickCount(0);
slider.setSnapToTicks(true);
From the Slider setSnapToTicks javadoc:
Indicates whether the value of the Slider should always be aligned with the tick marks. This is honored even if the tick marks are not shown.

Cross Browser input field width stylization

I have a shipping/billing input form and I'm having trouble styling the input fields to be the same width...
The Problem:
-a field <input type="text" size="X" /> appears to render with different sizes in different browsers (see link).
-In addition, select fields seem to render on a differently as well.
-Chrome/safari do not seem to respond to the font-size property for select fields.
Any guidance on how to stylize the size of text-input and select fields cross-browser would be oh so very helpful.
Must I result to having a different sytlesheet for each browser... just for these input fields?
-thanks
Remove that inline "size" attribute, first. You should use CSS to style the input form:
input[type="text"] {
width: 100px;
/* You can also style padding, margins and everything else,
* just remember that inputs of type "text" can only be one line.
*/
}
Don't use [type="text"] as a selector. I was just using it in this example to associate with input fields of type "text", but it's not fully cross-browser supported. You should give your text input fields their own class to stylize with.
Also, don't forget your CSS reset to make sure your margins, borders, et. al. are reset for all browsers. http://meyerweb.com/eric/tools/css/reset/
Nowadays, it's possible to normalize the width of "sized" inputs, using the ch unit, which has reached a decent browser support.
Unfortunately, it's still not possible to write:
input[size] {
width: attr(size) "ch";
}
So we have to style the widths we know we'll be using:
input[size="10"] {width: 10ch;}
input[size="20"] {width: 20ch;}
input[size="30"] {width: 30ch;}
/* etc. */
This can easily be automated using a CSS preprocessor.
UPDATE:
I made a test fiddle. As of today (feb. 2018), this is working on Windows 10 with Chrome 63, Edge 41, FF 58. On IE 11, it fails. I haven't tried on OS X.