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. QWizard padding around QWizardPage
Forum Updated to NodeBB v4.3 + New Features

QWizard padding around QWizardPage

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.4k 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.
  • C Offline
    C Offline
    cass
    wrote on last edited by cass
    #1

    I have made a full screen wizard in my application that derives from QWizard and QWizardPage. What I have found is that I always end up with some blank space around the QWizardPage, with the edges of the QWizardPage cut off. I would like to have my QWizardPage display across the entire screen without the margins.

    I have tried setting both the wizard and page to have fixed sizes (the same size), creating a layout on the QWizard then setting the content margins to all zeros. Setting the style sheet to use all zeros for all box model options and overriding the paint event on both to try and fix the issue. In the paint event of the QWizardPage it appeared that it only had access to the "shrunk" size.

    Has anyone else seen this behaviour and do you know how I could fix it?

    There is about 10 pixels cut off on each edge. The left edge of my screen looks like the scaled down image below, when the grey at the bottom should extend to the leftmost edge and to the bottom.
    0_1504586612698_QWizardPageEdge.png

    Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Please post the version of Qt you are using as well as OS and compiler.

      A minimal compilable example to reproduce this would be great.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cass
        wrote on last edited by
        #3

        Thanks SGaist and sorry for the lack of information,

        I am using Qt 5.9.1 with gcc (SUSE Linux) 4.8.5, on operating system openSUSE Leap 42.1

        I have copied an example below (I don't have permissions to upload yet sorry). This example has just a QWizard and QWizardPage that has two square buttons at the very edges of the QWizardPage. When I run it on my system the two button's edges are cut off and the black background shows around the cut off buttons.

        I have not attempted to set margins, set style sheet or override paint events to keep it simple.

        ///main.cpp
        
        #include "wizard.h"
        #include <QApplication>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
        
            Wizard wizardExample;
            wizardExample.show();
        
            return a.exec();
        }
        
        ///wizard.h
        #include <QWizard>
        
        namespace Ui {
        class Wizard;
        }
        
        class Wizard : public QWizard
        {
            Q_OBJECT
        
        public:
            explicit Wizard(QWidget *parent = 0);
            ~Wizard();
        
        private:
            Ui::Wizard *ui;
        };
        
        
        ///wizard.cpp
        #include "wizard.h"
        #include "ui_wizard.h"
        
        Wizard::Wizard(QWidget *parent) :
            QWizard(parent),
            ui(new Ui::Wizard)
        {
            ui->setupUi(this);
        
        
            //remove all the standard buttons from the layout
            QList<QWizard::WizardButton> btnLayout;
            setButtonLayout(btnLayout);
        
        }
        
        Wizard::~Wizard()
        {
            delete ui;
        }
        
        ///wizardpage.h
        #include <QWizardPage>
        
        namespace Ui {
        class WizardPage;
        }
        
        class WizardPage : public QWizardPage
        {
            Q_OBJECT
        
        public:
            explicit WizardPage(QWidget *parent = 0);
            ~WizardPage();
        
        private:
            Ui::WizardPage *ui;
        };
        
        ///wizardpage.cpp
        #include "wizardpage.h"
        #include "ui_wizardpage.h"
        
        WizardPage::WizardPage(QWidget *parent) :
            QWizardPage(parent),
            ui(new Ui::WizardPage)
        {
            ui->setupUi(this);
        
        }
        
        WizardPage::~WizardPage()
        {
            delete ui;
        }
        
        
        
        
        //wizard.ui
        <?xml version="1.0" encoding="UTF-8"?>
        <ui version="4.0">
         <class>Wizard</class>
         <widget class="QWizard" name="Wizard">
          <property name="geometry">
           <rect>
            <x>0</x>
            <y>0</y>
            <width>400</width>
            <height>400</height>
           </rect>
          </property>
          <property name="palette">
           <palette>
            <active>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>255</red>
                <green>255</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>0</blue>
               </color>
              </brush>
             </colorrole>
            </active>
            <inactive>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>255</red>
                <green>255</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>0</blue>
               </color>
              </brush>
             </colorrole>
            </inactive>
            <disabled>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>0</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>0</blue>
               </color>
              </brush>
             </colorrole>
            </disabled>
           </palette>
          </property>
          <property name="windowTitle">
           <string>Dialog</string>
          </property>
          <property name="wizardStyle">
           <enum>QWizard::NStyles</enum>
          </property>
          <property name="options">
           <set>QWizard::NoBackButtonOnLastPage|QWizard::NoBackButtonOnStartPage|QWizard::NoCancelButton|QWizard::NoCancelButtonOnLastPage|QWizard::NoDefaultButton</set>
          </property>
          <widget class="WizardPage" name="wizardPage"/>
         </widget>
         <customwidgets>
          <customwidget>
           <class>WizardPage</class>
           <extends>QWizardPage</extends>
           <header>wizardpage.h</header>
           <container>1</container>
          </customwidget>
         </customwidgets>
         <resources/>
         <connections/>
        </ui>
        
        
        
        ///wizardpage.ui
        
        <?xml version="1.0" encoding="UTF-8"?>
        <ui version="4.0">
         <class>WizardPage</class>
         <widget class="QWizardPage" name="WizardPage">
          <property name="geometry">
           <rect>
            <x>0</x>
            <y>0</y>
            <width>400</width>
            <height>400</height>
           </rect>
          </property>
          <property name="palette">
           <palette>
            <active>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>255</red>
                <green>255</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
            </active>
            <inactive>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>255</red>
                <green>255</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
            </inactive>
            <disabled>
             <colorrole role="Base">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
             <colorrole role="Window">
              <brush brushstyle="SolidPattern">
               <color alpha="255">
                <red>0</red>
                <green>0</green>
                <blue>255</blue>
               </color>
              </brush>
             </colorrole>
            </disabled>
           </palette>
          </property>
          <property name="windowTitle">
           <string>Dialog</string>
          </property>
          <widget class="QPushButton" name="btnBottomLeft">
           <property name="geometry">
            <rect>
             <x>0</x>
             <y>280</y>
             <width>120</width>
             <height>120</height>
            </rect>
           </property>
           <property name="text">
            <string>Do Something</string>
           </property>
          </widget>
          <widget class="QPushButton" name="btnTopRight">
           <property name="geometry">
            <rect>
             <x>280</x>
             <y>0</y>
             <width>120</width>
             <height>120</height>
            </rect>
           </property>
           <property name="text">
            <string>Do Something</string>
           </property>
          </widget>
         </widget>
         <resources/>
         <connections/>
        </ui>
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          From a quick look at the code of QWizard/QWizardPage, it seems that this widget is rather tightly related to the style to in order to match the platform specific wizard look and feel.

          So all in all, you should maybe consider create your own wizard for your use case.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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