Skip to content
  • Animated Button Border

    Unsolved QML and Qt Quick border borderimage qtcreator qml button
    2
    0 Votes
    2 Posts
    1k Views
    sierdzioS
    There is no straightforward API for this. I see several possibilities: custom painting in QQuickPaintedItem custom painting in QQuickItem custom painting via GL shaders custom painting in QML Canvas a set of 4 animated Rectangle components, simulating the line. An ugly solution, but probably the easiest to do Perhaps BorderImage component can be forced to do an animation like that, but I doubt it.
  • 0 Votes
    15 Posts
    7k Views
    MrKozmonM
    Checkout the answer I have given here: https://forum.qt.io/topic/105191/why-isn-t-a-qcombobox-positioned-correctly-in-a-layout
  • 0 Votes
    3 Posts
    2k Views
    M
    Thanks, I tried the OpacityMask again as you suggested and it works now. It took me a bit to get it right, because i) I had a warning about the recursive property in ShaderEffectSource needing to be set to "true" and ii) the mask size needs to be the same as the source size for it to work properly. After a while I noticed that i) originated from some code in the contentItem of the button using the ColorOverlay (in fact it was the same problem there i.e. I tried to apply it to the parent). To fix ii) I used a transparent frame so that the code now looks something like: background: Item{ width: control.width height: control.height Rectangle{ id: progressFrame anchors.fill: parent color: "transparent" visible: false Rectangle{ id: progressRect width: 0.7*parent.width height: parent.height anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left color: "green" } } Rectangle { id: backgroundRect anchors.fill: parent radius: height / 2 color: "red" visible: true } OpacityMask{ anchors.fill: progressFrame source: progressFrame maskSource: backgroundRect } } Resulting in: [image: a7ae420c-4af3-47fd-b9d6-280eb03d86bb.png] Thanks again!
  • 0 Votes
    5 Posts
    1k Views
    mrjjM
    @Lasith Oh, thats a classic :)
  • 0 Votes
    2 Posts
    1k Views
    VRoninV
    f3 = new QFrame(); ??? How can I have a fixed size for the buttons for both the situations? c->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
  • Opening dynamically created buttons

    Solved General and Desktop dynamic button click qstringlist
    11
    0 Votes
    11 Posts
    13k Views
    K
    @jsulm thanx bro :)
  • Loading data from sqlite database

    Solved General and Desktop qtcreator sqlite tableview button
    10
    0 Votes
    10 Posts
    7k Views
    SGaistS
    What was the problem ?
  • 0 Votes
    4 Posts
    2k Views
    SGaistS
    Hi, More likely that not all your database data are loaded in memory. You would have to call fetchMore however beware that if you have big tables it's going to cost you more in RAM.
  • SQL query not loading back

    Solved General and Desktop qtableview button search results
    11
    0 Votes
    11 Posts
    3k Views
    L
    @VRonin I got it corrected! searchProxy->setSourceModel(modal); ui->tableView->setModel(searchProxy); should be put inside the search button method!
  • Getting proper folder path

    Solved General and Desktop qt creator folder path button line edit
    5
    0 Votes
    5 Posts
    4k Views
    L
    @J.Hilk Thanx mate :) I had been too complex
  • 0 Votes
    4 Posts
    22k Views
    G
    just use the filePath without further modification, its already the complete path. This code QDir d = QFileInfo(filePath).absoluteDir(); QString absolute=d.absolutePath(); will lead you to the dir above the selected path...
  • 0 Votes
    5 Posts
    2k Views
    mrjjM
    Hi Yes calling the function directly is actually a better solution in this case. Its worth mentioning that the so called slots are 100% normal c++ member functions and can be called without any Qt involvement/use of. void MainWindow::on_pushButton_clicked() { int value=ui->lineEdit->text().toInt(); // get value Dialog dialog1; dialog1.sendIntData(value); dialog1.exec(); }
  • Setting checked property of a button

    Solved QML and Qt Quick button qtquick2 qtquick control
    3
    0 Votes
    3 Posts
    1k Views
    P
    @Wieland thanks !!! for the answer.
  • 0 Votes
    6 Posts
    4k Views
    E
    @tansgumus said in Button backgound non-existent property!: Component.onCompleted: { // WORKS! // button.background.color = "red" // WRONG background = Rectangle { color: "red" } } Because Component.onCompleted is a javascript function and you can use only js syntax inside it. Rectangle { color: "red" } is QML specific syntax, js doesn't understand it. You can create a component dynamically (see the QML docs) by giving the component as a string to Qt.createQmlObject(). If you use button.background.color = "red" in Component.onCompleted it retains all other properties of the backround; I have found it to be a convenient way to change only one or two properties without messing others. Using other approaches, i.e. defining the whole component either dynamically or declaratively, overwrites everything which may or may not be desirable.
  • Light up a button when the button is clicked

    Solved General and Desktop button
    4
    0 Votes
    4 Posts
    2k Views
    J
    yeah I used the stylesheets and it solved my problem
  • Pop up a new window on a pushed button

    Solved General and Desktop button slots connect window
    6
    0 Votes
    6 Posts
    43k Views
    A
    Yep, it works. Thanks :)
  • Not to close Menu on MenuItem Click

    Unsolved General and Desktop menu button menuitem
    5
    1 Votes
    5 Posts
    3k Views
    A
    Just changing MenuItem to CheckBox does the job. Menu stays as long as you clicking CheckBox items: Menu { CheckBox { text: "Item A" checkable: true checked: false onCheckedChanged: { console.debug("item A", checked) } } CheckBox { text: "Item B" checkable: true checked: false onCheckedChanged: { console.debug("item B", checked) } } } This topic is still high in search results, so I think it would be helpful to post correct answer. Despite question is old it is still useful.
  • 0 Votes
    2 Posts
    2k Views
    ekkescornerE
    you should use a Flat Button to do this here's an example how you can do this. import QtQuick 2.6 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 // Flat Button Button { id: button property alias textColor: buttonText.color focusPolicy: Qt.NoFocus Layout.fillWidth: true Layout.preferredWidth : 1 leftPadding: 6 rightPadding: 6 contentItem: Text { id: buttonText text: button.text opacity: enabled ? 1.0 : 0.3 color: Material.primaryColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight font.capitalization: Font.AllUppercase font.weight: Font.Medium } background: Rectangle { id: buttonBackground implicitHeight: 48 Layout.minimumWidth: 88 color: button.pressed ? buttonText.color : "transparent" radius: 2 opacity: button.pressed ? 0.12 : 1.0 } // background } // button feel free to modify the Button to fit into your UI in my blog series about Qt 5.7 QtQuickControls2 you'll find more infos: http://j.mp/qt-x