是否可以自定义QPrintPreviewDialog?
我想分界放大和缩小功能。
答案 0 :(得分:2)
我知道这个问题已经有几个月了,但我花了很长时间才弄明白这一点,所以这里是:
QPrintPreviewDialog preview(&printer, this);
QList<QToolBar *> toolbarlist = preview.findChildren<QToolBar *>();
if(!toolbarlist.isEmpty())
{
toolbarlist.first()->actions().at(3)->setDisabled(true);
toolbarlist.first()->actions().at(4)->setDisabled(true);
toolbarlist.first()->actions().at(5)->setDisabled(true);
//or to remove:
//toolbarlist.first()->removeAction(toolbarlist.first()->actions().at(3));
//toolbarlist.first()->removeAction(toolbarlist.first()->actions().at(3));
//toolbarlist.first()->removeAction(toolbarlist.first()->actions().at(3));
//alternatively you can add actions to the toolbar:
//toolbarlist.first()->addAction(QIcon("icon.png"), tr("New Action"));
}