Qt GUI with Eclipse c++
-
Hi to all,
I've created a basic GUI with 2 buttons. I can start the GUI from eclipse and now Im wondering how can I check the click event on each of those 2 buttons from eclipse? Im using linux and Qt5 (5.13.0 version). Can you provide a link to a tutorial on eclipse and Qt?
Thanks
Gaston -
Hi,
What do you mean by "check the click event" ?
-
in the GUI I have 2 buttons. I want to print a message when I click on 1 button.
Gastón -
qDebug? Where en eclipse c++? Can you elaborate? Im using eclipse c++ with Qt5 Gui on linux tumbleweed.
Gastón -
It has nothing specific to Eclipse, it's a stream operator that will send whatever you pass to it to the console.
-
Maybe I wrote incorrectly my question. Here we go: Im using Qt5 and eclipse c++. I made a simple GUI on Qt5 and converted to cpp with UIC file (in the binary folder inside Qt5). In eclipse I'm using this cpp file (as header file) to invoke that GUI.
What I want to do now is to be able to use those 2 buttons in the GUI. I want to display a message when I press one of those 2 buttons. Here is the question, how I do that in eclipse cpp? looking in other forum I see this line:QObject::connect(button, SIGNAL(clicked()),this, SLOT(clickedSlot()));
I dont understand the "this" parameter in the connect(). The clickedSlot() is the subroutine generated when the button is clicked. How to translate "this" to eclipse.
Thanks for you help SGaist.
Gastón -
Ok, then first thing to understand: Eclipse is just an IDE, Eclipse C++, is just a specialisation of Eclipse to write C++ programs. There's nothing to translate here, Qt is a C++ framework, whether your write your application with Eclipse or on the command line, it doesn't change anything.
If you don't know what
this
represent in C++, I encourage you to first learn the C++ basics before going any further. -
you are right. How do I define a private slot in c++. I dont have that vast knlowdge.
Gastón -
You should read https://doc.qt.io/archives/qt-4.8/signalsandslots.html to get a feeling for that topic.
-
I'd recommend reading the Qt5 version: https://doc.qt.io/qt-5/signalsandslots.html
@GastonMelo You really should take the time to go through Qt's documentation. It's full of tutorials, getting started guides and it also explains all the core concepts provided within the framework.