Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QFontCombox not returning the font family
Qt 6.11 is out! See what's new in the release blog

QFontCombox not returning the font family

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 562 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
    Alveena
    wrote on last edited by
    #1

    How do I make QFontComboBox to return a list of font family only but not the complete dialog pop-up with font style, point size and other style techniques(kerning, strikeout,underline). I'm doing something like this:

    QFont Vizkit3DWidget::getFont()const                                                          
    { 
               QFontComboBox *dialog = new QFontComboBox();
               QFont font=dialog->currentFont();
               return font.family(),
        
    }
    
    void Vizkit3DWidget::setFont(QFont font)
    {
               QFontComboBox *dialog = new QFontComboBox();
               dialog->setCurrentFont(font);
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      If you want a list of the font families then why not just use QFontDatabase::families ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 2 Replies Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        If you want a list of the font families then why not just use QFontDatabase::families ?

        A Offline
        A Offline
        Alveena
        wrote on last edited by
        #3

        @SGaist How do I set Kerning(),Strikeout,Underline() to disable in the above code since they are always called after the QFontComboBox constructor and even if set to disable, dialogbox still shows them.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          If you want a list of the font families then why not just use QFontDatabase::families ?

          A Offline
          A Offline
          Alveena
          wrote on last edited by
          #4

          @SGaist Actually I'm trying to set the selected QFont onto an osg::text3D node, setFont(), SetStyle(),SetCharactersize() ->extracting each of these seperatle from QFont applying them on text3D.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            The code you show above does not much.

            You should explain exactly what you are trying to achieve because you are talking about a dialog yet create a combo box that you don't even show.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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