mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Some more dark themes & themes switching polishing
This commit is contained in:
parent
0411bba02c
commit
dcd4666f59
@ -521,3 +521,14 @@ void GraphView::setSliderColor(const QColor &color)
|
|||||||
_slider->setColor(color);
|
_slider->setColor(color);
|
||||||
_sliderInfo->setColor(color);
|
_sliderInfo->setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphView::changeEvent(QEvent *e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::PaletteChange) {
|
||||||
|
_message->setBrush(QPalette().brush(QPalette::Disabled,
|
||||||
|
QPalette::WindowText));
|
||||||
|
setBackgroundBrush(QBrush(palette().brush(QPalette::Base)));
|
||||||
|
}
|
||||||
|
|
||||||
|
QGraphicsView::changeEvent(e);
|
||||||
|
}
|
||||||
|
@ -70,6 +70,8 @@ protected:
|
|||||||
void clearInfo();
|
void clearInfo();
|
||||||
void skipColor() {_palette.nextColor();}
|
void skipColor() {_palette.nextColor();}
|
||||||
|
|
||||||
|
void changeEvent(QEvent *e);
|
||||||
|
|
||||||
QList<GraphItem*> _graphs;
|
QList<GraphItem*> _graphs;
|
||||||
GraphType _graphType;
|
GraphType _graphType;
|
||||||
|
|
||||||
|
@ -9,28 +9,32 @@
|
|||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
|
||||||
|
|
||||||
StyleComboBox::StyleComboBox(QWidget *parent) : QComboBox(parent)
|
|
||||||
{
|
static Qt::PenStyle styles[] = {Qt::SolidLine, Qt::DashLine, Qt::DotLine,
|
||||||
Qt::PenStyle styles[] = {Qt::SolidLine, Qt::DashLine, Qt::DotLine,
|
|
||||||
Qt::DashDotLine, Qt::DashDotDotLine};
|
Qt::DashDotLine, Qt::DashDotDotLine};
|
||||||
|
|
||||||
QSize is = iconSize();
|
QIcon StyleComboBox::icon(Qt::PenStyle style)
|
||||||
setIconSize(QSize(MIN_LINE_LENGTH, is.height()));
|
{
|
||||||
is = iconSize();
|
QPixmap pm(iconSize());
|
||||||
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(styles); i++) {
|
|
||||||
QPixmap pm(is);
|
|
||||||
pm.fill(Qt::transparent);
|
pm.fill(Qt::transparent);
|
||||||
|
|
||||||
QBrush brush(Qt::black);
|
QBrush brush(QPalette().brush(QPalette::Active, QPalette::WindowText));
|
||||||
QPen pen(brush, is.height() / LINE_WIDTH_RATIO, styles[i]);
|
QPen pen(brush, pm.height() / LINE_WIDTH_RATIO, style);
|
||||||
|
|
||||||
QPainter painter(&pm);
|
QPainter painter(&pm);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
painter.drawLine(0, is.height() / 2, is.width(), is.height() / 2);
|
painter.drawLine(0, pm.height() / 2, pm.width(), pm.height() / 2);
|
||||||
|
|
||||||
addItem(QIcon(pm), QString(), QVariant((int)styles[i]));
|
return QIcon(pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyleComboBox::StyleComboBox(QWidget *parent) : QComboBox(parent)
|
||||||
|
{
|
||||||
|
QSize is = iconSize();
|
||||||
|
setIconSize(QSize(MIN_LINE_LENGTH, is.height()));
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ARRAY_SIZE(styles); i++)
|
||||||
|
addItem(icon(styles[i]), QString(), QVariant((int)styles[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleComboBox::setValue(Qt::PenStyle value)
|
void StyleComboBox::setValue(Qt::PenStyle value)
|
||||||
@ -42,3 +46,12 @@ void StyleComboBox::setValue(Qt::PenStyle value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StyleComboBox::changeEvent(QEvent *e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::PaletteChange)
|
||||||
|
for (int i = 0; i < count(); i++)
|
||||||
|
setItemIcon(i, icon(styles[i]));
|
||||||
|
|
||||||
|
QComboBox::changeEvent(e);
|
||||||
|
}
|
||||||
|
@ -11,6 +11,12 @@ public:
|
|||||||
StyleComboBox(QWidget *parent = 0);
|
StyleComboBox(QWidget *parent = 0);
|
||||||
|
|
||||||
void setValue(Qt::PenStyle value);
|
void setValue(Qt::PenStyle value);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void changeEvent(QEvent *e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QIcon icon(Qt::PenStyle style);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STYLECOMBOBOX_H
|
#endif // STYLECOMBOBOX_H
|
||||||
|
Loading…
Reference in New Issue
Block a user