当前位置: 首页>>代码示例>>C++>>正文


C++ Azahar::getCategoryId方法代码示例

本文整理汇总了C++中Azahar::getCategoryId方法的典型用法代码示例。如果您正苦于以下问题:C++ Azahar::getCategoryId方法的具体用法?C++ Azahar::getCategoryId怎么用?C++ Azahar::getCategoryId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Azahar的用法示例。


在下文中一共展示了Azahar::getCategoryId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCategoryId

int PurchaseEditor::getCategoryId()
{
  QSqlQuery query(db);
  int code=-1;
  QString currentText = ui->categoriesCombo->currentText();
  Azahar *myDb = new Azahar;
  myDb->setDatabase(db);
  code = myDb->getCategoryId(currentText);
  return code;
}
开发者ID:dcchivela,项目名称:RaspberryPOS,代码行数:10,代码来源:purchaseeditor.cpp

示例2: addNewChild

void SubcategoryEditor::addNewChild()
{
    //launch dialog to ask for the new child. Using this same dialog.
    SubcategoryEditor *scEditor = new SubcategoryEditor(this);
    scEditor->setDb(db);
    Azahar *myDb = new Azahar;
    myDb->setDatabase(db);

    scEditor->setCatList( catList );
    scEditor->setScatList( scatList );
    scEditor->setDialogType(dialogType+1);//incrementing because this dialog is a child dialog (parentType+1)

    if (dialogType == 1) {
        //From "Add Department" dialog, creating a category.
        scEditor->setLabelForName(i18n("New category:"));
        scEditor->setLabelForList(i18n("Select the child subcategories for this category:"));
        scEditor->populateList( myDb->getSubCategoriesList() );
    } else if (dialogType == 2) {
        //From "Add Category" dialog, creating a subcategory. No child allowed.
        scEditor->setLabelForName(i18n("New subcategory:"));
        scEditor->setLabelForList(i18n(""));
        scEditor->hideListView(); //subcategories does not have children.
    }
        
    if ( scEditor->exec() ) {
        QString text = scEditor->getName();
        QStringList children = scEditor->getChildren();
        qDebug()<<text<<" CHILDREN:"<<children;

        if (dialogType == 1) { //The dialog is launched from the "Add Department" dialog. So we are going to create a category.
            //Create the category
            if (!myDb->insertCategory(text)) {
                qDebug()<<"Error:"<<myDb->lastError();
                delete myDb;
                return;
            }
            //insert new category to the box
            catList << text;
            ui->listView->addItem(text);
            //mark item as checkable
            ui->listView->item(ui->listView->count()-1)->setFlags(ui->listView->item(ui->listView->count()-1)->flags() |Qt::ItemIsUserCheckable);
            ui->listView->item(ui->listView->count()-1)->setCheckState(Qt::Checked); //mark as checked.
            qulonglong cId = myDb->getCategoryId(text);
            //create the m2m  relations for the new category->subcategory.
            foreach(QString cat, children) {
                //get subcategory id
                qulonglong scId = myDb->getSubCategoryId(cat);
                //create the link [category] --> [subcategory]
                myDb->insertM2MCategorySubcategory(cId, scId);
            }
        } else if (dialogType == 2) { //The dialog is launched from the "Add Category" dialog. So we are going to create a subcategory which does have a child.
开发者ID:hiramvillarreal,项目名称:lemonpos,代码行数:51,代码来源:subcategoryeditor.cpp

示例3: setFilter

void PromoEditor::setFilter()
{
  QRegExp regexp = QRegExp(ui->editName->text());
  if (ui->chByName->isChecked()) {
    //1st if: Filter by DESC.
    if (!regexp.isValid() || ui->editName->text().isEmpty() || (ui->editName->text()=="*") )  model->setFilter("");
    else  model->setFilter(QString("products.name REGEXP '%1'").arg(ui->editName->text()));
  }
  else { // filter by category...
    int catId=-1;
    QString catText = ui->comboCategory->currentText();
    Azahar *myDb = new Azahar;
    myDb->setDatabase(db);
    catId = myDb->getCategoryId(catText);
    //qDebug()<<"Category:"<<catText<<" Id:"<<catId;
    model->setFilter(QString("products.category=%1").arg(catId));
  }
}
开发者ID:adlh,项目名称:lemonpos,代码行数:18,代码来源:promoeditor.cpp


注:本文中的Azahar::getCategoryId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。