skg
skg

Reputation: 948

QPrintDialog: Disable Print Button

As per the title, I want to disable/remove Print Button from the QPrintDialog.

Is there anyway to achieve this ??

I need to show only printer setting page, where user can define printer settings and Apply the changes.

Can anyone suggest me the way to disable Print Button ??

Or is there any way to create Printer Settings Page with customize button ??

Upvotes: 2

Views: 589

Answers (1)

Tim Ikhizgilov
Tim Ikhizgilov

Reputation: 9

You could do something like this:

QPrintDialog printDialog;

QList<QPushButton *> allButtons = printDialog.findChildren<QPushButton *>();

for (int i = 0; i < allButtons.size(); i++) {
   if (allButtons.at(i)->text().contains("Print")) {
      allButtons.at(i)->setDisabled(true);
      break;
   }
}

printDialog.exec();

A bit of a hack, but should work.

Upvotes: 0

Related Questions