push button
信号:clicked()
实例代码:
connect(ui->lxpushButton, SIGNAL(clicked()), this, SLOT(myslots()));
tool box
实例代码:
action = new QAction("&Open", this);
action2 = new QAction("&Close", this);
menu = new QMenu();
QList<QAction *> fileActions;
fileActions.push_back(action);
fileActions.push_back(action2);
menu->addMenu("&File")->addMenu("web safe")->addActions(fileActions);
menu->addMenu("&Edit")->addMenu("app safe")->addActions(fileActions);
ui->lxtoolButton->setText("tool box");
ui->lxtoolButton->setPopupMode(QToolButton::InstantPopup);
ui->lxtoolButton->setMenu(menu);
connect(ui->lxtoolButton, SIGNAL(triggered(QAction *)), this, SLOT(paction(QAction *)));
效果:
group box
实例代码:
ui->gbSetNetWork->setChecked(false);
ui->gbSetNetWork->setStyleSheet(
QString::fromUtf8("QGroupBox\
{ border: 1px solid green; \ // 设置边框1个像素,绿色填充
border-radius: 4px; \ // 实现圆角边框效果,第一个参数是水平半径
margin-top: 6px\ // 设置对象顶边的外延边距,外延边距始终透明
}\
QGroupBox::title{top: -9 ex; left:8px}}")); // 设置标题显示的样式
效果:
QToolBox
信号: currentChanged
实例代码:
connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(GetCurrent(int)));
QTabWidget
信号:
tabCloseRequested(int)
currentChanged(int)
实例代码: