Beispiel #1
0
/*!
 * \en	Constructor. \_en
 * \ru	Конструктор.
 * 	Задает значение ширины по умолчанию для столбца = 100. \_ru
 */
wDBTable::wDBTable( QString objtype,  QWidget *parent, const char *name )
    : Q3DataTable( parent, name )
{
//	vId = 0;
//	verticalHeader()->hide();
	setLeftMargin(0);
	setNullText("");
	objtype = "";
	defColWidth = 100; //default column width
	tableInd = -1;
	inEditMode = false;
	searchWidget = 0;
	searchMode = false;
	searchString = "";
	connect( this, SIGNAL(cursorChanged ( QSql::Op ) ), this, SLOT(lineUpdate( QSql::Op ) ) );
	connect( this, SIGNAL(currentChanged ( int, int ) ), this, SLOT(lineChange( int, int ) ) );
	connect( this, SIGNAL(beforeInsert ( QSqlRecord* ) ), this, SLOT(lineInsert( QSqlRecord* ) ) );
	connect( this, SIGNAL(valueChanged ( int, int )  ), this, SLOT(updateTableCellHandler(int, int ) ) );
	connect( this, SIGNAL(doubleClicked ( int, int, int, const QPoint&) ), this, SLOT(doubleClickEventHandler(int,int,int, const QPoint&)));
	init();


	aLog::print(aLog::Debug, tr("wDBTable init ok"));
//	printf("ok init wdbtable\n");

}
Beispiel #2
0
bool Q3DataBrowser::deleteCurrent()
{
    if (isReadOnly())
        return false;
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return false;
    writeFields();
    int n = cur->at();
    emit beforeDelete(buf);
    int ar = cur->del();
    if (ar) {
        refresh();
        updateBoundary();
        cursorChanged(Q3SqlCursor::Delete);
        if (!cur->seek(n))
            last();
        if (cur->isValid()) {
            cur->editBuffer(true);
            readFields();
        } else {
            clearValues();
        }
        return true;
    } else {
        if (!cur->isActive()) {
            handleError(cur->lastError());
            refresh();
            updateBoundary();
        }
    }
    return false;
}
void QUProfileController::setCursor(qint64 pos)
{
    if( m_cursorIndex == pos) return;
    m_cursorIndex = pos;
    emit cursorChanged(pos);
    markDirty( Dirty::CURSOR_INDEX);
}
Beispiel #4
0
bool Q3DataBrowser::updateCurrent()
{
    if (isReadOnly())
        return false;
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return false;
    writeFields();
    emit beforeUpdate(buf);
    int ar = cur->update();
    if (!ar || !cur->isActive()) {
        handleError(cur->lastError());
        refresh();
        updateBoundary();
    } else {
        refresh();
        d->cur.findBuffer(cur->primaryIndex());
        updateBoundary();
        cur->editBuffer(true);
        cursorChanged(Q3SqlCursor::Update);
        readFields();
        return true;
    }
    return false;
}
Beispiel #5
0
SourceWindow::SourceWindow(const QString& fileName, QWidget* parent) :
	QPlainTextEdit(parent),
	m_fileName(fileName),
	m_highlighter(0),
	m_widthItems(16),
	m_widthPlus(12),
	m_widthLineNo(30),
	m_lineInfoArea(new LineInfoArea(this))
{
    // load pixmaps
    m_pcinner = UserIcon("pcinner");
    m_pcup = UserIcon("pcup");
    m_brkena = UserIcon("brkena");
    m_brkdis = UserIcon("brkdis");
    m_brktmp = UserIcon("brktmp");
    m_brkcond = UserIcon("brkcond");
    m_brkorph = UserIcon("brkorph");
    setFont(KGlobalSettings::fixedFont());
    setReadOnly(true);
    setViewportMargins(lineInfoAreaWidth(), 0, 0 ,0);
    setWordWrapMode(QTextOption::NoWrap);
    connect(this, SIGNAL(updateRequest(const QRect&, int)),
	    m_lineInfoArea, SLOT(update()));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorChanged()));

    // add a syntax highlighter
    if (QRegExp("\\.(c(pp|c|\\+\\+)?|CC?|h(\\+\\+|h|pp)?|HH?)$").indexIn(m_fileName) >= 0)
    {
	m_highlighter = new HighlightCpp(this);
    }
}
Beispiel #6
0
void SkinDocument::codeChanged()
{
    if(blockUpdate)
        return;

    if(editor->document()->isEmpty())
    {
        parseStatus = tr("Empty document");
        statusLabel->setText(parseStatus);
        return;
    }

    editor->clearErrors();
    parseStatus = model->changeTree(editor->document()->
                                    toPlainText().toAscii());
    if(skin_error_line() > 0)
        parseStatus = tr("Errors in document");
    statusLabel->setText(parseStatus);

    /* Highlighting if an error was found */
    if(skin_error_line() > 0)
    {
        editor->addError(skin_error_line());

        /* Now we're going to attempt parsing again at each line, until we find
           one that won't error out*/
        QTextDocument doc(editor->document()->toPlainText());
        int base = 0;
        while(skin_error_line() > 0 && !doc.isEmpty())
        {
            QTextCursor rest(&doc);

            for(int i = 0; i < skin_error_line(); i++)
                rest.movePosition(QTextCursor::NextBlock,
                                  QTextCursor::KeepAnchor);
            if(skin_error_line() == doc.blockCount())
                rest.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);

            rest.removeSelectedText();
            base += skin_error_line();

            skin_parse(doc.toPlainText().toAscii());

            if(skin_error_line() > 0)
                editor->addError(base + skin_error_line());

        }
    }

    if(editor->document()->toPlainText() != saved)
        emit titleChanged(titleText + QChar('*'));
    else
        emit titleChanged(titleText);

    model->render(project, &fileName);

    cursorChanged();

}
Beispiel #7
0
/*!
 * \author Ingemar Axelsson
 */
