Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
2f2aead0
Vérifiée
Valider
2f2aead0
rédigé
Il y a 3 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
UI: Force 4 tabs insertion and more methods are noexcept
parent
b10e0f00
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
1 requête de fusion
!11
Change a bit the UI + Add simple scripts support
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/UI/ScriptViews/ScriptEditor.cc
+22
-7
22 ajouts, 7 suppressions
src/UI/ScriptViews/ScriptEditor.cc
src/UI/ScriptViews/ScriptEditor.hh
+10
-9
10 ajouts, 9 suppressions
src/UI/ScriptViews/ScriptEditor.hh
avec
32 ajouts
et
16 suppressions
src/UI/ScriptViews/ScriptEditor.cc
+
22
−
7
Voir le fichier @
2f2aead0
...
...
@@ -3,10 +3,11 @@
#include
<QTextCursor>
#include
<QBrush>
#include
<QKeyEvent>
using
namespace
Vivy
;
ScriptEditor
::
LineNumberArea
::
LineNumberArea
(
ScriptEditor
*
editor
)
ScriptEditor
::
LineNumberArea
::
LineNumberArea
(
ScriptEditor
*
editor
)
noexcept
:
QWidget
(
editor
)
,
scriptEditor
(
editor
)
{
...
...
@@ -24,7 +25,7 @@ ScriptEditor::LineNumberArea::paintEvent(QPaintEvent *event) noexcept
scriptEditor
->
lineNumberAreaPaintEvent
(
event
);
}
ScriptEditor
::
ScriptEditor
(
QWidget
*
parent
)
ScriptEditor
::
ScriptEditor
(
QWidget
*
parent
)
noexcept
:
QPlainTextEdit
(
parent
)
{
setStyleSheet
(
QStringLiteral
(
"* { font-family:
\"
FiraCode
\"
; font-size: 10pt}"
));
...
...
@@ -36,8 +37,22 @@ ScriptEditor::ScriptEditor(QWidget *parent)
updateLineNumberAreaWidth
(
0
);
}
void
ScriptEditor
::
keyPressEvent
(
QKeyEvent
*
e
)
noexcept
{
if
(
e
->
key
()
==
Qt
::
Key_Tab
)
{
QTextCursor
cursor
=
textCursor
();
cursor
.
insertText
(
" "
);
e
->
accept
();
}
else
{
QPlainTextEdit
::
keyPressEvent
(
e
);
}
}
int
ScriptEditor
::
lineNumberAreaWidth
()
ScriptEditor
::
lineNumberAreaWidth
()
noexcept
{
int
digits
=
1
;
int
max
=
qMax
(
1
,
blockCount
());
...
...
@@ -53,13 +68,13 @@ ScriptEditor::lineNumberAreaWidth()
}
void
ScriptEditor
::
updateLineNumberAreaWidth
([[
maybe_unused
]]
int
newBlockCount
)
ScriptEditor
::
updateLineNumberAreaWidth
([[
maybe_unused
]]
int
newBlockCount
)
noexcept
{
setViewportMargins
(
lineNumberAreaWidth
(),
0
,
0
,
0
);
}
void
ScriptEditor
::
updateLineNumberArea
(
const
QRect
&
rect
,
int
dy
)
ScriptEditor
::
updateLineNumberArea
(
const
QRect
&
rect
,
int
dy
)
noexcept
{
if
(
dy
)
lineNumberArea
->
scroll
(
0
,
dy
);
...
...
@@ -71,7 +86,7 @@ ScriptEditor::updateLineNumberArea(const QRect &rect, int dy)
}
void
ScriptEditor
::
resizeEvent
(
QResizeEvent
*
e
)
ScriptEditor
::
resizeEvent
(
QResizeEvent
*
e
)
noexcept
{
QPlainTextEdit
::
resizeEvent
(
e
);
const
QRect
cr
=
contentsRect
();
...
...
@@ -79,7 +94,7 @@ ScriptEditor::resizeEvent(QResizeEvent *e)
}
void
ScriptEditor
::
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
)
ScriptEditor
::
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
)
noexcept
{
QPainter
painter
(
lineNumberArea
);
painter
.
fillRect
(
event
->
rect
(),
QColor
::
fromRgb
(
69
,
83
,
100
));
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/UI/ScriptViews/ScriptEditor.hh
+
10
−
9
Voir le fichier @
2f2aead0
...
...
@@ -17,7 +17,7 @@ class ScriptEditor final : public QPlainTextEdit {
class
LineNumberArea
final
:
public
QWidget
{
VIVY_UNMOVABLE_OBJECT
(
LineNumberArea
)
public:
LineNumberArea
(
ScriptEditor
*
editor
);
LineNumberArea
(
ScriptEditor
*
editor
)
noexcept
;
QSize
sizeHint
()
const
noexcept
override
;
...
...
@@ -25,23 +25,24 @@ class ScriptEditor final : public QPlainTextEdit {
void
paintEvent
(
QPaintEvent
*
event
)
noexcept
override
;
private:
ScriptEditor
*
scriptEditor
;
ScriptEditor
*
scriptEditor
{
nullptr
}
;
};
public
:
ScriptEditor
(
QWidget
*
parent
=
nullptr
)
;
ScriptEditor
(
QWidget
*
parent
)
noexcept
;
void
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
);
int
lineNumberAreaWidth
();
void
lineNumberAreaPaintEvent
(
QPaintEvent
*
event
)
noexcept
;
int
lineNumberAreaWidth
()
noexcept
;
protected
:
void
resizeEvent
(
QResizeEvent
*
event
)
override
;
void
resizeEvent
(
QResizeEvent
*
event
)
noexcept
override
;
void
keyPressEvent
(
QKeyEvent
*
e
)
noexcept
override
;
private
slots
:
void
updateLineNumberAreaWidth
(
int
newBlockCount
);
void
updateLineNumberArea
(
const
QRect
&
rect
,
int
dy
);
void
updateLineNumberAreaWidth
(
int
newBlockCount
)
noexcept
;
void
updateLineNumberArea
(
const
QRect
&
rect
,
int
dy
)
noexcept
;
private
:
QWidget
*
lineNumberArea
;
QWidget
*
lineNumberArea
{
nullptr
}
;
};
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter