Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
<Solved>How to remove or disable writing system combo box from QFontDialog ?
I want to customize font dialog box. I am using QFontDialog. In this dialog box, I just want to remove or disable a combo box "Writing System".
Here is the pic
- How can we remove or disable the "Writing System" labeled combobox?
- How to set Writing System of font programatically (Not using the font dialog box)?
I have find out solution of my first query.
But still, I don't know how to set Writing System from QFontDialog through programming ??
"writingSystem":http://qt-project.org/doc/qt-5/qfontcombobox.html#writingSystem-prop seems can do it. Haven't used it personally.
I have checked it out this. but since it is defined in QFontComboBox. So a separate combo box appear and value of writingsystem can be set for only this combo box . but combo box in qfontdialog is remained same and the values of writing system in qfontdialog is not changed.
Well you can always get the "children":http://qt-project.org/doc/qt-5/qobject.html#children of a QObject (here QFontDialog) iterate over the list, find the child i.e QComboBox here (only one), cast it to QComboBox and set it's properties.
Edit: Create QFontDialog; donot use the static one.
yes. I have done it as same as you told. but in this way i have find out solution of first query only.
( 1. How can we remove or disable the “Writing System” labeled combobox?
2. How to set Writing System of font programatically (Not using the font dialog box)? )
but how we can set values of QCombobox ("Writing System") as in query 2 ??
After casting it to QComboBox, set the desired index or text if you know them exactly.
oh yes. Thanx p3c0 for valuable suggestions.
My problem is solved now.
That's great. You're Welcome :)
nadamit last edited by
@ankursaxena: Could you please tell me, how did you disabled "Writing System" labeled combo box?
In the same way as above you can iterate and cast Object to QLabel, if it succeeds get the text of the label and match it with your text, if that matches too it means you have the exact QLabel and then hide it.
Ah. I misunderstood, here you go
QFontDialog f = new QFontDialog(this);
QList<QObject> ob = f->children();
QComboBox b = qobject_cast<QComboBox>(ob.at(i));