Disable tooltips through event filter (#6192)

* Control tooltip visibility using an event filter

...removing the need for a ToolTip helper class

* Remove whitespace
This commit is contained in:
Alex
2022-04-15 14:04:52 +02:00
committed by GitHub
parent 7c1ebd31c9
commit 33b44ec9c7
57 changed files with 312 additions and 430 deletions

View File

@@ -36,7 +36,6 @@
#include "RenameDialog.h"
#include "StringPairDrag.h"
#include "TextFloat.h"
#include "ToolTip.h"
#include "Track.h"
#include "Engine.h"
@@ -57,7 +56,7 @@ AutomationClipView::AutomationClipView( AutomationClip * _clip,
setAttribute( Qt::WA_OpaquePaintEvent, true );
ToolTip::add(this, m_clip->name());
setToolTip(m_clip->name());
setStyle( QApplication::style() );
if( s_clip_rec == nullptr ) { s_clip_rec = new QPixmap( embed::getIconPixmap(
@@ -85,7 +84,7 @@ void AutomationClipView::openInAutomationEditor()
void AutomationClipView::update()
{
ToolTip::add(this, m_clip->name());
setToolTip(m_clip->name());
ClipView::update();
}

View File

@@ -110,7 +110,6 @@ SET(LMMS_SRCS
gui/widgets/TextFloat.cpp
gui/widgets/TimeDisplayWidget.cpp
gui/widgets/ToolButton.cpp
gui/widgets/ToolTip.cpp
gui/widgets/TrackLabelButton.cpp
gui/widgets/TrackContentWidget.cpp
gui/widgets/TrackOperationsWidget.cpp

View File

@@ -65,7 +65,6 @@
#include "StringPairDrag.h"
#include "SubWindow.h"
#include "TabWidget.h"
#include "ToolTip.h"
#include "TrackContainerView.h"
#include "TrackLabelButton.h"
@@ -209,7 +208,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) );
ToolTip::add( saveSettingsBtn, tr( "Save current instrument track settings in a preset file" ) );
saveSettingsBtn->setToolTip(tr("Save current instrument track settings in a preset file"));
basicControlsLayout->addWidget( saveSettingsBtn, 0, 7 );

View File

@@ -25,7 +25,6 @@
#include "embed.h"
#include "ToolTip.h"
#include "LfoController.h"
@@ -84,7 +83,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"sin_wave_active" ) );
sin_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
ToolTip::add( sin_wave_btn,
sin_wave_btn->setToolTip(
tr( "Sine wave" ) );
PixmapButton * triangle_wave_btn =
@@ -94,7 +93,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
embed::getIconPixmap( "triangle_wave_active" ) );
triangle_wave_btn->setInactiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
ToolTip::add( triangle_wave_btn,
triangle_wave_btn->setToolTip(
tr( "Triangle wave" ) );
PixmapButton * saw_wave_btn = new PixmapButton( this, nullptr );
@@ -103,7 +102,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"saw_wave_active" ) );
saw_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
ToolTip::add( saw_wave_btn,
saw_wave_btn->setToolTip(
tr( "Saw wave" ) );
PixmapButton * sqr_wave_btn = new PixmapButton( this, nullptr );
@@ -112,7 +111,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"square_wave_active" ) );
sqr_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
ToolTip::add( sqr_wave_btn,
sqr_wave_btn->setToolTip(
tr( "Square wave" ) );
PixmapButton * moog_saw_wave_btn =
@@ -122,7 +121,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
embed::getIconPixmap( "moog_saw_wave_active" ) );
moog_saw_wave_btn->setInactiveGraphic(
embed::getIconPixmap( "moog_saw_wave_inactive" ) );
ToolTip::add( moog_saw_wave_btn,
moog_saw_wave_btn->setToolTip(
tr( "Moog saw wave" ) );
PixmapButton * exp_wave_btn = new PixmapButton( this, nullptr );
@@ -131,7 +130,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"exp_wave_active" ) );
exp_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"exp_wave_inactive" ) );
ToolTip::add( exp_wave_btn,
exp_wave_btn->setToolTip(
tr( "Exponential wave" ) );
PixmapButton * white_noise_btn = new PixmapButton( this, nullptr );
@@ -140,7 +139,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
embed::getIconPixmap( "white_noise_wave_active" ) );
white_noise_btn->setInactiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
ToolTip::add( white_noise_btn,
white_noise_btn->setToolTip(
tr( "White noise" ) );
m_userWaveBtn = new PixmapButton( this, nullptr );
@@ -152,7 +151,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
connect( m_userWaveBtn,
SIGNAL( doubleClicked() ),
this, SLOT( askUserDefWave() ) );
ToolTip::add( m_userWaveBtn,
m_userWaveBtn->setToolTip(
tr( "User-defined shape.\nDouble click to pick a file." ) );
m_waveBtnGrp = new automatableButtonGroup( this );
@@ -172,7 +171,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"lfo_x1_active" ) );
x1->setInactiveGraphic( embed::getIconPixmap(
"lfo_x1_inactive" ) );
ToolTip::add( x1,
x1->setToolTip(
tr( "Mutliply modulation frequency by 1" ));
PixmapButton * x100 = new PixmapButton( this, nullptr );
@@ -181,7 +180,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"lfo_x100_active" ) );
x100->setInactiveGraphic( embed::getIconPixmap(
"lfo_x100_inactive" ) );
ToolTip::add( x100,
x100->setToolTip(
tr( "Mutliply modulation frequency by 100" ));
PixmapButton * d100 = new PixmapButton( this, nullptr );
@@ -190,7 +189,7 @@ LfoControllerDialog::LfoControllerDialog( Controller * _model, QWidget * _parent
"lfo_d100_active" ) );
d100->setInactiveGraphic( embed::getIconPixmap(
"lfo_d100_inactive" ) );
ToolTip::add( d100,
d100->setToolTip(
tr( "Divide modulation frequency by 100" ));
m_multiplierBtnGrp = new automatableButtonGroup( this );
@@ -225,7 +224,7 @@ void LfoControllerDialog::askUserDefWave()
if( fileName.isEmpty() == false )
{
// TODO:
ToolTip::add( m_userWaveBtn, sampleBuffer->audioFile() );
m_userWaveBtn->setToolTip(sampleBuffer->audioFile());
}
}

