コード例 #1
0
ファイル: qmvtable.cpp プロジェクト: rmcm/xpracman-qt2-final
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
void QmvTable::activateNextCell()
{
    
    int col = currentColumn() + 1;
    int row = currentRow();

    bool eot = false;
    
    if ( col >= numCols() )
        if ( row >= numRows() )
            col--;
        else
        {
            col = 0;
            if ( row < (numRows() - 1) )
                row++;
            else
                eot = true;
        }

    setCurrentCell( row, col );
        // if we are in the last cell of table, the edit will not
        // automatically end the edit.
    if ( eot )
        editCompleted();
    
    ensureCellVisible( row, col );
}
コード例 #2
0
ファイル: FLDataTable.cpp プロジェクト: gestiweb/eneboo
void FLDataTable::selectRow(int r, int c)
{
  if (!cursor_ || !cursor_->metadata())
    return ;

  if (r < 0) {
    if (cursor_->isValid()) {
      rowSelected = cursor_->at();
      colSelected = currentColumn();
    } else {
      rowSelected = 0;
      colSelected = 0;
    }
  } else {
    rowSelected = r;
    colSelected = c;
  }

  QObject *snd = const_cast<QObject *>(sender());
  if (!snd || (snd && !snd ->isA("FLSqlCursor"))) {
    QWidget *sndw = ::qt_cast<QWidget *>(snd);
    if (sndw) {
      if (!sndw->hasFocus() || !sndw->isVisible()) {
        setCurrentCell(rowSelected, colSelected);
        return ;
      }
    }
    if (numRows() != cursor_->size())
      setNumRows(cursor_->size());
    cursor_->seek(rowSelected);
  }
  setCurrentCell(rowSelected, colSelected);
}
コード例 #3
0
void Spreadsheet::findPrevious(const QString &str, Qt::CaseSensitivity cs)
{
    int row = currentRow();
    int column = currentColumn() - 1;

    while(row >= 0)
    {
        while(column >= 0)
        {
            if(text(row, column).contains(str, cs))
            {
                clearSelection();
                setCurrentCell(row, column);
                activateWindow();
                return;
            }

            --column;
        }

        column = ColumnCount - 1;
        --row;
    }

    QApplication::beep();
}
コード例 #4
0
QString cCustomTitleModelTable::GetCurrentModel() {
    if (!ModelTable) return "";
    CurrentSel=currentRow()*columnCount()+currentColumn();
    if (CurrentSel>=ModelTable->List.count()) CurrentSel=ModelTable->List.count()-1;
    if ((CurrentSel>=0)&&(CurrentSel<ModelTable->List.count())) return ModelTable->List[CurrentSel]->Name;
    return "";
}
コード例 #5
0
ファイル: mtable.cpp プロジェクト: Klunkerball/EGSnrc
void MTable::stopEditing()
{
     int cCol = currentColumn();
     int cRow = currentRow();

     endEdit( cRow, cCol, TRUE, TRUE );
}
コード例 #6
0
void Spreadsheet::findNext(const QString &str, Qt::CaseSensitivity cs)
{
    int row = currentRow();
    int column = currentColumn() + 1;

    while(row < RowCount)
    {
        while(column < ColumnCount)
        {
            if(text(row,column).contains(str, cs))
            {
                clearSelection();
                setCurrentCell(row, column);
                activateWindow();
                return;
            }

            ++column;
        }

        column = 0;
        ++row;
    }

    QApplication::beep();
}
void UISpreadsheet::somethingChanged()
{
    /*
    if (autoRecalc)
        recalculate();
        */
  //  emit modified();

   UICell *c = cell(currentRow(),currentColumn());
   c->setCell(spreadSheet->getCell(currentRow(),currentColumn()));
   c->setWidget(this);
   c->update();
   cout<<"something changeeeeeeeeeeeeeeeeeeeeeeeeeeee"<<endl;
  // this->setCurrentCell(currentRow()+1,currentColumn());

}
コード例 #8
0
void NShortcutEditorWidget::keyPressEvent(QKeyEvent *e)
{
    QTableWidgetItem *currentItem = item(currentRow(), currentColumn());
    QString text = currentItem->text();

    int keyInt = e->key();
    bool modifiers = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier | Qt::MetaModifier);

    if (!modifiers && (keyInt == Qt::Key_Delete || keyInt == Qt::Key_Backspace)) {
        currentItem->setText("");
        return;
    }

    QString shortcut = keyEventToString(e);
    if (shortcut == "") {
        QTableWidget::keyPressEvent(e);
        return;
    }

    if (text.split(", ").size() >= 3)
        text = "";

    if (!text.isEmpty())
        text += ", ";

    currentItem->setText(text + shortcut);
}
コード例 #9
0
ファイル: wdbtable.cpp プロジェクト: K-Be/ananas-labs-qt4
bool
wDBTable::searchColumn( const QString & text, bool FromCurrent, bool Forward )
{

	QString s;
	uint curr = currentRow(), curc=currentColumn(), row = 0, idx;
	bool found = FALSE;
	aSQLTable *t = ( aSQLTable *) sqlCursor();

	if ( FromCurrent ) row = curr;
	if ( Forward ) row++; else row--;
	idx = indexOf( curc );

	while ( t->seek( row ) ){
		s = t->value( idx ).toString();
		if ( s.left( text.length() ) == text ) {
			found = TRUE;
			break;
		}
		if ( Forward ) row++; else row--;
	}
	if ( found ) {
		setCurrentCell( row, curc );
	};
	return found;
}
コード例 #10
0
/*
QWidget* KVocTrainTable::beginEdit(int row, int col, bool replace)
{
  if (KApplication::dcopClient()->isApplicationRegistered("kxkb"))
  {
    if (m_doc)
    {
      QString id = (col == KV_COL_ORG) ? m_doc->getOriginalIdent() : m_doc->getIdent(col - KV_EXTRA_COLS);

      if (langs)
      {
        QString kbLayout(langs->keyboardLayout(langs->indexShortId(id)));
        kdDebug() << "Keyboard Layout: " << kbLayout << endl;
        if (!kbLayout.isEmpty())
        {
          QByteArray data, replyData;
          QCString replyType;
          QDataStream arg(data, IO_WriteOnly);
          arg << kbLayout;

          if (!KApplication::dcopClient()->call("kxkb", "kxkb", "setLayout(QString)", data, replyType, replyData))
          {
            kdDebug() << "kxkb dcop error: beginEdit()" << endl;
          }
        }
      }
    }
  }
  return QTable::beginEdit(row, col, replace);
}

void KVocTrainTable::endEdit(int row, int col, bool accept, bool replace)
{
  QTable::endEdit(row, col, accept, replace);
}
*/
void KVocTrainTable::sortByColumn(int header, bool alpha) {
  if (header == KV_COL_MARK)
    return;

  if (header >= numRows()) {
    kdError() << "header >= numRows()\n";
    return;
  }

  if (m_doc && !m_doc->isAllowedSorting()) {
    KMessageBox::information(this, i18n("Sorting is currently turned off for this document.\n"
      "\nUse the document properties dialog to turn sorting on."), kapp->makeStdCaption(""));
    return;
  }

  QApplication::setOverrideCursor(waitCursor);

  clearSelection();

  bool sortdir = false;
  if (m_doc) {
    if (header >= KV_COL_ORG)
      sortdir = m_doc->sort(header-KV_EXTRA_COLS);
    else
      if (alpha)
        sortdir = m_doc->sortByLesson_alpha();
    else
      sortdir = m_doc->sortByLesson_index();
  }
  horizontalHeader()->setSortIndicator(header, sortdir);
  repaintContents();
  m_doc->setModified();
  emit currentChanged(currentRow(), currentColumn());
  QApplication::restoreOverrideCursor();
}
コード例 #11
0
ファイル: wdbtable.cpp プロジェクト: K-Be/ananas-labs-qt4
/*!
 *	\~english
 *	Delete line function
 *	\~russian
 *	Функция удаления строки.
 *	\~
 *	\return \~english true, if no error \~russian true, если ошибок не было \~
 */
