Customizing QPrintDialog - Need to remove access to disk storage
-
0
I need to customize the QPrintDialog in the Qt framework. The default view has controls that give access to local storage on the device. All access to local disks must be disabled on the dialog.
This software runs on Linux.
Is it safe to iterate over child widgets on the QPrintDialog and disable or remove all controls used for accessing the disk?
Example:
auto childrenList = printDialog->children (); for(auto obj : childrenList) { if(obj->isWidgetType ()) { ... if(qobject_cast<QComboBox*>(obj)) { qobject_cast<QComboBox*>(obj)->removeItem (1); qobject_cast<QComboBox*>(obj)->setEnabled (false); } if(qobject_cast<QLabel*>(obj)) { qobject_cast<QLabel*>(obj)->setEnabled (false); qobject_cast<QLabel*>(obj)->setText (""); qobject_cast<QLabel*>(obj)->setParent (parent); } if(qobject_cast<QLineEdit*>(obj)) { qobject_cast<QLineEdit*>(obj)->setEnabled (false); qobject_cast<QLineEdit*>(obj)->setText (""); qobject_cast<QLineEdit*>(obj)->setParent (parent); qobject_cast<QLineEdit*>(obj)->hide (); } ... } }
-
0
I need to customize the QPrintDialog in the Qt framework. The default view has controls that give access to local storage on the device. All access to local disks must be disabled on the dialog.
This software runs on Linux.
Is it safe to iterate over child widgets on the QPrintDialog and disable or remove all controls used for accessing the disk?
Example:
auto childrenList = printDialog->children (); for(auto obj : childrenList) { if(obj->isWidgetType ()) { ... if(qobject_cast<QComboBox*>(obj)) { qobject_cast<QComboBox*>(obj)->removeItem (1); qobject_cast<QComboBox*>(obj)->setEnabled (false); } if(qobject_cast<QLabel*>(obj)) { qobject_cast<QLabel*>(obj)->setEnabled (false); qobject_cast<QLabel*>(obj)->setText (""); qobject_cast<QLabel*>(obj)->setParent (parent); } if(qobject_cast<QLineEdit*>(obj)) { qobject_cast<QLineEdit*>(obj)->setEnabled (false); qobject_cast<QLineEdit*>(obj)->setText (""); qobject_cast<QLineEdit*>(obj)->setParent (parent); qobject_cast<QLineEdit*>(obj)->hide (); } ... } }
-
0
I need to customize the QPrintDialog in the Qt framework. The default view has controls that give access to local storage on the device. All access to local disks must be disabled on the dialog.
This software runs on Linux.
Is it safe to iterate over child widgets on the QPrintDialog and disable or remove all controls used for accessing the disk?
Example:
auto childrenList = printDialog->children (); for(auto obj : childrenList) { if(obj->isWidgetType ()) { ... if(qobject_cast<QComboBox*>(obj)) { qobject_cast<QComboBox*>(obj)->removeItem (1); qobject_cast<QComboBox*>(obj)->setEnabled (false); } if(qobject_cast<QLabel*>(obj)) { qobject_cast<QLabel*>(obj)->setEnabled (false); qobject_cast<QLabel*>(obj)->setText (""); qobject_cast<QLabel*>(obj)->setParent (parent); } if(qobject_cast<QLineEdit*>(obj)) { qobject_cast<QLineEdit*>(obj)->setEnabled (false); qobject_cast<QLineEdit*>(obj)->setText (""); qobject_cast<QLineEdit*>(obj)->setParent (parent); qobject_cast<QLineEdit*>(obj)->hide (); } ... } }
@James-S said in Customizing QPrintDialog - Need to remove access to disk storage:
0
I need to customize the QPrintDialog in the Qt framework. The default view has controls that give access to local storage on the device. All access to local disks must be disabled on the dialog.
Is this in reference to the print to file option? That can be turned off with the QAbstractPrintDialog::PrintToFile option. On my X11 test system with no other printer available, the dialog still shows the location as "local file", but the input to select a file is gone.