void CellDocument::mouseClickedOnCell(Cell *clickedCell)
{

    // 2006-04-25, AF
    if( lastClickedCell_ == clickedCell )
        return;
    else
        lastClickedCell_ = clickedCell;


    //Deselect all selection
    clearSelection();

    //Remove focus from old cell.
    if(getCursor()->currentCell()->isClosed())
    {
        getCursor()->currentCell()->child()->setReadOnly(true);
        getCursor()->currentCell()->child()->setFocus(false);
    }
    else
    {
        getCursor()->currentCell()->setReadOnly(true);
    }

    //Add focus to the cell clicked on.
    if(clickedCell->parentCell()->isClosed())
    {
        getCursor()->moveAfter(clickedCell->parentCell());
    }
    else
    {
        getCursor()->moveAfter(clickedCell); //Results in bus error why?
    }

    if( typeid(LatexCell) == typeid(*clickedCell))
    {
        LatexCell *latexcell = dynamic_cast<LatexCell*>(clickedCell);
        bool r =latexcell->isEvaluated();
        if(r==true)
        {
            latexcell->input_->setReadOnly(true);
            latexcell->setFocus(true);
        }
        else
        {
            latexcell->input_->setReadOnly(false);
        }
    }
    else
    {
        clickedCell->setReadOnly(false);
        clickedCell->setFocus(true);
    }
    emit cursorChanged();

}
Beispiel #8
0
/*!
 * \author Anders Fernström
 * \date 2006-04-26
 *
 * \brief Split current cell
 */
void CellDocument::cursorSplitCell()
{
    try
    {
        executeCommand( new SplitCellCommand() );
        emit cursorChanged();
    }
    catch( exception &e )
    {
        throw e;
    }
}
void VtkCustomInteractorStyle::OnKeyUp()
{
    switch (Interactor->GetKeyCode())
    {
    case 32: // Space
        _alternateMouseActions = false;
        emit cursorChanged(Qt::ArrowCursor);
        break;
    default:
        vtkInteractorStyleTrackballCamera::OnKeyUp();
    }
}
Beispiel #10
0
/*!
 * \author Ingemar Axelsson and Anders Fernström
 * \date 2005-10-03 (update)
 *
 * 2005-10-03 AF, addad the try-catch expression
 */
void CellDocument::cursorAddCell()
{
    try
    {
        executeCommand(new AddCellCommand());
        open_ = true;
        emit cursorChanged();
    }
    catch( exception &e )
    {
        throw e;
    }
}
Beispiel #11
0
/*!
 * \author Ingemar Axelsson
 */
