forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: share/share.qbs tests/auto/icheckbuild/icheckbuild.pro Change-Id: I13bc737c981aaeb615ab1a3571cc8a18f60a7cd6
This commit is contained in:
@@ -413,11 +413,12 @@ void EditorView::goBackInNavigationHistory()
|
||||
while (m_currentNavigationHistoryPosition > 0) {
|
||||
--m_currentNavigationHistoryPosition;
|
||||
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
|
||||
IEditor *editor;
|
||||
IEditor *editor = 0;
|
||||
if (location.document) {
|
||||
editor = em->activateEditorForDocument(this, location.document,
|
||||
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
|
||||
} else {
|
||||
}
|
||||
if (!editor) {
|
||||
editor = em->openEditor(this, location.fileName, location.id,
|
||||
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
|
||||
if (!editor) {
|
||||
@@ -439,11 +440,12 @@ void EditorView::goForwardInNavigationHistory()
|
||||
return;
|
||||
++m_currentNavigationHistoryPosition;
|
||||
EditLocation location = m_navigationHistory.at(m_currentNavigationHistoryPosition);
|
||||
IEditor *editor;
|
||||
IEditor *editor = 0;
|
||||
if (location.document) {
|
||||
editor = em->activateEditorForDocument(this, location.document,
|
||||
EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch);
|
||||
} else {
|
||||
}
|
||||
if (!editor) {
|
||||
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||
if (!editor) {
|
||||
//TODO
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <QDockWidget>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenuBar>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
@@ -96,6 +97,7 @@ bool panelWidget(const QWidget *widget)
|
||||
while (p) {
|
||||
if (qobject_cast<const QToolBar *>(p) ||
|
||||
qobject_cast<const QStatusBar *>(p) ||
|
||||
qobject_cast<const QMenuBar *>(p) ||
|
||||
p->property("panelwidget").toBool())
|
||||
return styleEnabled(widget);
|
||||
p = p->parentWidget();
|
||||
@@ -206,12 +208,16 @@ int ManhattanStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
|
||||
case PM_DockWidgetHandleExtent:
|
||||
case PM_DockWidgetSeparatorExtent:
|
||||
return 1;
|
||||
case PM_MenuPanelWidth:
|
||||
case PM_MenuBarHMargin:
|
||||
case PM_MenuBarVMargin:
|
||||
case PM_ToolBarFrameWidth:
|
||||
if (panelWidget(widget))
|
||||
retval = 1;
|
||||
break;
|
||||
case PM_ButtonShiftVertical:
|
||||
case PM_ButtonShiftHorizontal:
|
||||
case PM_MenuBarPanelWidth:
|
||||
case PM_ToolBarItemMargin:
|
||||
case PM_ToolBarItemSpacing:
|
||||
if (panelWidget(widget))
|
||||
@@ -636,6 +642,52 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
}
|
||||
break;
|
||||
|
||||
case CE_MenuBarItem:
|
||||
painter->save();
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
|
||||
QColor highlightOutline = Utils::StyleHelper::borderColor().lighter(120);
|
||||
bool act = mbi->state & State_Sunken;
|
||||
bool dis = !(mbi->state & State_Enabled);
|
||||
Utils::StyleHelper::menuGradient(painter, option->rect, option->rect);
|
||||
QStyleOptionMenuItem item = *mbi;
|
||||
item.rect = mbi->rect;
|
||||
QPalette pal = mbi->palette;
|
||||
pal.setBrush(QPalette::ButtonText, dis ? Qt::gray : Qt::black);
|
||||
item.palette = pal;
|
||||
QCommonStyle::drawControl(element, &item, painter, widget);
|
||||
QRect r = option->rect;
|
||||
|
||||
if (act) {
|
||||
// Fill|
|
||||
QColor baseColor = Utils::StyleHelper::baseColor();
|
||||
QLinearGradient grad(option->rect.topLeft(), option->rect.bottomLeft());
|
||||
grad.setColorAt(0, baseColor.lighter(120));
|
||||
grad.setColorAt(1, baseColor.lighter(130));
|
||||
painter->fillRect(option->rect.adjusted(1, 1, -1, 0), grad);
|
||||
|
||||
// Outline
|
||||
painter->setPen(QPen(highlightOutline, 0));
|
||||
painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
|
||||
painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
|
||||
painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
|
||||
highlightOutline.setAlpha(60);
|
||||
painter->setPen(QPen(highlightOutline, 0));
|
||||
painter->drawPoint(r.topLeft());
|
||||
painter->drawPoint(r.topRight());
|
||||
|
||||
QPalette pal = mbi->palette;
|
||||
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
|
||||
if (!styleHint(SH_UnderlineShortcut, mbi, widget))
|
||||
alignment |= Qt::TextHideMnemonic;
|
||||
pal.setBrush(QPalette::Text, dis ? Qt::gray : QColor(0, 0, 0, 60));
|
||||
drawItemText(painter, item.rect.translated(0, 1), alignment, pal, mbi->state & State_Enabled, mbi->text, QPalette::Text);
|
||||
pal.setBrush(QPalette::Text, dis ? Qt::gray : Qt::white);
|
||||
drawItemText(painter, item.rect, alignment, pal, mbi->state & State_Enabled, mbi->text, QPalette::Text);
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
break;
|
||||
|
||||
case CE_ComboBoxLabel:
|
||||
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
if (panelWidget(widget)) {
|
||||
@@ -716,6 +768,15 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
}
|
||||
break;
|
||||
|
||||
case CE_MenuBarEmptyArea: {
|
||||
Utils::StyleHelper::menuGradient(painter, option->rect, option->rect);
|
||||
painter->save();
|
||||
painter->setPen(Utils::StyleHelper::borderColor());
|
||||
painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
|
||||
case CE_ToolBar:
|
||||
{
|
||||
QRect rect = option->rect;
|
||||
|
||||
Reference in New Issue
Block a user