What event returns clik on QPushButton?

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

What event returns clik on QPushButton?

Post by pietro_72_ » Sun Aug 23, 2015 11:00 am

Ciao
Sto provaddo ad utilizzare le Q UI per gestire la mia estensionre ParallelLines.js per QCAD, ho creato il file ParallelLines.ui tramite QT Creator su Linux e prendendo spunti da Cross.ui, ho inserito 2 QPushButton oltre alttri oggetti
Quale evento restituisce il clik su questi pulsanti?

translation

Hello
I'm provaddo to use Q UI to manage my estensionre ParallelLines.js for QCAD, I created the file through ParallelLines.ui QT Creator on Linux and taking cues from Cross.ui, I inserted two QPushButton objects over others it
What event returns clik on these buttons?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: What event returns clik on QPushButton?

Post by andrew » Mon Aug 24, 2015 9:53 am

In Qt, you can use signals and slots to easily react to events:
QPushButton button = new QPushButton(parent);
button.clicked.connect(function() { print("button clicked"); });
You can also connect to a member function:
button.clicked.connect(this, "myMemberFunction");
Or to a static or global function:
button.clicked.connect("MyClass.myFunction");

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: What event returns clik on QPushButton?

Post by pietro_72_ » Fri Sep 11, 2015 11:29 am

Sono riuscito a fare qualcosa con QPushButton ma ora in modo simile non riesco a rilevare le variazioni di una QComboBox
Allego i file per maggior chiarezza

Translation by Google

I could do something with QPushButton but now similarly can not detect changes in a QComboBox
I attach files for clarity
Attachments
ParallelLines.ui
(4.16 KiB) Downloaded 634 times
ParallelLines.js
(9.71 KiB) Downloaded 618 times

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: What event returns clik on QPushButton?

Post by andrew » Fri Sep 11, 2015 12:38 pm

Combo boxes trigger signals in the same way as push buttons and other user interface components. Since there are two signals for currentIndexChanged (one with index, one with text as argument), you have to use a slightly different syntax to connect the signal:
var combo = new QComboBox(...);
...
combo['currentIndexChanged(int)'].connect(...);

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”