Skip to content

Commit

Permalink
Fixed issue #50: cannot set same color attribute with text color and …
Browse files Browse the repository at this point in the history
…text highlight twice in a row.

Fixed issue #47: HTML anchors created externally and HTML anchors created in QPrompt didn't share the same formatting.
Enhanced: Hid unnecessary alpha channel slider on mobile QML color ColorDialog.
  • Loading branch information
Javier O. Cordero Pérez committed Feb 1, 2022
1 parent e8cf82c commit cff8509
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
17 changes: 13 additions & 4 deletions src/kirigami_ui/EditorToolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,10 @@ ToolBar {
font.family: iconFont.name
font.pointSize: 13
focusPolicy: Qt.TabFocus
onClicked: colorDialog.open()

onClicked: {
colorDialog.color = prompter.textColor;
colorDialog.open();
}
Rectangle {
width: aFontMetrics.width + 3
height: 2
Expand Down Expand Up @@ -574,8 +576,15 @@ ToolBar {
font.family: iconFont.name
font.pointSize: 13
focusPolicy: Qt.TabFocus
onClicked: highlightDialog.open()

onClicked: {
console.log(highlightDialog.color);
highlightDialog.color = Qt.rgba(0,0,0,0);
// if (Qt.colorEqual(highlightDialog.color, "#000000"))
// highlightDialog.color = Qt.rgba(0,0,0,0);
// else
// highlightDialog.color = prompter.textBackground;
highlightDialog.open();
}
Rectangle {
width: bFontMetrics.width + 3
height: 2
Expand Down
6 changes: 3 additions & 3 deletions src/kirigami_ui/PrompterPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,12 @@ Kirigami.Page {

ColorDialog {
id: colorDialog
currentColor: Kirigami.Theme.textColor
showAlphaChannel: false
}

ColorDialog {
id: highlightDialog
currentColor: Kirigami.Settings.isMobile ? "#FFFF00" : Kirigami.Theme.backgroundColor
showAlphaChannel: false
}

// ShaderEffectSource {
Expand Down
4 changes: 2 additions & 2 deletions src/prompter/Prompter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ Flickable {
cursorPosition: editor.cursorPosition
selectionStart: editor.selectionStart
selectionEnd: editor.selectionEnd
textColor: "#FFF"
textBackground: "#000"
//textColor: "#FFF"
//textBackground: "#000"

onLoaded: {
editor.textFormat = format
Expand Down
1 change: 1 addition & 0 deletions src/prompter/PrompterBackground.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Rectangle {

ColorDialog {
id: backgroundColorDialog
showAlphaChannel: false
currentColor: appTheme.__backgroundColor
onAccepted: {
console.log(color)
Expand Down
1 change: 1 addition & 0 deletions src/prompter/TimerClock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Item {

ColorDialog {
id: timerColorDialog
showAlphaChannel: false
color: '#AAA'
onAccepted: {
timerSettings.color = currentColor
Expand Down
2 changes: 1 addition & 1 deletion src/prompter/documenthandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void DocumentHandler::setDocument(QQuickTextDocument *document)
m_document->textDocument()->disconnect(this);
m_document = document;
if (m_document) {
m_document->textDocument()->setDefaultStyleSheet("body{margin:0;padding:0;}a:link,a:visited,a:hover,a:active{color:#5294e2;text-decoration:none;}p,html,body,div,span,blockquote,address,cite,code,pre,h1,h2,h3,h4,h5,h6,li,ol,ul,table,tbody,td,th,thead,tr,dl,dt,big,small,tt,font{white-space:pre-wrap;font-size:medium;text-align:center;line-height:100%;margin:0;padding:0;border-width:2px;border-collapse:collapse;border-style:solid;border-color:\"#404040\";font-weight:normal;}table,tbody,thead{width:100%;}table,tbody,thead,td,th,tr{border:1pt;align:center;valign:top;}img{margin:5pt;width:50vw;}h1,h2,h3,h4,h5,h6,big{font-size:medium;font-weight:normal;}");
m_document->textDocument()->setDefaultStyleSheet("body{margin:0;padding:0;color:\"#FFFFFF\";}a:link,a:visited,a:hover,a:active,a:before,a:after{text-decoration:overline;color:\"#FFFFFF\";background-color:rgba(0,0,0,0.0);}p,html,body,div,span,blockquote,address,cite,code,pre,h1,h2,h3,h4,h5,h6,li,ol,ul,table,tbody,td,th,thead,tr,dl,dt,big,small,tt,font{white-space:pre-wrap;font-size:medium;text-align:center;line-height:100%;margin:0;padding:0;border-width:2px;border-collapse:collapse;border-style:solid;border-color:\"#404040\";background-color:rgba(0,0,0,0.0);font-weight:normal;}table,tbody,thead{width:100%;}table,tbody,thead,td,th,tr{border:1pt;align:center;valign:top;background-color:rgba(0,0,0,0.0);}img{margin:5pt;width:50vw;}h1,h2,h3,h4,h5,h6,big{font-size:medium;font-weight:normal;}");
connect(m_document->textDocument(), &QTextDocument::modificationChanged, this, &DocumentHandler::modifiedChanged);
connect(m_document->textDocument(), &QTextDocument::contentsChanged, this, &DocumentHandler::setMarkersListDirty);
}
Expand Down

0 comments on commit cff8509

Please sign in to comment.