跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • CustomMaterial shader compile error message and log absent

    Unsolved
    1
    0 評價
    1 貼文
    266 瀏覽
    尚無回覆
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    1 瀏覽
    尚無回覆
  • Slot Machine in Qt Quick

    Unsolved
    5
    0 評價
    5 貼文
    2k 瀏覽
    ndiasN
    @NullByte : I don't have any example implementing thins. But, with little effort, you can generate a random number and set the currentIndex for every Tumbler component. But I'm not sure how you can increase the speed to have a movement effect when incrementing the currentIndex. he movement effect can also be done by quickly incrementing the currentIndex. import QtQuick import QtQuick.Window import QtQuick.Controls ApplicationWindow { property var numItens: 5 Rectangle { anchors.fill: parent Row { Tumbler { id: tumbler1 model: numItens wrap: true } Tumbler { id: tumbler2 model: numItens wrap: true } Tumbler { id: tumbler3 model: numItens wrap: true } } Timer { id: incTimer1 property var counter: 0 property var frequency: 2 interval: 1000 / frequency repeat: true running: counter != 0 onTriggered: { tumbler1.currentIndex = counter % numItens; counter = counter-1 console.debug(incTimer1.counter + " " + tumbler1.currentIndex) } } MouseArea { id: playArea anchors.fill: parent onPressed: { incTimer1.startIndex = incTimer1.counter incTimer1.counter = 5*incTimer1.frequency + Math.floor(Math.random() * numItens) // 5 seconds + X variable time console.debug(incTimer1.counter) } } } }
  • Is it possible to queue events in QML?

    Solved
    4
    0 評價
    4 貼文
    583 瀏覽
    GrecKoG
    Or use StackView, push or replace pages onto it and pop them when needed.
  • MacOS: previous border remains when animating in transparent mode

    Unsolved
    1
    0 評價
    1 貼文
    125 瀏覽
    尚無回覆
  • How use QtGraphicalEffects in Qt6

    Solved
    4
    0 評價
    4 貼文
    2k 瀏覽
    MarkkyboyM
    I've only just started using QT6, for me, just adding the import statement was not enough in my case. I had to use the maintenance tool to add the compatibility module. Notably, there is also no shortcut in Start Menu for the maintenance tool, which can be found in the installation folder of Qt itself.
  • QtQuick.Extras is not working using qt 6.1.3 version

    Unsolved
    2
    0 評價
    2 貼文
    328 瀏覽
    MarkkyboyM
    https://www.qt.io/blog/qt-extras-modules-in-qt-6
  • 此主題已被刪除!

    Unsolved
    2
    0 評價
    2 貼文
    28 瀏覽
  • QML - SwipeDelegate

    Unsolved
    1
    0 評價
    1 貼文
    217 瀏覽
    尚無回覆
  • Qtquick\Qml Arc

    Unsolved arc shape canvas beginner help
    4
    0 評價
    4 貼文
    3k 瀏覽
    ndiasN
    Hi @fallouthase, Please find bellow a simple example using PathAngleArc: https://doc.qt.io/qt-6/qml-qtquick-pathanglearc.html import QtQuick.Shapes Shape { width: 200 height: 200 anchors.top: parent.top anchors.left: parent.left // Enable multisampled rendering layer.enabled: true layer.samples: 4 // Outer gray arc: ShapePath { fillColor: "transparent" strokeColor: "gray" strokeWidth: 20 capStyle: ShapePath.RoundCap PathAngleArc { centerX: 100; centerY: 100 radiusX: 100-20/2; radiusY: 100-20/2 startAngle: 135 sweepAngle: 270 } } // Inner blue arc: ShapePath { fillColor: "transparent" strokeColor: "blue" strokeWidth: 20 capStyle: ShapePath.RoundCap PathAngleArc { centerX: 100; centerY: 100 radiusX: 100-20/2; radiusY: 100-20/2 startAngle: 135 sweepAngle: 180 } } } [image: 512e5cf8-7b1e-4b4c-aa93-d98a1b78f9c0.png] You can also use already implemented customizable QML Circular Slider: https://github.com/arunpkqt/CircularSlider Best Regards
  • Passing QByteArray to a callable QJSValue

    Unsolved qjsvalue qbytearray
    3
    0 評價
    3 貼文
    1k 瀏覽
    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 評價
    2 貼文
    402 瀏覽
    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 評價
    1 貼文
    148 瀏覽
    尚無回覆
  • Qt via conan package manager - macOS - "Could not resolve plugin "qtquick2plugin""

    Solved
    2
    0 評價
    2 貼文
    817 瀏覽
    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 評價
    2 貼文
    233 瀏覽
    fcarneyF
    Show us actual import statement. For example: import "dynamicobjects.js" as DynObjs
  • How create Calendar in QML?

    Unsolved
    3
    0 評價
    3 貼文
    1k 瀏覽
    M
    I install Qt 6.3 alpha, but calendar not work
  • 0 評價
    3 貼文
    532 瀏覽
    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 評價
    2 貼文
    198 瀏覽
    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 評價
    3 貼文
    882 瀏覽
    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 評價
    2 貼文
    215 瀏覽
    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.