FormMain::FormMain(QWidget *parent) : QWidget(parent), ui(new Ui::FormMain) { ui->setupUi(this); this->setWindowFlags(Qt::FramelessWindowHint); createPages(); connect(ui->stackedWidget->widget(m_formIndex.value(FORMLOGIN)),SIGNAL(closeMainForm()) ,this,SLOT(on_btnClose_clicked())); connect(ui->stackedWidget->widget(m_formIndex.value(FORMLOGIN)),SIGNAL(changeToMaintain()) ,this,SLOT(LoginSuccess())); hideToolBox(); setWidgetSize(400,300); //焦点默认给登陆界面 ((FormLogin*)ui->stackedWidget->widget(m_formIndex.value(FORMLOGIN)))->setFocus(); }
void FormMain::LoginSuccess() { m_SoftRole = ((FormLogin*)ui->stackedWidget->widget(m_formIndex.value(FORMLOGIN)))->getSoftRole(); if(m_SoftRole == 0) { ui->tb_DataResend->hide(); ui->tb_Update->hide(); } else if(m_SoftRole == 1) { ui->tb_devtest->hide(); ui->tb_Setting->hide(); } setWidgetSize(800,600); showToolBox(); ui->stackedWidget->setCurrentIndex(m_formIndex.value(FORMTELNET)); }
FmInfoWidget::FmInfoWidget(QWidget *parent) : QWidget(parent) { initWidget(); readAndSetStyleSheet(); initWidgetValue(); setWidgetSize(); label_image->setScaledContents(true);//图片随label调整大小 label_image->setAlignment(Qt::AlignCenter); tableView_fm->setFmDelegate(); tableView_fm->setWidgetBottomHidden(); connect(pushButton_modify, &QPushButton::clicked, this, &FmInfoWidget::modifyFm); connect(pushButton_delete, &QPushButton::clicked, this, &FmInfoWidget::deleteFm); connect(tableView_fm, &PagingTableView::play, this, &FmInfoWidget::play); tableView_fm->setActorColumnWidth(6); }
/** * Create the layout with checkable categories. * It is parented by the main layout. * For the moment, there are only 6 available categories. * ( These could be expanded also by new user categories.) * @return The layout that contains the categories. */ MAWidgetHandle HomeScreen::createCategoriesLayout() { // Add a layout for categories. MAWidgetHandle categoriesLayout = maWidgetCreate(MAW_VERTICAL_LAYOUT); // Set layout's size. setWidgetSize( categoriesLayout, MAW_CONSTANT_FILL_AVAILABLE_SPACE, mScreenHeight/3); //or MAW_CONSTANT_WRAP_CONTENT // Add a horizontal line. MAWidgetHandle line1 = createSpacer(mScreenWidth,BREAKLINE_HEIGHT); setWidgetProperty( line1, MAW_WIDGET_BACKGROUND_COLOR, DARK_GREY, 16); MAWidgetHandle label = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, " Categories ", BLUE, mFontSize); maWidgetSetProperty( label, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT, MAW_ALIGNMENT_LEFT); maWidgetAddChild(categoriesLayout, label); // Add another horizontal line. MAWidgetHandle line2 = createSpacer(mScreenWidth,BREAKLINE_HEIGHT); setWidgetProperty(line2, MAW_WIDGET_BACKGROUND_COLOR, DARK_GREY, 16); maWidgetAddChild(categoriesLayout, line2); // Available categories: // All ( enabled by default), Nature, Sports, Movies, News, Science. mCategoriesStrings.clear(); mCategoriesStrings.add(CATEGORY_ALL); mCategoriesStrings.add(CATEGORY_NATURE); mCategoriesStrings.add(CATEGORY_SPORTS); mCategoriesStrings.add(CATEGORY_NEWS); mCategoriesStrings.add(CATEGORY_MOVIES); mCategoriesStrings.add(CATEGORY_SCIENCE); setWidgetProperty( categoriesLayout, MAW_WIDGET_BACKGROUND_COLOR, DARK_WHITE, 16); int index(-1); // Each category has a check box and label. for (int i=0; i < mCategoriesStrings.size() / 2; i++) { // Arrange 2 categories per row. MAWidgetHandle categoryLayout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT); // Set layout's size. setWidgetSize( categoryLayout,mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); MAWidgetHandle checkBox1 = createCheckBox(); // By default, the first category (All) is checked, // so all of them are checked also. maWidgetSetProperty(checkBox1,MAW_CHECK_BOX_CHECKED,"true"); // We hold the array of check boxes, so we can construct // the request url based on the chosen categories. mCategoryBoxes.add(checkBox1); maWidgetAddChild(categoryLayout, checkBox1); index++; MAWidgetHandle label1 = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, mCategoriesStrings[index].c_str(), BLUE, mFontSize ); // Arrange the text to the left. maWidgetSetProperty( label1, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT, MAW_ALIGNMENT_LEFT); maWidgetAddChild(categoryLayout, label1); // Add another check box & label, on the same row. MAWidgetHandle checkBox2 = createCheckBox(); // By default, the first category (All) is checked, // so all of them are checked also. maWidgetSetProperty(checkBox2,MAW_CHECK_BOX_CHECKED,"true"); // We hold the array of check boxes, so we can construct // the request url based on the chosen categories. mCategoryBoxes.add(checkBox2); maWidgetAddChild(categoryLayout, checkBox2); index++; MAWidgetHandle label2 = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, mCategoriesStrings[index].c_str(), BLUE, mFontSize ); // Arrange the text to the left. maWidgetSetProperty( label2, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT, MAW_ALIGNMENT_LEFT); maWidgetAddChild(categoryLayout, label2); // Add this layout to the main vertical layout. maWidgetAddChild(categoriesLayout, categoryLayout); } // Add another horizontal line. MAWidgetHandle line3 = createSpacer(mScreenWidth,BREAKLINE_HEIGHT); setWidgetProperty(line3, MAW_WIDGET_BACKGROUND_COLOR, DARK_GREY, 16); maWidgetAddChild(categoriesLayout, line3); return categoriesLayout; }
/** * Fill the list box with data provided by the engine. */ void TitleScreen::fillListBox() { // Clear previous entries. mCheckBoxes.clear(); mTitleLabels.clear(); mTitles.clear(); mSnippets.clear(); mTitles = mWiki->getAllTitles(); mSnippets = mWiki->getAllSnippets(); // Destroy the list view, and recreate it. if ( mListView != -1){ maWidgetDestroy(mListView); } mListView = createListView(mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); maWidgetAddChild(mMainLayout, mListView); // Add a Select/Deselect All button. MAWidgetHandle selectAllLayout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT); // Set layout's size. setWidgetSize( selectAllLayout, mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); mSelectAll = createCheckBox(); // All titles are deselected by default. maWidgetSetProperty(mSelectAll, MAW_CHECK_BOX_CHECKED, "false"); maWidgetAddChild(selectAllLayout, mSelectAll); MAWidgetHandle labelSelectAll = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, MESSAGE_SELECT_ALL.c_str(), DARK_GREY, mFontSize ); mTitleLabels.add(labelSelectAll); maWidgetAddChild(selectAllLayout, labelSelectAll); maWidgetAddChild(mListView,selectAllLayout); // Update the UI. for (int i=0; i < mTitles.size(); i++) { // Add results in a horizontal layout. MAWidgetHandle layout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT); setWidgetSize(layout, mScreenWidth, MAW_CONSTANT_FILL_AVAILABLE_SPACE); MAWidgetHandle checkbox = createCheckBox(); mCheckBoxes.add(checkbox); maWidgetAddChild(layout, mCheckBoxes[i]); MAWidgetHandle label = createLabel( MAW_CONSTANT_FILL_AVAILABLE_SPACE, mTitles[i].c_str(), BLUE, mFontSize); mTitleLabels.add(label); maWidgetAddChild(layout, label); setWidgetProperty(layout, MAW_WIDGET_BACKGROUND_COLOR, DARK_WHITE, 16); maWidgetAddChild(mListView,layout); } }