bool
wDBTable::deleteCurrent()
{
	bool res;
	res = Q3DataTable::deleteCurrent();
	emit(updateCurr(currentRow(),currentColumn()));
	return res;

}
コード例 #12
0
ファイル: maillistview.cpp プロジェクト: muromec/qtopia-ezx
// Keep the list of message headers scrolled hard to the left
void MailListView::scrollToLeft(int)
{
    // In right to left mode when the horizontal header is hidden a
    // phantom 70 pixel column appears. Scroll this out of the way.
    // It would be better to fix this elsewhere (in QTableWidget?)
    if (currentColumn() != 0)
        setCurrentCell( currentRow(), 0 );
    horizontalScrollBar()->setValue( 0 );
}
コード例 #13
0
ファイル: qmvtable.cpp プロジェクト: rmcm/xpracman-qt2-final
// ----------------------------------------------------------------------
// --------------------------------------------------------------------------------
void QmvTable::contentsMousePressEvent( QMouseEvent * mre )
{
        // are we moving to a new cell?
    is_current_cell = ( rowAt(mre->y()) == currentRow() )
        && (columnAt(mre->x()) == currentColumn() );
    
        // The order of events is PRESS/RELEASE/DOUBLECLICK/RELEASE
        // Flag the press, to differentiate the susequent release events.
    first_click = true;
    QTable::contentsMousePressEvent( mre );
}
コード例 #14
0
ファイル: wdbtable.cpp プロジェクト: K-Be/ananas-labs-qt4
bool
wDBTable::beginInsert() {
	if ( !sqlCursor() || isReadOnly() || !numCols() )
		return FALSE;
    if ( !sqlCursor()->canInsert() )
		return FALSE;

	bool result = Q3DataTable::beginInsert();
	endEdit( currentRow(), currentColumn(), false, false);
	setCurrentCell( numRows(), 0 );
	return result;

}
コード例 #15
0
ファイル: tupframestable.cpp プロジェクト: nanox/tupi
void TupFramesTable::emitFrameSelected(QTableWidgetItem *current, QTableWidgetItem *prev)
{
    Q_UNUSED(prev);

    TupFramesTableItem *item = dynamic_cast<TupFramesTableItem *>(current);
    
    if (item) {
        if (item->isUsed())
            emit emitRequestChangeFrame(k->sceneIndex, verticalHeader()->visualIndex(this->row(item)), this->column(item));
            // emit frameRequest(TupProjectActionBar::SelectFrame, this->column(item), verticalHeader()->visualIndex(this->row(item)), -1);
        else
            tFatal() << "TupFramesTable::emitFrameSelected <- item exists but isn't used right now";
    } else { 
        emit frameRequest(TupProjectActionBar::InsertFrame, currentColumn(), currentRow(), k->sceneIndex);
    }
}
コード例 #16
0
ファイル: pagepalette.cpp プロジェクト: ivro/scribus
void SeView::keyPressEvent(QKeyEvent * e)
{
	int k = e->key();
	if (k == Qt::Key_Delete)
	{
		e->accept();
		if (!QMessageBox::question(this, tr("Delete Page?"),
			 "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
						 CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 ))
		{
			bool dummy;
			int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
			emit DelPage(pageToDelete);
		}
	}
}
コード例 #17
0
void SeView::keyPressEvent(QKeyEvent * e)
{
	bool accepted = false;
	int k = e->key();
	if (k == Qt::Key_Delete)
	{
		e->accept();
		if (ScMessageBox::question(this, tr("Delete Page?"),
			 "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
			QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
		{
			bool dummy;
			int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy);
			emit DelPage(pageToDelete);
		}
		accepted = true;
	}
	if (!accepted)
		QTableWidget::keyPressEvent(e);
}
コード例 #18
0
ファイル: bltreewidget.cpp プロジェクト: JustDevZero/bulmages
/**
\return
**/
void BlTreeWidget::contextMenuEvent ( QContextMenuEvent * )
{
    BL_FUNC_DEBUG

    int column = currentColumn();
    
    if ( column < 0 ) return;

    QMenu *menu = new QMenu ( this );

    /// Lanzamos el evento para que pueda ser capturado por terceros.
    emit pintaMenu ( menu );

    /// Lanzamos la propagaci&oacute;n del men&uacute; a trav&eacute;s de las clases derivadas.
    createMenu ( menu );

    QAction *adjustColumnSize = menu->addAction ( _ ( "Ajustar columa" ) );
    QAction *adjustAllColumnsSize = menu->addAction ( _ ( "Ajustar columnas" ) );
    QAction *menuOption = menu->exec ( QCursor::pos() );

    /// Si no hay ninguna opci&oacute;n pulsada se sale sin hacer nada.
    if ( !menuOption ) return;

    if ( menuOption == adjustAllColumnsSize ) {

	for (int i = 0; i < columnCount(); i++) {
	    resizeColumnToContents (i);
	} // end for
	
    } else if ( menuOption == adjustColumnSize )  {
        resizeColumnToContents ( column );
    } // end if

    emit trataMenu ( menuOption );

    /// Activamos las herederas.
    execMenuAction ( menuOption );

    delete menu;
}
コード例 #19
0
ファイル: qmvtable.cpp プロジェクト: rmcm/xpracman-qt2-final
// ----------------------------------------------------------------------
bool QmvTable::eventFilter( QObject *o, QEvent *e )
{
#ifdef QMVTABLE_DEBUG
    const char *name = o ? o->name() : "NO_OBJECT";
    const char *classname = o ? o->className() : "NO_CLASS";
    int etype = e ? e->type() : -9999;
//    qDebug( "%-20.20s::eventFilter(%20.20s/%20.20s, %6d)", "QmvTable", name, classname, etype );
#endif
    // test disabing this eventfilter while tracing crash - Issue#324
    // return QTable::eventFilter( o, e );
    if ( !o || !e )
  	return true;

    if ( e->type() == QEvent::KeyPress )
    {
        QKeyEvent *ke = (QKeyEvent *) e;

            // keyboard row select.
        if ( ke->key() == Key_Return || ke->key() == Key_Enter )
            if  ( ke->state() & AltButton )
            {
                    // the mouse point is a fake - TODO: decide what to make it.
                emit clicked( currentRow(), currentColumn(), 1, QPoint(0,0) );
                return true;
            } else {
                activateNextCell();
                return true;
            }
        
    }

        // focus out - do nothing
        // TODO:  popup a reminder to do something
    if ( e->type() == QEvent::FocusOut )
        return true;
    
    return QTable::eventFilter( o, e );
}
コード例 #20
0
void KVocTrainTable::activateNextCell()
{
  int currRow = currentRow();
  int currCol = currentColumn();

  QTableSelection currentSel = selection(0);

  int tr = currentSel.topRow();
  int br = currentSel.bottomRow();
  int lc = currentSel.leftCol();
  int rc = currentSel.rightCol();

  if (currCol == rc)
  {
    if (currRow < br)
      setCurrentCell(currRow + 1, lc);
    else
      setCurrentCell(tr, lc);
  }
  else
    setCurrentCell(currRow, currCol + 1);

}
コード例 #21
0
ファイル: wdbtable.cpp プロジェクト: K-Be/ananas-labs-qt4
int
wDBTable::Select( ANANAS_UID db_uid )
{
	aSQLTable *t = ( aSQLTable *) sqlCursor();

//	printf("id = %Li\n",db_uid);
	ANANAS_UID cur_id = 0;
	uint curr = currentRow(), curc=currentColumn(), row = 0;
	bool found = FALSE;

	while ( t->seek( row ) ){
		cur_id = t->sysValue( "id" ).toULongLong();
		if ( cur_id == db_uid ) {
			found = TRUE;
			break;
		}
		row++;
	}
	if ( found ) {
		setCurrentCell( row, curc );
	} else setCurrentCell( curr, curc );
	return 0;
}
コード例 #22
0
void KVocTrainTable::updateContents(int row, int col)
{
  int current_row = row;
  if (current_row < 0)
    current_row = currentRow();
  int current_col = col;
  if (current_col < 0)
    current_col = currentColumn();
  int ncols, nrows;
  if (m_doc) {
    nrows = m_doc->numEntries();
    ncols = QMAX(1, m_doc->numLangs())+KV_EXTRA_COLS;
  }
  else {
    nrows = 0;
    ncols = 1+KV_EXTRA_COLS;
  }
  if (nrows != numRows()) {
    // remember number of new rows (typically one)
    unsigned int new_rows = QMAX(0, nrows - numRows());
    // adjust number of rows
    setNumRows(nrows);
    // adjust row heights for added rows
    for (int i=nrows-new_rows; i<nrows; ++i)
      setRowHeight(i, fontMetrics().lineSpacing());
  }
  if (ncols != numCols())
    setNumCols(ncols);
  current_row = QMIN(current_row, QMAX(0, numRows()-1));
  current_col = QMIN(current_col, QMAX(0, numCols()-1));
  bool b = signalsBlocked();
  blockSignals(true);
  setCurrentRow(current_row, current_col);
  blockSignals(b);
  viewport()->update();
  emit currentChanged(current_row, current_col);
}
コード例 #23
0
void KVocTrainTable::contentsMousePressEvent(QMouseEvent * e)
{
  delayTimer->stop();
  int cc = columnAt(e->x());
  int cr = rowAt(e->y());
  int co = currentColumn();

  QTable::contentsMousePressEvent(e);

  if(cc >= KV_EXTRA_COLS) {
    // update color of original when column changes and more than 1 translation
    bool update_org = false;
    if (cc != co && numCols() > 2)
      update_org = true;

    int topCell = rowAt(0);
    int lastRowVisible = QMIN(numRows(), rowAt(contentsHeight()));
    if (update_org)
      for (int i = topCell; i <= lastRowVisible; i++)
        updateCell(i, KV_COL_ORG);
  }
  if(e->button() == LeftButton)
    setCurrentCell(cr, cc);
}
コード例 #24
0
void QCustomTableWidget::mousePressEvent(QMouseEvent *e)
{
    int rowPosition, columnPosition;
    QTableWidgetItem *qtwitem = itemAt(e->pos());
    switch (e->button())
    {
        case Qt::LeftButton:    {
                                    if (qtwitem && !qtwitem->isSelected())
                                    {
                                        QTableWidget::mousePressEvent(e);
                                    }
                                    else
                                    {
                                        setCurrentItem(0);
                                    }
                                    break;
                                }
        case Qt::RightButton:   {
                                    if (qtwitem)
                                    {
                                        setCurrentItem(qtwitem);
                                        rowPosition = visualRow(currentRow());
                                        columnPosition = visualColumn(currentColumn());
                                    }
                                    else
                                    {
                                        rowPosition = rowCount()-1;
                                        columnPosition = columnCount()-1;
                                    }
                                    QTableWidget::mousePressEvent(e);
                                        
                                    bool null = (qtwitem != 0);
                                    actionRemoveColumn->setVisible(null);
                                    actionEditColumn->setVisible(null);
                                    actionRemoveRow->setVisible(null);
                                    actionEditRow->setVisible(null);
                                    QAction* action = menu->exec(e->globalPos());
                                    if (action == actionAddColumn)
                                    {
                                        addProperty(columnPosition);
                                    }
                                    else if (action == actionRemoveColumn)
                                    {
                                        if (qtwitem)
                                        {
                                            removeProperty(columnPosition);
                                        }
                                    }
                                    else if (action == actionEditColumn)
                                    {
                                        if (qtwitem)
                                        {
                                            editProperty(columnPosition);
                                        }
                                    }
                                    else if (action == actionAddRow)
                                    {
                                        addCharacter(rowPosition);
                                    }
                                    else if (action == actionRemoveRow)
                                    {
                                        if (qtwitem)
                                        {
                                            removeCharacter(rowPosition);
                                        }
                                    }
                                    else if (action == actionEditRow)
                                    {
                                        if (qtwitem)
                                        {
                                            editCharacter(rowPosition);
                                        }
                                    }
                                    break;
                                }
        default:    break;
    }
}
コード例 #25
0
void QCustomTableWidget::keyReleaseEvent(QKeyEvent *e)
{
    QTableWidgetItem *item = currentItem();
    int row = visualRow(currentRow());
    int column = visualColumn(currentColumn());
    Qt::KeyboardModifiers modifs = e->modifiers();
    switch (e->key())
    {
        case Qt::Key_F2:    if (!bEditing)
                            {
                                if (modifs == Qt::ControlModifier)
                                {
                                    editProperty(column);
                                }
                                else if (modifs == (Qt::ControlModifier | Qt::ShiftModifier))
                                {
                                    editCharacter(row);
                                }
                                else if (item)
                                {
                                    bEditing = true;
                                    editItem(item);
                                } 
                            }
                            break;
        case Qt::Key_Delete:    if (!bEditing)
                                {
                                    if (modifs == Qt::ControlModifier)
                                    {
                                        removeProperty(column);
                                    }
                                    else if (modifs == (Qt::ControlModifier | Qt::ShiftModifier))
                                    {
                                        removeCharacter(row);
                                    }
                                    else if (item)
                                    {
                                        item->setText("0");
                                    }
                                }
                                break;
        case Qt::Key_Insert:    if (!bEditing)
                                {
                                    if (modifs == Qt::ControlModifier)
                                    {
                                        addProperty(column);
                                    }
                                    else if (modifs == (Qt::ControlModifier | Qt::ShiftModifier))
                                    {
                                        addCharacter(row);
                                    }
                                    else
                                    {
                                        QTableWidget::keyReleaseEvent(e);
                                    }
                                }
                                break;
        case Qt::Key_Return:
        case Qt::Key_Enter:
        case Qt::Key_Escape:    bEditing = false;
                                break;
        default:    QTableWidget::keyReleaseEvent(e); break; 
    }
}
コード例 #26
0
void KVocTrainTable::setCurrentItem(int row)
{
  setCurrentRow(row, currentColumn());
}
コード例 #27
0
void KVocTrainTable::paintCell(QPainter * p, int row, int col, const QRect & cr, bool selected, const QColorGroup &cg)
{
  if (cr.width() == 0 || cr.height() == 0)
    return;

  if (selected && row == currentRow() && col == currentColumn() && (hasFocus() || viewport()->hasFocus()))
    selected = false;

  int w = cr.width();
  int h = cr.height();
  int x2 = w - 1;
  int y2 = h - 1;

  p->fillRect( 0, 0, w, h, selected ? cg.brush( QColorGroup::Highlight ) : cg.brush( QColorGroup::Base ) );

  kvoctrainExpr *expr = getRow(row);
  if (expr)
  {
    p->save();
    //cell->paint(p, col, w, selected, m_doc, numCols() == KV_EXTRA_COLS+2 ? KV_COL_TRANS : currentColumn(), gradecols);

    QColor color = KV_NORM_COLOR;
    int current_col = numCols() == KV_EXTRA_COLS+2 ? KV_COL_TRANS : currentColumn();

    if (Prefs::useGradeCol())
    {
      if (col > KV_COL_ORG)
      {
        color = Prefs::gradeCol(0);
        if (expr->getQueryCount(col - KV_EXTRA_COLS, false) != 0)
        {
          switch (expr->getGrade(col-KV_EXTRA_COLS, false))
          {
            case KV_NORM_GRADE: color = Prefs::gradeCol(0); break;
            case KV_LEV1_GRADE: color = Prefs::gradeCol(1); break;
            case KV_LEV2_GRADE: color = Prefs::gradeCol(2); break;
            case KV_LEV3_GRADE: color = Prefs::gradeCol(3); break;
            case KV_LEV4_GRADE: color = Prefs::gradeCol(4); break;
            case KV_LEV5_GRADE: color = Prefs::gradeCol(5); break;
            case KV_LEV6_GRADE: color = Prefs::gradeCol(6); break;
            case KV_LEV7_GRADE: color = Prefs::gradeCol(7); break;
            default           : color = Prefs::gradeCol(1);
          }
        }
      }
      else if ( col == KV_COL_ORG )
      {
        color = Prefs::gradeCol(0);
        if (expr->numTranslations() != 0 && current_col > KV_COL_ORG )
        {
          if (expr->getQueryCount(current_col - KV_EXTRA_COLS, true) != 0 )
          {
            switch (expr->getGrade(current_col - KV_EXTRA_COLS, true))
            {
              case KV_LEV1_GRADE: color = Prefs::gradeCol(1); break;
              case KV_LEV2_GRADE: color = Prefs::gradeCol(2); break;
              case KV_LEV3_GRADE: color = Prefs::gradeCol(3); break;
              case KV_LEV4_GRADE: color = Prefs::gradeCol(4); break;
              case KV_LEV5_GRADE: color = Prefs::gradeCol(5); break;
              case KV_LEV6_GRADE: color = Prefs::gradeCol(6); break;
              case KV_LEV7_GRADE: color = Prefs::gradeCol(7); break;
              default           : color = Prefs::gradeCol(1);
            }
          }
        }
      }
    }

    if (selected)
      p->setPen (cg.highlightedText());
    else
      p->setPen (color);

    int fontpos = (p->fontMetrics().lineSpacing() - p->fontMetrics().lineSpacing()) / 2;

    switch (col)
    {
      case KV_COL_LESS: // lesson
      {
        QString less_str;
        if (m_doc != 0 && expr->getLesson() != 0)
          less_str = m_doc->getLessonDescr(expr->getLesson());
        p->drawText( 3, fontpos, w, p->fontMetrics().lineSpacing(), Qt::AlignLeft, less_str);
      }
      break;

      case KV_COL_MARK: // mark
      {
        if (!expr->isActive())
        {
          p->drawPixmap((w - m_pixInactive.width()) / 2,
                         (p->fontMetrics().lineSpacing() - m_pixInactive.height())/2, m_pixInactive);
        }
        else if (expr->isInQuery() )
        {
          p->drawPixmap((w - m_pixInQuery.width()) / 2,
                         (p->fontMetrics().lineSpacing() - m_pixInQuery.height())/2, m_pixInQuery);
        }
      }
      break;

      case KV_COL_ORG: // original
      {
        QString s = expr->getOriginal();
        p->drawText(3, fontpos, w - 6, p->fontMetrics().lineSpacing(), cellAlignment(s), s);
      }
      break;

      default: // translation x
        QString s = expr->getTranslation(col - KV_COL_ORG);
        p->drawText(3, fontpos, w - 6, p->fontMetrics().lineSpacing(), cellAlignment(s), s);
        break;
    }
    p->restore();
  }

  QPen pen( p->pen() );
  int gridColor = style().styleHint( QStyle::SH_Table_GridLineColor, this );
  if (gridColor != -1) {
    const QPalette &pal = palette();
    if (cg != colorGroup()
        && cg != pal.disabled()
        && cg != pal.inactive())
      p->setPen(cg.mid());
    else
      p->setPen((QRgb)gridColor);
  } else {
    p->setPen(cg.mid());
  }
  p->drawLine( x2, 0, x2, y2 );
  p->drawLine( 0, y2, x2, y2 );
  p->setPen( pen );
}
コード例 #28
0
void KVocTrainTable::slotSelectionChanged()
{
  emit currentChanged(currentRow(), currentColumn());
}
コード例 #29
0
QString Spreadsheet::currentFormula() const
{
    return formula(currentRow(), currentColumn());
}
コード例 #30
0
ファイル: qmvtable.cpp プロジェクト: rmcm/xpracman-qt2-final
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
void QmvTable::editCompleted()
{
    editCompleted( currentRow(), currentColumn() );
}