void SimpleDIP::createConnects() { connect(this, SIGNAL(imageModified()), this, SLOT(setImageModified())); // color tab sliders connect(tools->colorTab->redSlider, SIGNAL(valueChanged(int)), this, SLOT(colorsChange())); connect(tools->colorTab->greenSlider, SIGNAL(valueChanged(int)), this, SLOT(colorsChange())); connect(tools->colorTab->blueSlider, SIGNAL(valueChanged(int)), this, SLOT(colorsChange())); connect(tools->colorTab->brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(colorsChange())); connect(tools->colorTab->contrastSlider, SIGNAL(valueChanged(int)), this, SLOT(contrastChange(int))); // transformation tab sliders connect(tools->transformTab->resizeSlider, SIGNAL(valueChanged(int)), this, SLOT(resizeImg())); // when ok button is pressed, the current changes will be // applied to the image connect(tools->colorTab->okButton, SIGNAL(clicked()), this, SLOT(tempSave())); connect(tools->colorTab->cancelButton, SIGNAL(clicked()), this, SLOT(tempRestore())); connect(tools->transformTab->okButton, SIGNAL(clicked()), this, SLOT(tempSave())); connect(tools->transformTab->cancelButton, SIGNAL(clicked()), this, SLOT(tempRestore())); }
void SongsOnlineWidget::save() { Media media; widget_info->getMediaValue(media); QString title("保存提示"); QString content("必填项未填写完整!"); QMessageBox box(QMessageBox::Warning, title, content); box.setStandardButtons(QMessageBox::Ok); //| QMessageBox::Cancel); box.setButtonText(QMessageBox::Ok, "确定"); // box.setButtonText(QMessageBox::Cancel, "取消"); if(widget_info->isRequiredOption()){ box.exec(); return; } tempSave(media); widget_info->setDefaultBorder(); widget_info->setDefaultValue(); #ifndef YQC_TECH qint64 mid = getMaxMediaMid(); if(mid != 0) { widget_info->setPlaceholder_serial_id(mid); } else { qint64 _mid = media.mid.toLongLong(); widget_info->setPlaceholder_serial_id(_mid); } #else qint64 serial_id = getMaxMediasSerial_id(); if(serial_id != 0) { widget_info->setPlaceholder_serial_id(serial_id); } else { qint64 _serial_id = media.serial_id.toLongLong(); widget_info->setPlaceholder_serial_id(_serial_id); } #endif }
void SongsOnlineWidget::upload() { this->setCursor(Qt::WaitCursor); QAxObject *excel = NULL; QAxObject *work_books = NULL; QAxObject *work_book = NULL; excel = new QAxObject("Excel.Application"); if (excel->isNull()) {//网络中很多使用excel==NULL判断,是错误的 QMessageBox::critical(0, "错误信息", "没有找到EXCEL应用程序"); return; } excel->setProperty("Visible", false); work_books = excel->querySubObject("WorkBooks"); QString path = lineEdit_upload->text(); if(path.isEmpty()) { QMessageBox::warning(NULL, "提示", "批量上传路径不能为空,\n点击浏览选择批量上传文件。"); return; } work_books->dynamicCall("Open (const QString&)", QString(path)); QVariant title_value = excel->property("Caption"); //获取标题 qDebug()<<QString("excel title : ")<<title_value; work_book = excel->querySubObject("ActiveWorkBook"); QAxObject *work_sheets = work_book->querySubObject("WorkSheets"); //Sheets也可换用WorkSheets int sheet_count = work_sheets->property("Count").toInt(); //获取工作表数目 qDebug()<<QString("sheet count : ")<<sheet_count; int newsong_wheet_index = 0; for(int i=1; i<=sheet_count; i++) { QAxObject *work_sheet = work_book->querySubObject("Sheets(int)", i); //Sheets(int)也可换用Worksheets(int) QString work_sheet_name = work_sheet->property("Name").toString(); //获取工作表名称 QString message = QString("sheet ")+QString::number(i, 10)+ QString(" name"); if(work_sheet_name.compare("新增歌曲") == 0) { newsong_wheet_index = i; break; } qDebug()<<message<<work_sheet_name; } if(newsong_wheet_index != 0) { QAxObject *work_sheet = work_book->querySubObject("Sheets(int)", newsong_wheet_index); QAxObject *used_range = work_sheet->querySubObject("UsedRange"); QAxObject *rows = used_range->querySubObject("Rows"); QAxObject *columns = used_range->querySubObject("Columns"); int row_start = used_range->property("Row").toInt(); //获取起始行 int column_start = used_range->property("Column").toInt(); //获取起始列 int row_count = rows->property("Count").toInt(); //获取行数 int column_count = columns->property("Count").toInt(); //获取列数 for(int i=row_start+1; i<=row_count; i++) { Media media; for(int j=column_start; j<=column_count; j++) { QAxObject *cell = work_sheet->querySubObject("Cells(int,int)", i, j); QAxObject *cell_01 = work_sheet->querySubObject("Cells(int)", i); QVariant value = cell_01->property("Value"); QVariant cell_value = cell->property("Value"); //获取单元格内容 if(j == 1) media.mid = cell_value.toString(); else if(j == 2) media.serial_id = cell_value.toString(); else if(j == 3) media.name = cell_value.toString(); else if(j == 4) media.language = cell_value.toString(); else if(j == 5) media.type = cell_value.toString(); else if(j == 6) media.singer = cell_value.toString(); else if(j == 7) media.artist_sid_1 = cell_value.toString(); else if(j == 8) media.artist_sid_2 = cell_value.toString(); else if(j == 9) media.pinyin = cell_value.toString(); else if(j == 10) media.header = cell_value.toString(); else if(j == 11) media.head = cell_value.toString(); else if(j == 12) media.words = cell_value.toString(); else if(j == 13) media.path = cell_value.toString(); else if(j == 14) media.lyric = cell_value.toString(); else if(j == 15) media.original_track = cell_value.toString(); else if(j == 16) media.sound_track = cell_value.toString(); else if(j == 17) media.start_volume_1 = cell_value.toString(); else if(j == 18) media.start_volume_2 = cell_value.toString(); else if(j == 19) media.prelude = cell_value.toString(); else if(j == 20) media.effect = cell_value.toString(); else if(j == 21) media.version = cell_value.toString(); else if(j == 22) media.create_time = cell_value.toString(); else if(j == 23) media.stars = cell_value.toString(); else if(j == 24) media.hot = cell_value.toString(); else if(j == 25) media.count = cell_value.toString(); else if(j == 26) media.enabled = cell_value.toString(); else if(j == 27) media.black = cell_value.toString(); else if(j == 28) media.match = cell_value.toString(); else if(j == 29) media.update_time = cell_value.toString(); else if(j == 30) media.resolution = cell_value.toString(); else if(j == 31) media.quality = cell_value.toString(); else if(j == 32) media.source = cell_value.toString(); else if(j == 33) media.rhythm = cell_value.toString(); else if(j == 34) media.pitch = cell_value.toString(); else if(j == 35) media.info = cell_value.toString(); } tempSave(media); } } excel->dynamicCall("Quit (void)"); this->setCursor(Qt::ArrowCursor); }