Mac UI Sidebar Cosmetics

The sidebar elements all get a blue focus rectangle on
Mac OSX. This is a platform specific setting. This patch
removes the focus rectangle for sidebar components only.
This commit is contained in:
Mark Liversedge
2012-11-06 11:16:41 +00:00
parent aecd4737fa
commit f48ae3d2a8
5 changed files with 22 additions and 2 deletions

View File

@@ -22,11 +22,15 @@
#include "Settings.h"
#include "TimeUtils.h"
IntervalSummaryWindow::IntervalSummaryWindow(MainWindow *mainWindow) : mainWindow(mainWindow) {
IntervalSummaryWindow::IntervalSummaryWindow(MainWindow *mainWindow) : mainWindow(mainWindow)
{
setWindowTitle(tr("Interval Summary"));
setReadOnly(true);
setFrameStyle(QFrame::NoFrame);
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
connect(mainWindow, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
}

View File

@@ -26,6 +26,9 @@ IntervalTreeView::IntervalTreeView(MainWindow *mainWindow) : mainWindow(mainWind
setDragDropMode(QAbstractItemView::InternalMove);
setDragDropOverwriteMode(true);
setDropIndicatorShown(true);
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
invisibleRootItem()->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}

View File

@@ -85,6 +85,9 @@ RideNavigator::RideNavigator(MainWindow *parent) : main(parent), active(false),
tableView->setContextMenuPolicy(Qt::CustomContextMenu);
tableView->header()->setStretchLastSection(false);
tableView->header()->setMinimumSectionSize(0);
#ifdef Q_OS_MAC
tableView->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
//tableView->setUniformRowHeights(true);
QFont smaller;
smaller.setPointSize(smaller.pointSize()-2);
@@ -859,7 +862,7 @@ QSize NavigatorCellDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, c
if (rideNavigator->groupByModel->mapToSource(rideNavigator->sortModel->mapToSource(index)) != QModelIndex() &&
rideNavigator->groupByModel->data(rideNavigator->sortModel->mapToSource(index), Qt::UserRole).toString() != "") {
s.setHeight(64);
s.setHeight(56);
} else s.setHeight(18);
#if 0
if (rideNavigator->tableView->model()->data(index, Qt::UserRole).toString() != "") s.setHeight(18);

View File

@@ -63,6 +63,9 @@ SearchBox::SearchBox(MainWindow *main, QWidget *parent)
connect(dropMenu, SIGNAL(triggered(QAction*)), this, SLOT(runMenu(QAction*)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
#ifdef Q_OS_MAC
setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
setStyleSheet(QString( //"QLineEdit { padding-right: %1px; } "
"QLineEdit {"
" selection-color: white; "

View File

@@ -251,6 +251,13 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
trainSplitter->addWidget(mediaTree);
#endif
#ifdef Q_OS_MAC
// get rid of annoying focus rectangle for sidebar components
mediaTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
workoutTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
deviceTree->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
// handle config changes
//connect(serverTree,SIGNAL(itemSelectionChanged()), this, SLOT(serverTreeWidgetSelectionChanged()));
connect(deviceTree,SIGNAL(itemSelectionChanged()), this, SLOT(deviceTreeWidgetSelectionChanged()));