下拉列表和菜单-创新互联
1,QComboBox
connect(ui.load_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(load_sel(int)));
bool
ar_editor_window,::load_sel(int
index)
{
//int seleitem = ui.load_combobox->currentIndex();
bool rt = false;
switch (index)
{
case 0:
;
break;
case 1:
;
break;
default:
break;
}
return rt;
}
2,按钮菜单
_load_button = new
QPushButton()
_load_menu = new
QMenu();
_load_model_action = new QAction(_load_menu);
_load_pack_action = new QAction(_load_menu);
_load_menu->addAction(_load_model_action);
_load_menu->addAction(_load_pack_action);
_load_button->setMenu(_load_menu);
//remove_watermarks_button->setStyleSheet("QPushButton::menu-indicator{image:None;}");//去掉下拉三角
_load_button->setText(QStringLiteral ("导入"));
_load_model_action->setText(QStringLiteral("导入模型"));
_load_pack_action->setText(QStringLiteral("导入资源包"));
connect(_load_model_action, SIGNAL(triggered()), this, SLOT(load_model()));
connect(_load_pack_action, SIGNAL(triggered()), this, SLOT(load_pack()));
当前文章:下拉列表和菜单-创新互联
标题URL:http://azwzsj.com/article/dssesi.html