On 31/12/2015 17:17, Bill Somerville wrote: > On 31/12/2015 16:54, Michael Black wrote: >> Wanted to add an audio card checkbox & chooser and was going to use >> QT55 ability to do so on the audio chooser. > Hi Mike, > > it is possible to add widgets to the existing layouts from code so you > don't necessarily have to have the whole UI designed in Designer. > Obviously some layouts like QGridLayout might be awkward but it should > still be possible. I assume this is destined for the Audio tab of the > Settings, that has a QGridLayout called gridLayout_5 (better to ask the > tab itself, see below) that you can add a new QGroupBox to with your > widgets inside, something like: > > #if Q_VERISION > 0x050500 > auto your_group_box = new QGroupBox ("Audio Announcements"); > // build group box contents > if (auto audio_layout = qobject_cast<QGridLayout *> > (ui_->audio_tab->layout ())) { > audio_layout->addWidget (your_group_box, 1, 0); > } > #endif I did say grid layouts would be awkward and I was right! The above code will replace another widget which is not what you want. There is no insertWidget() for grid layouts so what I'd do is change the layout of the Configuration tabs in Designer to be a vertical layout since there's no need for it to be a grid. Then use:
#if Q_VERISION > 0x050500 auto your_group_box = new QGroupBox ("Audio Announcements"); // build group box contents if (auto audio_layout = qobject_cast<QVBoxLayout *> (ui_->audio_tab->layout ())) { audio_layout->insertWidget (your_group_box, 1); } #endif 73 Bill G4WJS. ------------------------------------------------------------------------------ _______________________________________________ wsjt-devel mailing list wsjt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wsjt-devel