void DClusterSetManagerPage::appendManagerToList(DClusterUserInfo *info) { if(info->getUserRole() == Mi::SySManager || info->getUserRole() == Mi::SeniorManager) { CheckButton* btn = new CheckButton(this); btn->setUserID(info->getUserID()); btn->setUserName(info->getUserName()); btn->setClusterID(info->getClusterID()); if(info->getUserRole() == Mi::SySManager){ btn->setReviewText(tr("群主")); btn->setReviewEnable(false); }else{ btn->setReviewText(tr("取消管理员")); connect(btn, SIGNAL(reviewClicked()), this, SLOT(on_btnCancelManager_clicked())); } QPixmap pixmap(ImagePath::USER_PORTRAIT); pixmap.setDevicePixelRatio(2.0); btn->setPixMap(pixmap); btn->setFixedHeight(this->screenHeight()*0.1); btn->setFixedWidth(this->screenWidth()); btn->setAttribute(Qt::WA_LayoutUsesWidgetRect); btn->setStyleSheet(SheetStyle::CHECKBUTTON_BOTTOM_BORDER); btnCheckList.insert(info->getUserID(), btn); if(managerLayout->count() == 0){ managerLayout->addWidget(btn); managerLayout->addStretch(0); } else{ if(info->getUserRole() == Mi::SySManager) managerLayout->insertWidget(0, btn); else managerLayout->insertWidget(managerLayout->count() - 1, btn); } } }
void DClusterSetManagerPage::on_btnCancelManager_clicked() { CheckButton* btn = dynamic_cast<CheckButton*>(sender()); btn->setReviewText(tr("取消管理员")); quint8 role = Mi::Operator; curCancelManagerID = btn->getUserID(); AssemblyData assemblyData; assemblyData.append(curClusterID); assemblyData.append(role); assemblyData.append(curCancelManagerID); char* data = assemblyData.getAssemblyData(); quint16 dataLen = assemblyData.getAssemblyDataLen(); emit readyRead(CommandCode::DCLUSTER_SETTING_USER_AUTHORIZE, data, dataLen); //页面加载窗口 if(loadingPage == NULL){ loadingPage = new LoadingPage(this); loadingPage->show(); } }