Esempio n. 1
0
void LogTextEdit::appendLog(const QString &logText)
{
	setPlainText(toPlainText() + logText);
}
Esempio n. 2
0
void DiagrammTextItem::setText(const QString & text){
    setPlainText(text);
}
void DisplayStats::updateStatsText(int p_ants, int p_doodlebugs, int p_stepCount)
{
    setPlainText(QString("Ants Remaining: " + QString::number(p_ants) + "\nDoodlebugs Remaining: " + QString::number(p_doodlebugs)
                         + QString("\nTurn: " + QString::number(p_stepCount))));
}
Esempio n. 4
0
BlockDescription::BlockDescription(QString s, QGraphicsItem * parent) : QGraphicsTextItem(parent)
{
    textDescription = s;
    setPlainText(textDescription);
    blockHeight = this->boundingRect().height();
}
void ViewSelector::clearLabel()
{
    setPlainText("");
}
Esempio n. 6
0
void Score::inc()
{
    score++;
    setPlainText("Score: "+ QString::number(score));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    setWindowTitle("QML Easing Curve Editor");
    SplineEditor *splineEditor = new SplineEditor(this);

    QWidget *mainWidget = new QWidget(this);

    setCentralWidget(mainWidget);

    QHBoxLayout *hboxLayout = new QHBoxLayout(mainWidget);
    QVBoxLayout *vboxLayout = new QVBoxLayout();

    mainWidget->setLayout(hboxLayout);
    hboxLayout->addLayout(vboxLayout);

    QWidget *propertyWidget = new QWidget(this);
    ui_properties.setupUi(propertyWidget);

    ui_properties.spinBox->setMinimum(50);
    ui_properties.spinBox->setMaximum(10000);
    ui_properties.spinBox->setValue(500);

    hboxLayout->addWidget(propertyWidget);

    m_placeholder = new QWidget(this);

    m_placeholder->setFixedSize(quickView.size());

    vboxLayout->addWidget(splineEditor);
    vboxLayout->addWidget(m_placeholder);

    ui_properties.plainTextEdit->setPlainText(splineEditor->generateCode());
    connect(splineEditor, SIGNAL(easingCurveCodeChanged(QString)), ui_properties.plainTextEdit, SLOT(setPlainText(QString)));

    quickView.rootContext()->setContextProperty(QLatin1String("spinBox"), ui_properties.spinBox);

    foreach (const QString &name, splineEditor->presetNames())
        ui_properties.comboBox->addItem(name);

    connect(ui_properties.comboBox, SIGNAL(currentIndexChanged(QString)), splineEditor, SLOT(setPreset(QString)));

    splineEditor->setPreset(ui_properties.comboBox->currentText());

    QVBoxLayout *groupBoxLayout = new QVBoxLayout(ui_properties.groupBox);
    groupBoxLayout->setMargin(0);
    ui_properties.groupBox->setLayout(groupBoxLayout);

    groupBoxLayout->addWidget(splineEditor->pointListWidget());
    m_splineEditor = splineEditor;
    connect(ui_properties.plainTextEdit, SIGNAL(textChanged()), this, SLOT(textEditTextChanged()));

    QDialog* importDialog = new QDialog(this);
    ui_import.setupUi(importDialog);
    ui_import.inInfluenceEdit->setValidator(new QDoubleValidator(this));
    ui_import.inSlopeEdit->setValidator(new QDoubleValidator(this));
    ui_import.outInfluenceEdit->setValidator(new QDoubleValidator(this));
    ui_import.outSlopeEdit->setValidator(new QDoubleValidator(this));
    connect(ui_properties.importButton, SIGNAL(clicked()), importDialog, SLOT(show()));
    connect(importDialog, SIGNAL(finished(int)), this, SLOT(importData(int)));

    connect(this, SIGNAL(close()), this, SLOT(doClose()));
    initQml();
}
Esempio n. 8
0
QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value, QMap<int, QWidget*> &proxyWidgets )
{
    if ( !vl )
        return 0;

    QWidget *myWidget = 0;
    QgsVectorLayer::EditType editType = vl->editType( idx );
    const QgsField &field = vl->pendingFields()[idx];
    QVariant::Type myFieldType = field.type();

    bool synchronized = false;

    switch ( editType )
    {
    case QgsVectorLayer::UniqueValues:
    {
        QList<QVariant> values;
        vl->dataProvider()->uniqueValues( idx, values );

        QComboBox *cb = comboBox( editor, parent );
        if ( cb )
        {
            cb->setEditable( false );

            for ( QList<QVariant>::iterator it = values.begin(); it != values.end(); it++ )
                cb->addItem( it->toString(), it->toString() );

            myWidget = cb;
        }

    }
    break;

    case QgsVectorLayer::Enumeration:
    {
        QStringList enumValues;
        vl->dataProvider()->enumValues( idx, enumValues );

        QComboBox *cb = comboBox( editor, parent );
        if ( cb )
        {
            QStringList::const_iterator s_it = enumValues.constBegin();
            for ( ; s_it != enumValues.constEnd(); ++s_it )
            {
                cb->addItem( *s_it, *s_it );
            }

            myWidget = cb;
        }
    }
    break;

    case QgsVectorLayer::ValueMap:
    {
        const QMap<QString, QVariant> &map = vl->valueMap( idx );

        QComboBox *cb = comboBox( editor, parent );
        if ( cb )
        {
            for ( QMap<QString, QVariant>::const_iterator it = map.begin(); it != map.end(); it++ )
            {
                cb->addItem( it.key(), it.value() );
            }

            myWidget = cb;
        }
    }
    break;

    case QgsVectorLayer::ValueRelation:
    {
        const QgsVectorLayer::ValueRelationData &data = vl->valueRelation( idx );

        QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( data.mLayer ) );
        QMap< QString, QString > map;

        int fi = -1;
        if ( layer )
        {
            int ki = layer->fieldNameIndex( data.mOrderByValue ? data.mValue : data.mKey );
            int vi = layer->fieldNameIndex( data.mOrderByValue ? data.mKey : data.mValue );

            if ( !data.mFilterAttributeColumn.isNull() )
                fi = layer->fieldNameIndex( data.mFilterAttributeColumn );

            if ( ki >= 0 && vi >= 0 )
            {
                QgsAttributeList attributes;
                attributes << ki;
                attributes << vi;
                if ( fi >= 0 )
                    attributes << fi;

                QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( attributes ) );
                QgsFeature f;
                while ( fit.nextFeature( f ) )
                {
                    if ( fi >= 0 && f.attribute( fi ).toString() != data.mFilterAttributeValue )
                        continue;

                    map.insert( f.attribute( ki ).toString(), f.attribute( vi ).toString() );
                }
            }
        }

        if ( !data.mAllowMulti )
        {
            QComboBox *cb = comboBox( editor, parent );
            if ( cb )
            {
                if ( data.mAllowNull )
                {
                    QSettings settings;
                    cb->addItem( tr( "(no selection)" ), settings.value( "qgis/nullValue", "NULL" ).toString() );
                }

                for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
                {
                    if ( data.mOrderByValue )
                        cb->addItem( it.key(), it.value() );
                    else
                        cb->addItem( it.value(), it.key() );
                }

                myWidget = cb;
            }
        }
        else
        {
            QListWidget *lw = listWidget( editor, parent );
            if ( lw )
            {
                QStringList checkList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( "," );

                for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
                {
                    QListWidgetItem *item;
                    if ( data.mOrderByValue )
                    {
                        item = new QListWidgetItem( it.key() );
                        item->setData( Qt::UserRole, it.value() );
                        item->setCheckState( checkList.contains( it.value() ) ? Qt::Checked : Qt::Unchecked );
                    }
                    else
                    {
                        item = new QListWidgetItem( it.value() );
                        item->setData( Qt::UserRole, it.key() );
                        item->setCheckState( checkList.contains( it.key() ) ? Qt::Checked : Qt::Unchecked );
                    }
                    lw->addItem( item );
                }

                myWidget = lw;
            }
        }
    }
    break;

    case QgsVectorLayer::Classification:
    {
        QMap<QString, QString> classes;

        const QgsUniqueValueRenderer *uvr = dynamic_cast<const QgsUniqueValueRenderer *>( vl->renderer() );
        if ( uvr )
        {
            const QList<QgsSymbol *> symbols = uvr->symbols();

            for ( int i = 0; i < symbols.size(); i++ )
            {
                QString label = symbols[i]->label();
                QString name = symbols[i]->lowerValue();

                if ( label == "" )
                    label = name;

                classes.insert( name, label );
            }
        }

        const QgsCategorizedSymbolRendererV2 *csr = dynamic_cast<const QgsCategorizedSymbolRendererV2 *>( vl->rendererV2() );
        if ( csr )
        {
            const QgsCategoryList &categories = (( QgsCategorizedSymbolRendererV2 * )csr )->categories(); // FIXME: QgsCategorizedSymbolRendererV2::categories() should be const
            for ( int i = 0; i < categories.size(); i++ )
            {
                QString label = categories[i].label();
                QString value = categories[i].value().toString();
                if ( label.isEmpty() )
                    label = value;
                classes.insert( value, label );
            }
        }

        QComboBox *cb = comboBox( editor, parent );
        if ( cb )
        {
            for ( QMap<QString, QString>::const_iterator it = classes.begin(); it != classes.end(); it++ )
            {
                cb->addItem( it.value(), it.key() );
            }

            myWidget = cb;
        }
    }
    break;

    case QgsVectorLayer::DialRange:
    case QgsVectorLayer::SliderRange:
    case QgsVectorLayer::EditRange:
    {
        if ( myFieldType == QVariant::Int )
        {
            int min = vl->range( idx ).mMin.toInt();
            int max = vl->range( idx ).mMax.toInt();
            int step = vl->range( idx ).mStep.toInt();

            if ( editType == QgsVectorLayer::EditRange )
            {
                QSpinBox *sb = 0;

                if ( editor )
                    sb = qobject_cast<QSpinBox *>( editor );
                else
                    sb = new QSpinBox( parent );

                if ( sb )
                {
                    sb->setRange( min, max );
                    sb->setSingleStep( step );

                    myWidget = sb;
                }
            }
            else
            {
                QAbstractSlider *sl = 0;

                if ( editor )
                {
                    sl = qobject_cast<QAbstractSlider*>( editor );
                }
                else if ( editType == QgsVectorLayer::DialRange )
                {
                    sl = new QDial( parent );
                }
                else
                {
                    sl = new QSlider( Qt::Horizontal, parent );
                }

                if ( sl )
                {
                    sl->setRange( min, max );
                    sl->setSingleStep( step );

                    myWidget = sl;
                }
            }
            break;
        }
        else if ( myFieldType == QVariant::Double )
        {
            QDoubleSpinBox *dsb = 0;
            if ( editor )
                dsb = qobject_cast<QDoubleSpinBox*>( editor );
            else
                dsb = new QDoubleSpinBox( parent );

            if ( dsb )
            {
                double min = vl->range( idx ).mMin.toDouble();
                double max = vl->range( idx ).mMax.toDouble();
                double step = vl->range( idx ).mStep.toDouble();

                dsb->setRange( min, max );
                dsb->setSingleStep( step );

                myWidget = dsb;
            }
            break;
        }
    }

    case QgsVectorLayer::CheckBox:
    {
        QCheckBox *cb = 0;
        QGroupBox *gb = 0;
        if ( editor )
        {
            gb = qobject_cast<QGroupBox *>( editor );
            cb = qobject_cast<QCheckBox*>( editor );
        }
        else
            cb = new QCheckBox( parent );

        if ( cb )
        {
            myWidget = cb;
            break;
        }
        else if ( gb )
        {
            myWidget = gb;
            break;
        }
    }

    // fall-through

    case QgsVectorLayer::LineEdit:
    case QgsVectorLayer::TextEdit:
    case QgsVectorLayer::UuidGenerator:
    case QgsVectorLayer::UniqueValuesEditable:
    case QgsVectorLayer::Immutable:
    {
        QLineEdit *le = 0;
        QTextEdit *te = 0;
        QPlainTextEdit *pte = 0;
        QComboBox * cb = 0;

        if ( editor )
        {
            le = qobject_cast<QLineEdit *>( editor );
            te = qobject_cast<QTextEdit *>( editor );
            pte = qobject_cast<QPlainTextEdit *>( editor );
            cb = qobject_cast<QComboBox *>( editor );
        }
        else if ( editType == QgsVectorLayer::TextEdit )
        {
            pte = new QPlainTextEdit( parent );
        }
        else
        {
            le = new QLineEdit( parent );
        }

        if ( le )
        {
            if ( editType == QgsVectorLayer::UniqueValuesEditable )
            {
                QList<QVariant> values;
                vl->dataProvider()->uniqueValues( idx, values );

                QStringList svalues;
                for ( QList<QVariant>::const_iterator it = values.begin(); it != values.end(); it++ )
                    svalues << it->toString();

                QCompleter *c = new QCompleter( svalues );
                c->setCompletionMode( QCompleter::PopupCompletion );
                le->setCompleter( c );
            }

            if ( editType == QgsVectorLayer::UuidGenerator )
            {
                le->setReadOnly( true );
            }

            le->setValidator( new QgsFieldValidator( le, field ) );

            myWidget = le;
        }

        if ( te )
        {
            te->setAcceptRichText( true );
            myWidget = te;
        }

        if ( pte )
        {
            myWidget = pte;
        }

        if ( cb )
        {
            if ( cb->isEditable() )
                cb->setValidator( new QgsFieldValidator( cb, field ) );
            myWidget = cb;
        }

        if ( myWidget )
        {
            myWidget->setDisabled( editType == QgsVectorLayer::Immutable );

            QgsStringRelay* relay = NULL;

            QMap<int, QWidget*>::const_iterator it = proxyWidgets.find( idx );
            if ( it != proxyWidgets.end() )
            {
                QObject* obj = qvariant_cast<QObject*>(( *it )->property( "QgisAttrEditProxy" ) );
                relay = qobject_cast<QgsStringRelay*>( obj );
            }
            else
            {
                relay = new QgsStringRelay( myWidget );
            }

            const char* rSlot = SLOT( changeText( QString ) );
            const char* rSig = SIGNAL( textChanged( QString ) );
            const char* wSlot = SLOT( setText( QString ) );
            const char* wSig = SIGNAL( textChanged( QString ) );
            if ( te || pte )
            {
                rSlot = SLOT( changeText() );
                wSig = SIGNAL( textChanged() );
            }
            if ( pte )
            {
                wSlot = SLOT( setPlainText( QString ) );
            }
            if ( cb && cb->isEditable() )
            {
                wSlot = SLOT( setEditText( QString ) );
                wSig = SIGNAL( editTextChanged( QString ) );
            }

            synchronized =  connect( relay, rSig, myWidget, wSlot );
            synchronized &= connect( myWidget, wSig, relay, rSlot );

            // store list of proxies in relay
            relay->appendProxy( myWidget );

            if ( !cb || cb->isEditable() )
            {
                myWidget->setProperty( "QgisAttrEditSlot", QVariant( QByteArray( wSlot ) ) );
                myWidget->setProperty( "QgisAttrEditProxy", QVariant( QMetaType::QObjectStar, &relay ) );
            }
        }
    }
    break;

    case QgsVectorLayer::Hidden:
        myWidget = 0;
        break;

    case QgsVectorLayer::FileName:
    case QgsVectorLayer::Calendar:
    {
        QCalendarWidget *cw = qobject_cast<QCalendarWidget *>( editor );
        if ( cw )
        {
            myWidget = cw;
            break;
        }


        QPushButton *pb = 0;
        QLineEdit *le = qobject_cast<QLineEdit *>( editor );
        if ( le )
        {
            if ( le )
                myWidget = le;

            if ( editor->parent() )
            {
                pb = editor->parent()->findChild<QPushButton *>();
            }
        }
        else
        {
            le = new QLineEdit();

            pb = new QPushButton( tr( "..." ) );

            QHBoxLayout *hbl = new QHBoxLayout();
            hbl->addWidget( le );
            hbl->addWidget( pb );

            myWidget = new QWidget( parent );
            myWidget->setBackgroundRole( QPalette::Window );
            myWidget->setAutoFillBackground( true );
            myWidget->setLayout( hbl );
        }

        if ( pb )
        {
            if ( editType == QgsVectorLayer::FileName )
                connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectFileName() ) );
            if ( editType == QgsVectorLayer::Calendar )
                connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectDate() ) );
        }
    }
    break;
    }

    QMap<int, QWidget*>::const_iterator it = proxyWidgets.find( idx );
    if ( it != proxyWidgets.end() )
    {
        if ( !synchronized )
        {
            myWidget->setEnabled( false );
        }
    }
    else
    {
        proxyWidgets.insert( idx, myWidget );
    }

    setValue( myWidget, vl, idx, value );

    return myWidget;
}
TextEdit::TextEdit(QWidget *parent): QTextEdit(parent)
{

    this->setFont(QFont("Monaco", 10));
    this->setTabStopWidth(fontMetrics().width("\t")/2);
    connect(this,SIGNAL(cursorPositionChanged()),this,SLOT(slotCursorPositionChanged()));

    QFile file("/tmp/a.m");
    file.open(QIODevice::ReadOnly|QIODevice::Text);
    QByteArray data = file.readAll();
    QTextStream in(&data);
    QString decodedStr = in.readAll();
    setPlainText(decodedStr);
    file.close();
    cx_index = clang_createIndex(0,0);
    struct CXUnsavedFile unsaved_file;
    unsaved_file.Filename = "/tmp/a.m";
    unsaved_file.Contents = (char*)calloc(sizeof(char), 4096);
    unsaved_file.Length = this->toPlainText().length();
    char **cmd_args =  (char**)calloc(sizeof(char*), 6);
    int i = 0;
    for(i ; i <6; i++) {
    cmd_args[i] = (char*)calloc(sizeof(char), 1000 + 1);
    strcpy(cmd_args[i], "-cc1");
    strcpy(cmd_args[i], "-fsyntax-only");
    strcpy(cmd_args[i], "-code-completion-macros");
    strcpy(cmd_args[i], "-code-completion-patterns");
    strcpy(cmd_args[i], "-x objective-c");
    strcpy(cmd_args[i], "-I/usr/share/iPhoneOS5.0.sdk/usr/include");
    }

    cx_tu = clang_parseTranslationUnit(cx_index, "/tmp/a.m" , cmd_args, 6, &unsaved_file, 1, CXTranslationUnit_PrecompiledPreamble|CXTranslationUnit_Incomplete);
    if(!cx_tu)
        qDebug()<<"cx_tu";

    //connect(this,SIGNAL(textChanged()), this,SLOT(slotReparse()));



    completionList = new QListWidget(this);
    completionList->setSelectionMode( QAbstractItemView::SingleSelection );
    completionList->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    completionList->hide();
    completionList->setSortingEnabled( true );
    completionList->setSelectionMode( QAbstractItemView::SingleSelection );
    QPalette palette;
    palette.setBrush(QPalette::Active, QPalette::Base, Qt::white);
    completionList->setPalette(palette);

    m_formatFunction.setForeground(Qt::black);
    m_formatSingleLineComment.setForeground(Qt::red);
    m_formatKeyword.setForeground(Qt::blue);
    m_formatUserKeyword.setForeground(Qt::darkBlue);
    m_formatOperator.setForeground(Qt::black);
    m_formatNumber.setForeground(Qt::darkMagenta);
    m_formatEscapeChar.setForeground(Qt::darkBlue);
    m_formatMacro.setForeground(Qt::darkGreen);
    m_formatMultiLineComment.setForeground(Qt::red);
    m_formatString.setForeground(Qt::darkCyan);

    //connect(m_completionList, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(slotWordCompletion(QListWidgetItem *)) );
}
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, IVirtualBox *a_pVirtualBox /* = NULL */,
                                           const char *pszName/* = NULL*/)
    : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()), m_pVirtualBox(a_pVirtualBox)
{
    setReadOnly(true);
    setUndoRedoEnabled(false);
    setOverwriteMode(false);
    setPlainText("");
    setTextInteractionFlags(Qt::TextBrowserInteraction);
    setAutoFormatting(QTextEdit::AutoAll);
    setTabChangesFocus(true);
    setAcceptRichText(false);

    /*
     * Create actions for color-scheme menu items.
     */
    m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this);
    m_pGreenOnBlackAction->setCheckable(true);
    m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1);
    m_pGreenOnBlackAction->setData((int)kGreenOnBlack);
    connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme()));

    m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this);
    m_pBlackOnWhiteAction->setCheckable(true);
    m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2);
    m_pBlackOnWhiteAction->setData((int)kBlackOnWhite);
    connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(sltSelectColorScheme()));

    /* Create action group for grouping of exclusive color-scheme menu items. */
    QActionGroup *pActionColorGroup = new QActionGroup(this);
    pActionColorGroup->addAction(m_pGreenOnBlackAction);
    pActionColorGroup->addAction(m_pBlackOnWhiteAction);
    pActionColorGroup->setExclusive(true);

    /*
     * Create actions for font menu items.
     */
    m_pCourierFontAction = new QAction(tr("Courier"), this);
    m_pCourierFontAction->setCheckable(true);
    m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D);
    m_pCourierFontAction->setData((int)kFontType_Courier);
    connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType()));

    m_pMonospaceFontAction = new QAction(tr("Monospace"), this);
    m_pMonospaceFontAction->setCheckable(true);
    m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M);
    m_pMonospaceFontAction->setData((int)kFontType_Monospace);
    connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(sltSelectFontType()));

    /* Create action group for grouping of exclusive font menu items. */
    QActionGroup *pActionFontGroup = new QActionGroup(this);
    pActionFontGroup->addAction(m_pCourierFontAction);
    pActionFontGroup->addAction(m_pMonospaceFontAction);
    pActionFontGroup->setExclusive(true);

    /*
     * Create actions for font size menu.
     */
    uint32_t const uDefaultFontSize = font().pointSize();
    m_pActionFontSizeGroup = new QActionGroup(this);
    for (uint32_t i = 0; i < RT_ELEMENTS(m_apFontSizeActions); i++)
    {
        char szTitle[32];
        RTStrPrintf(szTitle, sizeof(szTitle), s_uMinFontSize + i != uDefaultFontSize ? "%upt" : "%upt (default)",
                    s_uMinFontSize + i);
        m_apFontSizeActions[i] = new QAction(tr(szTitle), this);
        m_apFontSizeActions[i]->setCheckable(true);
        m_apFontSizeActions[i]->setData(i + s_uMinFontSize);
        connect(m_apFontSizeActions[i], SIGNAL(triggered()), this, SLOT(sltSelectFontSize()));
        m_pActionFontSizeGroup->addAction(m_apFontSizeActions[i]);
    }

    /*
     * Set the defaults (which syncs with the menu item checked state).
     */
    /* color scheme: */
    com::Bstr bstrColor;
    HRESULT hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/ColorScheme").raw(), bstrColor.asOutParam()) : E_FAIL;
    if (  SUCCEEDED(hrc)
        && bstrColor.compareUtf8("blackonwhite", com::Bstr::CaseInsensitive) == 0)
        setColorScheme(kBlackOnWhite, false /*fSaveIt*/);
    else
        setColorScheme(kGreenOnBlack, false /*fSaveIt*/);

    /* font: */
    com::Bstr bstrFont;
    hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/Font").raw(), bstrFont.asOutParam()) : E_FAIL;
    if (  SUCCEEDED(hrc)
        && bstrFont.compareUtf8("monospace", com::Bstr::CaseInsensitive) == 0)
        setFontType(kFontType_Monospace, false /*fSaveIt*/);
    else
        setFontType(kFontType_Courier, false /*fSaveIt*/);

    /* font size: */
    com::Bstr bstrFontSize;
    hrc = m_pVirtualBox ? m_pVirtualBox->GetExtraData(com::Bstr("DbgConsole/FontSize").raw(), bstrFontSize.asOutParam()) : E_FAIL;
    if (SUCCEEDED(hrc))
    {
        com::Utf8Str strFontSize(bstrFontSize);
        uint32_t uFontSizePrf = strFontSize.strip().toUInt32();
        if (   uFontSizePrf - s_uMinFontSize < (uint32_t)RT_ELEMENTS(m_apFontSizeActions)
            && uFontSizePrf != uDefaultFontSize)
            setFontSize(uFontSizePrf, false /*fSaveIt*/);
    }

    NOREF(pszName);
}
void LabeledPlainTextEdit::showLabel()
{
    setStyleSheet("color: gray; font-style: italic");
    setPlainText(m_label);
}
Esempio n. 12
0
Ecuaciones_S::Ecuaciones_S(QGraphicsItem *parent)
{
    setPlainText(QString(" "));
    setDefaultTextColor(Qt::black);
    setFont(QFont("SansSerif", 12));
}
Esempio n. 13
0
//	WChatInput::QObject::event()
bool
WChatInput::event(QEvent * pEvent)
	{
	QEvent::Type eEventType = pEvent->type();
	//MessageLog_AppendTextFormatSev(eSeverityNoise, "WChatInput::event(type=$i)\n", eEventType);
	if (eEventType == QEvent::KeyPress)
		{
		QKeyEvent * pEventKey = static_cast<QKeyEvent *>(pEvent);
		const Qt::Key eKey = (Qt::Key)pEventKey->key();
		//MessageLog_AppendTextFormatSev(eSeverityNoise, "WChatInput::event(QEvent::KeyPress, key=0x$p, modifiers=$x)\n", eKey, pEventKey->modifiers());
		if ((eKey & d_kmKeyboardSpecialKeys) == 0)
			{
			// The user typed something other than a special key
			m_ttcBeforeChatStatePaused = d_ttcChatStateEventPaused;
			if (m_tidChatStateComposing == d_zNA)
				{
				m_tidChatStateComposing = startTimer(d_ttiChatState);	// Create a timer to determine when the user 'stopped' typing
				m_pwLayoutChatLog->Socket_WriteXmlChatState(eChatState_zComposing);
				}
			}
		if ((pEventKey->modifiers() & ~Qt::KeypadModifier) == Qt::NoModifier)
			{
			ITreeItemChatLogEvents * pContactOrGroup = m_pwLayoutChatLog->PGetContactOrGroup_NZ();
			pContactOrGroup->TreeItem_IconUpdateOnMessagesRead();	// Any key pressed in the message input assumes the user read the message history
			//m_pwLayoutChatLog->TreeItem_UpdateIconMessageRead();	// Any key pressed in the message input assumes the user read the message history
			if (eKey == Qt::Key_Enter || eKey == Qt::Key_Return)
				{
				EUserCommand eUserCommand = eUserCommand_ComposingStopped;	// Pretend the text message was sent
				CStr strText = *this;
				if (!strText.FIsEmptyString())
					{
					m_strTextLastWritten = strText;
					if (m_pEventEdit == NULL)
						eUserCommand = pContactOrGroup->Xmpp_EParseUserCommandAndSendEvents(IN_MOD_INV strText);	// This is the typical case of a new message
					else
						{
						// The user was editing an existing message
						m_pEventEdit->EventUpdateMessageText(strText, INOUT m_pwLayoutChatLog);
						m_pEventEdit = NULL;
						}
					ChatStateComposingCancelTimer((BOOL)eUserCommand);	// After sending a message, cancel (reset) the timer to, so a new 'composing' notification will be sent when the user starts typing again. BTW, there is no need to send a 'pause' command since receiving a text message automatically implies a pause.
					} // if

				if (eUserCommand != eUserCommand_Error)
					{
					clear();	// Clear the chat text
					setCurrentCharFormat(QTextCharFormat());
					}
				return true;
				} // if (enter)
			if (eKey == Qt::Key_Up)
				{
				// Set the previous text if there is notning in the edit box
				CStr strText = *this;
				if (strText.FIsEmptyString())
					{
					//EditEventText(pContactOrGroup->Vault_PGetEventLastMessageSentEditable_YZ());
					m_pEventEdit = pContactOrGroup->Vault_PFindEventLastMessageTextSentMatchingText(IN m_strTextLastWritten);
					if (m_pEventEdit != NULL)
						{
						MessageLog_AppendTextFormatSev(eSeverityNoise, "Editing Event ID $t\n", m_pEventEdit->m_tsEventID);
						}
					setPlainText(m_strTextLastWritten);
					moveCursor(QTextCursor::End);
					return true;
					}
				}
			if (eKey == Qt::Key_Escape)
				{
				m_pEventEdit = NULL;
				clear();	// Clear the chat text
				return TRUE;
				}
			} // if
		}
	else if (eEventType == QEvent::FocusIn)
		{
		//m_pwLayoutChatLog->OnEventFocusIn();
		m_pwLayoutChatLog->PGetContactOrGroup_NZ()->TreeItem_IconUpdateOnMessagesRead();
		}
	return WEditTextArea::event(pEvent);
	} // event()
