Giter Site home page Giter Site logo

mpaperno / maxlibqt Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 8.0 4.36 MB

A collection of C++ classes and QtQuick QML components for use with the Qt framework.

License: Other

CMake 2.11% C++ 82.09% QMake 1.03% QML 14.77%
code-library cplusplus cpp qml qml-components qt qt5 qtquick qtquick-controls2 ui-components widget-library widgets

maxlibqt's Introduction

        

Featured Repositories
Featured Contributions

maxlibqt's People

Contributors

mpaperno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

maxlibqt's Issues

MLDoubleSpinBox

Hi. I am writing my first QML application and am running into troubles. I am using your MLDoubleSpin box and it behaves slightly differently than the SpinBox. I am hoping you will see my mistake if I have one.

What I have works, until I press the + or - buttons on the spinbox. It then appears to overwrite my value and will no longer pull up the value from the c++ code. As far as I can tell, the SpinBox which uses integers, doesn't have this behaviour.

QML UI file
'ComboBox {
id: comboBox1
anchors.right: parent.right
anchors.rightMargin: 40
anchors.verticalCenter: parent.verticalCenter
textRole: "key"
valueRole: "value"
model: ListModel {
ListElement {
key: "7/8, 50 ohm"
value: 1
}
ListElement {
key: "1 5/8, 50 ohm"
value: 2
}
}
onCurrentValueChanged: _page3.preset = currentValue
}
.........
MLDoubleSpinBox {
id: spin3
anchors.right: parent.right
anchors.margins: 10
decimals: 3
from: 0
to: 30
value: _page3.outer
onValueChanged: _page3.outer = value
stepSize: 0.1
}
'

c++ header
'class CalcP3: public QObject
{
Q_OBJECT
Q_PROPERTY(double outer READ getOuter WRITE setOuter NOTIFY update)

.......
}'

c++ class
{
void CalcP3::setPreset(double value){
if (value == m_preset) return;
m_preset = value;
switch(m_preset) {
case 1:
m_outer = 0.785;
m_inner = 0.341;
break;
case 2:
m_outer = 1.527;
m_inner = 0.664;
break;
}
emit update();
}

........
'

MLDoubleSpinBox in Qt 5.12.2

Hello. I have found this while updating from Qt 9.1 to Qt 5.12.2

MLDoubleSpinBox has been used as delegate:

MLDoubleSpinBox {
                from: model.min
                to:   model.max
                stepSize: model.stepsize
                onValueChanged: model.value = value
                wrap: false
            }

In Qt 5.9.1 it works great as expected:
MLDoubleSpinBox works in qt_5 9 1

But not in Qt 5.12.2 (same model as in the above example):
MLDoubleSpinBox issue in qt_5 12 2

OS: Win7x64
Compiler: Mingw5.3x86 for Qt5.9.1 and Mingw7.3x86 for Qt5.12.2

Thank you for the code sharing!

MLDoubleSpinBox

Hello! Оnce again) Playing around with MLDoubleSpinBox I have found that it's text field does not updates properly if you enter value out of [from - to] range more than one time.

For the instance, let's use "controls/test.qml". MLDoubleSpinbox instance with "Default" label prepared to work in range from 0 to 10.

Step 1. Preview qmlscene
image

Step 2. Write, for the instance, 20 in the text field by keyboard
image

Step 3. Press 'Enter', value adjusted to top limit - it is ok, as expected
image

Step 4. Once again write 20, or whatever
image

Step 5. Press 'Enter', oops - it is not working now (
image

Step 6. Even if I change focus, MLDoubleSpinBox still contains 20
image

My specs.: MS Windows7x64
Qt: 5.9.1, 5.12.2
Compiller: Mingw32

Prefix and Suffix properties for MLDoubleSpinBox

Your implementation of the DoubleSpinBox for Qt Quick Controls 2 is very interesting. Thanks!
But in order to port code using Qt Quick Controls 1, one would need the support for the prefix and suffix properties.
As mentioned in the doc: prefix and suffix.

I have added it to the floating point SpinBox example from Qt Quick Controls 2 doc like this:

    property string prefix: ''
    property string suffix: ''
    
    [...]

    textFromValue: function(value, locale) {
        return prefix + Number(value / 100).toLocaleString(locale, 'f', decimals) + suffix
    }

    valueFromText: function(text, locale) {
        var numberStr = text.replace(suffix, '').replace(prefix, '');
        return Number.fromLocaleString(locale, numberStr) * 100
    }

Make compatible with Qt 6

Some types have been renamed in Qt 6, for instance "RegExValidator" got "RegularExpressionValidator".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.