Explorar el Código

more editor stuff

Zoadian hace 10 años
padre
commit
50a3732950
Se han modificado 4 ficheros con 10 adiciones y 9 borrados
  1. 3 3
      ccsim.h
  2. 3 3
      debugwidget.h
  3. 2 0
      syntaxhighlighter.cpp
  4. 2 3
      wgtcodeeditor.cpp

+ 3 - 3
ccsim.h

@@ -11,13 +11,13 @@ class CCSim : public QMainWindow
 {
     Q_OBJECT
 
+private:
+    Ui::CCSim *ui;
+
 public:
     explicit CCSim(QWidget *parent = 0);
     ~CCSim();
 
-private:
-    Ui::CCSim *ui;
-
 public slots:
     void updateUiElements();
 };

+ 3 - 3
debugwidget.h

@@ -11,12 +11,12 @@ class DebugWidget : public QWidget
 {
     Q_OBJECT
 
+private:
+    Ui::DebugWidget *ui;
+
 public:
     explicit DebugWidget(QWidget *parent = 0);
     ~DebugWidget();
-
-private:
-    Ui::DebugWidget *ui;
 };
 
 #endif // DEBUGWIDGET_H

+ 2 - 0
syntaxhighlighter.cpp

@@ -47,11 +47,13 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent)
     bankFormat.setForeground(Qt::white);
     bankFormat.setBackground(Qt::darkGray);
     rule.pattern = QRegExp("\\s*BANK.*");
+    rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
     rule.format = bankFormat;
     highlightingRules.append(rule);
 
     singleLineCommentFormat.setForeground(Qt::darkGreen);
     rule.pattern = QRegExp("//[^\n]*");
+    rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
     rule.format = singleLineCommentFormat;
     highlightingRules.append(rule);
 

+ 2 - 3
wgtcodeeditor.cpp

@@ -76,9 +76,8 @@ void WgtCodeEditor::highlightCurrentLine()
     if (!isReadOnly()) {
         QTextEdit::ExtraSelection selection;
 
-        QColor lineColor = QColor(Qt::yellow).lighter(160);
 
-        selection.format.setBackground(lineColor);
+        selection.format.setBackground(palette().alternateBase());
         selection.format.setProperty(QTextFormat::FullWidthSelection, true);
         selection.cursor = textCursor();
         selection.cursor.clearSelection();
@@ -91,7 +90,7 @@ void WgtCodeEditor::highlightCurrentLine()
 void WgtCodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
 {
     QPainter painter(lineNumberArea);
-    painter.fillRect(event->rect(), Qt::lightGray);
+    painter.fillRect(event->rect(), palette().alternateBase());
     QTextBlock block = firstVisibleBlock();
     int blockNumber = block.blockNumber();
     int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();