hydrogen 1.2.6
SoundLibraryTree.cpp
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-2025 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#include "SoundLibraryTree.h"
24
26
27#include <QMimeData>
28
30 : QTreeWidget( pParent )
31{
32 setHeaderLabels( QStringList( tr( "Sound library" ) ) );
33 setAlternatingRowColors( true );
34 setRootIsDecorated( false );
35
36 headerItem()->setHidden( true ); // hides the header
37
38}
39
40
41void SoundLibraryTree::mousePressEvent(QMouseEvent *event)
42{
43// INFOLOG( "[mousePressEvent]" );
44 QTreeWidget::mousePressEvent( event );
45
46 auto pEv = static_cast<MouseEvent*>( event );
47
48 if ( event->button() == Qt::RightButton ) {
49 emit rightClicked( pEv->globalPosition().toPoint() );
50
51 }
52 else if (event->button() == Qt::LeftButton ) {
53 emit leftClicked( pEv->globalPosition().toPoint() );
54 }
55}
56
57
58
59void SoundLibraryTree::mouseMoveEvent(QMouseEvent *event)
60{
61 emit onMouseMove( event );
62}
63
64
65
Compatibility class to support QMouseEvent more esily in Qt5 and Qt6.
Definition MouseEvent.h:35
SoundLibraryTree(QWidget *pParent)
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
void leftClicked(QPoint pos)
void rightClicked(QPoint pos)
void onMouseMove(QMouseEvent *event)