Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Passing QByteArray to a callable QJSValue

    Unsolved qjsvalue qbytearray
    3
    0 Votes
    3 Posts
    1k Views
    C
    In the event that anyone else comes across this looking for a solution (like I was), Qt 5 and above can convert QByteArray to a Javascript ArrayBuffer. To do this, use toScriptValue: QJSEngine jsEngine = qjsEngine(this); QJSValueList args; args << title; args << jsEngine->toScriptValue(byteArray); callback.call(args);
  • Can Items be told to subtract rather than add when laying over each other?

    Solved
    2
    0 Votes
    2 Posts
    381 Views
    fcarneyF
    This is kind of a proof of concept. It seems really messy: Rectangle { id: maskrect visible: false width: 256 height: width color: "black" Rectangle { id: maskrectcir anchors.centerIn: parent width: parent.width * 0.9 height: width radius: width color: "white" Rectangle { anchors.centerIn: parent width: parent.width * 0.8 height : width radius: width color: "black" } } } Rectangle { id: rotategradient visible: false width: maskrect.width height: width gradient: Gradient { GradientStop { position: 0.0 color: "white" } GradientStop { position: 1.0 color: "blue" } } } ShaderEffectSource { id: rotategradient_source sourceItem: rotategradient } ShaderEffectSource { id: maskrect_source sourceItem: maskrect } ShaderEffect { anchors.fill: rotategradient visible: true property variant source: rotategradient_source property variant maskSource: maskrect_source fragmentShader: " varying highp vec2 qt_TexCoord0; uniform highp float qt_Opacity; uniform lowp sampler2D source; uniform lowp sampler2D maskSource; void main(void) { gl_FragColor = vec4(texture2D(source, qt_TexCoord0.st).rgb * texture2D(maskSource, qt_TexCoord0.st).r, texture2D(maskSource, qt_TexCoord0.st).r); } " RotationAnimation on rotation { loops: Animation.Infinite from: 0 to: 360 } }
  • Create custom widget for project

    Solved
    1
    0 Votes
    1 Posts
    141 Views
    No one has replied
  • Qt via conan package manager - macOS - "Could not resolve plugin "qtquick2plugin""

    Solved
    2
    0 Votes
    2 Posts
    670 Views
    J
    I got it working : A bit of context : 1.: official qt conan package MUST be consumed using the --generator=virtualenv 2.: this generator generates activate.sh and environment.sh.env 3.: source activate.sh must be called for both the build, and to run the built app So the issue was that I was calling source activate.sh from my build script, so the variables weren't defined any more, when I tried to run my built app (outside of the script). So now I can use this script to run this texteditor example app (/Users/myUser/Qt/Examples/Qt-6.2.1/quickcontrols2/texteditor/) : set -e conan install qtbuildprofiles/6.2.2@qt/everywhere -r qt conan install -u conanfile.txt --profile=macos-universal-clang --build=never --update --generator=virtualenv -r qt source activate.sh mkdir -p build cd build echo "cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Release" cmake ../ -G Ninja -DCMAKE_BUILD_TYPE=Release VERBOSE=1 cmake --build . --config Release --clean-first cd .. #Run the built app : ./build/texteditor.app/Contents/MacOS/texteditor
  • Importing a *.JavaScript file in Release mode gives ERROR!

    Unsolved
    2
    0 Votes
    2 Posts
    220 Views
    fcarneyF
    Show us actual import statement. For example: import "dynamicobjects.js" as DynObjs
  • How create Calendar in QML?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    M
    I install Qt 6.3 alpha, but calendar not work
  • 0 Votes
    3 Posts
    503 Views
    GrecKoG
    What have you tried? Can you share a reproducible example? Please share details so we can help you. Because when I tried to reproduce what I understood from your post, it "works on my system": [image: 41147f2e-1d03-4df5-bfed-f549051d3136.png]
  • QtPdf open named location

    Unsolved
    2
    0 Votes
    2 Posts
    191 Views
    C
    I found the examples in qml/QtQuick/Pdf/qml/ how to show multiple pages: PdfMultiPageView.qml PdfPageView.qml PdfScrollablePageView.qml But I'm still looking for a solution how to navigate to a specific location inside the document (e.g. bookmark, nameddest, page)
  • QML MouseArea - Mouse Is Not Defined

    Solved
    3
    0 Votes
    3 Posts
    836 Views
    K
    @fcarney said in QML MouseArea - Mouse Is Not Defined: mouse Wow that worked, thanks! Really should throw a warning or something that the parameters don't matchup with the signal.
  • Row not sizing to fit content

    Unsolved
    2
    0 Votes
    2 Posts
    207 Views
    fcarneyF
    Don't use anchors.fill for Row and Column or any other container that changes its size according to context. Specify the height on Row. You should be seeing runtime warnings in the Application Output.
  • Generating Quick3D materials interactively

    Solved
    2
    0 Votes
    2 Posts
    281 Views
    D
    Well this was simple. After going into the source code, I noticed a onVertexShader changed signal or something of that nature and then I noticed an update command. How stupid of me. Of coarse. An update command is given in any openGL code to redraw the scene. So a simple update call in a function call is all that is needed. Now for the bigger problem. It appears that quick3D can only handle vertex and fragment shaders, and a large part of what I required shader wise is to be able to use a geometry shader to convert point data into some other shape and manipulate it interactively in real time. A bummer as the alternative Qt3D which seems more flexible and thorough to do all things 3D is quite impractical to try and implement. A combination of poor and sparse documentation with trivial examples that show little on how to expand them. The exact reason I have not tried to use other frameworks Qt3D. It seems there are all the parts to build a car, but little to no instructions on how to do it !
  • QML Image dont't load after build

    Unsolved
    2
    0 Votes
    2 Posts
    194 Views
    MarkkyboyM
    Where is the actual image? Did you include the image in your qml.qrc file? It cannot open it because it cannot find it. I do not see an Images folder in your application. What is in your "Other files" folder?, please elaborate.
  • 0 Votes
    2 Posts
    432 Views
    C
    I didn't read carefully documentation and as a result i have this question, what ones should do is : 1. copy the existing layout files from QTDIR/qtvirtualkeyboard/src/virtualkeyboard/content/layouts/en_GB 2. adapt to your needs 3. add the files in a (custom) path (e.g. :/path/to/my/layouts/en_GB) to your qrc in the beginning of your main() add: qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", ":/path/to/my/kb/layouts");
  • Howto hide blinking cursor from InActive TextInput

    Unsolved
    2
    0 Votes
    2 Posts
    561 Views
    L
    You can simply catch all unhandled click events below your inputs. Please note if you apply anchors.fill to the TextInput and the TapHandler has the same clickable area, all click events will stay in the TextInput as it covers the entire area of the TapHandler. Compare to the example below with the Rectangle indicating the area of the TextInput. Item{ id: contentWrapper anchors.fill: parent TapHandler{ id: clickOutsideCatcher onTapped: { console.debug("catched click outside") // this removes the active focus from the input field contentWrapper.forceActiveFocus() } } Rectangle{ id: highlightTextInputArea anchors.fill: num_id color: "red" } TextInput { id: num_id text: "1234" font.pixelSize: 20 selectByMouse: true //anchors.fill: parent validator: IntValidator {bottom: 1; top: 100000} } }
  • QML HorizontalHeaderView not working as expected

    Unsolved qml tableview horizontalheade
    3
    0 Votes
    3 Posts
    1k Views
    V
    This question was asked on stackoverflow as well. Just posting this here because the accepted answer was useful. Another approach would be to anchor the table below the header. TableView { id: tableView anchors.top: horizontalHeader.bottom model: TableModel { } }
  • QAbstractTableModel is not updating (TableView model)

    Solved
    9
    0 Votes
    9 Posts
    2k Views
    B
    @JonB Okay, I found an issue. Finally I will use this QStandardItemModel. The problem was that. I have Model class included to Manager class. Manager class was included into main. In main I declared an Manager class and qmlRegisterType<TableModelResults>("com.results.table", 1, 0, "TableModel");. In QML as model I used TableModel, but to modify data I used an function from Manager class. First time used qmlRegisterType, thank You for help.
  • How to increase Virtual Keyboard keypad size

    Unsolved
    2
    0 Votes
    2 Posts
    513 Views
    L
    @James-A I think you could simply copy the default styling to your project and modify it. Here you can modify anything (font size, font family, colors, keyboard size, replace images, etc.). QtQuick/VirtualKeyboard/Styles/default/ // apply your style in main.cpp qputenv("QT_VIRTUALKEYBOARD_STYLE", "yourStyleDirectoryName"); qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", "qrc:/path/to/your/style/directory/from/above");
  • Why the delegate component is eating up my memory

    Moved Unsolved
    1
    0 Votes
    1 Posts
    221 Views
    No one has replied
  • Running Qt Quick and CPP tests at the same time

    Solved
    3
    0 Votes
    3 Posts
    384 Views
    A
    @fcarney Ya looks like the uppercase. 🤦‍♂️ Thanks for your help.
  • How can I use format for text?

    Unsolved
    3
    0 Votes
    3 Posts
    256 Views
    fcarneyF
    Text { property real somenumber: 12345.12345 text: somenumber.toFixed(1) } This is a Javascript feature of Number.