Custom Widget how to begin ?
-
Hello everyone,
I'm new to Qt but not to programming. I am trying to see if it would be possible to create a Custom Widget and I saw multiple tutorials on YouTube but when I tried myself I got stuck at the start.
Using Qt Creator on Mac I follow the step to create a custom QWidget, once the project is created I want to run it to see where I start but I have an error : ":-1: erreur : Vous devez définir un exécutable dans la configuration d’exécution personnalisée." which translate "You have to define an executable in the configuration."
I would appreciate some help.
Regards.
Here is my pro file :
CONFIG += plugin debug_and_release TARGET = $$qtLibraryTarget(mytogglecustomplugin) TEMPLATE = lib HEADERS = mytogglecustomplugin.h SOURCES = mytogglecustomplugin.cpp RESOURCES = icons.qrc LIBS += -L. QT += designer target.path = $$[QT_INSTALL_PLUGINS]/designer INSTALLS += target include(mytogglecustom.pri) -
A custom widget is just
class MyWidget : public QWidget {}.What you have here is a Qt Designer plugin project that lets you use a custom widget in the designer. A designer plugin is optional. For a lot of widget types a custom class in code is more than enough.
But if you want a plugin anyway, a project like that does not produce an executable (as the message says). It produces a plugin, which, if configured properly, will be copied to your designer directory. To test it you run the designer and see if your plugin is loaded and that custom widget shows up in the widget selection list.
-
Thanks for your answer, it's clear.
I was following this video https://www.youtube.com/watch?v=bc13VWTPMBU&t=1300s but the person does actually have a window Custom Executable that's open and then the youtuber closes it. In my case I could reach the same result by compiling the project after right clicking the project name.
 -
A Aziz1 has marked this topic as solved on