hydrogen 1.2.3
WidgetScrollArea.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef WIDGETSCROLLAREA_H
24#define WIDGETSCROLLAREA_H
25
26#include <QWidget>
27
28/* Qt's QScrollArea widget has some behaviour that's quite unpleasant
29 * for Hydrogen. When tabbing to the next or previous widget, a
30 * QScrollArea will ensure that the most recently (or currently)
31 * focused child widget of the QScrollArea is visible.
32 *
33 * In the Hydrogen GUI, ScrollAreas typically are occupied by one
34 * single large widget, whose extent is larger than that visible to
35 * the ScrollArea. In this case, QScrollArea will center the viewport
36 * on the centre of the child widget.
37 *
38 * The movement is distracting and confusing and will likely remove
39 * the area the user is *actually* focusing from view.
40 *
41 * This class overrides this behaviour.
42 */
44class WidgetScrollArea : public QScrollArea
45{
46public:
47 explicit WidgetScrollArea( QWidget *parent ) : QScrollArea( parent ) {}
48
49 bool focusNextPrevChild( bool next ) override
50 {
51 return QWidget::focusNextPrevChild( next );
52 }
53};
54
55#endif
bool focusNextPrevChild(bool next) override
WidgetScrollArea(QWidget *parent)