Commit f2fd73b3 authored by Bryant's avatar Bryant

The editable waypoint view has been completely reworked from a styling...

The editable waypoint view has been completely reworked from a styling perspective. Now both the light and dark styles work great, though switching between the styles doesn't work as expected yet. That's still to come.
parent 341d2966
......@@ -254,11 +254,10 @@ QPushButton:pressed, QToolButton:pressed {
QPushButton:pressed#killButton {
font-weight: bold;
min-height: 30px;
color: #000000;
color: #000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #bb8500, stop:1 #903000);
background-clip: border;
border-width: 1px;
border-color: #555555;
border: 1px solid #555;
border-radius: 5px;
}
......@@ -271,7 +270,7 @@ QSlider {
}
QSlider::groove:horizontal {
border: 1px solid #999999;
border: 1px solid #999;
height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background-color: #4A4A4A;
margin: 2px 0;
......@@ -284,7 +283,7 @@ QSlider::groove:horizontal:disabled {
}
QSlider::groove:vertical {
border: 1px solid #999999;
border: 1px solid #999;
width: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background-color: #4A4A4A;
margin: 2px 0;
......@@ -300,7 +299,7 @@ QSlider::handle:horizontal {
QSlider::handle:horizontal:disabled {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #535258, stop: 1 #050508);
border: 2px solid #444444;
border: 2px solid #444;
width: 18px;
margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 3px;
......@@ -321,7 +320,7 @@ QSizeGrip {
QSpinBox, QDoubleSpinBox {
min-height: 14px;
max-height: 18px;
border: 1px solid #4A4A4A;
border: 1px solid #777;
border-radius: 5px;
}
......@@ -360,7 +359,7 @@ QTabBar::tab:hover {
QTabBar::tab:selected {
border: 2px solid #379AC3;
background: #CCC;
background: #555;
}
QTabWidget::tab-bar {
......@@ -392,3 +391,13 @@ QToolTip {
border-radius: 3px;
color: #DDD;
}
WaypointEditableView {
border: 1px solid #777;
border-radius: 5px;
margin-bottom: 3px;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget {
background: none;
}
......@@ -254,14 +254,17 @@ QPushButton:pressed, QToolButton:pressed {
QPushButton:pressed#killButton {
font-weight: bold;
min-height: 30px;
color: #000000;
color: #000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #bb8500, stop:1 #903000);
background-clip: border;
border-width: 1px;
border-color: #555555;
border: 1px solid #555;
border-radius: 5px;
}
QScrollBar {
border: 1px solid #333;
}
QSeparator {
color: #EEE;
}
......@@ -392,3 +395,13 @@ QToolTip {
border-radius: 3px;
color: #000;
}
WaypointEditableView {
border: 1px solid #333;
border-radius: 5px;
margin-bottom: 3px;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget {
background: none;
}
......@@ -20,7 +20,7 @@
#include "WaypointEditableView.h"
#include "ui_WaypointEditableView.h"
#include "MainWindow.h"
#include "mission/QGCMissionNavWaypoint.h"
#include "mission/QGCMissionNavLoiterUnlim.h"
#include "mission/QGCMissionNavLoiterTurns.h"
......@@ -488,41 +488,41 @@ void WaypointEditableView::updateValues()
{
m_ui->autoContinue->setChecked(wp->getAutoContinue());
}
m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
m_ui->idLabel->setText(QString::number(wp->getId()));
QColor backGroundColor = QGC::colorBackground;
// Style alternating rows of Missions as lighter/darker.
QString backGroundColor;
static int lastId = -1;
int currId = wp->getId() % 2;
if (currId != lastId)
{
// qDebug() << "COLOR ID: " << currId;
if (currId == 1)
{
//backGroundColor = backGroundColor.lighter(150);
backGroundColor = QColor("#252528").lighter(150);
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
}
else
{
backGroundColor = QColor("#252528").lighter(250);
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#CCC";
}
else
{
backGroundColor = "#555";
}
}
// qDebug() << "COLOR:" << backGroundColor.name();
// Update color based on id
QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; }").arg(backGroundColor.name());
QString labelStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; }").arg(backGroundColor.name());
QString checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; }").arg(backGroundColor.name());
QString widgetSlotStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; } QSpinBox {background-color: #252528 } QDoubleSpinBox {background-color: #252528 } QComboBox {background-color: #252528 }").arg(backGroundColor.name()); //FIXME There should be a way to declare background color for widgetSlot without letting the children inherit this color. Here, background color for every widget-type (QSpinBox, etc.) has to be declared separately to overrule the coloring of QWidget.
m_ui->autoContinue->setStyleSheet(checkBoxStyle);
m_ui->selectedBox->setStyleSheet(checkBoxStyle);
m_ui->idLabel->setStyleSheet(labelStyle);
m_ui->groupBox->setStyleSheet(groupBoxStyle);
m_ui->customActionWidget->setStyleSheet(widgetSlotStyle);
QString newStyle = QString("WaypointEditableView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId;
}
......@@ -651,3 +651,11 @@ void WaypointEditableView::changeEvent(QEvent *e)
break;
}
}
void WaypointEditableView::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
......@@ -77,7 +77,7 @@ public slots:
void remove();
/** @brief Waypoint matching this widget has been deleted */
void deleted(QObject* waypoint);
void changedAutoContinue(int);
void changedAutoContinue(int);
void changedFrame(int state);
void updateActionView(int action);
void initializeActionView(int action);
......@@ -98,6 +98,7 @@ protected slots:
protected:
virtual void changeEvent(QEvent *e);
virtual void paintEvent(QPaintEvent *);
Waypoint* wp;
QGC_WAYPOINTEDITABLEVIEW_MODE viewMode;
// Widgets for every mission element
......@@ -122,7 +123,7 @@ private:
signals:
void moveUpWaypoint(Waypoint*);
void moveDownWaypoint(Waypoint*);
void removeWaypoint(Waypoint*);
void removeWaypoint(Waypoint*);
void changeCurrentWaypoint(quint16);
void setYaw(double);
......
This diff is collapsed.
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