Exemplo n.º 1
0
Lng32 ExpHbaseInterface::checkAndDeleteRow(
					   HbaseStr &tblName,
					   HbaseStr &rowID, 
					   const Text& columnToCheck,
					   const Text& colValToCheck,
                                           NABoolean noXn,
					   const int64_t timestamp)
{
  Lng32 retcode = 0;

  retcode = rowExists(tblName, rowID);
  if (retcode < 0)
    return retcode;

  if (retcode == 0) // row does not exist
    {
      // return warning
      return HBASE_ROW_NOTFOUND_ERROR;
    }

  LIST(HbaseStr) columns(heap_);
  // row exists, delete it
  retcode = deleteRow(tblName,
		      rowID,
		      columns,
                      noXn,
		      timestamp);

  
  return retcode;
}
/**
 * @brief
 *
 * @param arg1
 */
void VirtualRotatingDialog::on_numVirtualZonesSpinBox_valueChanged(int arg1)
{
    int _totalRows = ui->zoneInfoTable->rowCount();
    int _newZoneNo = arg1;
    int _cZoneNo = _totalRows;
    if (_newZoneNo > _cZoneNo) // We need to add new rows
    {
        int _noNewRows = _newZoneNo - _cZoneNo;
        for (int i = 0;i < _noNewRows;i++)
            addRow(_cZoneNo+i);

    }
    else{
        if (_newZoneNo < _cZoneNo) // We need to delete rows
        {            
            int _noDeletedRows = _cZoneNo -_newZoneNo;
            ui->numVirtualZonesSpinBox->blockSignals(true);
            for (int i = 0; i <= _noDeletedRows;i++)
                deleteRow(_totalRows - i);

            ui->numVirtualZonesSpinBox->blockSignals(false);
        }
    }

}
Exemplo n.º 3
0
FlowsWidget::FlowsWidget(QWidget *parent) : QWidget(parent)
{
    qDebug() << __FUNCTION__;

    QStringList columnNames;
    columnNames << "ID"
                << "Название потока"
                << "Список групп"
                << "Примечание";

    flowsTableModel = EkonTables::createTableModel(this, "VIEW_FLOWS", columnNames);
    filterProxyModel = new CheckableSortFilterProxyModel(this);
    filterProxyModel->setSourceModel(flowsTableModel);
    flowsTableView = EkonTables::createTableView(this, filterProxyModel);
    flowsTableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    flowsTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

    controlWidget = new ControlWidget(this);

    QGridLayout *layout = new QGridLayout(this);
    layout->addWidget(flowsTableView);
    layout->addWidget(controlWidget);

    this->setLayout(layout);

    connect(controlWidget, SIGNAL(addRow()), this, SLOT(addRow()));
    connect(controlWidget, SIGNAL(removeRow()), this, SLOT(deleteRow()));
    connect(flowsTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editRow(QModelIndex)));
    connect(controlWidget, SIGNAL(filter(QString)), filterProxyModel, SLOT(setFilterFixedString(QString)));
    connect(controlWidget, SIGNAL(search(QString)), filterProxyModel, SLOT(setColorFilterString(QString)));
}
Exemplo n.º 4
0
Arquivo: WTable.C Projeto: DTidd/wt
void WTable::clear()
{
  while (rowCount() > 0)
    deleteRow(rowCount() - 1);

  while (columnCount() > 0)
    deleteColumn(columnCount() - 1);
}
Exemplo n.º 5
0
void PageScheme::connectSignals()
{
    connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow()));
    connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
    connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow()));
    mapper = new QDataWidgetMapper(this);
    connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int)));
    connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int)));
}
Exemplo n.º 6
0
void PlayState::move(int x, int y)
{
	if (collisionTest(x, y))
	{
		if (y == 1)
		{
			if (sPiece.y < 1)
			{
				GameStateManager::Instance()->changeGameState(new GameOverState());
			}
			else
			{
				//Add piece to landed
				for (int row = 0; row != 4; row++)
				{
					for (int col = 0; col != 4; col++)
					{
						if (sPiece.size[row][col] != TILEBLANK)
						{
							landed[sPiece.y + row][sPiece.x + col] = sPiece.size[row][col];
						}
					}
				}

				//Check filled rows
				for (int row = 0; row != 16; row++)
				{
					bool filled{ true };

					for (int col = 0; col != 10; col++)
					{
						if (landed[row][col] == TILEBLANK)
						{
							filled = false;
						}
					}

					if (filled)
					{
						deleteRow(row);
					}
				}

				dropDelay -= .05;
				newPiece();
			}
		}
	}
	else //No collision, move piece
	{
		sPiece.x += x;
		sPiece.y += y;
	}
}
Exemplo n.º 7
0
bool DbNote::deleteCategory(int idx)
{
    Category tmp_cat( idx );
    stringstream ss;
    ss << idx;
    string stmnt = "delete from KatTable where KatKey="+ss.str();
    if( existCategory( tmp_cat ) )
    {
        return deleteRow(stmnt);
    }
    return false;
}
Exemplo n.º 8
0
bool DbNote::deleteNote(int idx)
{
    Note tmp_note;
    tmp_note.setNoteKey(idx);
    stringstream ss;
    ss << idx;
    string stmnt = "delete from NoteTable where NoteKey="+ss.str();
    if( existNote( tmp_note ) )
    {
        return deleteRow(stmnt);
    }
    return false;
}
void EditOccupationsInfosWidget::clickHandler(const QModelIndex& index){
    if(index.column()==remove) deleteRow(index.row());
    else if(index.column()==begin || index.column()==end){
        targetItem=model->item(index.row(),index.column());
	if(calendar) calendar->close();
        calendar=new QCalendarWidget;
        calendar->setWindowFlags(Qt::WindowStaysOnTopHint);
        calendar->show();
        connect(calendar,SIGNAL(clicked(QDate)),this,SLOT(changeDate(QDate)));
        calendar->setSelectedDate((targetItem->text()!="Click")?QDate::fromString(targetItem->text(),"dd/M/yyyy")
                                                         :QDate::currentDate());
        calendar->showSelectedDate();
    }//if
}//clickHandler
Exemplo n.º 10
0
    /**
    Used by the view to tell the presenter something has changed
    */
    void ReflMainViewPresenter::notify(int flag)
    {
      switch(flag)
      {
      case ReflMainView::SaveAsFlag:    saveAs();     break;
      case ReflMainView::SaveFlag:      save();       break;
      case ReflMainView::AddRowFlag:    addRow();     break;
      case ReflMainView::DeleteRowFlag: deleteRow();  break;
      case ReflMainView::ProcessFlag:   process();    break;
      case ReflMainView::GroupRowsFlag: groupRows();  break;

      case ReflMainView::NoFlags:       return;
      }
      //Not having a 'default' case is deliberate. gcc issues a warning if there's a flag we aren't handling.
    }
Exemplo n.º 11
0
void EditStudiesInfosWidget::initDegrees(){
    QVector<int> aux; aux.push_back(remove);
    QStringList header; header<<deleteS<<tr("Università")<<tr("Corso di Laurea")<<tr("Situazione");
    model=new CustomStandardItemModel(aux,0,header.size());
    model->setHorizontalHeaderLabels(header);

    degrees=new QTableView;
    degrees->setMinimumWidth(500);
    degrees->horizontalHeader()->setDefaultAlignment(Qt::AlignCenter);
    degrees->verticalHeader()->setVisible(false);
    degrees->setMouseTracking(true);
    degrees->setModel(model);
    degrees->setStyleSheet("QHeaderView::section{background:"+GUIStyle::lightGold()+";}");
    form->addRow(tr("Lauree: "),degrees); form->setAlignment(degrees,Qt::AlignLeft);
    connect(degrees,SIGNAL(entered(QModelIndex)),this,SLOT(changeCursor(QModelIndex)));
    connect(degrees,SIGNAL(clicked(QModelIndex)),this,SLOT(deleteRow(QModelIndex)));
}//initDegrees
Exemplo n.º 12
0
int SectoresGUI::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_tablaSectores_activated((*reinterpret_cast< QModelIndex(*)>(_a[1]))); break;
        case 1: insertRow(); break;
        case 2: deleteRow(); break;
        case 3: modificarFila(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Exemplo n.º 13
0
void HModifyProd::on_pushButton_3_clicked()
{
  if (QMessageBox::Ok==QMessageBox::question(this,QApplication::applicationName(),"Rimuovere la riga?\n Attenzione!! La cancellazione è definitiva",QMessageBox::Ok|QMessageBox::Cancel))
  {
  bool b= deleteRow();
   if(b)
   {
       QMessageBox::information(this,QApplication::applicationName(),"Riga rimossa",QMessageBox::Ok);
   }
   else
   {
       QMessageBox::warning(this,QApplication::applicationName(),"ERRORACCIO!!!\n" + db.lastError().text()  ,QMessageBox::Ok);
   }
  }


}
Exemplo n.º 14
0
bool ColumnEditorModel::setData(QModelIndex const &oIndex, QVariant const &oValue, int nRole)
{
	if(!oIndex.isValid())
		return QStandardItemModel::setData(oIndex, oValue, nRole);

	StdString s = oValue.value<StdString>();
	bool rc;
	bool update = true;

	int n = rowCount()-1;
	int ir = oIndex.row();
	int ic = oIndex.column();
	if(ir == n)
	{
		// Add new empty line at the end if the last item has got some text
		if(ic == COL_NAME && s.size() > 0)
		{
			updateName(n, s);
			insertRow(n+1);
		}
	}
	else
	{
		if(ic == COL_NAME)
		{
			if(s.size() == 0)
			{
				n = oIndex.row();
				deleteRow(n);
				update = false;
			}
			else
				updateName(ir, s);
		}
		else
			updateType(ir, s);
	}

	if(update)
		rc = QStandardItemModel::setData(oIndex, oValue, nRole);
	else
		rc = false;

	return rc;
}
/**
 * @brief
 *
 * @param row
 * @param column
 */
void VirtualRotatingDialog::on_zoneInfoTable_cellClicked(int row, int column)
{
    switch (column)
    {
    case ColumnConfigure:
        createVirtualMRFData(row); //We only create them at the moment of configuration
        launchCurveDialog(row);
        break;
    case ColumnDelete: // We need to remove the objects accordingly
        ui->numVirtualZonesSpinBox->blockSignals(true);
        deleteRow(row);
        ui->numVirtualZonesSpinBox->blockSignals(false);
        break;
    case ColumnHelp:
        buildAssociatedHelp(row);
        break;
    }
}
Exemplo n.º 16
0
        void FenPrincipale::deleteRowss()
    {
        QSqlTableModel *model = qobject_cast<QSqlTableModel *>(tabless->model());
        if (!model)
            return;



        QModelIndexList currentSelection = tabless->selectionModel()->selectedIndexes();
        for (int i = 0; i < currentSelection.count(); ++i) {
            if (currentSelection.at(i).column() != 0)
                continue;
            model->removeRow(currentSelection.at(i).row());
            //tabless->edit();

            deleteRow();




         }
       }
Exemplo n.º 17
0
    void EFILE::hierarchicalClustering()
    {
      int _i,_j;
      if(nsolutions>nclusters+1){
        hasclusteredfirsttime=true;
        updatematrix=false;
        normalizeDistances();
        createProximityMatrix();
        while(pmsize>nclusters){
          findLowestValue(&_i,&_j);
          copy2Column(_i);
          copy2Column(_j);
          joinColumns(_i,_j);
          copy2Row(_i);
          deleteColumn(_j);
          deleteRow(_j);
          pmsize--;
        }
        for(_i=0;_i<nclusters;_i++){
          for(_j=0;proximitymatrixindex[_i][_j]!=-1;_j++);
          /*
      {

      for(int _k=0;_k<ndimensions;_k++){

      gbests4swarm[_i][_j].x[_k]=solutions[proximitymatrixindex[_i][_j]].x[_k];
          }

          for(int _k=0;_k<nobjectives;_k++){
          gbests4swarm[_i][_j].fx[_k]=solutions[proximitymatrixindex[_i][_j]].fx[_k];
          }
          }*/

          nsolutionsbyswarm[_i]=_j;
        }

      }
    }
Exemplo n.º 18
0
/****************************************************************************
Desc:
****************************************************************************/
RCODE F_Db::maintBlockChainFree(
	FLMUINT64		ui64MaintRowId,
	FLMUINT			uiStartBlkAddr,
	FLMUINT 			uiBlocksToFree,
	FLMUINT			uiExpectedEndBlkAddr,
	FLMUINT *		puiBlocksFreed)
{
	RCODE			rc = NE_SFLM_OK;
	FLMUINT		uiBlocksFreed = 0;
	FLMUINT		uiEndBlkAddr = 0;
	F_Row *		pRow = NULL;
	FLMUINT		uiRflToken = 0;

	// Make sure an update transaction is going and that a
	// non-zero number of blocks was specified

	if( getTransType() != SFLM_UPDATE_TRANS || !uiBlocksToFree)
	{
		rc = RC_SET_AND_ASSERT( NE_SFLM_ILLEGAL_OP);
		goto Exit;
	}

	m_pDatabase->m_pRfl->disableLogging( &uiRflToken);
	
	if( RC_BAD( rc = btFreeBlockChain( 
		this, NULL, uiStartBlkAddr, uiBlocksToFree, 
		&uiBlocksFreed, &uiEndBlkAddr, NULL)))
	{
		goto Exit;
	}

	flmAssert( uiBlocksFreed <= uiBlocksToFree);

	if (!uiEndBlkAddr)
	{
		if (RC_BAD( rc = deleteRow( SFLM_TBLNUM_BLOCK_CHAINS, ui64MaintRowId,
									FALSE)))
		{
			goto Exit;
		}
	}
	else
	{
		if (RC_BAD( rc = gv_SFlmSysData.pRowCacheMgr->retrieveRow( this,
										SFLM_TBLNUM_BLOCK_CHAINS, ui64MaintRowId,
										&pRow)))
		{
			goto Exit;
		}
		if (RC_BAD( rc = pRow->setUINT( this,
					SFLM_COLNUM_BLOCK_CHAINS_BLOCK_ADDRESS, uiEndBlkAddr)))
		{
			goto Exit;
		}
	}

	if (uiExpectedEndBlkAddr)
	{
		if (uiBlocksToFree != uiBlocksFreed ||
			 uiEndBlkAddr != uiExpectedEndBlkAddr)
		{
			rc = RC_SET_AND_ASSERT( NE_SFLM_DATA_ERROR);
			goto Exit;
		}
	}

	if (uiRflToken)
	{
		m_pDatabase->m_pRfl->enableLogging( &uiRflToken);
	}
	
	if( RC_BAD( rc = m_pDatabase->m_pRfl->logBlockChainFree( 
		this, ui64MaintRowId, uiStartBlkAddr, uiEndBlkAddr, uiBlocksFreed)))
	{
		goto Exit;
	}

	if (puiBlocksFreed)
	{
		*puiBlocksFreed = uiBlocksFreed;
	}

Exit:

	if (uiRflToken)
	{
		m_pDatabase->m_pRfl->enableLogging( &uiRflToken);
	}
	
	if (pRow)
	{
		pRow->ReleaseRow();
	}

	return( rc);
}
Exemplo n.º 19
0
void WTable::clear()
{
  while (numRows() > 0)
    deleteRow(numRows() - 1);
}
Exemplo n.º 20
0
void Row::on_deleteBtn_clicked()
{
    deleteRow();
    close();
}
DatabaseEditorActions::DatabaseEditorActions(DatabaseEditorController *controller) :
    QObject(controller),
    m_controller(controller)
{
    connect(controller, SIGNAL(currentDatabaseChanged(::LBDatabase::Database*)), this, SLOT(updateActions()));
    connect(controller, SIGNAL(currentTableChanged(::LBDatabase::Table*)), this, SLOT(updateActions()));
    connect(controller, SIGNAL(currentContextChanged(::LBDatabase::Context*)), this, SLOT(updateActions()));

    m_openDatabaseAction = new Action(this);
    m_openDatabaseAction->setText(tr("&Open..."));
    m_openDatabaseAction->setShortcut(QKeySequence::Open);
    connect(m_openDatabaseAction, SIGNAL(triggered()), m_controller, SLOT(openFile()));

    m_importDatabaseAction = new Action(this);
    m_importDatabaseAction->setText(tr("&Import database..."));
    connect(m_importDatabaseAction, SIGNAL(triggered()), m_controller, SLOT(importDatabase()));

    m_closeDatabaseAction = new Action(this);
    m_closeDatabaseAction->setText(tr("C&lose database"));
    m_closeDatabaseAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_W);
    m_closeDatabaseAction->setEnabled(false);
    connect(m_closeDatabaseAction, SIGNAL(triggered()), m_controller, SLOT(closeDatabase()));

    m_saveDatabaseAction = new Action(this);
    m_saveDatabaseAction->setText(tr("&Save"));
    m_saveDatabaseAction->setShortcut(QKeySequence::Save);
    m_saveDatabaseAction->setEnabled(false);
    connect(m_saveDatabaseAction, SIGNAL(triggered()), m_controller, SLOT(saveDatabase()));

    m_insertRowAction = new Action(this);
    m_insertRowAction->setText(tr("&Insert Row..."));
    m_insertRowAction->setEnabled(false);
    connect(m_insertRowAction, SIGNAL(triggered()), m_controller, SLOT(appendRow()));

    m_deleteRowAction = new Action(this);
    m_deleteRowAction->setText(tr("&Delete Row..."));
    m_deleteRowAction->setEnabled(false);
    connect(m_deleteRowAction, SIGNAL(triggered()), m_controller, SLOT(deleteRow()));

    m_createTableAction = new Action(this);
    m_createTableAction->setText(tr("&Create Table..."));
    m_createTableAction->setEnabled(false);
    connect(m_createTableAction, SIGNAL(triggered()), m_controller, SLOT(createTable()));

    m_editTableAction = new Action(this);
    m_editTableAction->setText(tr("&Edit Table..."));
    m_editTableAction->setEnabled(false);
    connect(m_editTableAction, SIGNAL(triggered()), m_controller, SLOT(editTable()));

    m_createContextAction = new Action(this);
    m_createContextAction->setText(tr("&Create Context..."));
    m_createContextAction->setEnabled(false);
    connect(m_createContextAction, SIGNAL(triggered()), m_controller, SLOT(createContext()));

    m_addEntityTypeAction = new Action(this);
    m_addEntityTypeAction->setText(tr("&Add EntityType..."));
    m_addEntityTypeAction->setEnabled(false);
    connect(m_addEntityTypeAction, SIGNAL(triggered()), m_controller, SLOT(addEntityType()));

    m_editEntityTypesAction = new Action(this);
    m_editEntityTypesAction->setText(tr("&Edit EntityTypes..."));
    m_editEntityTypesAction->setEnabled(false);
    connect(m_editEntityTypesAction, SIGNAL(triggered()), m_controller, SLOT(editEntityTypes()));

    m_exportUmlGraphvizAction = new Action(this);
    m_exportUmlGraphvizAction->setText(tr("&UML Graphviz *.dot document..."));
    m_exportUmlGraphvizAction->setEnabled(true);
    connect(m_exportUmlGraphvizAction, SIGNAL(triggered()), m_controller, SLOT(exportGraphviz()));

    m_exportCppAction = new Action(this);
    m_exportCppAction->setText(tr("&C++ Entity Storage..."));
    m_exportCppAction->setEnabled(true);
    connect(m_exportCppAction, SIGNAL(triggered()), m_controller, SLOT(exportCpp()));
}
//int newWordManageWindow::newWordList.size() = 0;
newWordManageWindow::newWordManageWindow(User *user):user(user)
{
    row = 13;
    column = 3;
    currentPage = 1;
    TotalPages = newWordList.size()/row+1;
    this->setMaximumSize(270, 480);
    this->setMinimumSize(270, 480);
    this->setWindowFlags(Qt::FramelessWindowHint);
    background =  new QLabel(this);
    background->setStyleSheet("background:url(:/image/wordManage.jpg)");
    background->setGeometry(0, 0, this->width(), this->height());

    tableWidget = new QTableWidget(row, column);
    tableWidget->setParent(this);
    tableWidget->setGeometry(22, 80, 226, 326);
    QStringList headerList;
    headerList << "单词"  << "解释" << "加入时间";
    tableWidget->setHorizontalHeaderLabels(headerList);
    tableWidget->setColumnWidth(0, 60);
    tableWidget->setColumnWidth(1, 82);
    tableWidget->setColumnWidth(2, 82);
    for(int i=0; i<row; i++)
    {
        tableWidget->setRowHeight(i, 23);
    }
    tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    tableWidget->setShowGrid(false);
    QHeaderView *headerview = tableWidget->verticalHeader();
    headerview->setHidden(true);
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    QTableWidgetItem *item1, *item2, *item3;
    for(int i=0; i<row; i++)
    {
            item1 = new QTableWidgetItem("");
            item2 = new QTableWidgetItem("");
            item3 = new QTableWidgetItem("");
            item1->setTextAlignment(Qt::AlignCenter);
            item2->setTextAlignment(Qt::AlignCenter);
            item3->setTextAlignment(Qt::AlignCenter);

            tableWidget->setItem(i, 0, item1);
            tableWidget->setItem(i, 1, item2);
            tableWidget->setItem(i, 2, item3);

    }
    remindLabel = new QLabel(this);
    addButton = new QPushButton(this);
    deleteButton = new QPushButton(this);
    preButton = new QPushButton(this);
    backButton = new QPushButton(this);
    nextButton = new QPushButton(this);

    backButton->setGeometry(10, 6, 40, 19);
    remindLabel->setGeometry(173, 30, 24, 40);
    remindLabel->setText("0");
    remindLabel->setStyleSheet("font-size:20px");
    remindLabel->setAlignment(Qt::AlignBottom|Qt::AlignHCenter);
    addButton->setGeometry(94, 419, 80, 35);
    deleteButton->setGeometry(175, 419, 80, 35);
    preButton->setGeometry(2, 210, 17, 33);
    nextButton->setGeometry(251, 210, 17, 33);
    addButton->setStyleSheet("background-color:transparent");
    deleteButton->setStyleSheet("background-color:transparent");
    preButton->setStyleSheet("background-color:transparent");
    nextButton->setStyleSheet("background-color:transparent");
    backButton->setStyleSheet("background-color:transparent");
    addDialog = new dialog(this);
    pageLabel = new QLabel(this);
    pageLabel->setGeometry(32, 410, 100, 40);
    QString string1 = QString::number(currentPage);
    QString string2 = QString::number(TotalPages);
    QString string = string1 + "/" + string2;
    pageLabel->setText(string);
    connect(addButton, SIGNAL(clicked()), addDialog, SLOT(show()));
    connect(addDialog->ensureButton, SIGNAL(clicked()), this, SLOT(add()));
    connect(addDialog->ensureButton, SIGNAL(clicked()), this, SLOT(clear()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteRow()));
    connect(backButton, SIGNAL(clicked()), this, SLOT(back()));
    connect(preButton, SIGNAL(clicked()), this, SLOT(prePage()));
    connect(nextButton, SIGNAL(clicked()), this, SLOT(nextPage()));

}
Exemplo n.º 23
0
ContactView::ContactView(ContactHandler *ch, QWidget *parent) :
    QWidget(parent)
{
    //Labels
    fName_lbl   = new QLabel("Fornavn:");
    lName_lbl   = new QLabel("Etternavn:");
    phoneN_lbl  = new QLabel("Tlf:");
    eMail_lbl   = new QLabel("e-post:");

    //LineEdit
    fName = new QLineEdit();
    lName = new QLineEdit();
    phoneNumber = new QLineEdit();
    eMail = new QLineEdit();

    //PushButtons
    edit = new QPushButton("Rediger");
    save = new QPushButton("Lagre");
    remove = new QPushButton("Slett");
    add = new QPushButton("Legg til");
    close = new QPushButton("Lukk");

    //Layouts
    main = new QHBoxLayout(this);
    setLayout(main);
    leftmain = new QVBoxLayout();
    rightmain = new QVBoxLayout();
    rightlabel = new QVBoxLayout();
    rightedit = new QVBoxLayout();
    bottomright = new QHBoxLayout();
    firstright = new QHBoxLayout();
    main->addLayout(leftmain);
    main->addLayout(rightmain);
    firstright->addLayout(rightlabel);
    firstright->addLayout(rightedit);
    rightmain->addLayout(firstright);
    rightmain->addLayout(bottomright);


    //Lager kontaklista
    tv = new QTableView();
    leftmain->addWidget(tv);
    mdl = new ContactListModel(ch,this);
    tv->setModel(mdl);
    tv->setSelectionBehavior(QTableView::SelectRows);
    tv->setSelectionMode(QTableView::SingleSelection);

    //Setter storrelset på vindu, knapper o.l.
    tv->setMinimumWidth(598);
    tv->setColumnWidth(0,150);
    tv->setColumnWidth(1,150);
    tv->setColumnWidth(2,120);
    tv->setColumnWidth(3,150);

    //Adder knapper og layouts til rl og ll
    rightlabel->addWidget(fName_lbl);
    rightlabel->addWidget(lName_lbl);
    rightlabel->addWidget(phoneN_lbl);
    rightlabel->addWidget(eMail_lbl);

    rightedit->addWidget(fName);
    rightedit->addWidget(lName);
    rightedit->addWidget(phoneNumber);
    rightedit->addWidget(eMail);
    rightedit->insertSpacing(4,5);

    bottomright->addWidget(edit);
    bottomright->addWidget(save);
    bottomright->addWidget(remove);
    bottomright->addWidget(add);
    bottomright->insertSpacing(3,5);
    bottomright->addWidget(close);

    //gjømmer knapper
    save->hide();

    //Ekle feltvariablar
    cHandler = ch;
    selectedRow = -1;

    //Connects
    connect(edit,SIGNAL(clicked()),this,SLOT(editRow()));
    connect(save,SIGNAL(clicked()),this,SLOT(saveRow()));
    connect(add,SIGNAL(clicked()),this,SLOT(addCont()));
    connect(remove,SIGNAL(clicked()),this,SLOT(deleteRow()));
    connect(close,SIGNAL(clicked()),this,SLOT(saveToFile()));
    connect(this,SIGNAL(end()),this,SLOT(close()));

    //Widget settings
    setWindowTitle("Kontakter");

}
Exemplo n.º 24
0
QDlgResult::QDlgResult( QString strTabName, QWidget* parent, Qt::WindowFlags flags )
    : QDialog(parent, flags)
{
    this->strTabName = strTabName ;

    modelQuery = new QSqlQueryModel ;

    tabView = new QTableView;
    tabView->setModel( modelQuery );

    tabView->setSelectionMode(QAbstractItemView::SingleSelection);
    tabView->setSelectionBehavior(QAbstractItemView::SelectRows);
    tabView->verticalHeader()->setVisible(false);

    tabView->setEditTriggers( QAbstractItemView::NoEditTriggers );

    tabView->horizontalHeader()->setStretchLastSection( true ); //最后一列占满可视空间

    buttonInsert = new QPushButton(tr("增加&A"));            //设置功能按钮
    buttonDelete = new QPushButton(tr("删除&D"));
    buttonUpdate = new QPushButton(tr("保存&S"));
    buttonClose = new QPushButton(tr("关闭&C"));
    buttonSaveXls = new QPushButton(tr("另存XLS"));

    connect(buttonInsert, SIGNAL(clicked()), this, SLOT(insertRow()));
    connect(buttonDelete, SIGNAL(clicked()), this, SLOT(deleteRow()));
    connect(buttonUpdate, SIGNAL(clicked()), this, SLOT(updateRow()));
    connect(buttonClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(buttonSaveXls, SIGNAL(clicked()), this, SLOT( slotSaveXls( )));

    lblStart = new QLabel(tr("开始时间:")) ;
    lblEnd = new QLabel(tr("结束时间:")) ;

    edtStart = new QLineEdit  ;
    edtEnd = new QLineEdit ;
    buttonQuery = new QPushButton(tr("查询"));
    connect(buttonQuery, SIGNAL(clicked()), this, SLOT(slotQuery()));

    QDateTime dtToday = QDateTime::currentDateTime( );
    QDate d = dtToday.date() ;
    QString strTime1, strTime2 ;

    strTime1.sprintf( "%04d-%02d-%02d 00:00:00", d.year(),d.month(),d.day() );
    strTime2.sprintf( "%04d-%02d-%02d 23:59:59", d.year(),d.month(),d.day() );
    edtStart->setText( strTime1 );
    edtEnd->setText( strTime2 );

    QHBoxLayout *queryLayout = new QHBoxLayout;
    queryLayout->addWidget( lblStart );
    queryLayout->addWidget( edtStart );
    queryLayout->addWidget( lblEnd );
    queryLayout->addWidget( edtEnd );
    queryLayout->addWidget( buttonQuery );

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addStretch( );
//    bottomLayout -> addWidget(buttonInsert);
//    bottomLayout -> addWidget(buttonDelete);
//    bottomLayout -> addWidget(buttonUpdate);

    bottomLayout -> addWidget(buttonSaveXls);
    bottomLayout -> addWidget(buttonClose);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout -> addLayout( queryLayout );
    mainLayout -> addWidget( tabView );
    mainLayout -> addLayout( bottomLayout );

    setLayout( mainLayout );

    resize(1200,600);
    slotQuery( );
    setWindowTitle(tr("流速测量结果"));

}
Exemplo n.º 25
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    init();

    name_label = new QLabel(tr("Name: "), this);
    name_line_edit = new QLineEdit(this);
    name_check_button = new QPushButton(this);
    name_check_button->setText("Check");
    connect(name_check_button, SIGNAL(clicked()), this, SLOT(checkName()));

    row_label = new QLabel(tr("Go to: "), this);
    row_number_spinbox = new QSpinBox(this);
    row_number_spinbox->setMinimumWidth(60);
    row_number_spinbox->setMinimum(1);
    row_number_spinbox->setMaximum(10000);
    connect(row_number_spinbox, SIGNAL(editingFinished()), this, SLOT(rowNumberEntered()));

    go_to_button = new QPushButton(this);
    go_to_button->setText("Go");
    connect(go_to_button, SIGNAL(clicked()), this, SLOT(goToRow()));

//    test_layout = new QHBoxLayout(this);
//    test_layout->addWidget(name_line_edit);
//    test_layout->addWidget(name_test_button);

    table_list = new QListWidget(this);
    for (int i = 0; i < number_of_tables; ++i)
    {
        table_list->insertItem(i, table_names.at(i));
    }
    table_list->setCurrentRow(0);
    connect(table_list, SIGNAL(currentRowChanged(int)), this, SLOT(changeTable(int)));

    connect(table_models.at(0),
            SIGNAL(dataChanged(const QModelIndex&,
                               const QModelIndex&,
                               const QVector<int> &)),
            this, SLOT(onDataChanged(const QModelIndex&,
                                     const QModelIndex&,
                                     const QVector<int> &)));

    table = new QTableView(this);
    table->setModel(table_models.at(table_list->currentRow()));
    table->setItemDelegate(new QSqlRelationalDelegate(table));
    table->hideColumn(0);
    table_models.at(table_list->currentRow())->select();

    splitter = new QSplitter(this);
    splitter->addWidget(table_list);
    splitter->addWidget(table);
    splitter->setStretchFactor(0, 1);
    splitter->setStretchFactor(1, 6);

//    main_layout = new QVBoxLayout(this);
//    main_layout->addLayout(test_layout);
//    main_layout->addWidget(splitter);
//    this->setLayout(main_layout);
    this->setCentralWidget(splitter);

    open_action = new QAction(QObject::tr("Import file..."), this);
    open_action->setIcon(QIcon("import.png"));
    connect(open_action, SIGNAL(triggered()), this, SLOT(openFile()));

    save_action = new QAction(QObject::tr("Save as..."), this);
    save_action->setIcon(QIcon("save.png"));
    connect(save_action, SIGNAL(triggered()), this, SLOT(saveAs()));

    label_open = new QLabel(tr("Clear table: "), this);
    check_box_open = new QCheckBox(this);
    check_box_open->setChecked(false);

    check_action = new QAction(QObject::tr("Check file ..."), this);
    check_action->setIcon(QIcon("check.png"));
    connect(check_action, SIGNAL(triggered()), this, SLOT(checkFile()));

    label_check = new QLabel(tr("Add new companies: "), this);
    check_box_check = new QCheckBox(this);
    check_box_check->setChecked(true);

    insert_action = new QAction(QObject::tr("Insert a row"), this);
    insert_action->setIcon(QIcon("insert.png"));
    connect(insert_action, SIGNAL(triggered()), this, SLOT(insertRow()));

    delete_action = new QAction(QObject::tr("Delete row(s)"), this);
    delete_action->setIcon(QIcon("remove.png"));
    connect(delete_action, SIGNAL(triggered()), this, SLOT(deleteRow()));

    add_deadline_action = new QAction(QObject::tr("Auto deadline"), this);
    add_deadline_action->setIcon(QIcon("deadline.png"));
//    add_deadline_action->setIconText("Auto deadline");
    connect(add_deadline_action, SIGNAL(triggered()), this, SLOT(addDeadline()));

    tool_bar_1 = new QToolBar(this);
    tool_bar_1->addAction(save_action);
    tool_bar_1->addSeparator();
    tool_bar_1->addAction(open_action);
    tool_bar_1->addSeparator();
    tool_bar_1->addWidget(label_open);
    tool_bar_1->addWidget(check_box_open);

    tool_bar_2 = new QToolBar(this);
    tool_bar_2->addAction(check_action);
    tool_bar_2->addSeparator();
    tool_bar_2->addWidget(label_check);
    tool_bar_2->addWidget(check_box_check);

    tool_bar_3 = new QToolBar(this);
    tool_bar_3->addAction(insert_action);
    tool_bar_3->addAction(delete_action);
    tool_bar_3->addAction(add_deadline_action);
    tool_bar_3->addSeparator();

    tool_bar_3->addWidget(row_label);
    tool_bar_3->addWidget(row_number_spinbox);
    tool_bar_3->addWidget(go_to_button);
    tool_bar_3->addSeparator();

    tool_bar_3->addWidget(name_label);
    tool_bar_3->addWidget(name_line_edit);
    tool_bar_3->addWidget(name_check_button);

    addToolBar(tool_bar_1);
    addToolBar(tool_bar_2);
    addToolBar(tool_bar_3);

//    table->addAction(insert_action);
//    table->addAction(delete_action);

    this->setWindowTitle(tr("TMS"));
}
Exemplo n.º 26
0
void EditorManagerView::slotDelete()
{
    deleteRow(_editorWidget->currentIndex());
}
Exemplo n.º 27
0
void EditorManagerView::slotDeleteItem(const QModelIndex & index)
{
    if(index.isValid()){
        deleteRow(index.row());
    }
}
Exemplo n.º 28
0
// ----------------------------------------------------------------------------
// method:  unregisterUser
//
// This method removes a user from the database
//
// Input:  parse tree containing a definition of the user
// Output: the global diags area is set up with the result
// ----------------------------------------------------------------------------
void CmpSeabaseDDLuser::unregisterUser (StmtDDLRegisterUser * pNode)
{
  try
  {
    verifyAuthority();

    // CASCADE option not yet supported
    if (pNode->getDropBehavior() == COM_CASCADE_DROP_BEHAVIOR)
    {
      *CmpCommon::diags() << DgSqlCode (-CAT_ONLY_SUPPORTING_RESTRICT_DROP_BEHAVIOR);
       DDLException excp (CAT_ONLY_SUPPORTING_RESTRICT_DROP_BEHAVIOR, NULL, 0);
       excp.throwException();
    }

    // Verify that the specified user name is not reserved
    // TBD - add the isCatman concept
    if (isAuthNameReserved(pNode->getDbUserName()))
    {
      *CmpCommon::diags() << DgSqlCode (-CAT_AUTH_NAME_RESERVED)
                          << DgString0(pNode->getDbUserName().data());
       DDLException excp (CAT_AUTH_NAME_RESERVED, NULL, 0);
       excp.throwException();
    }

    // set up class members from parse node
    // Read the row from the AUTHS table
    const NAString dbUserName(pNode->getDbUserName());
    NAString sysCat = CmpSeabaseDDL::getSystemCatalogStatic();
    char buf[1000];
    str_sprintf(buf, "select auth_id, auth_db_name, auth_ext_name, auth_type, auth_creator, auth_is_valid, auth_create_time, auth_redef_time from %s.\"%s\".%s where auth_db_name = '%s' ",
              sysCat.data(), SEABASE_MD_SCHEMA, SEABASE_AUTHS, dbUserName.data());

    NAString cmd (buf);
    if (!selectExactRow(cmd))
    {
      // TBD - add CQD to return okay if user has already been unregistered
      *CmpCommon::diags() << DgSqlCode(-CAT_USER_NOT_EXIST)
                          << DgString0(dbUserName.data());
       DDLException excp (CAT_USER_NOT_EXIST, NULL, 0);
       excp.throwException();
    }

    // Cannot unregister immutable users
    if (isAuthImmutable())
    {
      *CmpCommon::diags() << DgSqlCode(-1387);
       DDLException excp (1387, NULL, 0);
       excp.throwException();
    }

    // TBD, check to see if the user owns anything before removing

    // delete the row
    deleteRow(getAuthDbName());
  }
  catch (...)
  {
    // At this time, an error should be in the diags area.
    // If there is no error, set up an internal error
    Int32 numErrors = CmpCommon::diags()->getNumber(DgSqlCode::ERROR_);
    if (numErrors == 0)
      *CmpCommon::diags() << DgSqlCode (-CAT_INTERNAL_EXCEPTION_ERROR)
                          << DgInt0(__LINE__)
                          << DgString0("unregister user");

  }
}
Exemplo n.º 29
0
void FenPrincipale::createActions()
{
    newLetterAct = new QAction(QIcon(":/images/new.png"), tr("&New Letter"),
                               this);
    newLetterAct->setShortcuts(QKeySequence::New);
    newLetterAct->setStatusTip(tr("Create a new form letter"));
    connect(newLetterAct, SIGNAL(triggered()), this, SLOT(newLetter()));

    saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save..."), this);
    saveAct->setShortcuts(QKeySequence::Save);
    saveAct->setStatusTip(tr("Save the current form letter"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    printAct = new QAction(QIcon(":/images/print.png"), tr("&Print..."), this);
    printAct->setShortcuts(QKeySequence::Print);
    printAct->setStatusTip(tr("Print the current form letter"));
    connect(printAct, SIGNAL(triggered()), this, SLOT(print()));

    undoAct = new QAction(QIcon(":/images/undo.png"), tr("&Undo"), this);
    undoAct->setShortcuts(QKeySequence::Undo);
    undoAct->setStatusTip(tr("Undo the last editing action"));
    connect(undoAct, SIGNAL(triggered()), this, SLOT(undo()));

    quitAct = new QAction(tr("&Quit"), this);
    quitAct->setShortcuts(QKeySequence::Quit);
    quitAct->setStatusTip(tr("Quit the application"));
    connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

     ajoutLigne = new QAction(tr("ajout ss"),this);
     ajoutLigne->setStatusTip(tr("ajout station Stationnées"));
     connect (ajoutLigne, SIGNAL(triggered()),this, SLOT(insertRowss()));

     ajoutLigneMesures = new QAction(tr("ajout pt"),this);
     ajoutLigneMesures->setStatusTip(tr("ajout point rayonnnés"));
     connect (ajoutLigneMesures, SIGNAL(triggered()),this, SLOT(insertRow()));


     supprLigneMesures = new QAction (tr("suppr mesures"),this);
     supprLigneMesures->setStatusTip (tr("supprimer un points"));
     supprLigneMesures->setShortcuts(QKeySequence::Delete);
     connect (supprLigneMesures, SIGNAL(triggered()),this, SLOT(deleteRow()));

     supprLigne = new QAction (tr("suppr ss"),this);
     supprLigne->setStatusTip (tr("supprimer une ss"));
     supprLigne->setShortcuts(QKeySequence::Delete);
     connect (supprLigne, SIGNAL(triggered()),this, SLOT(deleteRowss()));

     submitSS = new QAction (tr("conf action"),this);
     submitSS->setStatusTip (tr("confirmer  les changements"));
     connect (submitSS , SIGNAL (triggered()),this, SLOT (submitChangement()));


    importGSI = new QAction (tr ("Importation Gsi"),this);
    importGSI->setStatusTip(tr("Importation de carnet"));
    connect (importGSI, SIGNAL(triggered()),this, SLOT(ImportGSI2()));

    actionafficherPolygonal = new QAction (tr ("Affichage de la poloygo"),this);
    connect (actionafficherPolygonal, SIGNAL(triggered()), this, SLOT(afficherPolygonal()));

    actioncreerProjet = new QAction (tr("Créer projet"),this);
    connect ( actioncreerProjet,SIGNAL(triggered()), this, SLOT(creerProjet()));

    actionouvrirProjet = new QAction (tr("Ouvrir projet"),this);
    connect (actionouvrirProjet,SIGNAL(triggered()), this, SLOT(ouvrirProjet()));


}
Exemplo n.º 30
0
 void FenPrincipale::on_pushButton_2_clicked()
 {
     deleteRow();
 }