forked from qt-creator/qt-creator
Some polish for the actionbar
* I have simplified and animated the tool buttons a bit. * The panel has been replaced by a very basic clean panel. * The tool buttons have been animated.
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QPalette>
|
#include <QtGui/QPalette>
|
||||||
|
#include <QtGui/QStyleOption>
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
// Clamps float color values within (0, 255)
|
// Clamps float color values within (0, 255)
|
||||||
static int clamp(float x)
|
static int clamp(float x)
|
||||||
@@ -247,6 +249,84 @@ static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &
|
|||||||
p->fillRect(rect, grad);
|
p->fillRect(rect, grad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option)
|
||||||
|
{
|
||||||
|
// From windowsstyle but modified to enable AA
|
||||||
|
if (option->rect.width() <= 1 || option->rect.height() <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QRect r = option->rect;
|
||||||
|
int size = qMin(r.height(), r.width());
|
||||||
|
QPixmap pixmap;
|
||||||
|
QString pixmapName;
|
||||||
|
pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld",
|
||||||
|
"$qt_ia",
|
||||||
|
uint(option->state), element,
|
||||||
|
size, option->palette.cacheKey());
|
||||||
|
if (!QPixmapCache::find(pixmapName, pixmap)) {
|
||||||
|
int border = size/5;
|
||||||
|
int sqsize = 2*(size/2);
|
||||||
|
QImage image(sqsize, sqsize, QImage::Format_ARGB32);
|
||||||
|
image.fill(Qt::transparent);
|
||||||
|
QPainter imagePainter(&image);
|
||||||
|
imagePainter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
imagePainter.translate(0.5, 0.5);
|
||||||
|
QPolygon a;
|
||||||
|
switch (element) {
|
||||||
|
case QStyle::PE_IndicatorArrowUp:
|
||||||
|
a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2);
|
||||||
|
break;
|
||||||
|
case QStyle::PE_IndicatorArrowDown:
|
||||||
|
a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2);
|
||||||
|
break;
|
||||||
|
case QStyle::PE_IndicatorArrowRight:
|
||||||
|
a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
|
||||||
|
break;
|
||||||
|
case QStyle::PE_IndicatorArrowLeft:
|
||||||
|
a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bsx = 0;
|
||||||
|
int bsy = 0;
|
||||||
|
|
||||||
|
if (option->state & QStyle::State_Sunken) {
|
||||||
|
bsx = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
|
||||||
|
bsy = qApp->style()->pixelMetric(QStyle::PM_ButtonShiftVertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRect bounds = a.boundingRect();
|
||||||
|
int sx = sqsize / 2 - bounds.center().x() - 1;
|
||||||
|
int sy = sqsize / 2 - bounds.center().y() - 1;
|
||||||
|
imagePainter.translate(sx + bsx, sy + bsy);
|
||||||
|
|
||||||
|
if (!(option->state & QStyle::State_Enabled)) {
|
||||||
|
QColor foreGround(150, 150, 150, 150);
|
||||||
|
imagePainter.setBrush(option->palette.mid().color());
|
||||||
|
imagePainter.setPen(option->palette.mid().color());
|
||||||
|
} else {
|
||||||
|
QColor shadow(0, 0, 0, 100);
|
||||||
|
imagePainter.translate(0, 1);
|
||||||
|
imagePainter.setPen(shadow);
|
||||||
|
imagePainter.setBrush(shadow);
|
||||||
|
QColor foreGround(255, 255, 255, 210);
|
||||||
|
imagePainter.drawPolygon(a);
|
||||||
|
imagePainter.translate(0, -1);
|
||||||
|
imagePainter.setPen(foreGround);
|
||||||
|
imagePainter.setBrush(foreGround);
|
||||||
|
}
|
||||||
|
imagePainter.drawPolygon(a);
|
||||||
|
imagePainter.end();
|
||||||
|
pixmap = QPixmap::fromImage(image);
|
||||||
|
QPixmapCache::insert(pixmapName, pixmap);
|
||||||
|
}
|
||||||
|
int xOffset = r.x() + (r.width() - size)/2;
|
||||||
|
int yOffset = r.y() + (r.height() - size)/2;
|
||||||
|
painter->drawPixmap(xOffset, yOffset, pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect)
|
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect)
|
||||||
{
|
{
|
||||||
if (StyleHelper::usePixmapCache()) {
|
if (StyleHelper::usePixmapCache()) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
#include <QtGui/QColor>
|
#include <QtGui/QColor>
|
||||||
|
#include <QtGui/QStyle>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPalette;
|
class QPalette;
|
||||||
@@ -63,6 +64,9 @@ public:
|
|||||||
// Sets the base color and makes sure all top level widgets are updated
|
// Sets the base color and makes sure all top level widgets are updated
|
||||||
static void setBaseColor(const QColor &color);
|
static void setBaseColor(const QColor &color);
|
||||||
|
|
||||||
|
// Draws a shaded anti-aliased arrow
|
||||||
|
static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option);
|
||||||
|
|
||||||
// Gradients used for panels
|
// Gradients used for panels
|
||||||
static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
static void horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
||||||
static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
static void verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored = false);
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ const char * const SETTINGS_CATEGORY_CORE = "A.Core";
|
|||||||
const char * const SETTINGS_TR_CATEGORY_CORE = QT_TRANSLATE_NOOP("Core", "Environment");
|
const char * const SETTINGS_TR_CATEGORY_CORE = QT_TRANSLATE_NOOP("Core", "Environment");
|
||||||
const char * const SETTINGS_ID_ENVIRONMENT = "A.General";
|
const char * const SETTINGS_ID_ENVIRONMENT = "A.General";
|
||||||
|
|
||||||
const int TARGET_ICON_SIZE = 32;
|
const int TARGET_ICON_SIZE = 24;
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -43,6 +43,10 @@
|
|||||||
#include <QtGui/QStatusBar>
|
#include <QtGui/QStatusBar>
|
||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QStyleOption>
|
#include <QtGui/QStyleOption>
|
||||||
|
#include <QtCore/QEvent>
|
||||||
|
#include <QtGui/QMouseEvent>
|
||||||
|
#include <QtCore/QAnimationGroup>
|
||||||
|
#include <QtCore/QPropertyAnimation>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
@@ -54,50 +58,84 @@ FancyToolButton::FancyToolButton(QWidget *parent)
|
|||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FancySeparator::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.fillRect(rect(), Qt::red);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FancyToolButton::event(QEvent *e)
|
||||||
|
{
|
||||||
|
switch(e->type()) {
|
||||||
|
case QEvent::Enter:
|
||||||
|
{
|
||||||
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
|
||||||
|
animation->setDuration(250);
|
||||||
|
animation->setEndValue(1.0);
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QEvent::Leave:
|
||||||
|
{
|
||||||
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
|
||||||
|
animation->setDuration(250);
|
||||||
|
animation->setEndValue(0.0);
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QToolButton::event(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void FancyToolButton::paintEvent(QPaintEvent *event)
|
void FancyToolButton::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
// draw borders
|
// draw borders
|
||||||
QLayout *parentLayout = qobject_cast<FancyActionBar*>(parentWidget())->actionsLayout();
|
|
||||||
bool isTitledAction = defaultAction()->property("titledAction").toBool();
|
bool isTitledAction = defaultAction()->property("titledAction").toBool();
|
||||||
|
|
||||||
#ifndef Q_WS_MAC // Mac UIs usually don't hover
|
#ifndef Q_WS_MAC // Mac UIs usually don't hover
|
||||||
if (underMouse() && isEnabled() && !isDown()) {
|
if (m_fader > 0 && isEnabled() && !isDown()) {
|
||||||
|
painter.save();
|
||||||
QColor whiteOverlay(Qt::white);
|
QColor whiteOverlay(Qt::white);
|
||||||
whiteOverlay.setAlpha(20);
|
whiteOverlay.setAlpha(int(20 * m_fader));
|
||||||
painter.fillRect(rect().adjusted(1, 1, -1, -1), whiteOverlay);
|
QRect roundRect = rect().adjusted(5, 3, -5, -3);
|
||||||
|
painter.translate(0.5, 0.5);
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
painter.setBrush(whiteOverlay);
|
||||||
|
whiteOverlay.setAlpha(int(30*m_fader));
|
||||||
|
painter.setPen(whiteOverlay);
|
||||||
|
painter.drawRoundedRect(roundRect, 3, 3);
|
||||||
|
painter.restore();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isDown()) {
|
if (isDown() || isChecked()) {
|
||||||
|
painter.save();
|
||||||
QColor whiteOverlay(Qt::black);
|
QColor whiteOverlay(Qt::black);
|
||||||
whiteOverlay.setAlpha(20);
|
whiteOverlay.setAlpha(30);
|
||||||
painter.fillRect(rect().adjusted(1, 1, -1, -1), whiteOverlay);
|
QRect roundRect = rect().adjusted(5, 3, -5, -3);
|
||||||
|
painter.translate(0.5, 0.5);
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
painter.setPen(QColor(255, 255, 255, 40));
|
||||||
|
static int rounding = 3;
|
||||||
|
painter.drawRoundedRect(roundRect.adjusted(-1, -1, 1, 1), rounding, rounding);
|
||||||
|
painter.setPen(QColor(0, 0, 0, 40));
|
||||||
|
painter.setBrush(QColor(0, 0, 0, 30));
|
||||||
|
painter.drawRoundedRect(roundRect.adjusted(1, 1, 0, 0), rounding, rounding);
|
||||||
|
whiteOverlay.setAlpha(150);
|
||||||
|
painter.setPen(whiteOverlay);
|
||||||
|
painter.setBrush(Qt::NoBrush);
|
||||||
|
painter.drawRoundedRect(roundRect, 3, 3);
|
||||||
|
painter.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap borderPixmap;
|
QPixmap borderPixmap;
|
||||||
QMargins margins;
|
QMargins margins;
|
||||||
if (parentLayout && parentLayout->count() > 0 &&
|
|
||||||
parentLayout->itemAt(parentLayout->count()-1)->widget() == this) {
|
|
||||||
margins = QMargins(3, 3, 2, 0);
|
|
||||||
borderPixmap = QPixmap(
|
|
||||||
QLatin1String(":/fancyactionbar/images/fancytoolbutton_bottom_outline.png"));
|
|
||||||
} else if (parentLayout && parentLayout->count() > 0 &&
|
|
||||||
parentLayout->itemAt(0)->widget() == this) {
|
|
||||||
margins = QMargins(3, 3, 2, 3);
|
|
||||||
borderPixmap = QPixmap(
|
|
||||||
QLatin1String(":/fancyactionbar/images/fancytoolbutton_top_outline.png"));
|
|
||||||
} else {
|
|
||||||
margins = QMargins(3, 3, 2, 0);
|
|
||||||
borderPixmap = QPixmap(
|
|
||||||
QLatin1String(":/fancyactionbar/images/fancytoolbutton_normal_outline.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw pixmap
|
|
||||||
QRect drawRect = rect();
|
|
||||||
qDrawBorderPixmap(&painter, drawRect, margins, borderPixmap);
|
|
||||||
|
|
||||||
QPixmap pix = icon().pixmap(Core::Constants::TARGET_ICON_SIZE, Core::Constants::TARGET_ICON_SIZE, isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
QPixmap pix = icon().pixmap(Core::Constants::TARGET_ICON_SIZE, Core::Constants::TARGET_ICON_SIZE, isEnabled() ? QIcon::Normal : QIcon::Disabled);
|
||||||
QPoint center = rect().center();
|
QPoint center = rect().center();
|
||||||
@@ -149,17 +187,28 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
|
|||||||
painter.setPen(penColor);
|
painter.setPen(penColor);
|
||||||
}
|
}
|
||||||
painter.drawText(r, textFlags, ellidedBuildConfiguration);
|
painter.drawText(r, textFlags, ellidedBuildConfiguration);
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.initFrom(this);
|
||||||
|
opt.rect = rect().adjusted(rect().width() - 18, 0, -10, 0);
|
||||||
|
Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowRight, &painter, &opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyActionBar::paintEvent(QPaintEvent *event)
|
void FancyActionBar::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
|
QPainter painter(this);
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
QColor light = QColor(255, 255, 255, 40);
|
||||||
|
QColor dark = QColor(0, 0, 0, 60);
|
||||||
|
painter.setPen(dark);
|
||||||
|
painter.drawLine(rect().topLeft(), rect().topRight());
|
||||||
|
painter.setPen(light);
|
||||||
|
painter.drawLine(rect().topLeft() + QPoint(0,1), rect().topRight() + QPoint(0,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize FancyToolButton::sizeHint() const
|
QSize FancyToolButton::sizeHint() const
|
||||||
{
|
{
|
||||||
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 40));
|
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 36));
|
||||||
if (defaultAction()->property("titledAction").toBool()) {
|
if (defaultAction()->property("titledAction").toBool()) {
|
||||||
QFont boldFont(font());
|
QFont boldFont(font());
|
||||||
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
|
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
|
||||||
@@ -167,7 +216,6 @@ QSize FancyToolButton::sizeHint() const
|
|||||||
QFontMetrics fm(boldFont);
|
QFontMetrics fm(boldFont);
|
||||||
qreal lineHeight = fm.height();
|
qreal lineHeight = fm.height();
|
||||||
buttonSize += QSizeF(0, (lineHeight*3.5));
|
buttonSize += QSizeF(0, (lineHeight*3.5));
|
||||||
|
|
||||||
}
|
}
|
||||||
return buttonSize.toSize();
|
return buttonSize.toSize();
|
||||||
}
|
}
|
||||||
@@ -189,21 +237,14 @@ FancyActionBar::FancyActionBar(QWidget *parent)
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
m_actionsLayout = new QVBoxLayout;
|
m_actionsLayout = new QVBoxLayout;
|
||||||
|
|
||||||
QVBoxLayout *spacerLayout = new QVBoxLayout;
|
QVBoxLayout *spacerLayout = new QVBoxLayout;
|
||||||
spacerLayout->addLayout(m_actionsLayout);
|
spacerLayout->addLayout(m_actionsLayout);
|
||||||
int sbh = ICore::instance()->statusBar()->height();
|
int sbh = ICore::instance()->statusBar()->height();
|
||||||
spacerLayout->addSpacing(sbh);
|
spacerLayout->addSpacing(sbh);
|
||||||
spacerLayout->setMargin(0);
|
spacerLayout->setMargin(0);
|
||||||
spacerLayout->setSpacing(0);
|
spacerLayout->setSpacing(0);
|
||||||
|
setLayout(spacerLayout);
|
||||||
QHBoxLayout *orientRightLayout = new QHBoxLayout;
|
setContentsMargins(0,2,0,0);
|
||||||
orientRightLayout->addStretch();
|
|
||||||
orientRightLayout->setMargin(0);
|
|
||||||
orientRightLayout->setSpacing(0);
|
|
||||||
orientRightLayout->setContentsMargins(0, 0, 1, 0);
|
|
||||||
orientRightLayout->addLayout(spacerLayout);
|
|
||||||
setLayout(orientRightLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyActionBar::addProjectSelector(QAction *action)
|
void FancyActionBar::addProjectSelector(QAction *action)
|
||||||
|
|||||||
@@ -45,17 +45,40 @@ class FancyToolButton : public QToolButton
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(float fader READ fader WRITE setFader)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FancyToolButton(QWidget *parent = 0);
|
FancyToolButton(QWidget *parent = 0);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
bool event(QEvent *e);
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
QSize minimumSizeHint() const;
|
QSize minimumSizeHint() const;
|
||||||
|
|
||||||
|
float m_fader;
|
||||||
|
float fader() { return m_fader; }
|
||||||
|
void setFader(float value) { m_fader = value; update(); }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actionChanged();
|
void actionChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FancySeparator: public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
FancySeparator(QWidget *parent = 0) :
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
setMinimumHeight(2);
|
||||||
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
}
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FancyActionBar : public QWidget
|
class FancyActionBar : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -642,80 +642,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
|||||||
case PE_IndicatorArrowRight:
|
case PE_IndicatorArrowRight:
|
||||||
case PE_IndicatorArrowLeft:
|
case PE_IndicatorArrowLeft:
|
||||||
{
|
{
|
||||||
// From windowsstyle but modified to enable AA
|
Utils::StyleHelper::drawArrow(element, painter, option);
|
||||||
if (option->rect.width() <= 1 || option->rect.height() <= 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
QRect r = option->rect;
|
|
||||||
int size = qMin(r.height(), r.width());
|
|
||||||
QPixmap pixmap;
|
|
||||||
QString pixmapName;
|
|
||||||
pixmapName.sprintf("%s-%s-%d-%d-%d-%lld",
|
|
||||||
"$qt_ia", metaObject()->className(),
|
|
||||||
uint(option->state), element,
|
|
||||||
size, option->palette.cacheKey());
|
|
||||||
if (!QPixmapCache::find(pixmapName, pixmap)) {
|
|
||||||
int border = size/5;
|
|
||||||
int sqsize = 2*(size/2);
|
|
||||||
QImage image(sqsize, sqsize, QImage::Format_ARGB32);
|
|
||||||
image.fill(Qt::transparent);
|
|
||||||
QPainter imagePainter(&image);
|
|
||||||
imagePainter.setRenderHint(QPainter::Antialiasing, true);
|
|
||||||
imagePainter.translate(0.5, 0.5);
|
|
||||||
QPolygon a;
|
|
||||||
switch (element) {
|
|
||||||
case PE_IndicatorArrowUp:
|
|
||||||
a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2);
|
|
||||||
break;
|
|
||||||
case PE_IndicatorArrowDown:
|
|
||||||
a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2);
|
|
||||||
break;
|
|
||||||
case PE_IndicatorArrowRight:
|
|
||||||
a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
|
|
||||||
break;
|
|
||||||
case PE_IndicatorArrowLeft:
|
|
||||||
a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bsx = 0;
|
|
||||||
int bsy = 0;
|
|
||||||
|
|
||||||
if (option->state & State_Sunken) {
|
|
||||||
bsx = pixelMetric(PM_ButtonShiftHorizontal);
|
|
||||||
bsy = pixelMetric(PM_ButtonShiftVertical);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect bounds = a.boundingRect();
|
|
||||||
int sx = sqsize / 2 - bounds.center().x() - 1;
|
|
||||||
int sy = sqsize / 2 - bounds.center().y() - 1;
|
|
||||||
imagePainter.translate(sx + bsx, sy + bsy);
|
|
||||||
|
|
||||||
if (!(option->state & State_Enabled)) {
|
|
||||||
QColor foreGround(150, 150, 150, 150);
|
|
||||||
imagePainter.setBrush(option->palette.mid().color());
|
|
||||||
imagePainter.setPen(option->palette.mid().color());
|
|
||||||
} else {
|
|
||||||
QColor shadow(0, 0, 0, 100);
|
|
||||||
imagePainter.translate(0, 1);
|
|
||||||
imagePainter.setPen(shadow);
|
|
||||||
imagePainter.setBrush(shadow);
|
|
||||||
QColor foreGround(255, 255, 255, 210);
|
|
||||||
imagePainter.drawPolygon(a);
|
|
||||||
imagePainter.translate(0, -1);
|
|
||||||
imagePainter.setPen(foreGround);
|
|
||||||
imagePainter.setBrush(foreGround);
|
|
||||||
}
|
|
||||||
imagePainter.drawPolygon(a);
|
|
||||||
imagePainter.end();
|
|
||||||
pixmap = QPixmap::fromImage(image);
|
|
||||||
QPixmapCache::insert(pixmapName, pixmap);
|
|
||||||
}
|
|
||||||
int xOffset = r.x() + (r.width() - size)/2;
|
|
||||||
int yOffset = r.y() + (r.height() - size)/2;
|
|
||||||
painter->drawPixmap(xOffset, yOffset, pixmap);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -698,7 +698,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
d->m_projectSelectorAction->setEnabled(false);
|
d->m_projectSelectorAction->setEnabled(false);
|
||||||
QWidget *mainWindow = Core::ICore::instance()->mainWindow();
|
QWidget *mainWindow = Core::ICore::instance()->mainWindow();
|
||||||
d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow);
|
d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow);
|
||||||
connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show()));
|
d->m_projectSelectorAction->setCheckable(true);
|
||||||
|
connect(d->m_projectSelectorAction, SIGNAL(toggled(bool)), d->m_targetSelector, SLOT(setVisible(bool)));
|
||||||
|
|
||||||
modeManager->addProjectSelector(d->m_projectSelectorAction);
|
modeManager->addProjectSelector(d->m_projectSelectorAction);
|
||||||
cmd = am->registerAction(d->m_projectSelectorAction, ProjectExplorer::Constants::SELECTTARGET,
|
cmd = am->registerAction(d->m_projectSelectorAction, ProjectExplorer::Constants::SELECTTARGET,
|
||||||
globalcontext);
|
globalcontext);
|
||||||
|
|||||||
Reference in New Issue
Block a user