fixed compatibility with older Qt version (before 5.12)

This commit is contained in:
jkriege2 2022-08-22 10:39:25 +02:00
parent cffa7189d4
commit 37024ffe34
2 changed files with 4 additions and 2 deletions

View File

@ -277,11 +277,12 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
menuPal->addAction(act);
#if (QT_VERSION>=QT_VERSION_CHECK(5, 12, 0))
colName="placeholdertext";
act=new QAction(jkqtp_makeQColorIcon(jkqtp_String2QColor(colName)), colName);
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
menuPal->addAction(act);
#endif
int trans;
trans=100; colName=QString::number(trans)+"%";
act=new QAction(jkqtp_makeQColorIcon(QColor(0,0,255,(100-trans)*255/100)), colName);

View File

@ -554,8 +554,9 @@ QColor jkqtp_lookupQColorName(const QString &color) {
if (col=="norole") return QGuiApplication::palette().color(QPalette::NoRole);
if (col=="tooltipbase") return QGuiApplication::palette().color(QPalette::ToolTipBase);
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);
#endif
for (int i=0; i<rgbTblSize; i++) {
if (col==rgbTbl[i].name) return QColor(rgbTbl[i].value);