Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. button
    Log in to post

    • SOLVED Open serial port when clicked the button
      General and Desktop • button serialport crashed • • suslucoder  

      4
      0
      Votes
      4
      Posts
      17
      Views

      @suslucoder Then mark the topic as solved.
    • SOLVED Restored window after minimizing is not maximized
      QML and Qt Quick • qml button window visibility minimize • • Krakenus00  

      3
      0
      Votes
      3
      Posts
      50
      Views

      Omg, I've just ORed the flags, and now it works as intended. In QtWidgets it should be: // To set the window minimized setWindowState(windowState() & ~Qt::WindowActive | Qt::WindowMinimized); // To restore the window from minimized state setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive); So in QML it should work in the same way.
    • SOLVED Access item inside ListView via delegate
      QML and Qt Quick • qml listview button delegate • • Ratzz  

      14
      0
      Votes
      14
      Posts
      94
      Views

      @GrecKo , I mean without the button, when I edit the values of TextEdit, I should be able to get the modified text. I tried via property. It always gave me empty
    • SOLVED Button receiving clicked events even when behind a rectangle item and not visible in screen.
      QML and Qt Quick • button qtquick control clickevent overlap event propogati • • Ashvit  

      3
      0
      Votes
      3
      Posts
      50
      Views

      @fcarney Thankyou for the prompt reply, your solution does solve my problem.
    • UNSOLVED Qt QuickTest and native dialogs
      QML and Qt Quick • button click native dialog qtquicktest simulate • • Oliver Starke CEOS  

      1
      0
      Votes
      1
      Posts
      37
      Views

      No one has replied

    • UNSOLVED QML proper using nested functions
      QML and Qt Quick • qml button style function nested • • Kyeiv  

      2
      0
      Votes
      2
      Posts
      82
      Views

      Hi @Kyeiv, I just did a quick test application and it worked for me: main.qml import QtQuick 2.9 import QtQuick.Window 2.2 import "someJSscriptFile.js" as Jss Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: rect color: Jss.getCurrentColor() anchors.fill: parent } } someJSScriptFile.js function getCurrentColor() { return __getColor(rect.currentValue) } function __getColor(value) { if (rect.pressed) { return "grey" } if(rect.activated === false) { return "white" } if(value ===0) { return "red"; } return "green"; } Is the variable "control" defined in your QML? Or what are you trying to use it for?
    • UNSOLVED How to create a button in Qt 3D Studio
      General and Desktop • qml button buttons element 3dstu • • Pivot15  

      1
      0
      Votes
      1
      Posts
      107
      Views

      No one has replied

    • SOLVED Check if button was right clicked or left clicked?
      General and Desktop • button qmouseevent right-click • • legitnameyo  

      15
      0
      Votes
      15
      Posts
      2044
      Views

      Solved it by creating a derivative of the CustomQPushButton class definition! Thanks!
    • SOLVED check for clicks on buttons inside a vector?
      General and Desktop • button vector dynamically • • legitnameyo  

      7
      0
      Votes
      7
      Posts
      457
      Views

      Rather than using a bunch of ifs, what about using a QMap or a QHash to store the information and retrieve that in the slot ? This will make your implementation easier to maintain.
    • UNSOLVED DRY with Actions in QtControls 2
      QML and Qt Quick • button action control 2 menuitem dry • • Devinder  

      1
      0
      Votes
      1
      Posts
      196
      Views

      No one has replied

    • SOLVED Custom Widgets on qt designer
      General and Desktop • pyqt5 button custom • • MafiaSkafia  

      5
      0
      Votes
      5
      Posts
      1153
      Views

      @mrjj okay thank you very much! And yes, my Designer also have a StyleSheet editor like this: Cheers
    • UNSOLVED Animated Button Border
      QML and Qt Quick • qml qtcreator button border borderimage • • VAIBHAVSRI  

      2
      0
      Votes
      2
      Posts
      552
      Views

      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.
    • SOLVED QComboBox and QPushButton in a grid layout do not line up properly in macOS
      General and Desktop • button combobox gridlayout mac-os • • Guy Gizmo  

      15
      0
      Votes
      15
      Posts
      4146
      Views

      Checkout the answer I have given here: https://forum.qt.io/topic/105191/why-isn-t-a-qcombobox-positioned-correctly-in-a-layout
    • SOLVED Rounded button with progress background fill
      QML and Qt Quick • qml button clipping progress mask • • markugra  

      3
      0
      Votes
      3
      Posts
      1302
      Views

      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: Thanks again!
    • SOLVED Dialog.ui not opening when a variable is declared in Dialog.h
      General and Desktop • qtcreator button program stop • • Lasith  

      5
      0
      Votes
      5
      Posts
      758
      Views

      @Lasith Oh, thats a classic :)
    • SOLVED Having fixed size for dynamically created buttons!
      General and Desktop • qtcreator button size dynamic • • Kushan  

      2
      0
      Votes
      2
      Posts
      515
      Views

      f3 = new QFrame(); ??? How can I have a fixed size for the buttons for both the situations? c->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    • SOLVED Opening dynamically created buttons
      General and Desktop • button qstringlist dynamic click • • Kushan  

      11
      0
      Votes
      11
      Posts
      7523
      Views

      @jsulm thanx bro :)
    • SOLVED Loading data from sqlite database
      General and Desktop • qtcreator tableview sqlite button • • Kushan  

      10
      0
      Votes
      10
      Posts
      3692
      Views

      What was the problem ?
    • SOLVED Searching word found after several clicks!
      General and Desktop • qtcreator tableview button search • • Lasith  

      4
      0
      Votes
      4
      Posts
      1116
      Views

      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.
    • SOLVED SQL query not loading back
      General and Desktop • qtableview button search results • • Lasith  

      11
      0
      Votes
      11
      Posts
      2048
      Views

      @VRonin I got it corrected! searchProxy->setSourceModel(modal); ui->tableView->setModel(searchProxy); should be put inside the search button method!
    • SOLVED Getting proper folder path
      General and Desktop • qt creator button line edit folder path • • Lasith  

      5
      0
      Votes
      5
      Posts
      1031
      Views

      @J.Hilk Thanx mate :) I had been too complex
    • SOLVED Getting only the folder path to a line edit without selecting any file
      General and Desktop • qtcreator button click folder path • • Lasith  

      4
      0
      Votes
      4
      Posts
      9481
      Views

      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...
    • SOLVED Signal and slot wrong value being sent
      General and Desktop • qtcreator signal & slot button qlineedit • • Lasith  

      5
      0
      Votes
      5
      Posts
      1425
      Views

      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(); }
    • SOLVED Setting checked property of a button
      QML and Qt Quick • button qtquick2 qtquick control • • pra7  

      3
      0
      Votes
      3
      Posts
      845
      Views

      @Wieland thanks !!! for the answer.
    • SOLVED Button backgound non-existent property!
      QML and Qt Quick • button background color qt quick 2.0 • • tansgumus  

      6
      0
      Votes
      6
      Posts
      2478
      Views

      @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.
    • SOLVED Light up a button when the button is clicked
      General and Desktop • button • • jkprog  

      4
      0
      Votes
      4
      Posts
      1181
      Views

      yeah I used the stylesheets and it solved my problem
    • SOLVED Pop up a new window on a pushed button
      General and Desktop • button window connect slots • • Adrian.Aioanei  

      6
      0
      Votes
      6
      Posts
      29637
      Views

      Yep, it works. Thanks :)
    • UNSOLVED Not to close Menu on MenuItem Click
      General and Desktop • button menu menuitem • • ars1614  

      4
      0
      Votes
      4
      Posts
      1168
      Views

      @ars1614 ok. never seen it then :) I would not rule out you can override it closing on menu selection by subclassing or using event filter.
    • UNSOLVED How to make ListElement a button in Drawer ?
      QML and Qt Quick • qml qt quick qt 5.7 button listmodel • • Qjay  

      2
      0
      Votes
      2
      Posts
      1771
      Views

      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
    • Place Button in Bottom of page
      QML and Qt Quick • qt quick button • • Qjay  

      8
      0
      Votes
      8
      Posts
      2580
      Views

      Both ApplicationWindow and Page provide header and footer properties that are convenient for placing anything at the top or bottom of the window or a page.
    • UNSOLVED The best way to handle signals inside Grid with Buttons?
      QML and Qt Quick • signal button grid • • Ferdl  

      2
      0
      Votes
      2
      Posts
      891
      Views

      I think i got it... sometimes you don't see the tree in the wood... Is just change inside the Grid.... ButtonMenu { width: columnbutton.w; height: columnbutton.h; operation: buttonUserTEXTA; onClicked: {menuuser.state = "STATE A" } } so easy, and I can remove the if-else stuff inside the ButtonMenu.qml... I think its SOLVED!!
    • SOLVED how to create an image button
      General and Desktop • image qt 5.4.1 button • • M4RZB4Ni  

      7
      0
      Votes
      7
      Posts
      15161
      Views

      @mrjj Thanks so Much Bro :)
    • UNSOLVED QtCreator disable run button adding existing file
      Tools • creator button run grayed disabled • • Keyos  

      9
      0
      Votes
      9
      Posts
      2875
      Views

      https://bugreports.qt.io/browse/QTCREATORBUG-16172
    • UNSOLVED How to go back 2 Wizardpages on a QWizard
      General and Desktop • button qwizard qwizardpa • • roseicollis  

      6
      0
      Votes
      6
      Posts
      2354
      Views

      I was thinking about reimplementing nextId so that when you click on the "Back" button you reroute to the page you want then call next()
    • UNSOLVED Change color while the button is pressed
      General and Desktop • c++ button color • • mandruk1331  

      3
      0
      Votes
      3
      Posts
      7892
      Views

      @mandruk1331 Hi, yourButton->setStyleSheet("QPushButton:pressed { background-color: red }");
    • SOLVED Adding own UI to dialog
      General and Desktop • gui button dialog click • • aney  

      12
      0
      Votes
      12
      Posts
      8441
      Views

      @aney Yeah when meta compiler doesn't run, it all get a bit strange. :) In first post , under it. to the right. is Topic Tools button. It can mark as solved.
    • UNSOLVED PyQt immediately calling function handler upon setup. Why?
      General and Desktop • pyqt5 signal button connect clicked • • errolflynn  

      4
      0
      Votes
      4
      Posts
      2651
      Views

      @errolflynn You should write self.button1.clicked.connect(ft_handler) - this will register the function ft_handler as a slot for the clicked signal. On http://doc.qt.io/qt-5/qabstractbutton.html you see that the signature of that signal is void clicked(bool checked). In other words, when the signal is activated, your handler is called as ft_handler(checked) where checked is either True or False. Per the signature of the clicked signal, this is the only information you will get out of the signal. If you want to pass additional parameters, you indeed will need to create a separate function that encodes those extra parameters and passes them to the handler. In Python it makes a lot of sense to use a lambda for it, for instance: self.button1.clicked.connect(lambda checked: fct_handler(par1, par2, par3, checked)) Hope this helps