View File

@@ -258,6 +258,11 @@ MainWindow::MainWindow() :
maximized = isMaximized();
new QShortcut(QKeySequence(Qt::Key_F11), this, SLOT(toggleFullscreen()));
if (ConfigManager::inst()->value("tooltips", "disabled").toInt())
{
qApp->installEventFilter(this);
}
}
@@ -1189,14 +1194,6 @@ void MainWindow::updateViewMenu()
qa->setChecked( ConfigManager::inst()->value( "app", "displaydbfs" ).toInt() );
m_viewMenu->addAction(qa);
// Maybe this is impossible?
/* qa = new QAction(tr( "Tooltips" ), this);
qa->setData("tooltips");
qa->setCheckable( true );
qa->setChecked( !ConfigManager::inst()->value( "tooltips", "disabled" ).toInt() );
m_viewMenu->addAction(qa);
*/
qa = new QAction(tr( "Smooth scroll" ), this);
qa->setData("smoothscroll");
qa->setCheckable( true );
@@ -1236,6 +1233,10 @@ void MainWindow::updateConfig( QAction * _who )
{
ConfigManager::inst()->setValue( "tooltips", "disabled",
QString::number(!checked) );
if (checked) { qApp->removeEventFilter(this); }
else { qApp->installEventFilter(this); }
}
else if ( tag == "smoothscroll" )
{
@@ -1363,6 +1364,18 @@ void MainWindow::sessionCleanup()
bool MainWindow::eventFilter(QObject* watched, QEvent* event)
{
// For now this function is only used to globally block tooltips
// It must be installed to QApplication through installEventFilter
if (event->type() == QEvent::ToolTip) { return true; }
return QObject::eventFilter(watched, event);
}
void MainWindow::focusOutEvent( QFocusEvent * _fe )
{
// TODO Remove this function, since it is apparently never actually called!

View File

@@ -36,7 +36,6 @@
#include "MidiClip.h"
#include "PianoRoll.h"
#include "RenameDialog.h"
#include "ToolTip.h"
MidiClipView::MidiClipView( MidiClip* clip, TrackView* parent ) :
ClipView( clip, parent ),
@@ -94,7 +93,7 @@ MidiClip* MidiClipView::getMidiClip()
void MidiClipView::update()
{
ToolTip::add(this, m_clip->name());
setToolTip(m_clip->name());
ClipView::update();
}

View File

@@ -297,7 +297,7 @@ MixerView::MixerChannelView::MixerChannelView(QWidget * _parent, MixerView * _mv
embed::getIconPixmap( "led_green" ) );
m_muteBtn->setCheckable( true );
m_muteBtn->move( 9, m_fader->y()-11);
ToolTip::add( m_muteBtn, tr( "Mute this channel" ) );
m_muteBtn->setToolTip(tr("Mute this channel"));
m_soloBtn = new PixmapButton( m_mixerLine, tr( "Solo" ) );
m_soloBtn->setModel( &mixerChannel->m_soloModel );
@@ -309,7 +309,7 @@ MixerView::MixerChannelView::MixerChannelView(QWidget * _parent, MixerView * _mv
m_soloBtn->move( 9, m_fader->y()-21);
connect(&mixerChannel->m_soloModel, SIGNAL( dataChanged() ),
_mv, SLOT ( toggledSolo() ), Qt::DirectConnection );
ToolTip::add( m_soloBtn, tr( "Solo this channel" ) );
m_soloBtn->setToolTip(tr("Solo this channel"));
// Create EffectRack for the channel
m_rackView = new EffectRackView( &mixerChannel->m_fxChain, _mv->m_racksWidget );

View File

@@ -34,7 +34,6 @@
#include "PatternClip.h"
#include "PatternStore.h"
#include "RenameDialog.h"
#include "ToolTip.h"
PatternClipView::PatternClipView(Clip* _clip, TrackView* _tv) :
ClipView( _clip, _tv ),
@@ -185,7 +184,7 @@ void PatternClipView::changeName()
void PatternClipView::update()
{
ToolTip::add(this, m_patternClip->name());
setToolTip(m_patternClip->name());
ClipView::update();
}

View File

@@ -29,7 +29,6 @@
#include <QIcon>
#include "embed.h"
#include "ToolTip.h"
#include "PeakController.h"
@@ -41,7 +40,7 @@ PeakControllerDialog::PeakControllerDialog( Controller * _model, QWidget * _pare
setWindowIcon( embed::getIconPixmap( "controller" ) );
setFixedSize( 256, 64 );
ToolTip::add( this, tr( "LFO Controller" ) );
setToolTip(tr("LFO Controller"));
QLabel * l = new QLabel( this );
l->setText( "Use FX's controls" );

View File

@@ -34,7 +34,6 @@
#include "SampleClip.h"
#include "Song.h"
#include "StringPairDrag.h"
#include "ToolTip.h"
SampleClipView::SampleClipView( SampleClip * _clip, TrackView * _tv ) :
ClipView( _clip, _tv ),
@@ -57,7 +56,7 @@ void SampleClipView::updateSample()
update();
// set tooltip to filename so that user can see what sample this
// sample-clip contains
ToolTip::add( this, ( m_clip->m_sampleBuffer->audioFile() != "" ) ?
setToolTip(m_clip->m_sampleBuffer->audioFile() != "" ?
PathUtil::toAbsolute(m_clip->m_sampleBuffer->audioFile()) :
tr( "Double-click to open sample" ) );
}

View File

@@ -40,7 +40,6 @@
#include "FadeButton.h"
#include "PixmapButton.h"
#include "StringPairDrag.h"
#include "ToolTip.h"
#include "Track.h"
#include "TrackContainerView.h"
#include "ClipView.h"
@@ -375,7 +374,7 @@ void TrackView::mouseMoveEvent( QMouseEvent * me )
if( height() < DEFAULT_TRACK_HEIGHT )
{
ToolTip::add( this, m_track->m_name );
setToolTip(m_track->m_name);
}
}

View File

@@ -60,7 +60,6 @@
#include "StringPairDrag.h"
#include "TextFloat.h"
#include "TimeLineWidget.h"
#include "ToolTip.h"
QPixmap * AutomationEditor::s_toolDraw = nullptr;
@@ -1878,7 +1877,7 @@ AutomationEditorWindow::AutomationEditorWindow() :
// setup tension-stuff
m_tensionKnob = new Knob( knobSmall_17, this, "Tension" );
m_tensionKnob->setModel(m_editor->m_tensionModel);
ToolTip::add(m_tensionKnob, tr("Tension value for spline"));
m_tensionKnob->setToolTip(tr("Tension value for spline"));
connect(m_cubicHermiteAction, SIGNAL(toggled(bool)), m_tensionKnob, SLOT(setEnabled(bool)));

View File

@@ -52,7 +52,6 @@
#include "TextFloat.h"
#include "TimeDisplayWidget.h"
#include "TimeLineWidget.h"
#include "ToolTip.h"
#include "TrackView.h"
const QVector<float> SongEditor::m_zoomLevels =
@@ -112,7 +111,7 @@ SongEditor::SongEditor( Song * song ) :
m_tempoSpinBox = new LcdSpinBox( 3, tb, tr( "Tempo" ) );
m_tempoSpinBox->setModel( &m_song->m_tempoModel );
m_tempoSpinBox->setLabel( tr( "TEMPO" ) );
ToolTip::add( m_tempoSpinBox, tr( "Tempo in BPM" ) );
m_tempoSpinBox->setToolTip(tr("Tempo in BPM"));
int tempoSpinBoxCol = getGUI()->mainWindow()->addWidgetToToolBar( m_tempoSpinBox, 0 );
@@ -149,7 +148,7 @@ SongEditor::SongEditor( Song * song ) :
m_masterVolumeSlider->setTickPosition( QSlider::TicksLeft );
m_masterVolumeSlider->setFixedSize( 26, 60 );
m_masterVolumeSlider->setTickInterval( 50 );
ToolTip::add( m_masterVolumeSlider, tr( "Master volume" ) );
m_masterVolumeSlider->setToolTip(tr("Master volume"));
connect( m_masterVolumeSlider, SIGNAL( logicValueChanged( int ) ), this,
SLOT( setMasterVolume( int ) ) );
@@ -182,7 +181,7 @@ SongEditor::SongEditor( Song * song ) :
m_masterPitchSlider->setTickPosition( QSlider::TicksLeft );
m_masterPitchSlider->setFixedSize( 26, 60 );
m_masterPitchSlider->setTickInterval( 12 );
ToolTip::add( m_masterPitchSlider, tr( "Master pitch" ) );
m_masterPitchSlider->setToolTip(tr("Master pitch"));
connect( m_masterPitchSlider, SIGNAL( logicValueChanged( int ) ), this,
SLOT( setMasterPitch( int ) ) );
connect( m_masterPitchSlider, SIGNAL( sliderPressed() ), this,

View File

@@ -43,7 +43,6 @@
#include "SetupDialog.h"
#include "TabBar.h"
#include "TabButton.h"
#include "ToolTip.h"
// Platform-specific audio-interface classes.
@@ -589,7 +588,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
bufferSize_reset_btn->setGeometry(320, 40, 28, 28);
connect(bufferSize_reset_btn, SIGNAL(clicked()),
this, SLOT(resetBufferSize()));
ToolTip::add(bufferSize_reset_btn,
bufferSize_reset_btn->setToolTip(
tr("Reset to default value"));

View File

@@ -38,7 +38,6 @@
#include "MainWindow.h"
#include "SubWindow.h"
#include "TempoSyncKnob.h"
#include "ToolTip.h"
EffectView::EffectView( Effect * _model, QWidget * _parent ) :
@@ -55,7 +54,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_bypass->move( 3, 3 );
m_bypass->setEnabled( isEnabled );
ToolTip::add( m_bypass, tr( "On/Off" ) );
m_bypass->setToolTip(tr("On/Off"));
m_wetDry = new Knob( knobBright_26, this );

View File

@@ -40,7 +40,6 @@
#include "StringPairDrag.h"
#include "TempoSyncKnob.h"
#include "TextFloat.h"
#include "ToolTip.h"
#include "Track.h"
@@ -218,14 +217,14 @@ EnvelopeAndLfoView::EnvelopeAndLfoView( QWidget * _parent ) :
m_x100Cb = new LedCheckBox( tr( "FREQ x 100" ), this );
m_x100Cb->setFont( pointSizeF( m_x100Cb->font(), 6.5 ) );
m_x100Cb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 36 );
ToolTip::add( m_x100Cb, tr( "Multiply LFO frequency by 100" ) );
m_x100Cb->setToolTip(tr("Multiply LFO frequency by 100"));
m_controlEnvAmountCb = new LedCheckBox( tr( "MODULATE ENV AMOUNT" ),
this );
m_controlEnvAmountCb->move( LFO_PREDELAY_KNOB_X, LFO_GRAPH_Y + 54 );
m_controlEnvAmountCb->setFont( pointSizeF( m_controlEnvAmountCb->font(), 6.5 ) );
ToolTip::add( m_controlEnvAmountCb,
m_controlEnvAmountCb->setToolTip(
tr( "Control envelope amount by this LFO" ) );

View File

@@ -31,7 +31,6 @@
#include "LadspaBase.h"
#include "LedCheckBox.h"
#include "TempoSyncKnob.h"
#include "ToolTip.h"
LadspaControlView::LadspaControlView( QWidget * _parent,
@@ -50,7 +49,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
{
link = new LedCheckBox( "", this );
link->setModel( &m_ctl->m_linkEnabledModel );
ToolTip::add( link, tr( "Link channels" ) );
link->setToolTip(tr("Link channels"));
layout->addWidget( link );
}

View File

@@ -26,7 +26,6 @@
#include <QHBoxLayout>
#include "LeftRightNav.h"
#include "ToolTip.h"
#include "embed.h"
@@ -60,8 +59,8 @@ LeftRightNav::LeftRightNav(QWidget *parent)
connect(&m_rightBtn, SIGNAL(clicked()), this,
SIGNAL(onNavRight()));
ToolTip::add(&m_leftBtn, tr("Previous"));
ToolTip::add(&m_rightBtn, tr("Next"));
m_leftBtn.setToolTip(tr("Previous"));
m_rightBtn.setToolTip(tr("Next"));
m_leftBtn.setWindowTitle(tr("Previous"));
m_rightBtn.setWindowTitle(tr("Next"));
@@ -88,6 +87,6 @@ void LeftRightNav::setShortcuts(const QKeySequence &leftShortcut, const QKeySequ
m_leftBtn.setShortcut(leftShortcut);
m_rightBtn.setShortcut(rightShortcut);
ToolTip::add(&m_leftBtn, tr("Previous (%1)").arg(leftShortcut.toString()));
ToolTip::add(&m_rightBtn, tr("Next (%1)").arg(rightShortcut.toString()));
m_leftBtn.setToolTip(tr("Previous (%1)").arg(leftShortcut.toString()));
m_rightBtn.setToolTip(tr("Next (%1)").arg(rightShortcut.toString()));
}

View File

@@ -32,7 +32,6 @@
#include "MeterModel.h"
#include "gui_templates.h"
#include "LcdSpinBox.h"
#include "ToolTip.h"
MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) :
@@ -50,7 +49,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) :
m_numerator = new LcdSpinBox( 2, num, tr( "Meter Numerator" ) );
ToolTip::add( m_numerator, tr( "Meter numerator" ) );
m_numerator->setToolTip(tr("Meter numerator"));
num_layout->addWidget( m_numerator );
@@ -71,7 +70,7 @@ MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) :
den_layout->setMargin( 0 );
m_denominator = new LcdSpinBox( 2, den, tr( "Meter Denominator" ) );
ToolTip::add( m_denominator, tr( "Meter denominator" ) );
m_denominator->setToolTip(tr("Meter denominator"));
if( _simple )
{
m_denominator->setLabel( tr( "TIME SIG" ) );

View File

@@ -26,7 +26,6 @@
#include <QMouseEvent>
#include "NStateButton.h"
#include "ToolTip.h"
@@ -75,7 +74,7 @@ void NStateButton::changeState( int _n )
( m_states[m_curState].second != "" ) ?
m_states[m_curState].second :
m_generalToolTip;
ToolTip::add( this, _tooltip );
setToolTip(_tooltip);
setIcon( m_states[m_curState].first );

View File

@@ -32,7 +32,6 @@
#include "MainWindow.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "ToolTip.h"
#include "Song.h"
#include "embed.h"
#include "BufferManager.h"
@@ -56,7 +55,7 @@ Oscilloscope::Oscilloscope( QWidget * _p ) :
BufferManager::clear( m_buffer, frames );
ToolTip::add( this, tr( "Oscilloscope" ) );
setToolTip(tr("Oscilloscope"));
}

View File

@@ -28,7 +28,6 @@
#include "SideBar.h"
#include "SideBarWidget.h"
#include "ToolTip.h"
// internal helper class allowing to create QToolButtons with
@@ -120,7 +119,7 @@ void SideBar::appendTab( SideBarWidget *widget )
widget->hide();
widget->setMinimumWidth( 200 );
ToolTip::add( button, widget->title() );
button->setToolTip(widget->title());
connect(widget, &SideBarWidget::closeButtonClicked,
[=]() { button->click(); });

View File

@@ -26,7 +26,6 @@
#include "TabBar.h"
#include "TabButton.h"
#include "gui_templates.h"
#include "ToolTip.h"
@@ -59,7 +58,7 @@ TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id,
b->show();
if( _text_is_tooltip )
{
ToolTip::add( b, _text );
b->setToolTip(_text);
}
// small workaround, because QBoxLayout::addWidget(...) doesn't

View File

@@ -28,7 +28,6 @@
#include "GuiApplication.h"
#include "MainWindow.h"
#include "Engine.h"
#include "ToolTip.h"
#include "Song.h"
@@ -49,7 +48,7 @@ TimeDisplayWidget::TimeDisplayWidget() :
setMaximumHeight( 32 );
ToolTip::add( this, tr( "Time units" ) );
setToolTip(tr("Time units"));
// update labels of LCD spinboxes
setDisplayMode( m_displayMode );

View File

@@ -24,7 +24,6 @@
#include "ToolButton.h"
#include "ToolTip.h"
ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
@@ -38,6 +37,6 @@ ToolButton::ToolButton( const QPixmap & _pixmap, const QString & _tooltip,
{
connect( this, SIGNAL( clicked() ), _receiver, _slot );
}
ToolTip::add( this, _tooltip );
setToolTip(_tooltip);
setIcon( _pixmap );
}

View File

@@ -1,41 +0,0 @@
/*
* ToolTip.cpp - namespace toolTip, a tooltip-wrapper for LMMS
*
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <QWidget>
#include "ToolTip.h"
#include "ConfigManager.h"
void ToolTip::add( QWidget * _w, const QString & _txt )
{
if( !ConfigManager::inst()->value( "tooltips", "disabled" ).toInt() )
{
_w->setToolTip( _txt );
}
}

View File

@@ -43,7 +43,6 @@
#include "PixmapButton.h"
#include "Song.h"
#include "StringPairDrag.h"
#include "ToolTip.h"
#include "Track.h"
#include "TrackContainerView.h"
#include "TrackView.h"
@@ -58,7 +57,7 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) :
QWidget( parent ), /*!< The parent widget */
m_trackView( parent ) /*!< The parent track view */
{
ToolTip::add( this, tr( "Press <%1> while clicking on move-grip "
setToolTip(tr("Press <%1> while clicking on move-grip "
"to begin a new drag'n'drop action." ).arg(UI_CTRL_KEY) );
QMenu * toMenu = new QMenu( this );
@@ -73,7 +72,7 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) :
m_trackOps->move( 12, 1 );
m_trackOps->setFocusPolicy( Qt::NoFocus );
m_trackOps->setMenu( toMenu );
ToolTip::add( m_trackOps, tr( "Actions" ) );
m_trackOps->setToolTip(tr("Actions"));
m_muteBtn = new PixmapButton( this, tr( "Mute" ) );
@@ -99,10 +98,10 @@ TrackOperationsWidget::TrackOperationsWidget( TrackView * parent ) :
}
m_muteBtn->show();
ToolTip::add( m_muteBtn, tr( "Mute" ) );
m_muteBtn->setToolTip(tr("Mute"));
m_soloBtn->show();
ToolTip::add( m_soloBtn, tr( "Solo" ) );
m_soloBtn->setToolTip(tr("Solo"));
connect( this, SIGNAL( trackRemovalScheduled( TrackView * ) ),
m_trackView->trackContainerView(),