mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 18:15:52 +08:00
fixed compatibility with older Qt version (before 5.12)
This commit is contained in:
parent
cffa7189d4
commit
37024ffe34
@ -277,11 +277,12 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
|
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
|
||||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||||
menuPal->addAction(act);
|
menuPal->addAction(act);
|
||||||
|
#if (QT_VERSION>=QT_VERSION_CHECK(5, 12, 0))
|
||||||
colName="placeholdertext";
|
colName="placeholdertext";
|
||||||
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
|
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
|
||||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||||
menuPal->addAction(act);
|
menuPal->addAction(act);
|
||||||
|
#endif
|
||||||
int trans;
|
int trans;
|
||||||
trans=100; colName=QString::number(trans)+"%";
|
trans=100; colName=QString::number(trans)+"%";
|
||||||
act=new QAction(jkqtp_makeQColorIcon(QColor(0,0,255,(100-trans)*255/100)), colName);
|
act=new QAction(jkqtp_makeQColorIcon(QColor(0,0,255,(100-trans)*255/100)), colName);
|
||||||
|
@ -554,8 +554,9 @@ QColor jkqtp_lookupQColorName(const QString &color) {
|
|||||||
if (col=="norole") return QGuiApplication::palette().color(QPalette::NoRole);
|
if (col=="norole") return QGuiApplication::palette().color(QPalette::NoRole);
|
||||||
if (col=="tooltipbase") return QGuiApplication::palette().color(QPalette::ToolTipBase);
|
if (col=="tooltipbase") return QGuiApplication::palette().color(QPalette::ToolTipBase);
|
||||||
if (col=="tooltiptext") return QGuiApplication::palette().color(QPalette::ToolTipText);
|
if (col=="tooltiptext") return QGuiApplication::palette().color(QPalette::ToolTipText);
|
||||||
|
#if (QT_VERSION>=QT_VERSION_CHECK(5, 12, 0))
|
||||||
if (col=="placeholdertext") return QGuiApplication::palette().color(QPalette::PlaceholderText);
|
if (col=="placeholdertext") return QGuiApplication::palette().color(QPalette::PlaceholderText);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<rgbTblSize; i++) {
|
for (int i=0; i<rgbTblSize; i++) {
|
||||||
if (col==rgbTbl[i].name) return QColor(rgbTbl[i].value);
|
if (col==rgbTbl[i].name) return QColor(rgbTbl[i].value);
|
||||||
|
Loading…
Reference in New Issue
Block a user