mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
[OP-835] Qt 5.1.0 - uncrustified gcs sources
This commit is contained in:
parent
28e57242f7
commit
09408b40ca
@ -444,7 +444,6 @@ void loadTranslators(QString language, QTranslator &translator, QTranslator &qtT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace anonymous
|
||||
|
||||
int main(int argc, char * *argv)
|
||||
@ -457,7 +456,7 @@ int main(int argc, char * *argv)
|
||||
systemInit();
|
||||
|
||||
#ifdef QT_NO_DEBUG
|
||||
// logInit();
|
||||
// logInit();
|
||||
#endif
|
||||
|
||||
// create application
|
||||
|
@ -35,13 +35,12 @@
|
||||
#include <QDockWidget>
|
||||
#include <QSettings>
|
||||
|
||||
static const char lockedKeyC[] = "Locked";
|
||||
static const char stateKeyC[] = "State";
|
||||
static const char lockedKeyC[] = "Locked";
|
||||
static const char stateKeyC[] = "State";
|
||||
static const int settingsVersion = 2;
|
||||
static const char dockWidgetActiveState[] = "DockWidgetActiveState";
|
||||
|
||||
namespace Utils {
|
||||
|
||||
/*! \class Utils::FancyMainWindow
|
||||
|
||||
\brief MainWindow with dock widgets and additional "lock" functionality
|
||||
@ -49,14 +48,13 @@ namespace Utils {
|
||||
|
||||
The dock actions and the additional actions should be accessible
|
||||
in a Window-menu.
|
||||
*/
|
||||
*/
|
||||
|
||||
struct FancyMainWindowPrivate
|
||||
{
|
||||
struct FancyMainWindowPrivate {
|
||||
FancyMainWindowPrivate();
|
||||
|
||||
bool m_locked;
|
||||
bool m_handleDockVisibilityChanges;
|
||||
bool m_locked;
|
||||
bool m_handleDockVisibilityChanges;
|
||||
|
||||
QAction m_menuSeparator1;
|
||||
QAction m_toggleLockedAction;
|
||||
@ -97,15 +95,17 @@ FancyMainWindow::~FancyMainWindow()
|
||||
QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget)
|
||||
{
|
||||
QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), this);
|
||||
|
||||
dockWidget->setWidget(widget);
|
||||
// Set an object name to be used in settings, derive from widget name
|
||||
const QString objectName = widget->objectName();
|
||||
if (objectName.isEmpty())
|
||||
if (objectName.isEmpty()) {
|
||||
dockWidget->setObjectName(QLatin1String("dockWidget") + QString::number(dockWidgets().size() + 1));
|
||||
else
|
||||
} else {
|
||||
dockWidget->setObjectName(objectName + QLatin1String("DockWidget"));
|
||||
}
|
||||
connect(dockWidget->toggleViewAction(), SIGNAL(triggered()),
|
||||
this, SLOT(onDockActionTriggered()), Qt::QueuedConnection);
|
||||
this, SLOT(onDockActionTriggered()), Qt::QueuedConnection);
|
||||
connect(dockWidget, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(onDockVisibilityChange(bool)));
|
||||
connect(dockWidget, SIGNAL(topLevelChanged(bool)),
|
||||
@ -118,13 +118,14 @@ QDockWidget *FancyMainWindow::addDockForWidget(QWidget *widget)
|
||||
void FancyMainWindow::updateDockWidget(QDockWidget *dockWidget)
|
||||
{
|
||||
const QDockWidget::DockWidgetFeatures features =
|
||||
(d->m_locked) ? QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable
|
||||
: QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable;
|
||||
(d->m_locked) ? QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable
|
||||
: QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable;
|
||||
|
||||
if (dockWidget->property("managed_dockwidget").isNull()) { // for the debugger tool bar
|
||||
QWidget *titleBarWidget = dockWidget->titleBarWidget();
|
||||
if (d->m_locked && !titleBarWidget && !dockWidget->isFloating())
|
||||
if (d->m_locked && !titleBarWidget && !dockWidget->isFloating()) {
|
||||
titleBarWidget = new QWidget(dockWidget);
|
||||
else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) {
|
||||
} else if ((!d->m_locked || dockWidget->isFloating()) && titleBarWidget) {
|
||||
delete titleBarWidget;
|
||||
titleBarWidget = 0;
|
||||
}
|
||||
@ -136,29 +137,32 @@ void FancyMainWindow::updateDockWidget(QDockWidget *dockWidget)
|
||||
void FancyMainWindow::onDockActionTriggered()
|
||||
{
|
||||
QDockWidget *dw = qobject_cast<QDockWidget *>(sender()->parent());
|
||||
|
||||
if (dw) {
|
||||
if (dw->isVisible())
|
||||
if (dw->isVisible()) {
|
||||
dw->raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FancyMainWindow::onDockVisibilityChange(bool visible)
|
||||
{
|
||||
if (d->m_handleDockVisibilityChanges)
|
||||
if (d->m_handleDockVisibilityChanges) {
|
||||
sender()->setProperty(dockWidgetActiveState, visible);
|
||||
}
|
||||
}
|
||||
|
||||
void FancyMainWindow::onTopLevelChanged()
|
||||
{
|
||||
updateDockWidget(qobject_cast<QDockWidget*>(sender()));
|
||||
updateDockWidget(qobject_cast<QDockWidget *>(sender()));
|
||||
}
|
||||
|
||||
void FancyMainWindow::setTrackingEnabled(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
d->m_handleDockVisibilityChanges = true;
|
||||
foreach (QDockWidget *dockWidget, dockWidgets())
|
||||
dockWidget->setProperty(dockWidgetActiveState, dockWidget->isVisible());
|
||||
foreach(QDockWidget * dockWidget, dockWidgets())
|
||||
dockWidget->setProperty(dockWidgetActiveState, dockWidget->isVisible());
|
||||
} else {
|
||||
d->m_handleDockVisibilityChanges = false;
|
||||
}
|
||||
@ -167,7 +171,7 @@ void FancyMainWindow::setTrackingEnabled(bool enabled)
|
||||
void FancyMainWindow::setLocked(bool locked)
|
||||
{
|
||||
d->m_locked = locked;
|
||||
foreach (QDockWidget *dockWidget, dockWidgets()) {
|
||||
foreach(QDockWidget * dockWidget, dockWidgets()) {
|
||||
updateDockWidget(dockWidget);
|
||||
}
|
||||
}
|
||||
@ -187,6 +191,7 @@ void FancyMainWindow::showEvent(QShowEvent *event)
|
||||
void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu *menu = createPopupMenu();
|
||||
|
||||
menu->exec(event->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
@ -194,14 +199,15 @@ void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
void FancyMainWindow::handleVisibilityChanged(bool visible)
|
||||
{
|
||||
d->m_handleDockVisibilityChanges = false;
|
||||
foreach (QDockWidget *dockWidget, dockWidgets()) {
|
||||
foreach(QDockWidget * dockWidget, dockWidgets()) {
|
||||
if (dockWidget->isFloating()) {
|
||||
dockWidget->setVisible(visible
|
||||
&& dockWidget->property(dockWidgetActiveState).toBool());
|
||||
&& dockWidget->property(dockWidgetActiveState).toBool());
|
||||
}
|
||||
}
|
||||
if (visible)
|
||||
if (visible) {
|
||||
d->m_handleDockVisibilityChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FancyMainWindow::saveSettings(QSettings *settings) const
|
||||
@ -217,7 +223,7 @@ void FancyMainWindow::saveSettings(QSettings *settings) const
|
||||
void FancyMainWindow::restoreSettings(const QSettings *settings)
|
||||
{
|
||||
QHash<QString, QVariant> hash;
|
||||
foreach (const QString &key, settings->childKeys()) {
|
||||
foreach(const QString &key, settings->childKeys()) {
|
||||
hash.insert(key, settings->value(key));
|
||||
}
|
||||
restoreSettings(hash);
|
||||
@ -228,9 +234,9 @@ QHash<QString, QVariant> FancyMainWindow::saveSettings() const
|
||||
QHash<QString, QVariant> settings;
|
||||
settings.insert(QLatin1String(stateKeyC), saveState(settingsVersion));
|
||||
settings.insert(QLatin1String(lockedKeyC), d->m_locked);
|
||||
foreach (QDockWidget *dockWidget, dockWidgets()) {
|
||||
foreach(QDockWidget * dockWidget, dockWidgets()) {
|
||||
settings.insert(dockWidget->objectName(),
|
||||
dockWidget->property(dockWidgetActiveState));
|
||||
dockWidget->property(dockWidgetActiveState));
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
@ -238,13 +244,15 @@ QHash<QString, QVariant> FancyMainWindow::saveSettings() const
|
||||
void FancyMainWindow::restoreSettings(const QHash<QString, QVariant> &settings)
|
||||
{
|
||||
QByteArray ba = settings.value(QLatin1String(stateKeyC), QByteArray()).toByteArray();
|
||||
if (!ba.isEmpty())
|
||||
|
||||
if (!ba.isEmpty()) {
|
||||
restoreState(ba, settingsVersion);
|
||||
}
|
||||
d->m_locked = settings.value(QLatin1String("Locked"), true).toBool();
|
||||
d->m_toggleLockedAction.setChecked(d->m_locked);
|
||||
foreach (QDockWidget *widget, dockWidgets()) {
|
||||
foreach(QDockWidget * widget, dockWidgets()) {
|
||||
widget->setProperty(dockWidgetActiveState,
|
||||
settings.value(widget->objectName(), false));
|
||||
settings.value(widget->objectName(), false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,14 +280,14 @@ QMenu *FancyMainWindow::createPopupMenu()
|
||||
for (int i = 0; i < dockwidgets.size(); ++i) {
|
||||
QDockWidget *dockWidget = dockwidgets.at(i);
|
||||
if (dockWidget->property("managed_dockwidget").isNull()
|
||||
&& dockWidget->parentWidget() == this) {
|
||||
&& dockWidget->parentWidget() == this) {
|
||||
actions.append(dockwidgets.at(i)->toggleViewAction());
|
||||
}
|
||||
}
|
||||
qSort(actions.begin(), actions.end(), actionLessThan);
|
||||
QMenu *menu = new QMenu(this);
|
||||
foreach (QAction *action, actions)
|
||||
menu->addAction(action);
|
||||
foreach(QAction * action, actions)
|
||||
menu->addAction(action);
|
||||
menu->addAction(&d->m_menuSeparator1);
|
||||
menu->addAction(&d->m_toggleLockedAction);
|
||||
menu->addAction(&d->m_menuSeparator2);
|
||||
@ -309,8 +317,8 @@ QAction *FancyMainWindow::resetLayoutAction() const
|
||||
|
||||
void FancyMainWindow::setDockActionsVisible(bool v)
|
||||
{
|
||||
foreach (const QDockWidget *dockWidget, dockWidgets())
|
||||
dockWidget->toggleViewAction()->setVisible(v);
|
||||
foreach(const QDockWidget * dockWidget, dockWidgets())
|
||||
dockWidget->toggleViewAction()->setVisible(v);
|
||||
d->m_toggleLockedAction.setVisible(v);
|
||||
d->m_menuSeparator1.setVisible(v);
|
||||
d->m_menuSeparator2.setVisible(v);
|
||||
@ -326,5 +334,4 @@ void FancyMainWindow::setToolBarDockWidget(QDockWidget *dock)
|
||||
{
|
||||
d->m_toolBarDockWidget = dock;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
@ -38,11 +38,9 @@ class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
|
||||
struct FancyMainWindowPrivate;
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
|
||||
{
|
||||
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -99,7 +97,6 @@ private:
|
||||
|
||||
FancyMainWindowPrivate *d;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#endif // FANCYMAINWINDOW_H
|
||||
|
@ -42,17 +42,21 @@ HostOsInfo::HostArchitecture HostOsInfo::hostArchitecture()
|
||||
switch (info.wProcessorArchitecture) {
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
return HostOsInfo::HostArchitectureAMD64;
|
||||
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
return HostOsInfo::HostArchitectureX86;
|
||||
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
return HostOsInfo::HostArchitectureItanium;
|
||||
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
return HostOsInfo::HostArchitectureArm;
|
||||
|
||||
default:
|
||||
return HostOsInfo::HostArchitectureUnknown;
|
||||
}
|
||||
#else
|
||||
return HostOsInfo::HostArchitectureUnknown;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ifdef Q_OS_WIN
|
||||
}
|
||||
|
@ -40,9 +40,7 @@
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT HostOsInfo
|
||||
{
|
||||
class QTCREATOR_UTILS_EXPORT HostOsInfo {
|
||||
public:
|
||||
// Add more as needed.
|
||||
enum HostOs { HostOsWindows, HostOsLinux, HostOsMac, HostOsOtherUnix, HostOsOther };
|
||||
@ -52,22 +50,33 @@ public:
|
||||
HostArchitectureArm, HostArchitectureUnknown };
|
||||
static HostArchitecture hostArchitecture();
|
||||
|
||||
static bool isWindowsHost() { return hostOs() == HostOsWindows; }
|
||||
static bool isLinuxHost() { return hostOs() == HostOsLinux; }
|
||||
static bool isMacHost() { return hostOs() == HostOsMac; }
|
||||
static bool isWindowsHost()
|
||||
{
|
||||
return hostOs() == HostOsWindows;
|
||||
}
|
||||
static bool isLinuxHost()
|
||||
{
|
||||
return hostOs() == HostOsLinux;
|
||||
}
|
||||
static bool isMacHost()
|
||||
{
|
||||
return hostOs() == HostOsMac;
|
||||
}
|
||||
static inline bool isAnyUnixHost();
|
||||
|
||||
static QString withExecutableSuffix(const QString &executable)
|
||||
{
|
||||
QString finalName = executable;
|
||||
if (isWindowsHost())
|
||||
|
||||
if (isWindowsHost()) {
|
||||
finalName += QLatin1String(QTC_HOST_EXE_SUFFIX);
|
||||
}
|
||||
return finalName;
|
||||
}
|
||||
|
||||
static Qt::CaseSensitivity fileNameCaseSensitivity()
|
||||
{
|
||||
return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
|
||||
return isWindowsHost() ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||
}
|
||||
|
||||
static QChar pathListSeparator()
|
||||
@ -85,14 +94,19 @@ HostOsInfo::HostOs HostOsInfo::hostOs()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return HostOsWindows;
|
||||
|
||||
#elif defined(Q_OS_LINUX)
|
||||
return HostOsLinux;
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
return HostOsMac;
|
||||
|
||||
#elif defined(Q_OS_UNIX)
|
||||
return HostOsOtherUnix;
|
||||
|
||||
#else
|
||||
return HostOsOther;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -100,11 +114,12 @@ bool HostOsInfo::isAnyUnixHost()
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
return true;
|
||||
|
||||
#else
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#endif // HOSTOSINFO_H
|
||||
|
@ -66,7 +66,7 @@ void StyledBar::paintEvent(QPaintEvent *event)
|
||||
Q_UNUSED(event)
|
||||
QPainter painter(this);
|
||||
QStyleOption option;
|
||||
option.rect = rect();
|
||||
option.rect = rect();
|
||||
option.state = QStyle::State_Horizontal;
|
||||
style()->drawControl(QStyle::CE_ToolBar, &option, &painter, this);
|
||||
}
|
||||
@ -82,8 +82,8 @@ void StyledSeparator::paintEvent(QPaintEvent *event)
|
||||
Q_UNUSED(event)
|
||||
QPainter painter(this);
|
||||
QStyleOption option;
|
||||
option.rect = rect();
|
||||
option.state = QStyle::State_Horizontal;
|
||||
option.rect = rect();
|
||||
option.state = QStyle::State_Horizontal;
|
||||
option.palette = palette();
|
||||
style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &option, &painter, this);
|
||||
}
|
||||
|
@ -34,9 +34,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget
|
||||
{
|
||||
class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
StyledBar(QWidget *parent = 0);
|
||||
@ -50,15 +48,13 @@ protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT StyledSeparator : public QWidget
|
||||
{
|
||||
class QTCREATOR_UTILS_EXPORT StyledSeparator : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
StyledSeparator(QWidget *parent = 0);
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
} // Utils
|
||||
|
||||
#endif // STYLEDBAR_H
|
||||
|
@ -40,24 +40,25 @@
|
||||
static int clamp(float x)
|
||||
{
|
||||
const int val = x > 255 ? 255 : static_cast<int>(x);
|
||||
|
||||
return val < 0 ? 0 : val;
|
||||
}
|
||||
|
||||
// Clamps float color values within (0, 255)
|
||||
/*
|
||||
static int range(float x, int min, int max)
|
||||
{
|
||||
static int range(float x, int min, int max)
|
||||
{
|
||||
int val = x > max ? max : x;
|
||||
return val < min ? min : val;
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
namespace Utils {
|
||||
|
||||
QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor)
|
||||
{
|
||||
const int maxFactor = 100;
|
||||
QColor tmp = colorA;
|
||||
|
||||
tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
|
||||
tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
|
||||
tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
|
||||
@ -72,6 +73,7 @@ qreal StyleHelper::sidebarFontSize()
|
||||
QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
|
||||
{
|
||||
QPalette palette = original;
|
||||
|
||||
palette.setColor(QPalette::Active, QPalette::Text, panelTextColor());
|
||||
palette.setColor(QPalette::Active, QPalette::WindowText, panelTextColor());
|
||||
palette.setColor(QPalette::Inactive, QPalette::Text, panelTextColor().darker());
|
||||
@ -81,11 +83,12 @@ QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
|
||||
|
||||
QColor StyleHelper::panelTextColor(bool lightColored)
|
||||
{
|
||||
//qApp->palette().highlightedText().color();
|
||||
if (!lightColored)
|
||||
// qApp->palette().highlightedText().color();
|
||||
if (!lightColored) {
|
||||
return Qt::white;
|
||||
else
|
||||
} else {
|
||||
return Qt::black;
|
||||
}
|
||||
}
|
||||
|
||||
// Invalid by default, setBaseColor needs to be called at least once
|
||||
@ -94,29 +97,33 @@ QColor StyleHelper::m_requestedBaseColor;
|
||||
|
||||
QColor StyleHelper::baseColor(bool lightColored)
|
||||
{
|
||||
if (!lightColored)
|
||||
if (!lightColored) {
|
||||
return m_baseColor;
|
||||
else
|
||||
} else {
|
||||
return m_baseColor.lighter(230);
|
||||
}
|
||||
}
|
||||
|
||||
QColor StyleHelper::highlightColor(bool lightColored)
|
||||
{
|
||||
QColor result = baseColor(lightColored);
|
||||
if (!lightColored)
|
||||
|
||||
if (!lightColored) {
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.16));
|
||||
else
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.16));
|
||||
} else {
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.06));
|
||||
clamp(result.saturation()),
|
||||
clamp(result.value() * 1.06));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor StyleHelper::shadowColor(bool lightColored)
|
||||
{
|
||||
QColor result = baseColor(lightColored);
|
||||
|
||||
result.setHsv(result.hue(),
|
||||
clamp(result.saturation() * 1.1),
|
||||
clamp(result.value() * 0.70));
|
||||
@ -126,6 +133,7 @@ QColor StyleHelper::shadowColor(bool lightColored)
|
||||
QColor StyleHelper::borderColor(bool lightColored)
|
||||
{
|
||||
QColor result = baseColor(lightColored);
|
||||
|
||||
result.setHsv(result.hue(),
|
||||
result.saturation(),
|
||||
result.value() / 2);
|
||||
@ -146,16 +154,17 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
|
||||
|
||||
if (color.isValid() && color != m_baseColor) {
|
||||
m_baseColor = color;
|
||||
foreach (QWidget *w, QApplication::topLevelWidgets())
|
||||
w->update();
|
||||
foreach(QWidget * w, QApplication::topLevelWidgets())
|
||||
w->update();
|
||||
}
|
||||
}
|
||||
|
||||
static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRect &rect, bool lightColored)
|
||||
{
|
||||
QColor highlight = StyleHelper::highlightColor(lightColored);
|
||||
QColor shadow = StyleHelper::shadowColor(lightColored);
|
||||
QColor shadow = StyleHelper::shadowColor(lightColored);
|
||||
QLinearGradient grad(spanRect.topRight(), spanRect.topLeft());
|
||||
|
||||
grad.setColorAt(0, highlight.lighter(117));
|
||||
grad.setColorAt(1, shadow.darker(109));
|
||||
p->fillRect(rect, grad);
|
||||
@ -174,8 +183,8 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_vertical %d %d %d %d %d",
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb());;
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb());;
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
@ -194,7 +203,7 @@ void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, con
|
||||
}
|
||||
|
||||
static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const
|
||||
QRect &rect, bool lightColored)
|
||||
QRect &rect, bool lightColored)
|
||||
{
|
||||
if (lightColored) {
|
||||
QLinearGradient shadowGradient(rect.topLeft(), rect.bottomLeft());
|
||||
@ -204,9 +213,9 @@ QRect &rect, bool lightColored)
|
||||
return;
|
||||
}
|
||||
|
||||
QColor base = StyleHelper::baseColor(lightColored);
|
||||
QColor base = StyleHelper::baseColor(lightColored);
|
||||
QColor highlight = StyleHelper::highlightColor(lightColored);
|
||||
QColor shadow = StyleHelper::shadowColor(lightColored);
|
||||
QColor shadow = StyleHelper::shadowColor(lightColored);
|
||||
QLinearGradient grad(rect.topLeft(), rect.bottomLeft());
|
||||
grad.setColorAt(0, highlight.lighter(120));
|
||||
if (rect.height() == StyleHelper::navigationWidgetHeight()) {
|
||||
@ -217,12 +226,12 @@ QRect &rect, bool lightColored)
|
||||
p->fillRect(rect, grad);
|
||||
|
||||
QLinearGradient shadowGradient(spanRect.topLeft(), spanRect.topRight());
|
||||
shadowGradient.setColorAt(0, QColor(0, 0, 0, 30));
|
||||
shadowGradient.setColorAt(0, QColor(0, 0, 0, 30));
|
||||
QColor lighterHighlight;
|
||||
lighterHighlight = highlight.lighter(130);
|
||||
lighterHighlight.setAlpha(100);
|
||||
shadowGradient.setColorAt(0.7, lighterHighlight);
|
||||
shadowGradient.setColorAt(1, QColor(0, 0, 0, 40));
|
||||
shadowGradient.setColorAt(1, QColor(0, 0, 0, 40));
|
||||
p->fillRect(rect, shadowGradient);
|
||||
}
|
||||
|
||||
@ -232,8 +241,8 @@ void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, c
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_horizontal %d %d %d %d %d %d",
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb(), spanRect.x());
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb(), spanRect.x());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
@ -246,7 +255,6 @@ void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, c
|
||||
}
|
||||
|
||||
painter->drawPixmap(clipRect.topLeft(), pixmap);
|
||||
|
||||
} else {
|
||||
horizontalGradientHelper(painter, spanRect, clipRect, lightColored);
|
||||
}
|
||||
@ -256,6 +264,7 @@ static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &
|
||||
{
|
||||
QLinearGradient grad(spanRect.topLeft(), spanRect.bottomLeft());
|
||||
QColor menuColor = StyleHelper::mergedColors(StyleHelper::baseColor(), QColor(244, 244, 244), 25);
|
||||
|
||||
grad.setColorAt(0, menuColor.lighter(112));
|
||||
grad.setColorAt(1, menuColor);
|
||||
p->fillRect(rect, grad);
|
||||
@ -264,10 +273,11 @@ static void menuGradientHelper(QPainter *p, const QRect &spanRect, const QRect &
|
||||
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)
|
||||
if (option->rect.width() <= 1 || option->rect.height() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
QRect r = option->rect;
|
||||
QRect r = option->rect;
|
||||
int size = qMin(r.height(), r.width());
|
||||
QPixmap pixmap;
|
||||
QString pixmapName;
|
||||
@ -276,8 +286,8 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
uint(option->state), element,
|
||||
size, option->palette.cacheKey());
|
||||
if (!QPixmapCache::find(pixmapName, pixmap)) {
|
||||
int border = size/5;
|
||||
int sqsize = 2*(size/2);
|
||||
int border = size / 5;
|
||||
int sqsize = 2 * (size / 2);
|
||||
QImage image(sqsize, sqsize, QImage::Format_ARGB32);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter imagePainter(&image);
|
||||
@ -285,20 +295,20 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
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;
|
||||
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;
|
||||
@ -334,8 +344,8 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
pixmap = QPixmap::fromImage(image);
|
||||
QPixmapCache::insert(pixmapName, pixmap);
|
||||
}
|
||||
int xOffset = r.x() + (r.width() - size)/2;
|
||||
int yOffset = r.y() + (r.height() - size)/2;
|
||||
int xOffset = r.x() + (r.width() - size) / 2;
|
||||
int yOffset = r.y() + (r.height() - size) / 2;
|
||||
painter->drawPixmap(xOffset, yOffset, pixmap);
|
||||
}
|
||||
|
||||
@ -344,8 +354,8 @@ void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const Q
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
key.sprintf("mh_menu %d %d %d %d %d",
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), StyleHelper::baseColor().rgb());
|
||||
spanRect.width(), spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), StyleHelper::baseColor().rgb());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(key, pixmap)) {
|
||||
@ -367,9 +377,11 @@ static qreal pixmapDevicePixelRatio(const QPixmap &pixmap)
|
||||
{
|
||||
#if QT_VERSION > 0x050000
|
||||
return pixmap.devicePixelRatio();
|
||||
|
||||
#else
|
||||
Q_UNUSED(pixmap);
|
||||
return 1.0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -386,9 +398,9 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
// return a high-dpi pixmap, which will in that case have a devicePixelRatio
|
||||
// different than 1. The shadow drawing caluculations are done in device
|
||||
// pixels.
|
||||
QPixmap px = icon.pixmap(rect.size());
|
||||
QPixmap px = icon.pixmap(rect.size());
|
||||
int devicePixelRatio = qCeil(pixmapDevicePixelRatio(px));
|
||||
int radius = dipRadius * devicePixelRatio;
|
||||
int radius = dipRadius * devicePixelRatio;
|
||||
QPoint offset = dipOffset * devicePixelRatio;
|
||||
cache = QPixmap(px.size() + QSize(radius * 2, radius * 2));
|
||||
cache.fill(Qt::transparent);
|
||||
@ -396,10 +408,10 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
QPainter cachePainter(&cache);
|
||||
if (iconMode == QIcon::Disabled) {
|
||||
QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
for (int y=0; y<im.height(); ++y) {
|
||||
QRgb *scanLine = (QRgb*)im.scanLine(y);
|
||||
for (int x=0; x<im.width(); ++x) {
|
||||
QRgb pixel = *scanLine;
|
||||
for (int y = 0; y < im.height(); ++y) {
|
||||
QRgb *scanLine = (QRgb *)im.scanLine(y);
|
||||
for (int x = 0; x < im.width(); ++x) {
|
||||
QRgb pixel = *scanLine;
|
||||
char intensity = qGray(pixel);
|
||||
*scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel));
|
||||
++scanLine;
|
||||
@ -459,39 +471,46 @@ void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, QRect re
|
||||
int left, int top, int right, int bottom)
|
||||
{
|
||||
QSize size = img.size();
|
||||
if (top > 0) { //top
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
|
||||
QRect(left, 0, size.width() -right - left, top));
|
||||
if (left > 0) //top-left
|
||||
|
||||
if (top > 0) { // top
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() - right - left, top), img,
|
||||
QRect(left, 0, size.width() - right - left, top));
|
||||
if (left > 0) { // top-left
|
||||
painter->drawImage(QRect(rect.left(), rect.top(), left, top), img,
|
||||
QRect(0, 0, left, top));
|
||||
if (right > 0) //top-right
|
||||
}
|
||||
if (right > 0) { // top-right
|
||||
painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top(), right, top), img,
|
||||
QRect(size.width() - right, 0, right, top));
|
||||
}
|
||||
}
|
||||
//left
|
||||
if (left > 0)
|
||||
painter->drawImage(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), img,
|
||||
// left
|
||||
if (left > 0) {
|
||||
painter->drawImage(QRect(rect.left(), rect.top() + top, left, rect.height() - top - bottom), img,
|
||||
QRect(0, top, left, size.height() - bottom - top));
|
||||
//center
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
|
||||
}
|
||||
// center
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top() + top, rect.width() - right - left,
|
||||
rect.height() - bottom - top), img,
|
||||
QRect(left, top, size.width() -right -left,
|
||||
QRect(left, top, size.width() - right - left,
|
||||
size.height() - bottom - top));
|
||||
if (right > 0) //right
|
||||
painter->drawImage(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), img,
|
||||
if (right > 0) { // right
|
||||
painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top() + top, right, rect.height() - top - bottom), img,
|
||||
QRect(size.width() - right, top, right, size.height() - bottom - top));
|
||||
if (bottom > 0) { //bottom
|
||||
painter->drawImage(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
|
||||
}
|
||||
if (bottom > 0) { // bottom
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top() + rect.height() - bottom,
|
||||
rect.width() - right - left, bottom), img,
|
||||
QRect(left, size.height() - bottom,
|
||||
size.width() - right - left, bottom));
|
||||
if (left > 0) //bottom-left
|
||||
painter->drawImage(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img,
|
||||
QRect(0, size.height() - bottom, left, bottom));
|
||||
if (right > 0) //bottom-right
|
||||
painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img,
|
||||
QRect(size.width() - right, size.height() - bottom, right, bottom));
|
||||
if (left > 0) { // bottom-left
|
||||
painter->drawImage(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img,
|
||||
QRect(0, size.height() - bottom, left, bottom));
|
||||
}
|
||||
if (right > 0) { // bottom-right
|
||||
painter->drawImage(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img,
|
||||
QRect(size.width() - right, size.height() - bottom, right, bottom));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -499,12 +518,13 @@ void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, QRect re
|
||||
void StyleHelper::tintImage(QImage &img, const QColor &tintColor)
|
||||
{
|
||||
QPainter p(&img);
|
||||
|
||||
p.setCompositionMode(QPainter::CompositionMode_Screen);
|
||||
|
||||
for (int x = 0; x < img.width(); ++x) {
|
||||
for (int y = 0; y < img.height(); ++y) {
|
||||
QRgb rgbColor = img.pixel(x, y);
|
||||
int alpha = qAlpha(rgbColor);
|
||||
int alpha = qAlpha(rgbColor);
|
||||
QColor c = QColor(rgbColor);
|
||||
|
||||
if (alpha > 0) {
|
||||
@ -522,10 +542,10 @@ QLinearGradient StyleHelper::statusBarGradient(const QRect &statusBarRect)
|
||||
{
|
||||
QLinearGradient grad(statusBarRect.topLeft(), QPoint(statusBarRect.center().x(), statusBarRect.bottom()));
|
||||
QColor startColor = shadowColor().darker(164);
|
||||
QColor endColor = baseColor().darker(130);
|
||||
QColor endColor = baseColor().darker(130);
|
||||
|
||||
grad.setColorAt(0, startColor);
|
||||
grad.setColorAt(1, endColor);
|
||||
return grad;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
@ -45,29 +45,43 @@ QT_END_NAMESPACE
|
||||
// Helper class holding all custom color values
|
||||
|
||||
namespace Utils {
|
||||
class QTCREATOR_UTILS_EXPORT StyleHelper
|
||||
{
|
||||
class QTCREATOR_UTILS_EXPORT StyleHelper {
|
||||
public:
|
||||
static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
|
||||
static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
|
||||
static const int progressFadeAnimationDuration = 600;
|
||||
|
||||
// Height of the project explorer navigation bar
|
||||
static int navigationWidgetHeight() { return 24; }
|
||||
static int navigationWidgetHeight()
|
||||
{
|
||||
return 24;
|
||||
}
|
||||
static qreal sidebarFontSize();
|
||||
static QPalette sidebarFontPalette(const QPalette &original);
|
||||
|
||||
// This is our color table, all colors derive from baseColor
|
||||
static QColor requestedBaseColor() { return m_requestedBaseColor; }
|
||||
static QColor requestedBaseColor()
|
||||
{
|
||||
return m_requestedBaseColor;
|
||||
}
|
||||
static QColor baseColor(bool lightColored = false);
|
||||
static QColor panelTextColor(bool lightColored = false);
|
||||
static QColor highlightColor(bool lightColored = false);
|
||||
static QColor shadowColor(bool lightColored = false);
|
||||
static QColor borderColor(bool lightColored = false);
|
||||
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
|
||||
static QColor buttonTextColor()
|
||||
{
|
||||
return QColor(0x4c4c4c);
|
||||
}
|
||||
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
|
||||
|
||||
static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); }
|
||||
static QColor sidebarShadow() { return QColor(0, 0, 0, 40); }
|
||||
static QColor sidebarHighlight()
|
||||
{
|
||||
return QColor(255, 255, 255, 40);
|
||||
}
|
||||
static QColor sidebarShadow()
|
||||
{
|
||||
return QColor(0, 0, 0, 40);
|
||||
}
|
||||
|
||||
// Sets the base color and makes sure all top level widgets are updated
|
||||
static void setBaseColor(const QColor &color);
|
||||
@ -79,13 +93,16 @@ public:
|
||||
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 menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect);
|
||||
static bool usePixmapCache() { return true; }
|
||||
static bool usePixmapCache()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void drawIconWithShadow(const QIcon &icon, const QRect &rect, QPainter *p, QIcon::Mode iconMode,
|
||||
int dipRadius = 3, const QColor &color = QColor(0, 0, 0, 130),
|
||||
const QPoint &dipOffset = QPoint(1, -2));
|
||||
static void drawCornerImage(const QImage &img, QPainter *painter, QRect rect,
|
||||
int left = 0, int top = 0, int right = 0, int bottom = 0);
|
||||
int left = 0, int top = 0, int right = 0, int bottom = 0);
|
||||
|
||||
static void tintImage(QImage &img, const QColor &tintColor);
|
||||
static QLinearGradient statusBarGradient(const QRect &statusBarRect);
|
||||
@ -94,6 +111,5 @@ private:
|
||||
static QColor m_baseColor;
|
||||
static QColor m_requestedBaseColor;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
#endif // STYLEHELPER_H
|
||||
|
@ -44,11 +44,10 @@
|
||||
#include <QTimer>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IConnection;
|
||||
|
||||
namespace Internal {
|
||||
class MainWindow;
|
||||
class MainWindow;
|
||||
} // namespace Internal
|
||||
|
||||
class DevListItem {
|
||||
|
@ -201,7 +201,7 @@ const char *const ICON_PREV = ":/core/images/prev.png";
|
||||
const char *const ICON_DIR = ":/core/images/dir.png";
|
||||
const char *const ICON_CLEAN_PANE = ":/core/images/clean_pane_small.png";
|
||||
const char *const ICON_CLEAR = ":/core/images/clear.png";
|
||||
const char *const ICON_CLOSE = ":/core/images/closebutton.png";
|
||||
const char *const ICON_CLOSE = ":/core/images/closebutton.png";
|
||||
const char *const ICON_FIND = ":/core/images/find.png";
|
||||
const char *const ICON_FINDNEXT = ":/core/images/findnext.png";
|
||||
const char *const ICON_REPLACE = ":/core/images/replace.png";
|
||||
|
@ -46,7 +46,7 @@
|
||||
using namespace Core;
|
||||
using namespace Internal;
|
||||
|
||||
const int FancyTabBar::m_rounding = 22;
|
||||
const int FancyTabBar::m_rounding = 22;
|
||||
const int FancyTabBar::m_textPadding = 4;
|
||||
|
||||
void FancyTab::fadeIn()
|
||||
@ -74,7 +74,7 @@ void FancyTab::setFader(float value)
|
||||
FancyTabBar::FancyTabBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_hoverIndex = -1;
|
||||
m_hoverIndex = -1;
|
||||
m_currentIndex = -1;
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||
setStyle(QStyleFactory::create(QLatin1String("windows")));
|
||||
@ -96,16 +96,18 @@ FancyTabBar::~FancyTabBar()
|
||||
QSize FancyTabBar::tabSizeHint(bool minimum) const
|
||||
{
|
||||
QFont boldFont(font());
|
||||
|
||||
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
|
||||
boldFont.setBold(true);
|
||||
QFontMetrics fm(boldFont);
|
||||
int spacing = 8;
|
||||
int width = 60 + spacing + 2;
|
||||
int width = 60 + spacing + 2;
|
||||
int maxLabelwidth = 0;
|
||||
for (int tab=0 ; tab<count() ;++tab) {
|
||||
for (int tab = 0; tab < count(); ++tab) {
|
||||
int width = fm.width(tabText(tab));
|
||||
if (width > maxLabelwidth)
|
||||
if (width > maxLabelwidth) {
|
||||
maxLabelwidth = width;
|
||||
}
|
||||
}
|
||||
int iconHeight = minimum ? 0 : 32;
|
||||
return QSize(qMax(width, maxLabelwidth + 4), iconHeight + spacing + fm.height());
|
||||
@ -116,19 +118,23 @@ void FancyTabBar::paintEvent(QPaintEvent *event)
|
||||
Q_UNUSED(event)
|
||||
QPainter p(this);
|
||||
|
||||
for (int i = 0; i < count(); ++i)
|
||||
if (i != currentIndex())
|
||||
for (int i = 0; i < count(); ++i) {
|
||||
if (i != currentIndex()) {
|
||||
paintTab(&p, i);
|
||||
}
|
||||
}
|
||||
|
||||
// paint active tab last, since it overlaps the neighbors
|
||||
if (currentIndex() != -1)
|
||||
if (currentIndex() != -1) {
|
||||
paintTab(&p, currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hover events for mouse fade ins
|
||||
void FancyTabBar::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
int newHover = -1;
|
||||
|
||||
for (int i = 0; i < count(); ++i) {
|
||||
QRect area = tabRect(i);
|
||||
if (area.contains(e->pos())) {
|
||||
@ -136,11 +142,13 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newHover == m_hoverIndex)
|
||||
if (newHover == m_hoverIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (validIndex(m_hoverIndex))
|
||||
if (validIndex(m_hoverIndex)) {
|
||||
m_tabs[m_hoverIndex]->fadeOut();
|
||||
}
|
||||
|
||||
m_hoverIndex = newHover;
|
||||
|
||||
@ -156,7 +164,7 @@ bool FancyTabBar::event(QEvent *event)
|
||||
if (validIndex(m_hoverIndex)) {
|
||||
QString tt = tabToolTip(m_hoverIndex);
|
||||
if (!tt.isEmpty()) {
|
||||
QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), tt, this);
|
||||
QToolTip::showText(static_cast<QHelpEvent *>(event)->globalPos(), tt, this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -168,7 +176,7 @@ bool FancyTabBar::event(QEvent *event)
|
||||
void FancyTabBar::enterEvent(QEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
m_hoverRect = QRect();
|
||||
m_hoverRect = QRect();
|
||||
m_hoverIndex = -1;
|
||||
}
|
||||
|
||||
@ -177,8 +185,8 @@ void FancyTabBar::leaveEvent(QEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
m_hoverIndex = -1;
|
||||
m_hoverRect = QRect();
|
||||
for (int i = 0 ; i < m_tabs.count() ; ++i) {
|
||||
m_hoverRect = QRect();
|
||||
for (int i = 0; i < m_tabs.count(); ++i) {
|
||||
m_tabs[i]->fadeOut();
|
||||
}
|
||||
}
|
||||
@ -186,12 +194,14 @@ void FancyTabBar::leaveEvent(QEvent *e)
|
||||
QSize FancyTabBar::sizeHint() const
|
||||
{
|
||||
QSize sh = tabSizeHint();
|
||||
|
||||
return QSize(sh.width(), sh.height() * m_tabs.count());
|
||||
}
|
||||
|
||||
QSize FancyTabBar::minimumSizeHint() const
|
||||
{
|
||||
QSize sh = tabSizeHint(true);
|
||||
|
||||
return QSize(sh.width(), sh.height() * m_tabs.count());
|
||||
}
|
||||
|
||||
@ -199,11 +209,11 @@ QRect FancyTabBar::tabRect(int index) const
|
||||
{
|
||||
QSize sh = tabSizeHint();
|
||||
|
||||
if (sh.height() * m_tabs.count() > height())
|
||||
if (sh.height() * m_tabs.count() > height()) {
|
||||
sh.setHeight(height() / m_tabs.count());
|
||||
}
|
||||
|
||||
return QRect(0, index * sh.height(), sh.width(), sh.height());
|
||||
|
||||
}
|
||||
|
||||
// This keeps the sidebar responsive since
|
||||
@ -219,7 +229,6 @@ void FancyTabBar::mousePressEvent(QMouseEvent *e)
|
||||
e->accept();
|
||||
for (int index = 0; index < m_tabs.count(); ++index) {
|
||||
if (tabRect(index).contains(e->pos())) {
|
||||
|
||||
if (isTabEnabled(index)) {
|
||||
m_currentIndex = index;
|
||||
update();
|
||||
@ -238,12 +247,12 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
}
|
||||
painter->save();
|
||||
|
||||
QRect rect = tabRect(tabIndex);
|
||||
QRect rect = tabRect(tabIndex);
|
||||
bool selected = (tabIndex == m_currentIndex);
|
||||
bool enabled = isTabEnabled(tabIndex);
|
||||
bool enabled = isTabEnabled(tabIndex);
|
||||
|
||||
if (selected) {
|
||||
//background
|
||||
// background
|
||||
painter->save();
|
||||
QLinearGradient grad(rect.topLeft(), rect.topRight());
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 140));
|
||||
@ -251,21 +260,21 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
painter->fillRect(rect.adjusted(0, 0, 0, -1), grad);
|
||||
painter->restore();
|
||||
|
||||
//shadows
|
||||
// shadows
|
||||
painter->setPen(QColor(0, 0, 0, 110));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1,-1), rect.topRight() - QPoint(0,1));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, -1), rect.topRight() - QPoint(0, 1));
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
painter->setPen(QColor(0, 0, 0, 40));
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
|
||||
//highlights
|
||||
// highlights
|
||||
painter->setPen(QColor(255, 255, 255, 50));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0,2));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0,1));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, -2), rect.topRight() - QPoint(0, 2));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0, 1), rect.bottomRight() + QPoint(0, 1));
|
||||
painter->setPen(QColor(255, 255, 255, 40));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, 0), rect.topRight());
|
||||
painter->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0,-1), rect.bottomRight()-QPoint(0,1));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0, -1), rect.bottomRight() - QPoint(0, 1));
|
||||
}
|
||||
|
||||
QString tabText(this->tabText(tabIndex));
|
||||
@ -299,8 +308,9 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if (!enabled)
|
||||
if (!enabled) {
|
||||
painter->setOpacity(0.7);
|
||||
}
|
||||
|
||||
if (drawIcon) {
|
||||
int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height();
|
||||
@ -313,7 +323,8 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void FancyTabBar::setCurrentIndex(int index) {
|
||||
void FancyTabBar::setCurrentIndex(int index)
|
||||
{
|
||||
if (isTabEnabled(index)) {
|
||||
m_currentIndex = index;
|
||||
update();
|
||||
@ -337,8 +348,9 @@ bool FancyTabBar::isTabEnabled(int index) const
|
||||
Q_ASSERT(index < m_tabs.size());
|
||||
Q_ASSERT(index >= 0);
|
||||
|
||||
if (index < m_tabs.size() && index >= 0)
|
||||
if (index < m_tabs.size() && index >= 0) {
|
||||
return m_tabs[index]->enabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -348,11 +360,10 @@ bool FancyTabBar::isTabEnabled(int index) const
|
||||
// FancyColorButton
|
||||
//////
|
||||
|
||||
class FancyColorButton : public QWidget
|
||||
{
|
||||
class FancyColorButton : public QWidget {
|
||||
public:
|
||||
FancyColorButton(QWidget *parent)
|
||||
: m_parent(parent)
|
||||
: m_parent(parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
}
|
||||
@ -361,8 +372,9 @@ public:
|
||||
{
|
||||
if (ev->modifiers() & Qt::ShiftModifier) {
|
||||
QColor color = QColorDialog::getColor(Utils::StyleHelper::requestedBaseColor(), m_parent);
|
||||
if (color.isValid())
|
||||
if (color.isValid()) {
|
||||
Utils::StyleHelper::setBaseColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
@ -384,7 +396,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent)
|
||||
selectionLayout->setMargin(0);
|
||||
|
||||
Utils::StyledBar *bar = new Utils::StyledBar;
|
||||
QHBoxLayout *layout = new QHBoxLayout(bar);
|
||||
QHBoxLayout *layout = new QHBoxLayout(bar);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(new FancyColorButton(this));
|
||||
@ -407,7 +419,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent)
|
||||
selectionLayout->addWidget(m_cornerWidgetContainer, 0);
|
||||
|
||||
m_modesStack = new QStackedLayout;
|
||||
m_statusBar = new QStatusBar;
|
||||
m_statusBar = new QStatusBar;
|
||||
m_statusBar->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
@ -451,6 +463,7 @@ void FancyTabWidget::removeTab(int index)
|
||||
void FancyTabWidget::setBackgroundBrush(const QBrush &brush)
|
||||
{
|
||||
QPalette pal = m_tabBar->palette();
|
||||
|
||||
pal.setBrush(QPalette::Mid, brush);
|
||||
m_tabBar->setPalette(pal);
|
||||
pal = m_cornerWidgetContainer->palette();
|
||||
@ -479,6 +492,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
||||
void FancyTabWidget::insertCornerWidget(int pos, QWidget *widget)
|
||||
{
|
||||
QVBoxLayout *layout = static_cast<QVBoxLayout *>(m_cornerWidgetContainer->layout());
|
||||
|
||||
layout->insertWidget(pos, widget);
|
||||
}
|
||||
|
||||
@ -504,13 +518,15 @@ QStatusBar *FancyTabWidget::statusBar() const
|
||||
|
||||
void FancyTabWidget::setCurrentIndex(int index)
|
||||
{
|
||||
if (m_tabBar->isTabEnabled(index))
|
||||
if (m_tabBar->isTabEnabled(index)) {
|
||||
m_tabBar->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void FancyTabWidget::showWidget(int index)
|
||||
{
|
||||
emit currentAboutToShow(index);
|
||||
|
||||
m_modesStack->setCurrentIndex(index);
|
||||
emit currentChanged(index);
|
||||
}
|
||||
|
@ -43,18 +43,18 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class FancyTab : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(float fader READ fader WRITE setFader)
|
||||
class FancyTab : public QObject {
|
||||
Q_OBJECT Q_PROPERTY(float fader READ fader WRITE setFader)
|
||||
public:
|
||||
FancyTab(QWidget *tabbar) : enabled(false), tabbar(tabbar), m_fader(0) {
|
||||
FancyTab(QWidget *tabbar) : enabled(false), tabbar(tabbar), m_fader(0)
|
||||
{
|
||||
animator.setPropertyName("fader");
|
||||
animator.setTargetObject(this);
|
||||
}
|
||||
float fader() { return m_fader; }
|
||||
float fader()
|
||||
{
|
||||
return m_fader;
|
||||
}
|
||||
void setFader(float value);
|
||||
|
||||
void fadeIn();
|
||||
@ -71,8 +71,7 @@ private:
|
||||
float m_fader;
|
||||
};
|
||||
|
||||
class FancyTabBar : public QWidget
|
||||
{
|
||||
class FancyTabBar : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -87,7 +86,10 @@ public:
|
||||
void mouseMoveEvent(QMouseEvent *);
|
||||
void enterEvent(QEvent *);
|
||||
void leaveEvent(QEvent *);
|
||||
bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); }
|
||||
bool validIndex(int index) const
|
||||
{
|
||||
return index >= 0 && index < m_tabs.count();
|
||||
}
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
@ -95,28 +97,50 @@ public:
|
||||
void setTabEnabled(int index, bool enable);
|
||||
bool isTabEnabled(int index) const;
|
||||
|
||||
void insertTab(int index, const QIcon &icon, const QString &label) {
|
||||
void insertTab(int index, const QIcon &icon, const QString &label)
|
||||
{
|
||||
FancyTab *tab = new FancyTab(this);
|
||||
|
||||
tab->icon = icon;
|
||||
tab->text = label;
|
||||
m_tabs.insert(index, tab);
|
||||
updateGeometry();
|
||||
}
|
||||
void setEnabled(int index, bool enabled);
|
||||
void removeTab(int index) {
|
||||
void removeTab(int index)
|
||||
{
|
||||
FancyTab *tab = m_tabs.takeAt(index);
|
||||
|
||||
delete tab;
|
||||
updateGeometry();
|
||||
}
|
||||
void setCurrentIndex(int index);
|
||||
int currentIndex() const { return m_currentIndex; }
|
||||
int currentIndex() const
|
||||
{
|
||||
return m_currentIndex;
|
||||
}
|
||||
|
||||
void setTabToolTip(int index, QString toolTip) { m_tabs[index]->toolTip = toolTip; }
|
||||
QString tabToolTip(int index) const { return m_tabs.at(index)->toolTip; }
|
||||
void setTabToolTip(int index, QString toolTip)
|
||||
{
|
||||
m_tabs[index]->toolTip = toolTip;
|
||||
}
|
||||
QString tabToolTip(int index) const
|
||||
{
|
||||
return m_tabs.at(index)->toolTip;
|
||||
}
|
||||
|
||||
QIcon tabIcon(int index) const { return m_tabs.at(index)->icon; }
|
||||
QString tabText(int index) const { return m_tabs.at(index)->text; }
|
||||
int count() const {return m_tabs.count(); }
|
||||
QIcon tabIcon(int index) const
|
||||
{
|
||||
return m_tabs.at(index)->icon;
|
||||
}
|
||||
QString tabText(int index) const
|
||||
{
|
||||
return m_tabs.at(index)->text;
|
||||
}
|
||||
int count() const
|
||||
{
|
||||
return m_tabs.count();
|
||||
}
|
||||
QRect tabRect(int index) const;
|
||||
|
||||
signals:
|
||||
@ -131,14 +155,12 @@ private:
|
||||
QRect m_hoverRect;
|
||||
int m_hoverIndex;
|
||||
int m_currentIndex;
|
||||
QList<FancyTab*> m_tabs;
|
||||
QList<FancyTab *> m_tabs;
|
||||
QTimer m_triggerTimer;
|
||||
QSize tabSizeHint(bool minimum = false) const;
|
||||
|
||||
};
|
||||
|
||||
class FancyTabWidget : public QWidget
|
||||
{
|
||||
class FancyTabWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -180,7 +202,6 @@ private:
|
||||
QWidget *m_selectionWidget;
|
||||
QStatusBar *m_statusBar;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Core
|
||||
|
||||
|
@ -59,10 +59,12 @@ const QStyle::State State_Animating = QStyle::State(0x00000040);
|
||||
bool styleEnabled(const QWidget *widget)
|
||||
{
|
||||
const QWidget *p = widget;
|
||||
|
||||
while (p) {
|
||||
if (p->property("_q_custom_style_disabled").toBool())
|
||||
if (p->property("_q_custom_style_disabled").toBool()) {
|
||||
return false;
|
||||
p = p->parentWidget();
|
||||
}
|
||||
p = p->parentWidget();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -70,26 +72,31 @@ bool styleEnabled(const QWidget *widget)
|
||||
// Consider making this a QStyle state
|
||||
bool panelWidget(const QWidget *widget)
|
||||
{
|
||||
if (!widget)
|
||||
if (!widget) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not style dialogs or explicitly ignored widgets
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (qobject_cast<const Utils::FancyMainWindow *>(widget))
|
||||
if (qobject_cast<const Utils::FancyMainWindow *>(widget)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (qobject_cast<const QTabBar *>(widget))
|
||||
if (qobject_cast<const QTabBar *>(widget)) {
|
||||
return styleEnabled(widget);
|
||||
}
|
||||
|
||||
const QWidget *p = widget;
|
||||
while (p) {
|
||||
if (qobject_cast<const QToolBar *>(p) ||
|
||||
qobject_cast<const QStatusBar *>(p) ||
|
||||
qobject_cast<const QMenuBar *>(p) ||
|
||||
p->property("panelwidget").toBool())
|
||||
p->property("panelwidget").toBool()) {
|
||||
return styleEnabled(widget);
|
||||
}
|
||||
p = p->parentWidget();
|
||||
}
|
||||
return false;
|
||||
@ -98,24 +105,26 @@ bool panelWidget(const QWidget *widget)
|
||||
// Consider making this a QStyle state
|
||||
bool lightColored(const QWidget *widget)
|
||||
{
|
||||
if (!widget)
|
||||
if (!widget) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't style dialogs or explicitly ignored widgets
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QWidget *p = widget;
|
||||
while (p) {
|
||||
if (p->property("lightColored").toBool())
|
||||
if (p->property("lightColored").toBool()) {
|
||||
return true;
|
||||
}
|
||||
p = p->parentWidget();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
class ManhattanStylePrivate
|
||||
{
|
||||
class ManhattanStylePrivate {
|
||||
public:
|
||||
explicit ManhattanStylePrivate();
|
||||
void init();
|
||||
@ -133,14 +142,12 @@ ManhattanStylePrivate::ManhattanStylePrivate() :
|
||||
lineeditImage_disabled(QLatin1String(":/core/images/inputfield_disabled.png")),
|
||||
extButtonPixmap(QLatin1String(":/core/images/extension.png")),
|
||||
closeButtonPixmap(QLatin1String(Core::Constants::ICON_CLOSE))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
ManhattanStyle::ManhattanStyle(const QString &baseStyleName)
|
||||
: QProxyStyle(QStyleFactory::create(baseStyleName)),
|
||||
d(new ManhattanStylePrivate())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
ManhattanStyle::~ManhattanStyle()
|
||||
{
|
||||
@ -158,10 +165,11 @@ QSize ManhattanStyle::sizeFromContents(ContentsType type, const QStyleOption *op
|
||||
{
|
||||
QSize newSize = QProxyStyle::sizeFromContents(type, option, size, widget);
|
||||
|
||||
if (type == CT_Splitter && widget && widget->property("minisplitter").toBool())
|
||||
if (type == CT_Splitter && widget && widget->property("minisplitter").toBool()) {
|
||||
return QSize(1, 1);
|
||||
else if (type == CT_ComboBox && panelWidget(widget))
|
||||
} else if (type == CT_ComboBox && panelWidget(widget)) {
|
||||
newSize += QSize(14, 0);
|
||||
}
|
||||
return newSize;
|
||||
}
|
||||
|
||||
@ -185,37 +193,44 @@ QStyle::SubControl ManhattanStyle::hitTestComplexControl(ComplexControl control,
|
||||
int ManhattanStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
retval = QProxyStyle::pixelMetric(metric, option, widget);
|
||||
switch (metric) {
|
||||
case PM_SplitterWidth:
|
||||
if (widget && widget->property("minisplitter").toBool())
|
||||
if (widget && widget->property("minisplitter").toBool()) {
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
case PM_ToolBarIconSize:
|
||||
if (panelWidget(widget))
|
||||
if (panelWidget(widget)) {
|
||||
retval = 16;
|
||||
}
|
||||
break;
|
||||
case PM_DockWidgetHandleExtent:
|
||||
case PM_DockWidgetSeparatorExtent:
|
||||
return 1;
|
||||
|
||||
case PM_MenuPanelWidth:
|
||||
case PM_MenuBarHMargin:
|
||||
case PM_MenuBarVMargin:
|
||||
case PM_ToolBarFrameWidth:
|
||||
if (panelWidget(widget))
|
||||
if (panelWidget(widget)) {
|
||||
retval = 1;
|
||||
}
|
||||
break;
|
||||
case PM_ButtonShiftVertical:
|
||||
case PM_ButtonShiftHorizontal:
|
||||
case PM_MenuBarPanelWidth:
|
||||
case PM_ToolBarItemMargin:
|
||||
case PM_ToolBarItemSpacing:
|
||||
if (panelWidget(widget))
|
||||
if (panelWidget(widget)) {
|
||||
retval = 0;
|
||||
}
|
||||
break;
|
||||
case PM_DefaultFrameWidth:
|
||||
if (qobject_cast<const QLineEdit*>(widget) && panelWidget(widget))
|
||||
if (qobject_cast<const QLineEdit *>(widget) && panelWidget(widget)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -242,6 +257,7 @@ QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false)
|
||||
{
|
||||
QColor color = Utils::StyleHelper::panelTextColor(lightColored);
|
||||
QPalette pal = oldPalette;
|
||||
|
||||
pal.setBrush(QPalette::All, QPalette::WindowText, color);
|
||||
pal.setBrush(QPalette::All, QPalette::ButtonText, color);
|
||||
pal.setBrush(QPalette::All, QPalette::Foreground, color);
|
||||
@ -258,33 +274,31 @@ void ManhattanStyle::polish(QWidget *widget)
|
||||
|
||||
// OxygenStyle forces a rounded widget mask on toolbars and dock widgets
|
||||
if (baseStyle()->inherits("OxygenStyle") || baseStyle()->inherits("Oxygen::Style")) {
|
||||
if (qobject_cast<QToolBar*>(widget) || qobject_cast<QDockWidget*>(widget)) {
|
||||
if (qobject_cast<QToolBar *>(widget) || qobject_cast<QDockWidget *>(widget)) {
|
||||
widget->removeEventFilter(baseStyle());
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
if (panelWidget(widget)) {
|
||||
|
||||
// Oxygen and possibly other styles override this
|
||||
if (qobject_cast<QDockWidget*>(widget))
|
||||
if (qobject_cast<QDockWidget *>(widget)) {
|
||||
widget->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
|
||||
if (qobject_cast<QToolButton*>(widget)) {
|
||||
if (qobject_cast<QToolButton *>(widget)) {
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
|
||||
}
|
||||
else if (qobject_cast<QLineEdit*>(widget)) {
|
||||
} else if (qobject_cast<QLineEdit *>(widget)) {
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
|
||||
}
|
||||
else if (qobject_cast<QLabel*>(widget))
|
||||
} else if (qobject_cast<QLabel *>(widget)) {
|
||||
widget->setPalette(panelPalette(widget->palette()));
|
||||
else if (widget->property("panelwidget_singlerow").toBool())
|
||||
} else if (widget->property("panelwidget_singlerow").toBool()) {
|
||||
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight());
|
||||
else if (qobject_cast<QStatusBar*>(widget))
|
||||
} else if (qobject_cast<QStatusBar *>(widget)) {
|
||||
widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight() + 2);
|
||||
else if (qobject_cast<QComboBox*>(widget)) {
|
||||
} else if (qobject_cast<QComboBox *>(widget)) {
|
||||
widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2);
|
||||
widget->setAttribute(Qt::WA_Hover);
|
||||
}
|
||||
@ -294,14 +308,16 @@ void ManhattanStyle::polish(QWidget *widget)
|
||||
void ManhattanStyle::unpolish(QWidget *widget)
|
||||
{
|
||||
QProxyStyle::unpolish(widget);
|
||||
|
||||
if (panelWidget(widget)) {
|
||||
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, false);
|
||||
if (qobject_cast<QTabBar*>(widget))
|
||||
if (qobject_cast<QTabBar *>(widget)) {
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
else if (qobject_cast<QToolBar*>(widget))
|
||||
} else if (qobject_cast<QToolBar *>(widget)) {
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
else if (qobject_cast<QComboBox*>(widget))
|
||||
} else if (qobject_cast<QComboBox *>(widget)) {
|
||||
widget->setAttribute(Qt::WA_Hover, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,10 +329,12 @@ void ManhattanStyle::polish(QPalette &pal)
|
||||
QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
QIcon icon;
|
||||
|
||||
switch (standardIcon) {
|
||||
case QStyle::SP_TitleBarCloseButton:
|
||||
case QStyle::SP_ToolBarHorizontalExtensionButton:
|
||||
return QIcon(standardPixmap(standardIcon, option, widget));
|
||||
|
||||
default:
|
||||
icon = baseStyle()->standardIcon(standardIcon, option, widget);
|
||||
}
|
||||
@ -326,8 +344,9 @@ QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, co
|
||||
QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||
const QWidget *widget) const
|
||||
{
|
||||
if (widget && !panelWidget(widget))
|
||||
if (widget && !panelWidget(widget)) {
|
||||
return QProxyStyle::standardPixmap(standardPixmap, opt, widget);
|
||||
}
|
||||
|
||||
QPixmap pixmap;
|
||||
switch (standardPixmap) {
|
||||
@ -348,15 +367,18 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const
|
||||
QStyleHintReturn *returnData) const
|
||||
{
|
||||
int ret = QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
|
||||
switch (hint) {
|
||||
// Make project explorer alternate rows all the way
|
||||
case QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
|
||||
if (widget && widget->property("AlternateEmpty").toBool())
|
||||
if (widget && widget->property("AlternateEmpty").toBool()) {
|
||||
ret = true;
|
||||
}
|
||||
break;
|
||||
case QStyle::SH_EtchDisabledText:
|
||||
if (panelWidget(widget))
|
||||
if (panelWidget(widget)) {
|
||||
ret = false;
|
||||
}
|
||||
break;
|
||||
case QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren:
|
||||
ret = true;
|
||||
@ -370,16 +392,17 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const
|
||||
void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
if (!panelWidget(widget))
|
||||
if (!panelWidget(widget)) {
|
||||
return QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||
}
|
||||
|
||||
bool animating = (option->state & State_Animating);
|
||||
int state = option->state;
|
||||
QRect rect = option->rect;
|
||||
QRect rect = option->rect;
|
||||
QRect oldRect;
|
||||
QRect newRect;
|
||||
if (widget && (element == PE_PanelButtonTool) && !animating) {
|
||||
QWidget *w = const_cast<QWidget *> (widget);
|
||||
QWidget *w = const_cast<QWidget *> (widget);
|
||||
int oldState = w->property("_q_stylestate").toInt();
|
||||
oldRect = w->property("_q_stylerect").toRect();
|
||||
newRect = w->rect();
|
||||
@ -387,10 +410,9 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
w->setProperty("_q_stylerect", w->rect());
|
||||
|
||||
// Determine the animated transition
|
||||
bool doTransition = ((state & State_On) != (oldState & State_On) ||
|
||||
(state & State_MouseOver) != (oldState & State_MouseOver));
|
||||
if (oldRect != newRect)
|
||||
{
|
||||
bool doTransition = ((state & State_On) != (oldState & State_On) ||
|
||||
(state & State_MouseOver) != (oldState & State_MouseOver));
|
||||
if (oldRect != newRect) {
|
||||
doTransition = false;
|
||||
d->animator.stopAnimation(widget);
|
||||
}
|
||||
@ -398,9 +420,9 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
if (doTransition) {
|
||||
QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
|
||||
QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
|
||||
Animation *anim = d->animator.widgetAnimation(widget);
|
||||
Animation *anim = d->animator.widgetAnimation(widget);
|
||||
QStyleOption opt = *option;
|
||||
opt.state = (QStyle::State)oldState;
|
||||
opt.state = (QStyle::State)oldState;
|
||||
opt.state |= State_Animating;
|
||||
startImage.fill(0);
|
||||
Transition *t = new Transition;
|
||||
@ -420,10 +442,11 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
QPainter endPainter(&endImage);
|
||||
drawPrimitive(element, &endOpt, &endPainter, widget);
|
||||
t->setEndImage(endImage);
|
||||
if (oldState & State_MouseOver)
|
||||
if (oldState & State_MouseOver) {
|
||||
t->setDuration(150);
|
||||
else
|
||||
} else {
|
||||
t->setDuration(75);
|
||||
}
|
||||
t->setStartTime(QTime::currentTime());
|
||||
}
|
||||
}
|
||||
@ -436,160 +459,162 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
QCommonStyle::drawPrimitive(element, option, painter, widget);
|
||||
break;
|
||||
case PE_PanelLineEdit:
|
||||
{
|
||||
painter->save();
|
||||
{
|
||||
painter->save();
|
||||
|
||||
// Fill the line edit background
|
||||
QRect filledRect = option->rect.adjusted(1, 1, -1, -1);
|
||||
painter->setBrushOrigin(filledRect.topLeft());
|
||||
painter->fillRect(filledRect, option->palette.base());
|
||||
// Fill the line edit background
|
||||
QRect filledRect = option->rect.adjusted(1, 1, -1, -1);
|
||||
painter->setBrushOrigin(filledRect.topLeft());
|
||||
painter->fillRect(filledRect, option->palette.base());
|
||||
|
||||
if (option->state & State_Enabled)
|
||||
Utils::StyleHelper::drawCornerImage(d->lineeditImage, painter, option->rect, 5, 5, 5, 5);
|
||||
else
|
||||
Utils::StyleHelper::drawCornerImage(d->lineeditImage_disabled, painter, option->rect, 5, 5, 5, 5);
|
||||
|
||||
if (option->state & State_HasFocus || option->state & State_MouseOver) {
|
||||
QColor hover = Utils::StyleHelper::baseColor();
|
||||
if (state & State_HasFocus)
|
||||
hover.setAlpha(100);
|
||||
else
|
||||
hover.setAlpha(50);
|
||||
|
||||
painter->setPen(QPen(hover, 1));
|
||||
painter->drawRect(option->rect.adjusted(1, 1, -2 ,-2));
|
||||
}
|
||||
painter->restore();
|
||||
if (option->state & State_Enabled) {
|
||||
Utils::StyleHelper::drawCornerImage(d->lineeditImage, painter, option->rect, 5, 5, 5, 5);
|
||||
} else {
|
||||
Utils::StyleHelper::drawCornerImage(d->lineeditImage_disabled, painter, option->rect, 5, 5, 5, 5);
|
||||
}
|
||||
break;
|
||||
|
||||
if (option->state & State_HasFocus || option->state & State_MouseOver) {
|
||||
QColor hover = Utils::StyleHelper::baseColor();
|
||||
if (state & State_HasFocus) {
|
||||
hover.setAlpha(100);
|
||||
} else {
|
||||
hover.setAlpha(50);
|
||||
}
|
||||
|
||||
painter->setPen(QPen(hover, 1));
|
||||
painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
|
||||
case PE_FrameStatusBarItem:
|
||||
break;
|
||||
|
||||
case PE_PanelButtonTool: {
|
||||
Animation *anim = d->animator.widgetAnimation(widget);
|
||||
if (!animating && anim) {
|
||||
anim->paint(painter, option);
|
||||
} else {
|
||||
bool pressed = option->state & State_Sunken || option->state & State_On;
|
||||
QColor shadow(0, 0, 0, 30);
|
||||
painter->setPen(shadow);
|
||||
if (pressed) {
|
||||
QColor shade(0, 0, 0, 40);
|
||||
painter->fillRect(rect, shade);
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight() - QPoint(1, 0));
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
// painter->drawLine(rect.bottomLeft() + QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
|
||||
QColor highlight(255, 255, 255, 30);
|
||||
painter->setPen(highlight);
|
||||
}
|
||||
else if (option->state & State_Enabled &&
|
||||
option->state & State_MouseOver) {
|
||||
QColor lighter(255, 255, 255, 37);
|
||||
painter->fillRect(rect, lighter);
|
||||
}
|
||||
if (option->state & State_HasFocus && (option->state & State_KeyboardFocusChange)) {
|
||||
QColor highlight = option->palette.highlight().color();
|
||||
highlight.setAlphaF(0.4);
|
||||
painter->setPen(QPen(highlight.lighter(), 1));
|
||||
highlight.setAlphaF(0.3);
|
||||
painter->setBrush(highlight);
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
QRectF rect = option->rect;
|
||||
rect.translate(0.5, 0.5);
|
||||
painter->drawRoundedRect(rect.adjusted(2, 2, -3, -3), 2, 2);
|
||||
}
|
||||
}
|
||||
case PE_PanelButtonTool:
|
||||
{
|
||||
Animation *anim = d->animator.widgetAnimation(widget);
|
||||
if (!animating && anim) {
|
||||
anim->paint(painter, option);
|
||||
} else {
|
||||
bool pressed = option->state & State_Sunken || option->state & State_On;
|
||||
QColor shadow(0, 0, 0, 30);
|
||||
painter->setPen(shadow);
|
||||
if (pressed) {
|
||||
QColor shade(0, 0, 0, 40);
|
||||
painter->fillRect(rect, shade);
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight() - QPoint(1, 0));
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
// painter->drawLine(rect.bottomLeft() + QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
|
||||
QColor highlight(255, 255, 255, 30);
|
||||
painter->setPen(highlight);
|
||||
} else if (option->state & State_Enabled &&
|
||||
option->state & State_MouseOver) {
|
||||
QColor lighter(255, 255, 255, 37);
|
||||
painter->fillRect(rect, lighter);
|
||||
}
|
||||
if (option->state & State_HasFocus && (option->state & State_KeyboardFocusChange)) {
|
||||
QColor highlight = option->palette.highlight().color();
|
||||
highlight.setAlphaF(0.4);
|
||||
painter->setPen(QPen(highlight.lighter(), 1));
|
||||
highlight.setAlphaF(0.3);
|
||||
painter->setBrush(highlight);
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
QRectF rect = option->rect;
|
||||
rect.translate(0.5, 0.5);
|
||||
painter->drawRoundedRect(rect.adjusted(2, 2, -3, -3), 2, 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PE_PanelStatusBar:
|
||||
{
|
||||
painter->save();
|
||||
QLinearGradient grad = Utils::StyleHelper::statusBarGradient(rect);
|
||||
painter->fillRect(rect, grad);
|
||||
painter->setPen(QColor(255, 255, 255, 60));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0,1),
|
||||
rect.topRight()+ QPoint(0,1));
|
||||
painter->setPen(Utils::StyleHelper::borderColor().darker(110));
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
{
|
||||
painter->save();
|
||||
QLinearGradient grad = Utils::StyleHelper::statusBarGradient(rect);
|
||||
painter->fillRect(rect, grad);
|
||||
painter->setPen(QColor(255, 255, 255, 60));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, 1),
|
||||
rect.topRight() + QPoint(0, 1));
|
||||
painter->setPen(Utils::StyleHelper::borderColor().darker(110));
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
|
||||
case PE_IndicatorToolBarSeparator:
|
||||
{
|
||||
QColor separatorColor = Utils::StyleHelper::borderColor();
|
||||
separatorColor.setAlpha(100);
|
||||
painter->setPen(separatorColor);
|
||||
const int margin = 6;
|
||||
if (option->state & State_Horizontal) {
|
||||
const int offset = rect.width()/2;
|
||||
painter->drawLine(rect.bottomLeft().x() + offset,
|
||||
rect.bottomLeft().y() - margin,
|
||||
rect.topLeft().x() + offset,
|
||||
rect.topLeft().y() + margin);
|
||||
} else { //Draw vertical separator
|
||||
const int offset = rect.height()/2;
|
||||
painter->setPen(QPen(option->palette.background().color().darker(110)));
|
||||
painter->drawLine(rect.topLeft().x() + margin ,
|
||||
rect.topLeft().y() + offset,
|
||||
rect.topRight().x() - margin,
|
||||
rect.topRight().y() + offset);
|
||||
}
|
||||
{
|
||||
QColor separatorColor = Utils::StyleHelper::borderColor();
|
||||
separatorColor.setAlpha(100);
|
||||
painter->setPen(separatorColor);
|
||||
const int margin = 6;
|
||||
if (option->state & State_Horizontal) {
|
||||
const int offset = rect.width() / 2;
|
||||
painter->drawLine(rect.bottomLeft().x() + offset,
|
||||
rect.bottomLeft().y() - margin,
|
||||
rect.topLeft().x() + offset,
|
||||
rect.topLeft().y() + margin);
|
||||
} else { // Draw vertical separator
|
||||
const int offset = rect.height() / 2;
|
||||
painter->setPen(QPen(option->palette.background().color().darker(110)));
|
||||
painter->drawLine(rect.topLeft().x() + margin,
|
||||
rect.topLeft().y() + offset,
|
||||
rect.topRight().x() - margin,
|
||||
rect.topRight().y() + offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PE_IndicatorToolBarHandle:
|
||||
{
|
||||
bool horizontal = option->state & State_Horizontal;
|
||||
painter->save();
|
||||
QPainterPath path;
|
||||
int x = option->rect.x() + (horizontal ? 2 : 6);
|
||||
int y = option->rect.y() + (horizontal ? 6 : 2);
|
||||
static const int RectHeight = 2;
|
||||
if (horizontal) {
|
||||
while (y < option->rect.height() - RectHeight - 6) {
|
||||
path.moveTo(x, y);
|
||||
path.addRect(x, y, RectHeight, RectHeight);
|
||||
y += 6;
|
||||
}
|
||||
} else {
|
||||
while (x < option->rect.width() - RectHeight - 6) {
|
||||
path.moveTo(x, y);
|
||||
path.addRect(x, y, RectHeight, RectHeight);
|
||||
x += 6;
|
||||
}
|
||||
{
|
||||
bool horizontal = option->state & State_Horizontal;
|
||||
painter->save();
|
||||
QPainterPath path;
|
||||
int x = option->rect.x() + (horizontal ? 2 : 6);
|
||||
int y = option->rect.y() + (horizontal ? 6 : 2);
|
||||
static const int RectHeight = 2;
|
||||
if (horizontal) {
|
||||
while (y < option->rect.height() - RectHeight - 6) {
|
||||
path.moveTo(x, y);
|
||||
path.addRect(x, y, RectHeight, RectHeight);
|
||||
y += 6;
|
||||
}
|
||||
} else {
|
||||
while (x < option->rect.width() - RectHeight - 6) {
|
||||
path.moveTo(x, y);
|
||||
path.addRect(x, y, RectHeight, RectHeight);
|
||||
x += 6;
|
||||
}
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
QColor dark = Utils::StyleHelper::borderColor();
|
||||
dark.setAlphaF(0.4);
|
||||
|
||||
QColor light = Utils::StyleHelper::baseColor();
|
||||
light.setAlphaF(0.4);
|
||||
|
||||
painter->fillPath(path, light);
|
||||
painter->save();
|
||||
painter->translate(1, 1);
|
||||
painter->fillPath(path, dark);
|
||||
painter->restore();
|
||||
painter->translate(3, 3);
|
||||
painter->fillPath(path, light);
|
||||
painter->translate(1, 1);
|
||||
painter->fillPath(path, dark);
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
QColor dark = Utils::StyleHelper::borderColor();
|
||||
dark.setAlphaF(0.4);
|
||||
|
||||
QColor light = Utils::StyleHelper::baseColor();
|
||||
light.setAlphaF(0.4);
|
||||
|
||||
painter->fillPath(path, light);
|
||||
painter->save();
|
||||
painter->translate(1, 1);
|
||||
painter->fillPath(path, dark);
|
||||
painter->restore();
|
||||
painter->translate(3, 3);
|
||||
painter->fillPath(path, light);
|
||||
painter->translate(1, 1);
|
||||
painter->fillPath(path, dark);
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
case PE_IndicatorArrowUp:
|
||||
case PE_IndicatorArrowDown:
|
||||
case PE_IndicatorArrowRight:
|
||||
case PE_IndicatorArrowLeft:
|
||||
{
|
||||
Utils::StyleHelper::drawArrow(element, painter, option);
|
||||
}
|
||||
break;
|
||||
{
|
||||
Utils::StyleHelper::drawArrow(element, painter, option);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||
@ -600,8 +625,9 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *option,
|
||||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
if (!panelWidget(widget))
|
||||
if (!panelWidget(widget)) {
|
||||
return QProxyStyle::drawControl(element, option, painter, widget);
|
||||
}
|
||||
|
||||
switch (element) {
|
||||
case CE_Splitter:
|
||||
@ -612,16 +638,16 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
// Most styles draw a single dark outline. This looks rather ugly when combined with our
|
||||
// single pixel dark separator so we adjust the first tab to compensate for this
|
||||
|
||||
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
|
||||
if (const QStyleOptionTabV3 * tab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
|
||||
QStyleOptionTabV3 adjustedTab = *tab;
|
||||
if (tab->cornerWidgets == QStyleOptionTab::NoCornerWidgets && (
|
||||
tab->position == QStyleOptionTab::Beginning ||
|
||||
tab->position == QStyleOptionTab::OnlyOneTab))
|
||||
{
|
||||
if (option->direction == Qt::LeftToRight)
|
||||
tab->position == QStyleOptionTab::OnlyOneTab)) {
|
||||
if (option->direction == Qt::LeftToRight) {
|
||||
adjustedTab.rect = adjustedTab.rect.adjusted(-1, 0, 0, 0);
|
||||
else
|
||||
adjustedTab.rect = adjustedTab.rect.adjusted(0, 0, 1 ,0);
|
||||
} else {
|
||||
adjustedTab.rect = adjustedTab.rect.adjusted(0, 0, 1, 0);
|
||||
}
|
||||
}
|
||||
QProxyStyle::drawControl(element, &adjustedTab, painter, widget);
|
||||
return;
|
||||
@ -630,13 +656,13 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
|
||||
case CE_MenuBarItem:
|
||||
painter->save();
|
||||
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
|
||||
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;
|
||||
item.rect = mbi->rect;
|
||||
QPalette pal = mbi->palette;
|
||||
pal.setBrush(QPalette::ButtonText, dis ? Qt::gray : Qt::black);
|
||||
item.palette = pal;
|
||||
@ -661,10 +687,11 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
painter->drawPoint(r.topLeft());
|
||||
painter->drawPoint(r.topRight());
|
||||
|
||||
QPalette pal = mbi->palette;
|
||||
QPalette pal = mbi->palette;
|
||||
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
|
||||
if (!styleHint(SH_UnderlineShortcut, mbi, widget))
|
||||
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);
|
||||
@ -675,30 +702,32 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
break;
|
||||
|
||||
case CE_ComboBoxLabel:
|
||||
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
if (const QStyleOptionComboBox * cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
if (panelWidget(widget)) {
|
||||
painter->save();
|
||||
QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
|
||||
QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
|
||||
QPalette customPal = cb->palette;
|
||||
bool drawIcon = !(widget && widget->property("hideicon").toBool());
|
||||
|
||||
if (!cb->currentIcon.isNull() && drawIcon) {
|
||||
QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
|
||||
: QIcon::Disabled;
|
||||
QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
|
||||
: QIcon::Disabled;
|
||||
QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
|
||||
QRect iconRect(editRect);
|
||||
iconRect.setWidth(cb->iconSize.width() + 4);
|
||||
iconRect = alignedRect(cb->direction,
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
iconRect.size(), editRect);
|
||||
if (cb->editable)
|
||||
if (cb->editable) {
|
||||
painter->fillRect(iconRect, customPal.brush(QPalette::Base));
|
||||
}
|
||||
drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
|
||||
|
||||
if (cb->direction == Qt::RightToLeft)
|
||||
if (cb->direction == Qt::RightToLeft) {
|
||||
editRect.translate(-4 - cb->iconSize.width(), 0);
|
||||
else
|
||||
} else {
|
||||
editRect.translate(cb->iconSize.width() + 4, 0);
|
||||
}
|
||||
|
||||
// Reserve some space for the down-arrow
|
||||
editRect.adjust(0, 0, -13, 0);
|
||||
@ -734,94 +763,101 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
}
|
||||
break;
|
||||
|
||||
case CE_SizeGrip: {
|
||||
painter->save();
|
||||
QColor dark = Qt::white;
|
||||
dark.setAlphaF(0.1);
|
||||
int x, y, w, h;
|
||||
option->rect.getRect(&x, &y, &w, &h);
|
||||
int sw = qMin(h, w);
|
||||
if (h > w)
|
||||
painter->translate(0, h - w);
|
||||
else
|
||||
painter->translate(w - h, 0);
|
||||
int sx = x;
|
||||
int sy = y;
|
||||
int s = 4;
|
||||
painter->setPen(dark);
|
||||
if (option->direction == Qt::RightToLeft) {
|
||||
sx = x + sw;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
painter->drawLine(x, sy, sx, sw);
|
||||
sx -= s;
|
||||
sy += s;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
painter->drawLine(sx, sw, sw, sy);
|
||||
sx += s;
|
||||
sy += s;
|
||||
}
|
||||
case CE_SizeGrip:
|
||||
{
|
||||
painter->save();
|
||||
QColor dark = Qt::white;
|
||||
dark.setAlphaF(0.1);
|
||||
int x, y, w, h;
|
||||
option->rect.getRect(&x, &y, &w, &h);
|
||||
int sw = qMin(h, w);
|
||||
if (h > w) {
|
||||
painter->translate(0, h - w);
|
||||
} else {
|
||||
painter->translate(w - h, 0);
|
||||
}
|
||||
int sx = x;
|
||||
int sy = y;
|
||||
int s = 4;
|
||||
painter->setPen(dark);
|
||||
if (option->direction == Qt::RightToLeft) {
|
||||
sx = x + sw;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
painter->drawLine(x, sy, sx, sw);
|
||||
sx -= s;
|
||||
sy += s;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
painter->drawLine(sx, sw, sw, sy);
|
||||
sx += s;
|
||||
sy += s;
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
break;
|
||||
painter->restore();
|
||||
}
|
||||
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_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;
|
||||
bool horizontal = option->state & State_Horizontal;
|
||||
rect = option->rect;
|
||||
{
|
||||
QRect rect = option->rect;
|
||||
bool horizontal = option->state & State_Horizontal;
|
||||
rect = option->rect;
|
||||
|
||||
// Map offset for global window gradient
|
||||
QPoint offset = widget->window()->mapToGlobal(option->rect.topLeft()) -
|
||||
widget->mapToGlobal(option->rect.topLeft());
|
||||
QRect gradientSpan;
|
||||
if (widget)
|
||||
gradientSpan = QRect(offset, widget->window()->size());
|
||||
|
||||
bool drawLightColored = lightColored(widget);
|
||||
if (horizontal)
|
||||
Utils::StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored);
|
||||
else
|
||||
Utils::StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored);
|
||||
|
||||
if (!drawLightColored)
|
||||
painter->setPen(Utils::StyleHelper::borderColor());
|
||||
else
|
||||
painter->setPen(QColor(0x888888));
|
||||
|
||||
if (horizontal) {
|
||||
// Note: This is a hack to determine if the
|
||||
// toolbar should draw the top or bottom outline
|
||||
// (needed for the find toolbar for instance)
|
||||
QColor lighter(Utils::StyleHelper::sidebarHighlight());
|
||||
if (drawLightColored)
|
||||
lighter = QColor(255, 255, 255, 180);
|
||||
if (widget && widget->property("topBorder").toBool()) {
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
painter->setPen(lighter);
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
|
||||
} else {
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
painter->setPen(lighter);
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
}
|
||||
} else {
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
}
|
||||
// Map offset for global window gradient
|
||||
QPoint offset = widget->window()->mapToGlobal(option->rect.topLeft()) -
|
||||
widget->mapToGlobal(option->rect.topLeft());
|
||||
QRect gradientSpan;
|
||||
if (widget) {
|
||||
gradientSpan = QRect(offset, widget->window()->size());
|
||||
}
|
||||
break;
|
||||
|
||||
bool drawLightColored = lightColored(widget);
|
||||
if (horizontal) {
|
||||
Utils::StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored);
|
||||
} else {
|
||||
Utils::StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored);
|
||||
}
|
||||
|
||||
if (!drawLightColored) {
|
||||
painter->setPen(Utils::StyleHelper::borderColor());
|
||||
} else {
|
||||
painter->setPen(QColor(0x888888));
|
||||
}
|
||||
|
||||
if (horizontal) {
|
||||
// Note: This is a hack to determine if the
|
||||
// toolbar should draw the top or bottom outline
|
||||
// (needed for the find toolbar for instance)
|
||||
QColor lighter(Utils::StyleHelper::sidebarHighlight());
|
||||
if (drawLightColored) {
|
||||
lighter = QColor(255, 255, 255, 180);
|
||||
}
|
||||
if (widget && widget->property("topBorder").toBool()) {
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
painter->setPen(lighter);
|
||||
painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
|
||||
} else {
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
painter->setPen(lighter);
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
}
|
||||
} else {
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
QProxyStyle::drawControl(element, option, painter, widget);
|
||||
@ -832,41 +868,46 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
||||
QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
if (!panelWidget(widget))
|
||||
return QProxyStyle::drawComplexControl(control, option, painter, widget);
|
||||
if (!panelWidget(widget)) {
|
||||
return QProxyStyle::drawComplexControl(control, option, painter, widget);
|
||||
}
|
||||
|
||||
QRect rect = option->rect;
|
||||
switch (control) {
|
||||
case CC_ToolButton:
|
||||
if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
|
||||
bool reverse = option->direction == Qt::RightToLeft;
|
||||
if (const QStyleOptionToolButton * toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
|
||||
bool reverse = option->direction == Qt::RightToLeft;
|
||||
bool drawborder = (widget && widget->property("showborder").toBool());
|
||||
|
||||
if (drawborder)
|
||||
if (drawborder) {
|
||||
drawButtonSeparator(painter, rect, reverse);
|
||||
}
|
||||
|
||||
QRect button, menuarea;
|
||||
button = subControlRect(control, toolbutton, SC_ToolButton, widget);
|
||||
button = subControlRect(control, toolbutton, SC_ToolButton, widget);
|
||||
menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
|
||||
|
||||
State bflags = toolbutton->state;
|
||||
if (bflags & State_AutoRaise) {
|
||||
if (!(bflags & State_MouseOver))
|
||||
if (!(bflags & State_MouseOver)) {
|
||||
bflags &= ~State_Raised;
|
||||
}
|
||||
}
|
||||
|
||||
State mflags = bflags;
|
||||
if (toolbutton->state & State_Sunken) {
|
||||
if (toolbutton->activeSubControls & SC_ToolButton)
|
||||
if (toolbutton->activeSubControls & SC_ToolButton) {
|
||||
bflags |= State_Sunken;
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
}
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu) {
|
||||
mflags |= State_Sunken;
|
||||
}
|
||||
}
|
||||
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
if (toolbutton->subControls & SC_ToolButton) {
|
||||
tool.rect = button;
|
||||
tool.rect = button;
|
||||
tool.state = bflags;
|
||||
drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
|
||||
}
|
||||
@ -875,13 +916,13 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
|
||||
label.palette = panelPalette(option->palette, lightColored(widget));
|
||||
int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
|
||||
label.rect = button.adjusted(fw, fw, -fw, -fw);
|
||||
label.rect = button.adjusted(fw, fw, -fw, -fw);
|
||||
|
||||
drawControl(CE_ToolButtonLabel, &label, painter, widget);
|
||||
|
||||
if (toolbutton->subControls & SC_ToolButtonMenu) {
|
||||
tool.state = mflags;
|
||||
tool.rect = menuarea.adjusted(1, 1, -1, -1);
|
||||
tool.rect = menuarea.adjusted(1, 1, -1, -1);
|
||||
if (mflags & (State_Sunken | State_On | State_Raised)) {
|
||||
painter->setPen(Qt::gray);
|
||||
painter->drawLine(tool.rect.topLeft(), tool.rect.bottomLeft());
|
||||
@ -901,53 +942,59 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
QRect ir = toolbutton->rect.adjusted(1, 1, -1, -1);
|
||||
QStyleOptionToolButton newBtn = *toolbutton;
|
||||
newBtn.palette = panelPalette(option->palette);
|
||||
newBtn.rect = QRect(ir.right() - arrowSize - 1,
|
||||
ir.height() - arrowSize - 2, arrowSize, arrowSize);
|
||||
newBtn.rect = QRect(ir.right() - arrowSize - 1,
|
||||
ir.height() - arrowSize - 2, arrowSize, arrowSize);
|
||||
drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CC_ComboBox:
|
||||
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
if (const QStyleOptionComboBox * cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
|
||||
painter->save();
|
||||
bool isEmpty = cb->currentText.isEmpty() && cb->currentIcon.isNull();
|
||||
bool reverse = option->direction == Qt::RightToLeft;
|
||||
bool isEmpty = cb->currentText.isEmpty() && cb->currentIcon.isNull();
|
||||
bool reverse = option->direction == Qt::RightToLeft;
|
||||
bool drawborder = !(widget && widget->property("hideborder").toBool());
|
||||
bool alignarrow = !(widget && widget->property("alignarrow").toBool());
|
||||
|
||||
if (drawborder)
|
||||
if (drawborder) {
|
||||
drawButtonSeparator(painter, rect, reverse);
|
||||
}
|
||||
|
||||
QStyleOption toolbutton = *option;
|
||||
if (isEmpty)
|
||||
if (isEmpty) {
|
||||
toolbutton.state &= ~(State_Enabled | State_Sunken);
|
||||
}
|
||||
painter->save();
|
||||
if (drawborder)
|
||||
if (drawborder) {
|
||||
painter->setClipRect(toolbutton.rect.adjusted(0, 0, -2, 0));
|
||||
}
|
||||
drawPrimitive(PE_PanelButtonTool, &toolbutton, painter, widget);
|
||||
painter->restore();
|
||||
// Draw arrow
|
||||
int menuButtonWidth = 12;
|
||||
int left = !reverse ? rect.right() - menuButtonWidth : rect.left();
|
||||
int left = !reverse ? rect.right() - menuButtonWidth : rect.left();
|
||||
int right = !reverse ? rect.right() : rect.left() + menuButtonWidth;
|
||||
QRect arrowRect((left + right) / 2 + (reverse ? 6 : -6), rect.center().y() - 3, 9, 9);
|
||||
|
||||
if (!alignarrow) {
|
||||
int labelwidth = option->fontMetrics.width(cb->currentText);
|
||||
if (reverse)
|
||||
if (reverse) {
|
||||
arrowRect.moveLeft(qMax(rect.width() - labelwidth - menuButtonWidth - 2, 4));
|
||||
else
|
||||
} else {
|
||||
arrowRect.moveLeft(qMin(labelwidth + menuButtonWidth - 2, rect.width() - menuButtonWidth - 4));
|
||||
}
|
||||
}
|
||||
if (option->state & State_On)
|
||||
if (option->state & State_On) {
|
||||
arrowRect.translate(QProxyStyle::pixelMetric(PM_ButtonShiftHorizontal, option, widget),
|
||||
QProxyStyle::pixelMetric(PM_ButtonShiftVertical, option, widget));
|
||||
}
|
||||
|
||||
QStyleOption arrowOpt = *option;
|
||||
arrowOpt.rect = arrowRect;
|
||||
if (isEmpty)
|
||||
if (isEmpty) {
|
||||
arrowOpt.state &= ~(State_Enabled | State_Sunken);
|
||||
}
|
||||
|
||||
if (styleHint(SH_ComboBox_Popup, option, widget)) {
|
||||
arrowOpt.rect.translate(0, -3);
|
||||
@ -971,6 +1018,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const
|
||||
{
|
||||
QLinearGradient grad(rect.topRight(), rect.bottomRight());
|
||||
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 20));
|
||||
grad.setColorAt(0.4, QColor(255, 255, 255, 60));
|
||||
grad.setColorAt(0.7, QColor(255, 255, 255, 50));
|
||||
@ -982,8 +1030,9 @@ void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, b
|
||||
grad.setColorAt(0.7, QColor(0, 0, 0, 70));
|
||||
grad.setColorAt(1, QColor(0, 0, 0, 40));
|
||||
painter->setPen(QPen(grad, 0));
|
||||
if (!reverse)
|
||||
painter->drawLine(rect.topRight() - QPoint(1,0), rect.bottomRight() - QPoint(1,0));
|
||||
else
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
if (!reverse) {
|
||||
painter->drawLine(rect.topRight() - QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
|
||||
} else {
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,7 @@
|
||||
|
||||
class ManhattanStylePrivate;
|
||||
|
||||
class CORE_EXPORT ManhattanStyle : public QProxyStyle
|
||||
{
|
||||
class CORE_EXPORT ManhattanStyle : public QProxyStyle {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -39,13 +39,11 @@ using namespace Core::Internal;
|
||||
const int WorkspaceSettings::MAX_WORKSPACES = 10;
|
||||
|
||||
WorkspaceSettings::WorkspaceSettings(QObject *parent) :
|
||||
IOptionsPage(parent)
|
||||
{
|
||||
}
|
||||
IOptionsPage(parent)
|
||||
{}
|
||||
|
||||
WorkspaceSettings::~WorkspaceSettings()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
// IOptionsPage
|
||||
|
||||
@ -121,8 +119,8 @@ void WorkspaceSettings::readSettings(QSettings *qs)
|
||||
m_iconNames.append(iconName);
|
||||
m_modeNames.append(QString("Mode") + QString::number(i));
|
||||
}
|
||||
m_tabBarPlacementIndex = qs->value(QLatin1String("TabBarPlacementIndex"), 1).toInt(); // 1 == "Bottom"
|
||||
m_allowTabBarMovement = qs->value(QLatin1String("AllowTabBarMovement"), false).toBool();
|
||||
m_tabBarPlacementIndex = qs->value(QLatin1String("TabBarPlacementIndex"), 1).toInt(); // 1 == "Bottom"
|
||||
m_allowTabBarMovement = qs->value(QLatin1String("AllowTabBarMovement"), false).toBool();
|
||||
m_restoreSelectedOnStartup = qs->value(QLatin1String("RestoreSelectedOnStartup"), false).toBool();
|
||||
|
||||
qs->endGroup();
|
||||
@ -169,8 +167,8 @@ void WorkspaceSettings::apply()
|
||||
modeManager->updateModeNameIcon(mode, QIcon(iconName(i)), name(i));
|
||||
}
|
||||
}
|
||||
m_tabBarPlacementIndex = m_page->comboBoxTabBarPlacement->currentIndex();
|
||||
m_allowTabBarMovement = m_page->checkBoxAllowTabMovement->isChecked();
|
||||
m_tabBarPlacementIndex = m_page->comboBoxTabBarPlacement->currentIndex();
|
||||
m_allowTabBarMovement = m_page->checkBoxAllowTabMovement->isChecked();
|
||||
m_restoreSelectedOnStartup = m_page->checkBoxRestoreSelectedOnStartup->isChecked();
|
||||
|
||||
QTabWidget::TabPosition pos = m_tabBarPlacementIndex == 0 ? QTabWidget::North : QTabWidget::South;
|
||||
|
Loading…
x
Reference in New Issue
Block a user