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. two combo boxes next to each other
Forum Updated to NodeBB v4.3 + New Features

two combo boxes next to each other

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 968 Views 2 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i wanna implement two combo boxes next to each other (in horizontal layout) but will little or luck. but they appear in vertical anyways. here's what i've tried:

    auto fontFamilyComboBox = new QFontComboBox(this);
    QWidgetAction *action = new QWidgetAction(this);
    fontFamilyComboBox->setDefaultAction(action);
    // code to add fontFamilyComboBox to where it belongs
    
    auto fontSizeComboBox = new QComboBox(this);
    fontSizeComboBox->setMaximumWidth(50);
    // code to add items to this combo box
    // code to add fontSizeComboBox to where it belongs
    
    QHBoxLayout *fontLayout = new QHBoxLayout(this);
    fontLayout->addWidget(fontFamilyComboBox);
    fontLayout->addWidget(fontSizeComboBox);
    setLayout(fontLayout);
    

    i've also tried QGridLayout but that didn't show the second combo box entirely.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mostefa
      wrote on last edited by
      #2

      @user4592357 said in two combo boxes next to each other:

      QHBoxLayout *fontLayout = new QHBoxLayout(this);

      Hi @user4592357

      in this line

      QHBoxLayout *fontLayout = new QHBoxLayout(this);
      

      this must refer to the parent widget in which you want add your layout

      Can you share more source code ?

      1 Reply Last reply
      1
      • U Offline
        U Offline
        user4592357
        wrote on last edited by
        #3

        that's what i was missing. thanks!

        M 1 Reply Last reply
        0
        • U user4592357

          that's what i was missing. thanks!

          M Offline
          M Offline
          mostefa
          wrote on last edited by
          #4

          @user4592357 said in two combo boxes next to each other:

          that's what i was missing. thanks!

          You're welcome =)

          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