void CellDocument::cursorMoveAfter(Cell *aCell, const bool open)
{
    //if(!open)
    executeCommand(new CursorMoveAfterCommand(aCell));
    // else
    //       {
    //    if(aCell->hasChilds())
    //       executeCommand(new CursorMoveAfterCommand(aCell->child()));
    //    else
    //       executeCommand(new CursorMoveAfterCommand(aCell));
    //       }

    emit cursorChanged();
}
void MainWindow::createStatusBar()
{
    locationLabel = new QLabel("0, 0");
    locationLabel->setAlignment(Qt::AlignHCenter);
    locationLabel->setMinimumSize(locationLabel->sizeHint());

    zoomFactorLabel = new QLabel(tr("Zoom factor") + ": 1.0");

    statusBar()->addWidget(locationLabel);
    statusBar()->addWidget(zoomFactorLabel);
    connect(painter, SIGNAL(cursorChanged()),
            this, SLOT(updateStatusBar()));
    connect(painter, SIGNAL(zoomFactorChanged()),
            this, SLOT(updateStatusBar()));
    updateStatusBar();
}
QFCompleterTextEditWidget::QFCompleterTextEditWidget(QWidget *parent)
    : QTextEdit(parent), c(0)
{
    commentString="//";
    currentlySearching=false;
    currentlyReplacing=false;
    searchPhrase="";
    replacePhrase="";
    searchFromStart=false;
    matchCase=false;
    wholeWords=false;
    replaceAll=false;
    askBeforeReplace=false;
    tabwidth=2;
    setLineWrapMode(QTextEdit::NoWrap);
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorChanged()));
}
Beispiel #14
0
void MainWindow::statusBarCreate(void)
{
	m_statusPositionLabel = new QLabel(this);
	m_statusPositionLabel->setAlignment(Qt::AlignHCenter);
	m_statusPositionLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_statusPositionLabel->setLineWidth(1);

	m_statusMessageLabel = new QLabel(this);
	m_statusMessageLabel->setAlignment(Qt::AlignLeft);
	m_statusMessageLabel->setIndent(3);
	m_statusMessageLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_statusMessageLabel->setLineWidth(1);

	statusBar()->addWidget(m_statusPositionLabel);
	statusBar()->addWidget(m_statusMessageLabel, 1);

	connect(m_editBox, SIGNAL(cursorChanged()),
		this, SLOT(statusBarUpdate()));

	m_statusReady = true;
}
Beispiel #15
0
VisualizationWidget::VisualizationWidget( QWidget* parent /*= 0*/ )
	: QWidget(parent)
{
	this->setupUi(this);

	_interactorStyle = VtkCustomInteractorStyle::New();
	vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(_interactorStyle);

	_vtkPickCallback = VtkPickCallback::New();
	vtkSmartPointer<vtkCellPicker> picker = vtkSmartPointer<vtkCellPicker>::New();
	picker->AddObserver(vtkCommand::EndPickEvent, _vtkPickCallback);
	vtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(picker);

	vtkRenderWindow* renderWindow = vtkWidget->GetRenderWindow();
	renderWindow->StereoCapableWindowOn();
	renderWindow->SetStereoTypeToCrystalEyes();
	_vtkRender = vtkRenderer::New();
	renderWindow->AddRenderer(_vtkRender);
	_interactorStyle->SetDefaultRenderer(_vtkRender);

	QSettings settings;

	_vtkRender->SetBackground(0.0,0.0,0.0);

	// Create an orientation marker using vtkAxesActor
	vtkSmartPointer<vtkAxesActor> axesActor = vtkSmartPointer<vtkAxesActor>::New();
	vtkOrientationMarkerWidget* markerWidget = vtkOrientationMarkerWidget::New();
	markerWidget->SetOrientationMarker(axesActor);
	//markerWidget->SetViewport(0.0, 0.0, 0.15, 0.3); // size
	markerWidget->SetInteractor(vtkWidget->GetRenderWindow()->GetInteractor());
	markerWidget->EnabledOn();
	markerWidget->InteractiveOff();

	_isShowAllOnLoad = settings.value("resetViewOnLoad", true).toBool();

	// Set alternate cursor shapes
	connect(_interactorStyle, SIGNAL(cursorChanged(Qt::CursorShape)),
	        this, SLOT(setCursorShape(Qt::CursorShape)));
}
Beispiel #16
0
void SkinDocument::setupUI()
{
    /* Setting up the text edit */
    layout = new QHBoxLayout;
    editor = new CodeEditor(this);
    editor->setLineWrapMode(QPlainTextEdit::NoWrap);
    layout->addWidget(editor);

    setLayout(layout);

    /* Attaching the syntax highlighter */
    highlighter = new SkinHighlighter(editor->document());

    /* Setting up the model */
    model = new ParseTreeModel("");

    /* Connecting the editor's signal */
    QObject::connect(editor, SIGNAL(textChanged()),
                     this, SLOT(codeChanged()));
    QObject::connect(editor, SIGNAL(cursorPositionChanged()),
                     this, SLOT(cursorChanged()));

    settingsChanged();
}
Beispiel #17
0
bool QDataBrowser::insertCurrent()
{
    if ( isReadOnly() )
	return FALSE;
    QSqlRecord* buf = d->frm.record();
    QSqlCursor* cur = d->cur.cursor();
    if ( !buf || !cur )
	return FALSE;
    writeFields();
    emit beforeInsert( buf );
    int ar = cur->insert();
    if ( !ar || !cur->isActive() ) {
	handleError( cur->lastError() );
	refresh();
	updateBoundary();
    } else {
	refresh();
	d->cur.findBuffer( cur->primaryIndex() );
	updateBoundary();
	cursorChanged( QSqlCursor::Insert );
	return TRUE;
    }
    return FALSE;
}
Beispiel #18
0
/*!
 * \author Anders Fernström
 * \date 2006-02-03
 *
 * \brief set focus on output part in inputcell
 */
