Important: Please read the Qt Code of Conduct -

Can't drag and drop widgets onto UI

  • I've created a new item in the Action Editor box, and I'm trying to drag and drop them onto the mainwindow UI, but it's not letting me. Does anyone know why this is?

    Also, when I drag and drop a widget, i.e a button onto the UI, it doesn't show when I build and run it. Why is this?

  • Lifetime Qt Champion

    Please provide more information - where do you want to drag'n'drop something?

  • Lifetime Qt Champion

    If you change the UI file by adding a new widget and it still sort of shows the old GUI when run,
    the often seen cause is that some of the build files (from the build directory ) is
    placed in the project folder. Make sure there are no build files in the project folder .

  • @Christian-Ehrlicher I've included an image because I think showing you a picture would make a lot more sense than me trying to explain it.
    Screen Shot 2020-12-31 at 7.34.09 PM.png

  • Lifetime Qt Champion

    You can only drag Actions to the Main Menu (file) or the tool bar.
    Actions are non visual so if you could drag to center of the GUI, it would not make much sense. :)

  • @mrjj Ah, I see. I was following a tutorial on YT and the guy was able to do it, so I was just confused. Maybe older versions?

    Anyhow, I'm sorry to post another question here like this, but it's sort of related. When I drag and drop widgets like a button onto the UI, when I compile it, it doesn't show in the window. Do you know why this is happening?

  • Lifetime Qt Champion

    Are you sure he didnt drag to the top menu ?
    Do you have link to video ? Just curious of what you saw :)

    • When I drag and drop widgets like a button onto the UI, when I compile it, it doesn't show in the window.

    Well the normal cause i have seen is that for some reason some of the build files got into the project folder
    ( and it will see them first and use the old)

    So check the project folder ( where the .pro file is) for any files looking like

    alt text

    especially any ui_xxxxx files as they are generated and should not be in the project folder.

    Also check project that the build folder is not pointing to the project folder
    alt text

    Pro tip :)
    You can right click a file to go directly to it
    alt text

Log in to reply