Esempio n. 14
0
void LogTextEdit::appendLog(const QString &logText, bool runFailed)
{
	setPlainText(toPlainText() + logText);
	setLogPalette(runFailed);
}
Esempio n. 15
0
void Health::decrease(){
    health--;
    setPlainText(QString("Health: ") + QString::number(health));
}
Esempio n. 16
0
void SearchBarTextItem::mousePressEvent ( QGraphicsSceneMouseEvent * event )
{
	setPlainText( "" );
	QGraphicsTextItem::mousePressEvent( event );
} 
Esempio n. 17
0
void Taxi_distance::increase()
{
    taxi_distance+=0.01;
    setPlainText(QString("주행거리: ") + QString::number(taxi_distance)+QString("km"));//score2
}
Esempio n. 18
0
LabelItem::LabelItem ( const QString& str, QGraphicsItem* parent, QGraphicsScene* scene )
  : QGraphicsTextItem ( parent, scene ) {
  setPlainText ( str );
  setFlag ( QGraphicsItem::ItemIsMovable, false );
  setFlag ( QGraphicsItem::ItemIsSelectable, false );
}
Esempio n. 19
0
void TextItem::setText(const QString& text)
{
    setPlainText(text);
}
Esempio n. 20
0
//decrease the health of the player when the ball fall
void Health::decrease(){
    health--;
     setPlainText("Health : "+QString:: number(health)); // to overwriting the new health
}
Esempio n. 21
0
void BlockDescription::setDescription(const QString desc)
{
    setPlainText(desc);
}
/** Function to increase the life*/
void Life::increase(){
    health++;
    setPlainText(QString("Whale Remaining: ")+QString::number(health));

}
Esempio n. 23
0
void ViewSelector::setLabel(QString label)
{
    setPlainText(label);
}
void TextEdit::prependText(const QString& text)
{
    QString tmp = text;
    tmp.append(' '+toPlainText());
    setPlainText(tmp);
}
void Weaponscore::increase(){
    ++damage_score;
    setPlainText(QString("Damage: ") + QString::number(damage_score)); // Score: 3
}
Esempio n. 26
0
void TCommandLine::handleTabCompletion( bool direction )
{
    if( ( mTabCompletionCount < 0 ) || ( mUserKeptOnTyping ) )
    {
        mTabCompletionTyped = toPlainText();
        if( mTabCompletionTyped.size() == 0 ) return;
        mUserKeptOnTyping = false;
        mTabCompletionCount = -1;
    }
    int amount = mpHost->mpConsole->buffer.size();
    if( amount > 500 ) amount = 500;

    QStringList bufferList = mpHost->mpConsole->buffer.getEndLines( amount );
    QString buffer = bufferList.join(" ");

    buffer.replace(QChar( 0x21af ), "\n");
    buffer.replace(QChar('\n'), " " );

    QStringList wordList = buffer.split( QRegExp("\\b"), QString::SkipEmptyParts );
    if( direction )
    {
        mTabCompletionCount++;
    }
    else
    {
        mTabCompletionCount--;
    }
    if( wordList.size() > 0 )
    {
        if( mTabCompletionTyped.endsWith(" ") ) return;
        QString lastWord;
        QRegExp reg = QRegExp("\\b(\\w+)$");
        int typePosition = reg.indexIn( mTabCompletionTyped );
        if( reg.numCaptures() >= 1 )
            lastWord = reg.cap( 1 );
        else
            lastWord = "";
        QStringList filterList = wordList.filter( QRegExp( "^"+lastWord+"\\w+",Qt::CaseInsensitive  ) );
        if( filterList.size() < 1 ) return;
        int offset = 0;
        for( ; ; )
        {
            QString tmp = filterList.back();
            filterList.removeAll( tmp );
            filterList.insert( offset, tmp );
            ++offset;
            if( offset >= filterList.size() ) break;
        }

        if( filterList.size() > 0 )
        {
            if( mTabCompletionCount >= filterList.size() ) mTabCompletionCount = filterList.size()-1;
            if( mTabCompletionCount < 0 ) mTabCompletionCount = 0;
            QString proposal = filterList[mTabCompletionCount];
            QString userWords = mTabCompletionTyped.left( typePosition );
            setPlainText( QString( userWords + proposal ).trimmed() );
            moveCursor( QTextCursor::End, QTextCursor::MoveAnchor );
            mTabCompletionOld = toPlainText();
        }
    }
}
int QPlainTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractScrollArea::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 25)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 25;
    }