void CellDocument::mouseClickedOnCellOutput(Cell *clickedCell)
{
    clearSelection();

    //Remove focus from old cell.
    if(getCursor()->currentCell()->isClosed())
    {
        getCursor()->currentCell()->child()->setReadOnly(true);
        getCursor()->currentCell()->child()->setFocus(false);
    }
    else
    {
        getCursor()->currentCell()->setReadOnly(true);
    }

    //Add focus to the cell clicked on.
    if(clickedCell->parentCell()->isClosed())
    {
        getCursor()->moveAfter(clickedCell->parentCell());
    }
    else
    {
        getCursor()->moveAfter(clickedCell); //Results in bus error why?
    }

    if( typeid(InputCell) == typeid(*clickedCell))
    {
        InputCell *inputcell = dynamic_cast<InputCell*>(clickedCell);
        inputcell->setReadOnly(false);
        inputcell->setFocusOutput(true);
    }
    else if(typeid(GraphCell) == typeid(*clickedCell))
    {
        GraphCell *graphcell = dynamic_cast<GraphCell*>(clickedCell);
        graphcell->setReadOnly(false);
        graphcell->setFocusOutput(true);
    }

    else if(typeid(LatexCell) == typeid(*clickedCell))
    {
        LatexCell *latexcell = dynamic_cast<LatexCell*>(clickedCell);
        //latexcell->setReadOnly(false);
        latexcell->setFocusOutput(true);
        latexcell->output_->setReadOnly(false);
        /* QString text=latexcell->textOutput();
         if(!text.isEmpty())
         {
             latexcell->output_->hide();
             latexcell->input_->show();
             latexcell->hideButton->show();
         } */
    }

    else
    {
        clickedCell->setReadOnly(false);
        clickedCell->setFocus(true);
    }

    emit cursorChanged();
}
Beispiel #19
0
/*!
 * \author Ingemar Axelsson
 */
