Prettify Scrollbars for Windows

.. as well as for Linux as done earlier today.
This commit is contained in:
Mark Liversedge
2014-05-25 15:54:00 +01:00
parent e6dfbc2908
commit 153e11e868
6 changed files with 48 additions and 3 deletions

View File

@@ -29,9 +29,13 @@
IntervalSummaryWindow::IntervalSummaryWindow(Context *context) : context(context)
{
setWindowTitle(tr("Interval Summary"));
setReadOnly(true);
setWindowTitle(tr("Interval Summary"));
setReadOnly(true);
setFrameStyle(QFrame::NoFrame);
#ifdef Q_OS_WIN
QStyle *cde = QStyleFactory::create("plastique");
verticalScrollBar()->setStyle(cde);
#endif
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacShowFocusRect, 0);

View File

@@ -21,6 +21,7 @@
#include "RideItem.h"
#include "RideFile.h"
#include "Context.h"
#include <QStyle>
IntervalTreeView::IntervalTreeView(Context *context) : context(context)
@@ -30,6 +31,10 @@ IntervalTreeView::IntervalTreeView(Context *context) : context(context)
setDropIndicatorShown(true);
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
QStyle *cde = QStyleFactory::create("plastique");
verticalScrollBar()->setStyle(cde);
#endif
setStyleSheet("QTreeView::item:hover { background: lightGray; }");
setMouseTracking(true);

View File

@@ -28,6 +28,7 @@
#include <QWebFrame>
#include <QScrollBar>
#include <QtGui>
#include <QStyle>
// seasons support
#include "Season.h"
@@ -76,6 +77,10 @@ LTMSidebar::LTMSidebar(Context *context) : QWidget(context->mainWindow), context
dateRangeTree->setContextMenuPolicy(Qt::CustomContextMenu);
#ifdef Q_OS_MAC
dateRangeTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
QStyle *cde = QStyleFactory::create("plastique");
dateRangeTree->verticalScrollBar()->setStyle(cde);
#endif
seasonsWidget->addWidget(dateRangeTree);
@@ -100,6 +105,10 @@ LTMSidebar::LTMSidebar(Context *context) : QWidget(context->mainWindow), context
eventTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#ifdef Q_OS_MAC
eventTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
cde = QStyleFactory::create("plastique");
eventTree->verticalScrollBar()->setStyle(cde);
#endif
eventsWidget->addWidget(eventTree);
@@ -129,6 +138,10 @@ LTMSidebar::LTMSidebar(Context *context) : QWidget(context->mainWindow), context
filterTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#ifdef Q_OS_MAC
filterTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
cde = QStyleFactory::create("plastique");
filterTree->verticalScrollBar()->setStyle(cde);
#endif
// we cast the filter tree and this because we use the same constructor XXX fix this!!!
filterSplitter = new GcSubSplitter(Qt::Vertical, (GcSplitterControl*)filterTree, (GcSplitter*)this, true);
@@ -529,6 +542,10 @@ LTMSidebar::autoFilterChanged()
tree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#ifdef Q_OS_MAC
tree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
QStyle *cde = QStyleFactory::create("plastique");
tree->verticalScrollBar()->setStyle(cde);
#endif
item->addWidget(tree);
filterSplitter->addWidget(item);

View File

@@ -86,6 +86,12 @@ RideNavigator::RideNavigator(Context *context, bool mainwindow) : context(contex
tableView->header()->setStretchLastSection(false);
tableView->header()->setMinimumSectionSize(0);
tableView->header()->setFocusPolicy(Qt::NoFocus);
#ifdef Q_OS_WIN
if (mainwindow) {
QStyle *cde = QStyleFactory::create("plastique");
tableView->verticalScrollBar()->setStyle(cde);
}
#endif
#ifdef Q_OS_MAC
tableView->header()->setSortIndicatorShown(false); // blue looks nasty
tableView->setAttribute(Qt::WA_MacShowFocusRect, 0);

View File

@@ -115,7 +115,7 @@ TabView::setSidebar(QWidget *sidebar)
void
TabView::configChanged()
{
#ifdef Q_OS_LINUX
#if (defined Q_OS_LINUX) || (defined Q_OS_WIN)
// style that sucker
if (sidebar_) {
sidebar_->setStyleSheet(

View File

@@ -28,6 +28,7 @@
#include <QApplication>
#include <QtGui>
#include <QRegExp>
#include <QStyle>
// Three current realtime device types supported are:
#include "RealtimeController.h"
@@ -105,6 +106,10 @@ TrainSidebar::TrainSidebar(Context *context) : GcWindow(context), context(contex
mediaTree->header()->setSortIndicatorShown(false); // blue looks nasty
mediaTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
QStyle *cde = QStyleFactory::create("plastique");
mediaTree->verticalScrollBar()->setStyle(cde);
#endif
#endif
deviceTree = new QTreeWidget;
@@ -119,6 +124,10 @@ TrainSidebar::TrainSidebar(Context *context) : GcWindow(context), context(contex
deviceTree->setIndentation(5);
deviceTree->expandItem(deviceTree->invisibleRootItem());
deviceTree->setContextMenuPolicy(Qt::CustomContextMenu);
#ifdef Q_OS_WIN
QStyle *xde = QStyleFactory::create("plastique");
deviceTree->verticalScrollBar()->setStyle(xde);
#endif
workoutModel = new QSqlTableModel(this, trainDB->connection());
workoutModel->setTable("workouts");
@@ -153,6 +162,10 @@ TrainSidebar::TrainSidebar(Context *context) : GcWindow(context), context(contex
workoutTree->header()->setSortIndicatorShown(false); // blue looks nasty
workoutTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
#ifdef Q_OS_WIN
xde = QStyleFactory::create("plastique");
workoutTree->verticalScrollBar()->setStyle(xde);
#endif
// TOOLBAR BUTTONS ETC
QHBoxLayout *toolallbuttons=new QHBoxLayout; // on toolbar