[Solved] custom Qt Designer widget on a QWizardPage



  • 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);@



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



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.