mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 17:09:56 +00:00
Upgrade to QWT 6.0.1, but still uses a locally patched copy since support for 8 axes has not been included, despite it being a relatively simple patch. Fixes #634. Fixes #567.
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#include <qlayout.h>
|
|
#include "tunerfrm.h"
|
|
#include "ampfrm.h"
|
|
#include "mainwindow.h"
|
|
|
|
MainWindow::MainWindow():
|
|
QWidget()
|
|
{
|
|
TunerFrame *frmTuner = new TunerFrame(this);
|
|
frmTuner->setFrameStyle(QFrame::Panel|QFrame::Raised);
|
|
|
|
AmpFrame *frmAmp = new AmpFrame(this);
|
|
frmAmp->setFrameStyle(QFrame::Panel|QFrame::Raised);
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
layout->setMargin(0);
|
|
layout->setSpacing(0);
|
|
layout->addWidget(frmTuner);
|
|
layout->addWidget(frmAmp);
|
|
|
|
connect(frmTuner, SIGNAL(fieldChanged(double)),
|
|
frmAmp, SLOT(setMaster(double)));
|
|
|
|
frmTuner->setFreq(90.0);
|
|
|
|
setPalette( QPalette( QColor( 192, 192, 192 ) ) );
|
|
updateGradient();
|
|
}
|
|
|
|
void MainWindow::resizeEvent( QResizeEvent * )
|
|
{
|
|
#ifdef Q_WS_X11
|
|
updateGradient();
|
|
#endif
|
|
}
|
|
|
|
void MainWindow::updateGradient()
|
|
{
|
|
QPalette pal = palette();
|
|
|
|
const QColor buttonColor = pal.color( QPalette::Button );
|
|
const QColor lightColor = pal.color( QPalette::Light );
|
|
const QColor midLightColor = pal.color( QPalette::Midlight );
|
|
|
|
#ifdef Q_WS_X11
|
|
// Qt 4.7.1: QGradient::StretchToDeviceMode is buggy on X11
|
|
|
|
QLinearGradient gradient( rect().topLeft(), rect().topRight() );
|
|
#else
|
|
QLinearGradient gradient( 0, 0, 1, 0 );
|
|
gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
|
|
#endif
|
|
|
|
gradient.setColorAt( 0.0, midLightColor );
|
|
gradient.setColorAt( 0.7, buttonColor );
|
|
gradient.setColorAt( 1.0, buttonColor );
|
|
|
|
pal.setBrush( QPalette::Window, gradient );
|
|
setPalette( pal );
|
|
}
|