adapt style function to work with PlainTextEdit
This commit is contained in:
parent
fe5623b804
commit
b9aa141763
@ -8,6 +8,7 @@
|
||||
#include <QTimer>
|
||||
#include <QTextEdit>
|
||||
#include <QColorDialog>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@ -216,13 +217,13 @@ void MainWindow::on_actionEditCut_triggered()
|
||||
|
||||
void MainWindow::setBold(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QTextEdit* textEdit = qobject_cast<QTextEdit*>(focused);
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (textEdit) {
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
QTextCharFormat format;
|
||||
QFont font = textEdit->currentFont();
|
||||
QFont font = plainTextEdit->currentCharFormat().font();
|
||||
font.setBold(!font.bold());
|
||||
format.setFont(font);
|
||||
cursor.mergeCharFormat(format);
|
||||
@ -239,13 +240,13 @@ void MainWindow::on_actionBold_triggered()
|
||||
|
||||
void MainWindow::setItalic(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QTextEdit* textEdit = qobject_cast<QTextEdit*>(focused);
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (textEdit) {
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
QTextCharFormat format;
|
||||
QFont font = textEdit->currentFont();
|
||||
QFont font = plainTextEdit->currentCharFormat().font();
|
||||
font.setItalic(!font.italic());
|
||||
format.setFont(font);
|
||||
cursor.mergeCharFormat(format);
|
||||
@ -261,13 +262,13 @@ void MainWindow::on_actionItalic_triggered()
|
||||
|
||||
void MainWindow::setUnderline(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QTextEdit* textEdit = qobject_cast<QTextEdit*>(focused);
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (textEdit) {
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
QTextCharFormat format;
|
||||
QFont font = textEdit->currentFont();
|
||||
QFont font = plainTextEdit->currentCharFormat().font();
|
||||
font.setUnderline(!font.underline());
|
||||
format.setFont(font);
|
||||
cursor.mergeCharFormat(format);
|
||||
@ -284,11 +285,11 @@ void MainWindow::on_actionUnderline_triggered()
|
||||
|
||||
void MainWindow::setColor(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QTextEdit* textEdit = qobject_cast<QTextEdit*>(focused);
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (textEdit) {
|
||||
if (plainTextEdit) {
|
||||
QColor color = QColorDialog::getColor(Qt::black, this, "Choisir une couleur");
|
||||
QTextCursor cursor = textEdit->textCursor();
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
if (color.isValid()) {
|
||||
QTextCharFormat format;
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/add.png</normaloff>:/data/images/data/images/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -280,13 +280,13 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>100</y>
|
||||
<x>200</x>
|
||||
<y>80</y>
|
||||
<width>391</width>
|
||||
<height>121</height>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -373,7 +373,7 @@
|
||||
</action>
|
||||
<action name="actionNewFile">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/new.png</normaloff>:/data/images/data/images/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -385,7 +385,7 @@
|
||||
</action>
|
||||
<action name="actionSaveFile">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/save_as.png</normaloff>:/data/images/data/images/save_as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -397,7 +397,7 @@
|
||||
</action>
|
||||
<action name="actionSaveAsFile">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/save.png</normaloff>:/data/images/data/images/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -409,7 +409,7 @@
|
||||
</action>
|
||||
<action name="actionPrintFile">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/print.png</normaloff>:/data/images/data/images/print.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -421,7 +421,7 @@
|
||||
</action>
|
||||
<action name="actionEditCopy">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/copy.png</normaloff>:/data/images/data/images/copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -433,7 +433,7 @@
|
||||
</action>
|
||||
<action name="actionEditPaste">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/paste.png</normaloff>:/data/images/data/images/paste.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -445,7 +445,7 @@
|
||||
</action>
|
||||
<action name="actionEditCut">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/cut.png</normaloff>:/data/images/data/images/cut.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -457,7 +457,7 @@
|
||||
</action>
|
||||
<action name="actionEditUndo">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/edit_undo.png</normaloff>:/data/images/data/images/edit_undo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -469,7 +469,7 @@
|
||||
</action>
|
||||
<action name="actionEditRedo">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/edit_redo.png</normaloff>:/data/images/data/images/edit_redo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -481,7 +481,7 @@
|
||||
</action>
|
||||
<action name="actionopenFile">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/open.png</normaloff>:/data/images/data/images/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -493,7 +493,7 @@
|
||||
</action>
|
||||
<action name="actionBold">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/bold.png</normaloff>:/data/images/data/images/bold.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -502,7 +502,7 @@
|
||||
</action>
|
||||
<action name="actionItalic">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/italic.png</normaloff>:/data/images/data/images/italic.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -511,7 +511,7 @@
|
||||
</action>
|
||||
<action name="actionUnderline">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/underline.png</normaloff>:/data/images/data/images/underline.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -520,7 +520,7 @@
|
||||
</action>
|
||||
<action name="actionColor">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/data/images/data/images/font-color.png</normaloff>:/data/images/data/images/font-color.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -528,8 +528,6 @@
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="data.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
124
pages/parcours0.html
Normal file
124
pages/parcours0.html
Normal file
@ -0,0 +1,124 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Carte du parcours</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
#container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
#map {
|
||||
height: 600px;
|
||||
width: 60%;
|
||||
border-radius: 5%;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
#fiche {
|
||||
padding-right:20px;
|
||||
width: 40%;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #aaa;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
background-color:#095228;
|
||||
border-radius: 5%;
|
||||
}
|
||||
#fiche ul {
|
||||
padding-left: 20px;
|
||||
list-style-type: disc;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
white-space: normal;
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
#fiche li {
|
||||
white-space: normal;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
body h1 {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
text-align: center;
|
||||
color: black;
|
||||
font-style: bold;
|
||||
margin-bottom: 20px;
|
||||
background-color:brown;
|
||||
border-radius:12px;
|
||||
height: 75px;
|
||||
}
|
||||
#fiche h2, #fiche h3, #fiche p, #fiche li {
|
||||
color: white;
|
||||
}
|
||||
#fiche img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-top: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Fiche du parcours</h1>
|
||||
<div id="container">
|
||||
<div id="map"></div>
|
||||
<div id="fiche">
|
||||
<h2>parcous123</h2>
|
||||
<p><strong>Ville :</strong> Bourg en bresse</p>
|
||||
<p><strong>Département :</strong> 0</p>
|
||||
<p><strong>Difficulté :</strong> 2</p>
|
||||
<p><strong>Durée (heures) :</strong> 2.3</p>
|
||||
<p><strong>Longueur (km) :</strong> 17.3</p>
|
||||
<img src="data/parcours1.png">
|
||||
<h3>Étape 1</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Quentin</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ok c'est cool</li>
|
||||
</ul>
|
||||
<h3>Étape 2</h3>
|
||||
<p><strong>Personnages :</strong></p>
|
||||
<ul><li>Quentin</li>
|
||||
</ul>
|
||||
<p><strong>Dialogues :</strong></p>
|
||||
<ul><li>ok c'est cool</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
<script>
|
||||
var map = L.map('map').setView([45.5, 1.5], 10); // Vue centrée
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
L.marker([0, 0]).addTo(map).bindPopup("<b>Étape 1</b><br>");
|
||||
var latlngs = [
|
||||
[0, 0],
|
||||
];
|
||||
|
||||
var polyline = L.polyline(latlngs, {
|
||||
color: 'purple',
|
||||
weight: 2,
|
||||
dashArray: '10, 10',
|
||||
opacity: 0.7
|
||||
}).addTo(map);
|
||||
map.fitBounds(polyline.getBounds());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user