mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
Greentext color is defined in stylesheet, and can be overridden with qss files
This commit is contained in:
parent
bc4691ceb4
commit
e2c40d6693
6 changed files with 32 additions and 1 deletions
|
@ -41,6 +41,7 @@ MimeTextEdit::MimeTextEdit(QWidget *parent)
|
||||||
mCompleterKeyModifiers = Qt::ControlModifier;
|
mCompleterKeyModifiers = Qt::ControlModifier;
|
||||||
mCompleterKey = Qt::Key_Space;
|
mCompleterKey = Qt::Key_Space;
|
||||||
mForceCompleterShowNextKeyEvent = false;
|
mForceCompleterShowNextKeyEvent = false;
|
||||||
|
highliter = new RsSyntaxHighlighter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
|
bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include "RSTextEdit.h"
|
#include "RSTextEdit.h"
|
||||||
|
#include "util/RsSyntaxHighlighter.h"
|
||||||
|
|
||||||
class MimeTextEdit : public RSTextEdit
|
class MimeTextEdit : public RSTextEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(QColor textColorQuote READ textColorQuote WRITE setTextColorQuote)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MimeTextEdit(QWidget *parent = 0);
|
MimeTextEdit(QWidget *parent = 0);
|
||||||
|
|
||||||
|
@ -44,6 +47,11 @@ public:
|
||||||
// Add QAction to context menu (action won't be deleted)
|
// Add QAction to context menu (action won't be deleted)
|
||||||
void addContextMenuAction(QAction *action);
|
void addContextMenuAction(QAction *action);
|
||||||
|
|
||||||
|
QColor textColorQuote() const { return highliter->textColorQuote();}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void calculateContextMenuActions();
|
void calculateContextMenuActions();
|
||||||
|
|
||||||
|
@ -71,6 +79,7 @@ private:
|
||||||
bool mForceCompleterShowNextKeyEvent;
|
bool mForceCompleterShowNextKeyEvent;
|
||||||
QString mCompleterStartString;
|
QString mCompleterStartString;
|
||||||
QList<QAction*> mContextMenuActions;
|
QList<QAction*> mContextMenuActions;
|
||||||
|
RsSyntaxHighlighter *highliter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MIMETEXTEDIT_H
|
#endif // MIMETEXTEDIT_H
|
||||||
|
|
|
@ -10,6 +10,8 @@ class RSTextBrowser : public QTextBrowser
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(QColor textColorQuote READ textColorQuote WRITE setTextColorQuote)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RSTextBrowser(QWidget *parent = 0);
|
explicit RSTextBrowser(QWidget *parent = 0);
|
||||||
|
|
||||||
|
@ -21,8 +23,11 @@ public:
|
||||||
|
|
||||||
virtual QVariant loadResource(int type, const QUrl &name);
|
virtual QVariant loadResource(int type, const QUrl &name);
|
||||||
|
|
||||||
|
QColor textColorQuote() const { return highliter->textColorQuote();}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showImages();
|
void showImages();
|
||||||
|
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void linkClicked(const QUrl &url);
|
void linkClicked(const QUrl &url);
|
||||||
|
|
|
@ -188,6 +188,11 @@ NetworkDialog
|
||||||
qproperty-backgroundColorDenied: lightGray;
|
qproperty-backgroundColorDenied: lightGray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RSTextBrowser, MimeTextEdit
|
||||||
|
{
|
||||||
|
qproperty-textColorQuote: rgb(120, 153, 34);
|
||||||
|
}
|
||||||
|
|
||||||
QLabel#headerTextLabel
|
QLabel#headerTextLabel
|
||||||
{
|
{
|
||||||
qproperty-fontSizeFactor: 225;
|
qproperty-fontSizeFactor: 225;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
RsSyntaxHighlighter::RsSyntaxHighlighter(QTextEdit *parent)
|
RsSyntaxHighlighter::RsSyntaxHighlighter(QTextEdit *parent)
|
||||||
: QSyntaxHighlighter(parent)
|
: QSyntaxHighlighter(parent)
|
||||||
{
|
{
|
||||||
quotationFormat.setForeground(QColor(120,153,34));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsSyntaxHighlighter::highlightBlock(const QString &text)
|
void RsSyntaxHighlighter::highlightBlock(const QString &text)
|
||||||
|
@ -26,6 +26,12 @@ void RsSyntaxHighlighter::highlightBlock(const QString &text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsSyntaxHighlighter::setTextColorQuote(QColor textColorQuote)
|
||||||
|
{
|
||||||
|
quotationFormat.setForeground(textColorQuote);
|
||||||
|
this->rehighlight();
|
||||||
|
}
|
||||||
|
|
||||||
//Dumping the raw unicode string into the console in Base64 encoding
|
//Dumping the raw unicode string into the console in Base64 encoding
|
||||||
/*
|
/*
|
||||||
QByteArray uniline;
|
QByteArray uniline;
|
||||||
|
|
|
@ -9,8 +9,11 @@ class RsSyntaxHighlighter : public QSyntaxHighlighter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(QColor textColorQuote READ textColorQuote WRITE setTextColorQuote)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RsSyntaxHighlighter(QTextEdit *parent = 0);
|
RsSyntaxHighlighter(QTextEdit *parent = 0);
|
||||||
|
QColor textColorQuote() const { return quotationFormat.foreground().color(); };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void highlightBlock(const QString &text);
|
void highlightBlock(const QString &text);
|
||||||
|
@ -21,6 +24,8 @@ private:
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setTextColorQuote(QColor textColorQuote);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSSYNTAXHIGHLIGHTER_H
|
#endif // RSSYNTAXHIGHLIGHTER_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue