Nominate our 2022 Qt Champions!

Create events

  • Excuse me my English, is not good. How I can create a event to any widget using QT designer for paint a line using the class QPaint. This class requer one event to execut that I don't know make.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I am not sure I am following your question right but creating an "event" from designer is not possible. This is done by code.

    If you can't find the right formulation in english, a couple of picture could help us understand your problem better.

  • When I have a form and I add him a press button. I select it and I give him right click and I select go to slot and after I select the event that I want (for example clicked()) and after in the .cpp I implement the function that I want that he do when I give click to the press button. Here a photo goes.
    This is the way that I know to create an event and I am sure that exist another way but I don’t know yet. I study in university and in my carrier they teach me C# and in the Visual Study when I select a press button appear many of his events to select and in Qt only few events appear.
    I am trying to learn Qt in C++ because I know C++ and I have heard that Qt is good.
    Now I need to draw a scheme in a form and to do it I think that I need to implement an event to be able to use the class QPaint that is who permits doing me, but this event I don’t know her name and I don’t know how create it.
    If you don´t understand you and me have a simple project (whit a .ui form) when you draw a line in a simple form send it me. If you know some link of some .pdf or .doc to learn Qt using designer also send it me. Thanks you for hear me.

  • In Qt world, they are called SIGNALS and SLOTS. And more common ways to connect the signal to slot is write code directly instead of do it in designer.

    Event is another story, you can find more name such as QMouseEvent/QKeyEvent/QTimerEvent/...

Log in to reply