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. QPageSetupDialog QT open 'empty' window on QT5
Forum Update on Monday, May 27th 2025

QPageSetupDialog QT open 'empty' window on QT5

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • C Offline
    C Offline
    creatron
    wrote on 5 Aug 2013, 08:34 last edited by
    #1

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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 5 Aug 2013, 19:13 last edited by
      #2

      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.

      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

      1/2

      5 Aug 2013, 08:34

      • Login

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