Commit 6377dab3 authored by Bryant's avatar Bryant

The background color of the mission items is now controlled by stylesheets as...

The background color of the mission items is now controlled by stylesheets as well. This change also fixed restyling the mission lists when a style change occurred.
parent 3d1a54df
...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView { ...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView {
margin-bottom: 3px; margin-bottom: 3px;
} }
WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] {
background-color: #333;
}
WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] {
background-color: #555;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget {
background: none; background: none;
} }
...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView { ...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView {
margin-bottom: 3px; margin-bottom: 3px;
} }
WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] {
background-color: #999;
}
WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] {
background-color: #CCC;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget {
background: none; background: none;
} }
...@@ -492,37 +492,18 @@ void WaypointEditableView::updateValues() ...@@ -492,37 +492,18 @@ void WaypointEditableView::updateValues()
m_ui->idLabel->setText(QString::number(wp->getId())); m_ui->idLabel->setText(QString::number(wp->getId()));
// Style alternating rows of Missions as lighter/darker. // Style alternating rows of Missions as lighter/darker.
QString backGroundColor;
static int lastId = -1; static int lastId = -1;
int currId = wp->getId() % 2; int currId = wp->getId() % 2;
if (currId != lastId) if (currId != lastId)
{ {
if (currId == 1) if (currId == 1)
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "odd");
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
}
else
{
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#CCC";
} }
else else
{ {
backGroundColor = "#555"; this->setProperty("RowColoring", "even");
} }
}
QString newStyle = QString("WaypointEditableView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId; lastId = currId;
} }
......
...@@ -90,32 +90,14 @@ void WaypointViewOnlyView::updateValues() ...@@ -90,32 +90,14 @@ void WaypointViewOnlyView::updateValues()
int currId = wp->getId() % 2; int currId = wp->getId() % 2;
if (currId != lastId) if (currId != lastId)
{ {
QString backGroundColor;
if (currId == 1) if (currId == 1)
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "odd");
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
} }
else else
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "even");
{
backGroundColor = "#CCC";
} }
else
{
backGroundColor = "#555";
}
}
QString newStyle = QString("WaypointViewOnlyView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId; lastId = currId;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment