File indexing completed on 2024-05-12 03:47:46
0001 #ifndef WARNINGSTYLE_H 0002 #define WARNINGSTYLE_H 0003 0004 // "red" warning color in formula inputs, etc. 0005 #define SET_WARNING_STYLE(elem) \ 0006 { \ 0007 QPalette p; \ 0008 if (qGray(p.color(QPalette::Base).rgb()) > 160) /* light */ \ 0009 elem->setStyleSheet(QLatin1String("background: rgb(255, 200, 200);")); \ 0010 else /* dark */ \ 0011 elem->setStyleSheet(QLatin1String("background: rgb(128, 0, 0);")); \ 0012 } 0013 0014 #define SET_WARNING_PALETTE \ 0015 { \ 0016 QPalette p = palette(); \ 0017 if (qGray(p.color(QPalette::Base).rgb()) > 160) /* light */ \ 0018 p.setColor(QPalette::Text, QColor(255, 200, 200)); \ 0019 else /* dark */ \ 0020 p.setColor(QPalette::Text, QColor(128, 0, 0)); \ 0021 setPalette(p); \ 0022 } 0023 0024 #define SET_WARNING_BACKGROUND(elem) \ 0025 { \ 0026 QPalette p = palette(); \ 0027 if (qGray(p.color(QPalette::Base).rgb()) > 160) /* light */ \ 0028 elem->setBackground(QColor(255, 200, 200)); \ 0029 else /* dark */ \ 0030 elem->setBackground(QColor(128, 0, 0)); \ 0031 } 0032 0033 #endif // WARNINGSTYLE_H