Commit deabae38 authored by Jens Bache-Wiig's avatar Jens Bache-Wiig
Browse files

Add drop shadow to project settings

I added a second drop shadow to make the panel a bit nicer.
This also makes it clearer what the scrollbar does.

Reviewed-by:thorbjorn
parent b7ae4916
......@@ -137,7 +137,7 @@ int TargetSelector::targetWidth() const
QSize TargetSelector::minimumSizeHint() const
{
return QSize((targetWidth() + 1) * m_targets.size() + (ADDBUTTON_WIDTH + 1) * 2 + 1, TARGET_HEIGHT + 2);
return QSize((targetWidth() + 1) * m_targets.size() + (ADDBUTTON_WIDTH + 1) * 2 + 3, TARGET_HEIGHT + 4);
}
void TargetSelector::mousePressEvent(QMouseEvent *event)
......@@ -191,11 +191,20 @@ void TargetSelector::paintEvent(QPaintEvent *event)
QSize size = minimumSizeHint();
//draw frame
p.drawLine(1, 0, size.width() - 2, 0);
p.drawLine(1, size.height() - 3, size.width() - 2, size.height() - 3);
p.drawLine(1, 1, 1, size.height() - 4);
p.drawLine(size.width() - 2, 1, size.width() - 2, size.height() - 4);
//draw shadow
p.setPen(QColor(0, 0, 0, 50));
p.drawLine(1, size.height() - 2, size.width() - 2, size.height() - 2);
p.setPen(QColor(0, 0, 0, 20));
p.drawLine(0, size.height() - 2, 0, size.height() - 9);
p.drawLine(size.width()-1, size.height() - 2, size.width()-1, size.height() - 9);
p.drawLine(1, size.height() - 1, size.width() - 2, size.height() - 1);
p.drawLine(0, 1, 0, size.height() - 2);
p.drawLine(size.width() - 1, 1, size.width() - 1, size.height() - 2);
//draw targets
int x = 1;
int x = 2;
int index = 0;
QFontMetrics fm(font());
if (m_removeButtonEnabled)
......@@ -231,7 +240,7 @@ void TargetSelector::paintEvent(QPaintEvent *event)
// Build
int margin = 2; // position centered within the rounded buttons
QFontMetrics fm = fontMetrics();
QRect textRect(x + margin, size.height() - fm.height() - 5, targetWidth()/2, fm.height());
QRect textRect(x + margin, size.height() - fm.height() - 7, targetWidth()/2, fm.height());
p.setPen(buildSelected ? Qt::black : Qt::white);
if (index!=m_currentTargetIndex)
p.setPen(QColor(0x555555));
......
......@@ -21,6 +21,19 @@ TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) :
this, SIGNAL(removeButtonClicked()));
connect(m_targetSelector, SIGNAL(currentChanged(int,int)),
this, SIGNAL(currentChanged(int,int)));
m_shadow = new QWidget(this);
// Create shadow below targetselector
m_targetSelector->raise();
QPalette shadowPal = palette();
QLinearGradient grad(0, 0, 0, 2);
grad.setColorAt(0, QColor(0, 0, 0, 60));
grad.setColorAt(1, Qt::transparent);
shadowPal.setBrush(QPalette::All, QPalette::Window, grad);
m_shadow->setPalette(shadowPal);
m_shadow->setAutoFillBackground(true);
updateTargetSelector();
}
......@@ -102,9 +115,15 @@ bool TargetSettingsWidget::isRemoveButtonEnabled() const
return m_targetSelector->isRemoveButtonEnabled();
}
void TargetSettingsWidget::resizeEvent(QResizeEvent *e)
{
QWidget::resizeEvent(e);
m_shadow->setGeometry(0, m_targetSelector->height() + 3, width(), 2);
}
void TargetSettingsWidget::updateTargetSelector()
{
m_targetSelector->setGeometry((WIDTH-m_targetSelector->minimumSizeHint().width())/2, 12,
m_targetSelector->setGeometry((WIDTH-m_targetSelector->minimumSizeHint().width())/2, 13,
m_targetSelector->minimumSizeHint().width(),
m_targetSelector->minimumSizeHint().height());
}
......
......@@ -43,6 +43,7 @@ signals:
void currentChanged(int targetIndex, int subIndex);
protected:
void resizeEvent(QResizeEvent *);
void changeEvent(QEvent *e);
private:
......@@ -50,6 +51,7 @@ private:
Ui::TargetSettingsWidget *ui;
TargetSelector *m_targetSelector;
QWidget *m_shadow;
};
} // namespace Internal
......
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