c++ - Radio button in Qt GUI -


i using qt5.2.1 , made program stuff. in added radio button (named 'others') want when user clicks button line edit pops besides , lets user enter stuff inside it. when user clicks radio button, line edit goes away. how do this?

please please me!

i want when user clicks button (...). how do this?

qradiobutton

whenever button switched on or off emits toggled() signal. connect signal if want trigger action each time button changes state. use ischecked() see if particular button selected.

you can write wrapper on qradiobuttons can connect toggled(bool) signals single slot toggled(int) of wrapper using i.e. qsignalmapper. can manage logic in such wrapper:

void radiohelper::initialize( const std::vector<                                    qsharedpointer<radiohelperentry> >& entries) {     entries_ = entries;     mapper_.reset(new qsignalmapper(this));     entriesiterator = entries_.begin();      int = 0;     while ( it!=entries_.end())     {        connect(( *it)->button_, signal( toggled(bool)), mapper_.data(),                                                                     slot(map()));        mapper_->setmapping( ( *it)->button_, (int)( *it)->mode_);        it++;        i++;     }     connect( mapper_.data(), signal( mapped(int)), this, signal( toggled(int)));     connect( this, signal( toggled(int)), this, slot( updatevalue(int))); }  void radiohelper::updatevalue( int v) {     value_ = v;     emit valuechanged(); } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -