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. [Solved] custom Qt Designer widget on a QWizardPage
Qt 6.11 is out! See what's new in the release blog

[Solved] custom Qt Designer widget on a QWizardPage

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.0k 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.
  • J Offline
    J Offline
    joval
    wrote on last edited by
    #1

    Hi all

    I've created a widget in Qt Designer, which I want to add on a QWizardPage programmatically along with a QListWidget. The problem is, when I add the list, it takes the whole page space, and the custom widget overlaps it from the left, despite using layout (I tried to use QBoxLayout and QGridLayout, but the only effect which I managed to get is that the list takes half the page space, but custom widget stays in the same place). I even tried to place them with setGeometry method, but nothing changed.

    What is worth to tell, I had to use setupUi(parent) instead of setupUi(this) in the custom widget constructor, beacuse without this, it wasn't visible on the page. Parent here is the QWizard instance, owning the page, or the page itself - without a single difference.

    I even tried to add an empty widget to the layout instead of direct custom widget adding and using it as a parent, but it also doesn't work.

    It's something like this (inside a QWizard class):
    @QWizardPage* page = new QWizardPage();
    QHBoxLayout* layout = new QHBoxLayout(page);
    QListWidget* list = new QListWidget();
    layout->addWidget(list);
    layout->addWidget(new CustomWidget(page));
    addPage(page);@

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      Can you attach an image of the output you are getting ? It will be more clear for us to understand.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        joval
        wrote on last edited by
        #3

        I can't make a screenshot, but here's a thing:
        "preview":http://s21.postimg.org/o5kytxc0n/preview.png

        Widget1 is the ListWidget, Widget2 is the CustomWidget instance.

        EDIT: I have returned to [quote author="joval" date="1364291754"]setupUi(this) in the custom widget constructor[/quote] and then the code changes to
        @QWizardPage* page = new QWizardPage();
        QHBoxLayout* layout = new QHBoxLayout(page);
        QListWidget* list = new QListWidget();
        layout->addWidget(list);
        layout->addWidget(new CustomWidget());
        addPage(page);@

        but the CustomWidget isn't visible (but it still takes a little space in layout manager).

        edit: Solved. The CustomWidget had it's minimumSize set to 0x0.

        1 Reply Last reply
        0

        • Login

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