two combo boxes next to each other
Solved
General and Desktop
-
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.
-
@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 layoutCan you share more source code ?
-
that's what i was missing. thanks!
-
@user4592357 said in two combo boxes next to each other:
that's what i was missing. thanks!
You're welcome =)