Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. <Solved>How to remove or disable writing system combo box from QFontDialog ?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 3.6k Views 1 Watching
  • 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 Offline
    A Offline
    ankursaxena
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      ankursaxena
      wrote on last edited by
      #2

      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
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #3

        "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
        0
        • A Offline
          A Offline
          ankursaxena
          wrote on last edited by
          #4

          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
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #5

            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
            0
            • A Offline
              A Offline
              ankursaxena
              wrote on last edited by
              #6

              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
              0
              • p3c0P Offline
                p3c0P Offline
                p3c0
                Moderators
                wrote on last edited by
                #7

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

                157

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ankursaxena
                  wrote on last edited by
                  #8

                  oh yes. Thanx p3c0 for valuable suggestions.

                  My problem is solved now.

                  1 Reply Last reply
                  0
                  • p3c0P Offline
                    p3c0P Offline
                    p3c0
                    Moderators
                    wrote on last edited by
                    #9

                    That's great. You're Welcome :)

                    157

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nadamit
                      wrote on last edited by
                      #10

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

                      1 Reply Last reply
                      0
                      • p3c0P Offline
                        p3c0P Offline
                        p3c0
                        Moderators
                        wrote on last edited by
                        #11

                        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
                        0
                        • p3c0P Offline
                          p3c0P Offline
                          p3c0
                          Moderators
                          wrote on last edited by
                          #12

                          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
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved