Skip to content
  • 0 Votes
    3 Posts
    98 Views
    SavizS

    @costasjames479 I am aware that other styles are available for Qt Quick Controls. However, according to the documentation, the Basic Style is the most performant and platform-compatible, which is why I prefer to use it. With this in mind, how can I figure out what to place as the attribute or property name instead of ? in the following code:

    TextField { palette { ?: "blue" ?: "white" } } ComboBox { palette { ?: "blue" ?: "white" } }

    In other words, is there a detailed list in the documentation that specifies the name of each attribute, which I might have overlooked?

  • 0 Votes
    1 Posts
    533 Views
    No one has replied
  • 0 Votes
    1 Posts
    290 Views
    No one has replied
  • 1 Votes
    1 Posts
    506 Views
    No one has replied
  • 0 Votes
    3 Posts
    480 Views
    A

    Thank you, alright!

  • 0 Votes
    1 Posts
    500 Views
    No one has replied
  • 1 Votes
    8 Posts
    2k Views
    I

    Note: it turns out that setting background to Qt.transparent doesn't make sense. It worked simply because the types are incompatible and background got set to null. It's easier to simply set background to null to get the same result.

  • 0 Votes
    1 Posts
    825 Views
    No one has replied
  • 0 Votes
    5 Posts
    2k Views
    M

    @p3c0 said in qmlscene and Qt Quick Controls 2: styling:

    @morte Are you sure you are setting it correctly ? I just tried it with Qt 5.7 and it works. Can you try the same with Qt 5.7 ?

    export QT_QUICK_CONTROLS_STYLE=universal; /opt/Qt5.7.0/5.7/gcc_64/bin/qmlscene Test.qml Or export QT_QUICK_CONTROLS_STYLE=material; /opt/Qt5.7.0/5.7/gcc_64/bin/qmlscene Test.qml

    No, thats on Windows. Now it's start to work after i add environment variable in QtCreator for "Desktop" kit instead of setting it for external tool. Thanks for your assistance.

  • 0 Votes
    3 Posts
    917 Views
    M

    @p3c0

    Thank you.

  • 0 Votes
    6 Posts
    5k Views
    SGaistS

    @KRHC hi and welcome to devnet,

    You need QApplication if you use anything that relies on the widgets module. Otherwise, there's no need for it and you would just bloat your deployment for no good reason.

  • 0 Votes
    5 Posts
    3k Views
    A

    Hi again. I found way to cause crash if I use Qt.createComponent + createObject + FileDialog +Controls2.StackView. Here is my code:

    Main.qml (for this example I just create qml app from QtCreator template and rewrite main.qml)

    import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 ApplicationWindow { id: window visible: true height: 300 ColumnLayout{ Button { text: "Push" onClicked: { var component = Qt.createComponent("file:///D:/aknew-Data/Sandbox/build-test-Desktop_Qt_5_7_0_MinGW_32bit-Debug/debug/TestQML.qml") switch (component.status) { case Component.Ready: var form = component.createObject() stackView.push(form) break case Component.Error: console.log(component.errorString()) break } } } Button { text: "Pop" onClicked: stackView.pop() } StackView { id: stackView height: 100 width: 100 initialItem: Rectangle { Component.onDestruction: console.log( "Cyan Destruction Beginning!") color: "cyan" } } } }

    TestQml which I loadfrom file:

    import QtQuick 2.5 import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.2 Rectangle { Component.onDestruction: console.log("Green Destruction Beginning!") color: "Green" FileDialog {} }

    If I push-pop TestQml few times, I got QCoreApplication::postEvent: Unexpected null receiver during push (really during component.createObject() ) and app crashes. It seems that reason is that js garbage collector destroy previous instances of component , but something in C++ still have pointer to it (I suppose so because I have seen some methods with name like QV4::MemoryManager::runGC in call stack when I tried to debug this crash, but it happens rarely with active debugger and doesn't happen if I make push-pop sequence from code). I figure out that if I remove FileDialog, the app does not crash.

    I understand that my code can be incorrect for Controls 2, but I haven't had any system notification about it, this code is result of migration from Controls 1 and it is work in general (when I don't use FileDialog), so I think this situation is should be at least described because figure out what causes this crash was not easy

    My environment is Qt Creator 4.0.2, Qt 5.7.0, MinGW 32 bit, OS Win 8.1 64 bit, if you need some other information, please, I ready to answer, but maybe not very fast - I use qt only in my pet project now.

  • 1 Votes
    3 Posts
    2k Views
    M

    @jpnurmi Thanks for the clarification!

  • 0 Votes
    2 Posts
    2k Views
    Camilo del RealC

    See this, is very simple. I put a ColumnLayout in a drawer and modified the content to have a space to a header in the drawer and your actions list.

    Drawer {
    id: drawer
    width: Math.min(window.width, window.height) / 3 * 2
    height: window.height

    ColumnLayout { anchors.fill: parent Rectangle { width: drawer.width height: 100 Label { text: "Change this pane as you desire" anchors.centerIn: parent wrapMode: Text.WordWrap } } ListView { id: listView currentIndex: -1 Layout.fillWidth: true Layout.fillHeight: true delegate: ItemDelegate { width: parent.width text: model.title highlighted: ListView.isCurrentItem onClicked: { if (listView.currentIndex != index) { listView.currentIndex = index titleLabel.text = model.title stackView.replace(model.source) } drawer.close() } } model: ListModel { ListElement { title: "Get New Pages"; source: "qrc:/pages/get_new_pages.qml" } ListElement { title: "Manage Pages"; source: "qrc:/pages/manage_pages.qml" } } ScrollIndicator.vertical: ScrollIndicator { } } }

    }

  • 0 Votes
    3 Posts
    4k Views
    _
    ...
    OK, this works. I thought that control was a reserved keyword.

    <u>For readers :</u>
    Since I have many TabButton, I don't use id: control as suggested but parent.

    TabButton { id: tabButtonMenu width: 100 height: parent.height text: "Menu" contentItem: Text { text: parent.text font: parent.font opacity: enabled ? 1.0 : 0.3 color: parent.down ? "yellow" : "white" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } }
  • 0 Votes
    2 Posts
    1k Views
    ekkescornerE

    icons depend on DevicePixelRatio and are named this way:

    myIcon.png - corresponds to 1.0 and mdpi - use this name in qml
    myIcon@2x.png - 2.0 and xhdpi
    myIcon@3x.png - 3.0 and xxhdpi
    myIcon@4x.png - 4.0 and xxxhdpi

    if you want to know the DevicePixelRatio:

    C++
    qApp->primaryScreen()......