#ifndef QT_NO_PROPERTIES
    else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            *reinterpret_cast< bool*>(_v) = tabChangesFocus();
            break;
        case 1:
            *reinterpret_cast< QString*>(_v) = documentTitle();
            break;
        case 2:
            *reinterpret_cast< bool*>(_v) = isUndoRedoEnabled();
            break;
        case 3:
            *reinterpret_cast< LineWrapMode*>(_v) = lineWrapMode();
            break;
        case 4:
            *reinterpret_cast< bool*>(_v) = isReadOnly();
            break;
        case 5:
            *reinterpret_cast< QString*>(_v) = toPlainText();
            break;
        case 6:
            *reinterpret_cast< bool*>(_v) = overwriteMode();
            break;
        case 7:
            *reinterpret_cast< int*>(_v) = tabStopWidth();
            break;
        case 8:
            *reinterpret_cast< int*>(_v) = cursorWidth();
            break;
        case 9:
            *reinterpret_cast< Qt::TextInteractionFlags*>(_v) = textInteractionFlags();
            break;
        case 10:
            *reinterpret_cast< int*>(_v) = blockCount();
            break;
        case 11:
            *reinterpret_cast< int*>(_v) = maximumBlockCount();
            break;
        case 12:
            *reinterpret_cast< bool*>(_v) = backgroundVisible();
            break;
        case 13:
            *reinterpret_cast< bool*>(_v) = centerOnScroll();
            break;
        }
        _id -= 14;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            setTabChangesFocus(*reinterpret_cast< bool*>(_v));
            break;
        case 1:
            setDocumentTitle(*reinterpret_cast< QString*>(_v));
            break;
        case 2:
            setUndoRedoEnabled(*reinterpret_cast< bool*>(_v));
            break;
        case 3:
            setLineWrapMode(*reinterpret_cast< LineWrapMode*>(_v));
            break;
        case 4:
            setReadOnly(*reinterpret_cast< bool*>(_v));
            break;
        case 5:
            setPlainText(*reinterpret_cast< QString*>(_v));
            break;
        case 6:
            setOverwriteMode(*reinterpret_cast< bool*>(_v));
            break;
        case 7:
            setTabStopWidth(*reinterpret_cast< int*>(_v));
            break;
        case 8:
            setCursorWidth(*reinterpret_cast< int*>(_v));
            break;
        case 9:
            setTextInteractionFlags(*reinterpret_cast< Qt::TextInteractionFlags*>(_v));
            break;
        case 11:
            setMaximumBlockCount(*reinterpret_cast< int*>(_v));
            break;
        case 12:
            setBackgroundVisible(*reinterpret_cast< bool*>(_v));
            break;
        case 13:
            setCenterOnScroll(*reinterpret_cast< bool*>(_v));
            break;
        }
        _id -= 14;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 14;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 14;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 14;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 14;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 14;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 14;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 28
0
void ResultDisplay::clear()
{
    m_count = 0;
    setPlainText(QLatin1String(""));
}
Esempio n. 29
0
void Score::increase()
{
    setPlainText(QString("Score: ") + QString::number(score)); // Score: 1
    score++;
    setPlainText(QString("Score: ") + QString::number(score)); // Score: 1
}
Esempio n. 30
0
void LogTextEdit::updateLog(const QString &logText, bool runFailed)
{
	setPlainText(logText);
	setLogPalette(runFailed);
}