|
|
@ -131,6 +131,29 @@ void MessageBytesDelegate::paint(QPainter *painter, const QStyleOptionViewItem & |
|
|
|
painter->setPen(old_pen); |
|
|
|
painter->setPen(old_pen); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TabBar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int TabBar::addTab(const QString &text) { |
|
|
|
|
|
|
|
int index = QTabBar::addTab(text); |
|
|
|
|
|
|
|
QToolButton *btn = new ToolButton("x", tr("Close Tab")); |
|
|
|
|
|
|
|
int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, btn); |
|
|
|
|
|
|
|
int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, btn); |
|
|
|
|
|
|
|
btn->setFixedSize({width, height}); |
|
|
|
|
|
|
|
setTabButton(index, QTabBar::RightSide, btn); |
|
|
|
|
|
|
|
QObject::connect(btn, &QToolButton::clicked, this, &TabBar::closeTabClicked); |
|
|
|
|
|
|
|
return index; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TabBar::closeTabClicked() { |
|
|
|
|
|
|
|
QObject *object = sender(); |
|
|
|
|
|
|
|
for (int i = 0; i < count(); ++i) { |
|
|
|
|
|
|
|
if (tabButton(i, QTabBar::RightSide) == object) { |
|
|
|
|
|
|
|
emit tabCloseRequested(i); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QColor getColor(const cabana::Signal *sig) { |
|
|
|
QColor getColor(const cabana::Signal *sig) { |
|
|
|
float h = 19 * (float)sig->lsb / 64.0; |
|
|
|
float h = 19 * (float)sig->lsb / 64.0; |
|
|
|
h = fmod(h, 1.0); |
|
|
|
h = fmod(h, 1.0); |
|
|
@ -191,7 +214,7 @@ void setTheme(int theme) { |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor("#777777")); |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor("#777777")); |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::WindowText, QColor("#777777")); |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::WindowText, QColor("#777777")); |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::Text, QColor("#777777"));; |
|
|
|
new_palette.setColor(QPalette::Disabled, QPalette::Text, QColor("#777777"));; |
|
|
|
new_palette.setColor(QPalette::Light, QColor("#3c3f41")); |
|
|
|
new_palette.setColor(QPalette::Light, QColor("#777777")); |
|
|
|
new_palette.setColor(QPalette::Dark, QColor("#353535")); |
|
|
|
new_palette.setColor(QPalette::Dark, QColor("#353535")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
new_palette = style->standardPalette(); |
|
|
|
new_palette = style->standardPalette(); |
|
|
|