all repos — mgba @ 3a6756b3991dab1de69cafde92f196c0adddac44

mGBA Game Boy Advance Emulator

src/platform/qt/RotatedHeaderView.cpp (view raw)

 1/* Copyright (c) 2013-2019 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "RotatedHeaderView.h"
 7
 8#include <QPainter>
 9
10using namespace QGBA;
11
12RotatedHeaderView::RotatedHeaderView(Qt::Orientation orientation, QWidget* parent)
13	: QHeaderView(orientation, parent)
14{
15}
16
17void RotatedHeaderView::paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const {
18	painter->save();
19	painter->translate(rect.x() + rect.width(), rect.y());
20	painter->rotate(90);
21	QHeaderView::paintSection(painter, QRect(0, 0, rect.height(), rect.width()), logicalIndex);
22	painter->restore();
23}
24
25QSize RotatedHeaderView::sectionSizeFromContents(int logicalIndex) const {
26	return QHeaderView::sectionSizeFromContents(logicalIndex).transposed();
27}