void CellDocument::cursorStepDown()
{
    executeCommand(new CursorMoveDownCommand());
    emit cursorChanged();
}
Beispiel #20
0
VisualizationWidget::VisualizationWidget( QWidget* parent /*= 0*/ )
	: QWidget(parent)
{
	this->setupUi(this);

	_interactorStyle = VtkCustomInteractorStyle::New();
	vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(_interactorStyle);

	_vtkPickCallback = VtkPickCallback::New();
	vtkSmartPointer<vtkCellPicker> picker = vtkSmartPointer<vtkCellPicker>::New();
	picker->AddObserver(vtkCommand::EndPickEvent, _vtkPickCallback);
	vtkWidget->GetRenderWindow()->GetInteractor()->SetPicker(picker);

	// BUG Render Window conflicts with VREDs render window
#ifndef OGS_VRED_PLUGIN
	vtkRenderWindow* renderWindow = vtkWidget->GetRenderWindow();
	renderWindow->StereoCapableWindowOn();
	renderWindow->SetStereoTypeToCrystalEyes();
	_vtkRender = vtkRenderer::New();
	renderWindow->AddRenderer(_vtkRender);
	_interactorStyle->SetDefaultRenderer(_vtkRender);
#endif // OGS_VRED_PLUGIN

	QSettings settings("UFZ", "OpenGeoSys-5");

#ifdef OGS_USE_VRPN
	VtkTrackedCamera* cam = new VtkTrackedCamera(this);
	_vtkRender->SetActiveCamera(cam);
	connect( cam, SIGNAL(viewUpdated()), this, SLOT(updateView()) );

	//QSpaceNavigatorClient* spacenav = QSpaceNavigatorClient::Instance();
	//spacenav->init("spacenav@localhost", 1000 / 15, SpaceNavigatorClient::Z);
	//cam->setFocalPoint(0, 5.0, 0.5);
	//cam->updateView();
	//spacenav->setTranslationFactor(2.0);
	//connect( spacenav, SIGNAL(translated(double, double, double)), cam, SLOT(setTrackingData(double, double, double)) );
	//connect( spacenav, SIGNAL(translated(double, double, double)), cam, SLOT(translate(double, double, double)) );

	QVrpnArtTrackingClient* art = QVrpnArtTrackingClient::Instance(this);
	if (settings.contains("Tracking/artDeviceName"))
	{
		QString deviceName = settings.value("Tracking/artDeviceName").toString();
		QString deviceNameAt = settings.value("Tracking/artDeviceNameAt").toString();
		art->StartTracking(QString(deviceName + "@" + deviceNameAt).toStdString().c_str(),
		                   settings.value("Tracking/artUpdateInterval").toInt());
	}
	else
		art->StartTracking("[email protected]");
	connect( art, SIGNAL(positionUpdated(double, double, double)),
	         cam, SLOT(setTrackingData(double, double, double)) );

	// Connect the vtk event to the qt slot
	_qtConnect = vtkEventQtSlotConnect::New();
	_qtConnect->Connect(vtkWidget->GetRenderWindow()->GetInteractor(),
	                    vtkCommand::EndInteractionEvent,
	                    cam,
	                    SLOT(updatedFromOutside()));

#endif // OGS_USE_VRPN

	_vtkRender->SetBackground(0.0,0.0,0.0);

	// Restore settings
	stereoToolButton->setChecked(settings.value("stereoEnabled").toBool());
	//if (settings.contains("stereoEyeAngle"))
	//	cam->SetEyeAngle(settings.value("stereoEyeAngle").toDouble());
	//else
	//	cam->SetEyeAngle(2.0);
/*
    if (!stereoToolButton->isChecked())
    {
        eyeAngleLabel->setEnabled(false);
        eyeAngleSlider->setEnabled(false);
    }
 */
	//eyeAngleSlider->setValue((int)(_vtkRender->GetActiveCamera()->GetEyeAngle() * 10));

	// Create an orientation marker using vtkAxesActor
	vtkSmartPointer<vtkAxesActor> axesActor = vtkSmartPointer<vtkAxesActor>::New();
	vtkOrientationMarkerWidget* markerWidget = vtkOrientationMarkerWidget::New();
	markerWidget->SetOrientationMarker(axesActor);
	//markerWidget->SetViewport(0.0, 0.0, 0.15, 0.3); // size
	markerWidget->SetInteractor(vtkWidget->GetRenderWindow()->GetInteractor());
	markerWidget->EnabledOn();
	markerWidget->InteractiveOff();

	_isShowAllOnLoad = true;

	// Set alternate cursor shapes
	connect(_interactorStyle, SIGNAL(cursorChanged(Qt::CursorShape)),
	        this, SLOT(setCursorShape(Qt::CursorShape)));
}
Beispiel #21
0
void KoToolBase::useCursor(const QCursor &cursor)
{
    Q_D(KoToolBase);
    d->currentCursor = cursor;
    emit cursorChanged(d->currentCursor);
}
Beispiel #22
0
SourceEdit::SourceEdit(QWidget * parent): QTextEdit(parent), m_line(0), m_lineRect(lineRect())
{
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorChanged()));
}
Beispiel #23
0
/*!
 * \author Ingemar Axelsson
 */
void CellDocument::cursorStepUp()
{
    executeCommand(new CursorMoveUpCommand());
    emit cursorChanged();
}