Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    <Solved>How to remove or disable writing system combo box from QFontDialog ?

    General and Desktop
    3
    12
    2738
    Loading More Posts
    • 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.
    • A
      ankursaxena last edited by

      Hi all,

      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

      http://postimg.org/image/6d7vl1jv7/

      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)?
      1 Reply Last reply Reply Quote 0
      • A
        ankursaxena last edited by

        I have find out solution of my first query.

        But still, I don't know how to set Writing System from QFontDialog through programming ??

        1 Reply Last reply Reply Quote 0
        • p3c0
          p3c0 Moderators last edited by

          "writingSystem":http://qt-project.org/doc/qt-5/qfontcombobox.html#writingSystem-prop seems can do it. Haven't used it personally.

          157

          1 Reply Last reply Reply Quote 0
          • A
            ankursaxena last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • p3c0
              p3c0 Moderators last edited by

              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.

              157

              1 Reply Last reply Reply Quote 0
              • A
                ankursaxena last edited by

                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 ??

                1 Reply Last reply Reply Quote 0
                • p3c0
                  p3c0 Moderators last edited by

                  After casting it to QComboBox, set the desired index or text if you know them exactly.

                  157

                  1 Reply Last reply Reply Quote 0
                  • A
                    ankursaxena last edited by

                    oh yes. Thanx p3c0 for valuable suggestions.

                    My problem is solved now.

                    1 Reply Last reply Reply Quote 0
                    • p3c0
                      p3c0 Moderators last edited by

                      That's great. You're Welcome :)

                      157

                      1 Reply Last reply Reply Quote 0
                      • N
                        nadamit last edited by

                        @ankursaxena: Could you please tell me, how did you disabled "Writing System" labeled combo box?

                        1 Reply Last reply Reply Quote 0
                        • p3c0
                          p3c0 Moderators last edited by

                          Hi

                          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.

                          157

                          1 Reply Last reply Reply Quote 0
                          • p3c0
                            p3c0 Moderators last edited by

                            Ah. I misunderstood, here you go
                            @
                            QFontDialog f = new QFontDialog(this);
                            QList<QObject
                            > ob = f->children();
                            for(int i=0;i<ob.count();i++)
                            {
                            if(qobject_cast<QComboBox*>(ob.at(i))) {
                            QComboBox b = qobject_cast<QComboBox>(ob.at(i));
                            b->hide();
                            }
                            }
                            f->show();
                            @

                            157

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post