Qt GUI中的单选按钮
Radio button in Qt GUI
我使用Qt5.2.1,我做了一个程序来做一些事情。在它我添加了一个单选按钮(命名为"其他人"),我想,当用户点击这个按钮一行编辑弹出除了它,让用户输入一些东西里面。当用户单击另一个单选按钮时,此行编辑将消失。我该怎么做呢?
请帮帮我!
我希望当用户点击这个按钮(…)。我该怎么做呢?
QRadioButton
当一个按钮被打开或关闭时,它发出
toggled() signal
。连接到这个信号,如果你想触发一个动作当按钮改变状态时。使用isChecked()
查看某个按钮是否被选中。
你也可以在QRadioButtons
上写一个包装器,这样你就可以使用QSignalMapper将他们的toggled(bool)
信号连接到这个包装器的单个插槽toggled(int)
。然后,您可以在这样的包装器中管理所有这些逻辑:
void RadioHelper::initialize( const std::vector<
QSharedPointer<RadioHelperEntry> >& entries)
{
entries_ = entries;
mapper_.reset(new QSignalMapper(this));
EntriesIterator it = entries_.begin();
int i = 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();
}
我找到我要找的东西了
界面-> radio_button -> setvisible(假);
^帮助我得到想要的结果
相关文章:
- 颜色为C++的单选按钮
- Qt单选按钮仅在实际选中按钮时调用SLOT()
- MFC单选按钮组消息处理程序
- 如何使用 qss 在选中时将单选按钮设置为粗体
- 除了Qt中的单选按钮之外,是否有类似gui元素的开关
- 在MFC中以编程方式设置单选按钮状态
- 生成具有不同"内容"的单选按钮
- 如何在单选按钮分组框中获取用户的选择以进行进一步处理
- 是否通过其他按钮将单选按钮添加到QListWidget或从QListWidget中删除单选按钮?问题
- Qt - 记住上次选中的单选按钮
- 2 组单独的单选按钮,采用相同形式的 WINAPI(无 MFC)
- C++ 复选框就像单选按钮 WINAPI ( 无 MFC )
- C++ MFC、带复选框的自定义网格、单选按钮
- 如何知道visual C++2010中单选按钮的可用属性
- 如何在菜单栏中添加单选按钮,qt 5 c++
- 我需要检查一个接一个地知道哪个单选按钮在Qt组检查
- 获取所选单选按钮的索引
- c++ Win32单选按钮背景色
- 如何手动设置单选按钮激活(通过代码)
- Qt GUI中的单选按钮