Commit 7c57e2e5 authored by Lorenz Meier's avatar Lorenz Meier

Fixed visual bug on status bar

parent 3325c274
......@@ -104,9 +104,14 @@ MainWindow::MainWindow(QWidget *parent):
lowPowerMode(false)
{
hide();
isAdvancedMode = false;
emit initStatusChanged("Loading UI Settings..");
loadSettings();
emit initStatusChanged("Loading Style.");
loadStyle(currentStyle);
if (settings.contains("ADVANCED_MODE"))
{
isAdvancedMode = settings.value("ADVANCED_MODE").toBool();
......@@ -132,9 +137,6 @@ MainWindow::MainWindow(QWidget *parent):
settings.sync();
emit initStatusChanged("Loading Style.");
loadStyle(currentStyle);
emit initStatusChanged("Setting up user interface.");
// Setup user interface
......@@ -175,12 +177,12 @@ MainWindow::MainWindow(QWidget *parent):
advancedActions << ui.actionEngineersView;
toolBar->setPerspectiveChangeAdvancedActions(advancedActions);
customStatusBar = new QGCStatusBar(this);
setStatusBar(customStatusBar);
statusBar()->setSizeGripEnabled(true);
emit initStatusChanged("Building common widgets.");
buildCommonWidgets();
......@@ -394,7 +396,6 @@ void MainWindow::buildCommonWidgets()
logPlayer = new QGCMAVLinkLogPlayer(mavlink, customStatusBar);
customStatusBar->setLogPlayer(logPlayer);
// Center widgets
if (!plannerView)
{
......
......@@ -44,12 +44,17 @@ QGCStatusBar::QGCStatusBar(QWidget *parent) :
loadSettings();
setStyleSheet("QWidget {border-color: transparent; } QStatusBar {border-color: transparent; border: 0px; border-bottom: 1px solid #101010; border-top: 1px solid #4F4F4F; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4B4B4B, stop:0.3 #404040, stop:0.34 #383838, stop:1 #181818);}");
setStyleSheet("QStatusBar { border: 0px; border-bottom: 1px solid #101010; border-top: 1px solid #4F4F4F; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4B4B4B, stop:0.3 #404040, stop:0.34 #383838, stop:1 #181818); } ");
}
void QGCStatusBar::paintEvent(QPaintEvent * event)
{
// if (currentMessage().length() != 0) {
QPainter p(this);
QStyleOption opt;
opt.initFrom(this);
style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this);
//QStatusBar::paintEvent(event);
// if (currentMessage().length() == 0) {
// QStatusBar::paintEvent(event);
// } else {
......
......@@ -54,11 +54,11 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms)
// Alternate colors to increase visibility
if ((ms / 1000) % 2 == 0)
{
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
}
else
{
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.dark(250).name()));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.dark(250).name()));
}
toolBarTimeoutLabel->setText(tr("CONNECTION LOST: %1 s").arg((ms / 1000.0f), 2, 'f', 1, ' '));
}
......@@ -91,12 +91,12 @@ void QGCToolBar::createUI()
toolBarTimeoutLabel = new QLabel("UNCONNECTED", this);
toolBarTimeoutLabel->setToolTip(tr("System timed out, interval since last message"));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarTimeoutLabel);
toolBarSafetyLabel = new QLabel("SAFE", this);
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setToolTip(tr("Vehicle safety state"));
toolBarSafetyLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarSafetyLabel);
......@@ -353,12 +353,12 @@ void QGCToolBar::updateView()
if (systemArmed)
{
toolBarSafetyLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorRed.name()).arg(QGC::colorYellow.name()));
toolBarSafetyLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorRed.name()).arg(QGC::colorYellow.name()));
toolBarSafetyLabel->setText(tr("ARMED"));
}
else
{
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setText(tr("SAFE"));
}
......
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