示例#1
0
TextEditor::TextEditor(QWidget *parent): QPlainTextEdit(parent) {
    connect(this, SIGNAL(textChanged()),            this, SLOT(UpdateDocumentStatus()));

    LineCountArea = new LineNumberArea(this);
    connect(this, SIGNAL(blockCountChanged(int)),   this, SLOT(UpdateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(UpdateLineNumberArea(QRect,int)));
    UpdateLineNumberAreaWidth(0);

//    connect(this, SIGNAL(cursorPositionChanged()),
//            this, SLOT(Highlight_Current_Line()));
    connect(this, SIGNAL(cursorPositionChanged()),
            this, SLOT(bracketValidate()));

    setFont(QFont("Monaco", 12));

    setTabSize(4);

    Size = 0;
    Counter = 0;
    Start = 0;
    End = 0;

    // Setup autocomplete
    minCompleterLength = 1;

    c = new QCompleter(this);
//            c->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    c->setCompletionMode(QCompleter::PopupCompletion);
    c->setCaseSensitivity(Qt::CaseInsensitive);
    c->setWrapAround(false);
    c->setWidget(this);
    c->popup()->setObjectName("autocomplete");

    completerModel = new QStringListModel(getWords(), c);
    c->setModel(completerModel);

    connect(this, SIGNAL(textChanged()),
            this, SLOT(updateCompleterModel()));

    QTextOption option = document()->defaultTextOption();

    bool on = false;
    if (on) {
        option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
    } else {
        option.setFlags(option.flags() & ~QTextOption::ShowTabsAndSpaces);
    }
    option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
    document()->setDefaultTextOption(option);

    setTabsAsSpaces(true);

    bracketMismatchFormat = currentCharFormat();
    bracketMismatchFormat.setBackground(QColor(255, 223, 223));

    bracketMatchFormat = currentCharFormat();
    bracketMatchFormat.setBackground(QColor(158, 209, 255));
}
示例#2
0
int Configuration::getTabSize()
{
    QVariant var = settings->value(TAB_SIZE);
    if(var.isValid() && var.canConvert(QVariant::Int))
    {
        return var.toInt();
    } else {
        setTabSize(4);
        return 4;
    }
}
void CppToQsConverter::initialize( const Config& config )
{
    qClassRegExp.setPattern( "\\bQ([A-Z][A-Za-z]+)\\b" );
    addressOperatorRegExp.setPattern( "([(\\s])[*&]([a-zA-Z])" );
    gulbrandsenRegExp.setPattern( "\\b::\\b|->" );

    tabSize = config.getInt( CONFIG_TABSIZE );
    setTabSize( tabSize );

    int size = config.getInt( CONFIG_QUICK + Config::dot + CONFIG_INDENTSIZE );
    if ( size > 0 )
	setIndentSize( size );
}
示例#4
0
文件: tft.cpp 项目: Amhunter/Year-3
tft_t::tft_t(void)
{
	setX(0);
	setY(0);
	d.tfa = 0;
	d.bfa = 0;
	d.vsp = SIZE_H;
	setTopMask(0);
	setBottomMask(0);
	setTransform(false);
	setZoom(1);
	d.orient = Portrait;
	setTabSize(4);
	setWidth(SIZE_W);
	setHeight(SIZE_H);
	setForeground(DEF_FGC);
	setBackground(DEF_BGC);
}