Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Replacing widgets and customizing
Forum Updated to NodeBB v4.3 + New Features

Replacing widgets and customizing

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 347 Views
  • 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.
  • J Offline
    J Offline
    JUDE34823
    wrote on 10 Jul 2024, 07:32 last edited by JUDE34823 7 Oct 2024, 07:58
    #1

    Hi, if someone could let me know the best practice for this I would appreciate it..

    I am using QT Designer 6.4.3 and VS Code, Windows 11. I have a design with a main window, central widget, then a sidebar with buttons, a stacked widget with pages, with buttons and labels and spinboxes etc on each page.

    I am customizing most of the items, for example I replace a pushbutton with a custom toggle switch.py that changes the color of the overlay widget in central widget. All the buttons are replaced with custom.py buttons.

    It has turned ugly! I think the first problem is targeting the items to be replaced and how to setup those items in QT Designer. I found that I had to put a button in a widget to be able to replace it. So i ended up with extra widgets all over the place. Widgets in widgets and layouts in layouts just so the item would be found and replaced successfully in VS Code. Now for example I have rogue extra replaced buttons that should not be there.

    I copy the code from QT Designer and paste to a ui.py that I do not touch. Then all coding I do in app.py with custom items like button.py used.

    A bit of a long question I suppose but the main idea is best practice for replacing items with custom .py items, QT Designer setup. Where to find out about this?

    Many Thanks.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 10 Jul 2024, 08:24 last edited by
      #2

      See https://doc.qt.io/qt-6/designer-using-custom-widgets.html on how to use your custom widgets with designer.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      J 1 Reply Last reply 10 Jul 2024, 08:26
      0
      • C Christian Ehrlicher
        10 Jul 2024, 08:24

        See https://doc.qt.io/qt-6/designer-using-custom-widgets.html on how to use your custom widgets with designer.

        J Offline
        J Offline
        JUDE34823
        wrote on 10 Jul 2024, 08:26 last edited by
        #3

        @Christian-Ehrlicher thank you

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JUDE34823
          wrote on 10 Jul 2024, 08:53 last edited by JUDE34823 7 Oct 2024, 08:55
          #4

          It did not really help, I am not promoting. And making custom plugins does not seem to be the way to go.

          The problem is that I started coding only a few months ago, I have made about 10 apps with great success but now I start with QT Designer to make the UIs look better, the complexity has tripled and the gremlins are plenty, dealing with app.py , ui.py and several custombutton.py etc.

          Looking in manuals and forums does not seem to help much.

          What would you recommend? A course? A skype tutor? I don't know where to start.

          Thanks.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 10 Jul 2024, 10:31 last edited by
            #5

            If you have a custom widget derived e.g. from QPushButton then create a promoted widget derived from QPushButton. Where is the problem?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JUDE34823
              wrote on 11 Jul 2024, 07:07 last edited by
              #6

              yes, it's easy when you know how. I found a relevant tutorial.

              1 Reply Last reply
              0

              1/6

              10 Jul 2024, 07:32

              • Login

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