1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 3 /* 4 Rosegarden 5 A MIDI and audio sequencer and musical notation editor. 6 Copyright 2000-2021 the Rosegarden development team. 7 8 Other copyrights also apply to some parts of this work. Please 9 see the AUTHORS file and individual file headers for details. 10 11 This program is free software; you can redistribute it and/or 12 modify it under the terms of the GNU General Public License as 13 published by the Free Software Foundation; either version 2 of the 14 License, or (at your option) any later version. See the file 15 COPYING included with this distribution for more information. 16 */ 17 18 #define RG_MODULE_STRING "[BaseTool]" 19 20 #include "BaseTool.h" 21 22 #include "misc/Debug.h" 23 #include <QCursor> 24 #include <QObject> 25 #include <QToolTip> 26 #include <QString> 27 #include <QMenu> 28 29 30 namespace Rosegarden 31 { 32 BaseTool(const QString & menuName,QObject * parent)33BaseTool::BaseTool(const QString& menuName, QObject* parent) 34 : QObject(parent), 35 m_menuName(menuName), 36 m_menu(nullptr) 37 {} 38 ~BaseTool()39BaseTool::~BaseTool() 40 { 41 //RG_DEBUG << "BaseTool::~BaseTool()"; 42 } 43 ready()44void BaseTool::ready() 45 {} 46 stow()47void BaseTool::stow() 48 {} 49 showMenu()50void BaseTool::showMenu() 51 { 52 if (!hasMenu()) 53 return; 54 55 if (!m_menu) 56 createMenu(); 57 58 if (m_menu) 59 m_menu->exec(QCursor::pos()); 60 //else 61 //RG_DEBUG << "BaseTool::showMenu() : no menu to show"; 62 } 63 getCurrentContextHelp() const64QString BaseTool::getCurrentContextHelp() const 65 { 66 return m_contextHelp; 67 } 68 setContextHelp(const QString & help)69void BaseTool::setContextHelp(const QString &help) 70 { 71 m_contextHelp = help; 72 emit showContextHelp(m_contextHelp); 73 } 74 75 } 76 77 78