void LoginSettingWidget::showEvent(QShowEvent *event) { AppSettings settings; settings.beginGroup(QString(APP_PARAM_GROUP_TARGET)); dest_addr_edit->setText(settings.value(QString(APP_PARAM_ADDR), QString(DEFAULT_TARGET_ADDR)).toString()); dest_port_edit->setText(settings.value(QString(APP_PARAM_PORT), QString(DEFAULT_TARGET_PORT)).toString()); settings.endGroup(); ok_button->setFocus(); QWidget::showEvent(event); }
void LoginSettingWidget::onOkButtonClicked() { QString ip_addr = dest_addr_edit->text(); QString port = dest_port_edit->text(); if(ip_addr.isEmpty() || port.isEmpty()) { emit showMsg(Util::EmptyTargetAddrOrPortMsg); } else { AppSettings settings; settings.beginGroup(QString(APP_PARAM_GROUP_TARGET)); settings.setValue(QString(APP_PARAM_ADDR), ip_addr); settings.setValue(QString(APP_PARAM_PORT), port); settings.endGroup(); emit showLogin(); } }