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] combobox font question

[SOLVED] combobox font question

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 13.7k Views
  • 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.
  • K Offline
    K Offline
    kalster
    wrote on 22 Oct 2011, 07:07 last edited by
    #1

    font question:
    in the gui builder, i have selected a size 14 font for the combobox. when i build the app, the size 14 font is not displayed in the combobox. instead, the combobox is displaying the default font. when i select an item from the drop down box, all the items are displayed in a size 14 font. yet once selected, it displays the result of the item back in the default font. how do i solve this issue?

    menu question: deleted

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 22 Oct 2011, 11:34 last edited by
      #2

      Please keep the combobox context menu questions in your "old thread":http://developer.qt.nokia.com/forums/viewthread/10887/ - it does not help to ask it multiple times.

      Regarding the font:
      It seems that this is only saved correctly if you set the font on the combo box while it is not set to editable. So in Designer, the steps that worked for me are:

      • set the combo box to editable disabled
      • select and set the desired font
      • make the combo box editable again (if needed)

      I checked the font using Designer's preview function.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kalster
        wrote on 22 Oct 2011, 23:37 last edited by
        #3

        the font is still not working for me. perhaps i am doing something wrong. in the qt builder, i set the combobox font to 14 and then clicked the "editable" to false.

        the code has the following in it...
        @ui->userName->setFont(QFont ("Courier New", 14));
        ui->userName->setEditable(true);
        ui->userName->setFont(QFont ("Courier New", 14));@

        still the font is not changing.

        Volker, i don't understand when you say that you checked the font using the designers preview function?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kalster
          wrote on 23 Oct 2011, 05:36 last edited by
          #4

          i solved the combobox font problem in editable mode by using the following style code :)

          @ QComboBox {
          font-family: "Verdana";
          font-size: 11pt;
          }@

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on 23 Oct 2011, 12:25 last edited by
            #5

            [quote author="kalster" date="1319326678"]
            Volker, i don't understand when you say that you checked the font using the designers preview function?[/quote]

            I meant that I used Qt Designer to create the UI and to change the font. Designer also has a preview mode (Ctrl-R) where you can check the settings.

            I just checked on a Mac machine, setting the font using C++ like in your first attempt works for me. What OS do you use?

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kalster
              wrote on 24 Oct 2011, 01:05 last edited by
              #6

              windows

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on 24 Oct 2011, 09:52 last edited by
                #7

                I'm at the Developer Days right now, I'll have a look on my Windows box once I'm at home again.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on 24 Oct 2011, 12:02 last edited by
                  #8

                  Hi,

                  I checked on windows (ok, using code :-)) and it works perfectly:

                  @
                  QComboBox* pCbo = new QComboBox;
                  QFont ft("Courier New", 14);
                  pCbo->setEditable(true);
                  pCbo->setFont(ft);

                  pCbo->addItem("Item 1");
                  pCbo->addItem("Item 2");
                  pCbo->addItem("Item 3");
                  pCbo->addItem("Item 4");
                  pCbo->addItem("Item 5");
                  pCbo->addItem("Item 6");
                  

                  @

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kalster
                    wrote on 25 Oct 2011, 02:09 last edited by
                    #9

                    that's strange Gerolf, its still not working for me. i am using vista. but that's ok, because i am using a style sheet and that works good.

                    1 Reply Last reply
                    0

                    1/9

                    22 Oct 2011, 07:07

                    • Login

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