From 30c5a027caad423fdfba47912bc97ecdc091f3f1 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 9 Mar 2015 15:22:52 -0300 Subject: Clone a bit of code to mark the Location Widget changed This code is the same that is used on the MainTab, but since they are different objects, I can't just call it. so I'm duplicating them for the time being. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'qt-ui/simplewidgets.cpp') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 8a808d2a2..edee3ec49 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -667,7 +667,7 @@ void MultiFilter::closeFilter() #include #include -LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent) +LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false) { ui.setupUi(this); ui.diveSiteMessage->setText("You are editing the Dive Site"); @@ -755,3 +755,19 @@ void LocationInformationWidget::rejectChanges() void LocationInformationWidget::showEvent(QShowEvent *ev) { ui.diveSiteMessage->setCloseButtonVisible(false); } + +void LocationInformationWidget::markChangedWidget(QWidget *w) +{ + QPalette p; + qreal h, s, l, a; + enableEdition(); + qApp->palette().color(QPalette::Text).getHslF(&h, &s, &l, &a); + p.setBrush(QPalette::Base, (l <= 0.3) ? QColor(Qt::yellow).lighter() : (l <= 0.6) ? QColor(Qt::yellow).light() : /* else */ QColor(Qt::yellow).darker(300)); + w->setPalette(p); + modified = true; +} + +void LocationInformationWidget::enableEdition() +{ + +} -- cgit v1.2.3-70-g09d2