Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.7k Posts
  • 0 Votes
    3 Posts
    963 Views
    P
    @raven-worx Thank you for the inputs. I am trying to implement the radio buttons based on the size of the parent window. But, the text beside radio buttons are not aligning vertically center. Could you please help me where am doing wrong Window { id: mainwindow visible: true width: 640 height: 480 title: qsTr("Hello World") function getActualValue( percent , value) { var percentageValue = Math.round((percent*value)/100); return percentageValue; } GroupBox { id: groupboxId title: qsTr("Log Meas") font.pixelSize: mainwindow.getActualValue(2, mainwindow.width) width: mainwindow.width/4 height: mainwindow.height/8 anchors.centerIn: parent RowLayout { RadioButton { id: radioButton1 checked: true font.pixelSize: mainwindow.getActualValue(2, mainwindow.width) text: qsTr("Imperial") indicator: Rectangle { implicitWidth: mainwindow.getActualValue(3, mainwindow.height) implicitHeight: mainwindow.getActualValue(3, mainwindow.height) radius: 9 border.color: radioButton1.activeFocus ? "red" : "gray" border.width: 1 Rectangle { anchors.fill: parent visible: radioButton1.checked color: "#555" radius: 9 anchors.margins: 4 } } contentItem: Text { text: radioButton1.text font: radioButton1.font opacity: enabled ? 1.0 : 0.3 color: radioButton1.down ? "#17a81a" : "#21be2b" verticalAlignment: Text.AlignVCenter leftPadding: radioButton1.indicator.width + radioButton1.spacing } } RadioButton { id: radioButton2 checked: false font.pixelSize: mainwindow.getActualValue(2, mainwindow.width) text: qsTr("Metric") indicator: Rectangle { implicitWidth: mainwindow.getActualValue(3, mainwindow.height) implicitHeight: mainwindow.getActualValue(3, mainwindow.height) radius: 9 border.color: radioButton2.activeFocus ? "darkblue" : "gray" border.width: 1 Rectangle { anchors.fill: parent visible: radioButton2.checked color: "#555" radius: 9 anchors.margins: 4 } } contentItem: Text { text: radioButton2.text font: radioButton2.font opacity: enabled ? 1.0 : 0.3 color: radioButton2.down ? "#17a81a" : "#21be2b" verticalAlignment: Text.AlignVCenter leftPadding: radioButton2.indicator.width + radioButton2.spacing } } } } } The output looks like below [image: 8db35596-b2c2-4360-a93b-9d50176b225f.png]
  • QML: "Cannot assign Derived to Base"

    Solved
    9
    0 Votes
    9 Posts
    747 Views
    A
    Well, that's too bad. :( Thanks for your help. I've applied a workaround like this in Point: Q_PROPERTY(QGeoCoordinate coordinates READ coordinates CONSTANT) const QGeoCoordinate &coordinates() const { return *this; } And seems to do the job. It's not ideal, since I also have a QList<Point> (used in a Repeater in QML), and there I need to make a copy of the list with casted objects. But if that's the only way it can work now... so be it. :)
  • QtQuick.Dialogs is missing Qt 6.1.3 / Qt 6.2.0

    Unsolved
    2
    0 Votes
    2 Posts
    654 Views
    sierdzioS
    I think it's not available in Qt 6, but the one from Labs should work: https://doc.qt.io/qt-6/qml-qt-labs-platform-messagedialog.html
  • Qml Module Not Found But App is running

    Solved
    5
    0 Votes
    5 Posts
    7k Views
    raven-worxR
    @Enes-Alp then its an issue with QtCreator not parsing source files of .pri files
  • Howto reset QML interface

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    P
    @raven-worx Q_PROPERTY will notify the view about the changes. At first I thought that my cpp logic can change the objects and in-order to reflect those changes in QML, I've to reset the ContextProperty() but now I understood, I don't need resetModel() at all as Q_PROPERTY notify signal will done this behind the scenes. Thanks
  • Reset a QML property from Javascript

    Unsolved
    4
    0 Votes
    4 Posts
    545 Views
    raven-worxR
    @EddieC on what properties did you try it exactly? maybe the property does not have a reset method defined?
  • QML plugin: how to export mixed C++ and QML content

    Unsolved qml plugins designer qmltypes qtquick
    1
    0 Votes
    1 Posts
    508 Views
    No one has replied
  • [Solved] Editing and saving indexed roles to Settings

    Unsolved
    6
    0 Votes
    6 Posts
    351 Views
    MarkkyboyM
    @fcarney - thanks again, this is taking shape now. There are a few odd behaviours which I will try to nail down, but largely, I am now able to edit price, name and type, close and open again with all my changes being present! yay! Regards,
  • CMake/VS2019: Specified module could not be found

    Unsolved
    3
    0 Votes
    3 Posts
    692 Views
    J
    @Crisian-Adam-0 I have verified that the file does exist at that location. I receive the same errors when attempting to run in Release mode.
  • QML SystemInfo - it exists already, but only seems to be part of the Neptune 3 UI

    Unsolved
    3
    0 Votes
    3 Posts
    331 Views
    V
    @raven-worx So what you are saying is what I said in the first few lines of my post, that I have to write what has already been written, is already documented by Qt as existing, is a direct reflection of what already exists in C++ because Qt decided to wrap it up in a "special" Neptune UI package. Not that it does ANYTHING relative to 3D or provides ANY additional information beyond that in the C++ class, so it in no way justifies a "special" package. But sure, why not use C++ to do what QML fails to do. Or why not just use a Qt Python package if you want your UI development to be separate from your core. Sort of removes having to dance around the not complete javascript to add a bit of functionality.
  • Dynamically load QML components together with the C++ context.

    Unsolved
    1
    0 Votes
    1 Posts
    170 Views
    No one has replied
  • How to create single QML file with all the constants or labels so that it can reused

    Unsolved
    2
    0 Votes
    2 Posts
    576 Views
    raven-worxR
    @MaruthiMarsh create a singleton componen: https://wiki.qt.io/Qml_Styling#Approach_2:_Style_Singleton
  • how to redraw certain items of a Calendar or just the selected one?

    Unsolved
    2
    0 Votes
    2 Posts
    302 Views
    mbruelM
    well I suppose it is not possible... I'm redrawing all the items (delegates). As an update() is not doing the job, I'm using a "fake" binding like suggested here.
  • print() and console.log() dont print messages to my commandline

    Unsolved
    1
    0 Votes
    1 Posts
    193 Views
    No one has replied
  • Splash screen in QML

    Unsolved
    2
    0 Votes
    2 Posts
    986 Views
    raven-worxR
    @Praveen-Illa EGLFS can only display a single window. thus your splash screen cannot be also a window. you must make it an Item and place it above the content of the mainwindow. E.g. as a child of the windows's overlay for example
  • Make a gridlayout item fullscreen / full height and width of gridlayout

    Solved
    2
    0 Votes
    2 Posts
    777 Views
    A
    After some hour's a found a way todo this. Worklfow: DoubleClick on cameraPane (Expand) cameraPane.Layout.preferredWidth and cameraPane.Layout.preferredHeight is set to parent w, h other cameraPane opacity is set to 0 DoubleClick on cameraPane (Shrink) cameraPane.Layout.preferredWidth and cameraPane.Layout.preferredHeight is set to 0 other cameraPane opacity is set to 1
  • How to update size of content in ScrollView ?

    Solved
    2
    0 Votes
    2 Posts
    440 Views
    R
    @r3d9u11 so, finally I've replaced ScrollView with Flickable and made function, that is refreshing content size. children elements call it manually: Flickable { id: fieldMap anchors.fill: parent ScrollBar.horizontal: ScrollBar { active: true; onActiveChanged: { if (!active) active = true; } } ScrollBar.vertical: ScrollBar { active: true; onActiveChanged: { if (!active) active = true; } } function refreshContentSize() { fieldMap.contentWidth = fieldMap.width; fieldMap.contentHeight = fieldMap.height; for (var i = 0; i < fieldMap.contentItem.children.length; ++i) { var item = fieldMap.contentItem.children[i]; var itemX = item.x+item.width; if ( itemX > fieldMap.contentWidth ) fieldMap.contentWidth = itemX; var itemY = item.y+item.height; if ( itemY > fieldMap.contentHeight ) fieldMap.contentHeight = itemY; } } } Maybe there is better solution
  • ContentWidth in TableView

    Unsolved
    1
    0 Votes
    1 Posts
    126 Views
    No one has replied
  • How to show QWidget and QtQuick.Window

    Unsolved
    2
    0 Votes
    2 Posts
    381 Views
    SGaistS
    Hi, That's because widgets are not meant to be embedded like that. You can check KDAB's Declarative Widget project to mix widgets and QtQuick.
  • Why I cant Play Audio Files? My Code is on armbian os in orangepipluse2 device

    Solved
    9
    0 Votes
    9 Posts
    779 Views
    jsulmJ
    @EmadDeve20 said in Why I cant Play Audio Files? My Code is on armbian os in orangepipluse2 device: armbian I know, but Armbian is based on Debian und Ubuntu too, so usually package names are same. Good that it works now!