Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Custom Widget how to begin ?
Qt 6.11 is out! See what's new in the release blog

Custom Widget how to begin ?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 2 Posters 498 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aziz1
    wrote on last edited by
    #1

    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)
    
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Aziz1
        wrote on last edited by
        #3

        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.

        ![alt text](Capture_Ecran_ 2024-08-12 à 14.49.48.jpg image url)

        1 Reply Last reply
        0
        • A Aziz1 has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved