QPageSetupDialog QT open 'empty' window on QT5



  • I am using a table printer class for many moons, however the QPageSetupDialog creates a empty window when ported to QT5, if compiled with any version < 5 (4.5, 4.6, 4.7 4.8) it actually works.

    I created a test program to verify the problem with abs minimal code.

    Tested on Ubuntu 13.04 (64Bit), using the 'default' and downloaded version 5.1.0 SDK (Creator 2.7.2)

    What else must be changed to get a printer setup window in QT5?

    Thanks

    Project File
    @
    QT += core gui
    greaterThan(QT_MAJOR_VERSION, 4) {
    QT += widgets
    QT += printsupport
    }
    TARGET = the-printer
    TEMPLATE = app
    SOURCES += main.cpp
    mainwindow.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui
    @

    Main Window with one signal slot
    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    printer= new QPrinter(QPrinter::HighResolution);
    connect (ui->pb_test_printer,
    SIGNAL(clicked()),
    this,
    SLOT(slot_setup_printer()));
    }
    MainWindow::~MainWindow()
    {
    delete ui;
    }
    void MainWindow::slot_setup_printer (void)
    {
    QPageSetupDialog *dialog;
    dialog = new QPageSetupDialog(printer, this);
    dialog->exec();
    delete dialog;
    }
    @

    Header File
    @
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <QPrinter>
    #include <QPageSetupDialog>
    namespace Ui {
    class MainWindow;
    }
    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    private:
    Ui::MainWindow * ui;
    QPrinter * printer;
    QPageSetupDialog * dialog;
    public slots:
    void slot_setup_printer (void);
    };
    @


  • Lifetime Qt Champion

    Hi,

    This sounds like a regression. You can check the "bug report system":bugreports.qt-project.org/issues/ to see if someone else already reported it.


Log in to reply
 

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