1) Tabs in TabWidget class have now a "tooltip" attribute. So that they can now show

more meaningfull information then simply the tab's name.
2) Fixed the compilation problem with QT5
This commit is contained in:
Cyrille Bollu
2016-02-25 16:45:28 +01:00
parent 857b6ed93f
commit 3f09440749
3 changed files with 15 additions and 11 deletions

View File

@@ -38,7 +38,7 @@ public:
TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false );
virtual ~TabWidget();
void addTab( QWidget *_w, const QString &_name, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 );
void addTab( QWidget *_w, const QString &_name, const QString &_tooltip = NULL, const char *activePixmap = NULL, const char *inactivePixmap = NULL, int _idx = -1 );
void setActiveTab( int _idx );
@@ -65,6 +65,7 @@ private:
const char *activePixmap; // artwork for the widget
const char *inactivePixmap; // artwork for the widget
QString name; // name for widget
QString tooltip; // name for widget
int nwidth; // width of name when painting (only valid for text tab)
} ;
typedef QMap<int, widgetDesc> widgetStack;

View File

@@ -65,7 +65,7 @@ TabWidget::~TabWidget()
void TabWidget::addTab( QWidget * _w, const QString & _name, const char *activePixmap, const char *inactivePixmap, int _idx )
void TabWidget::addTab( QWidget * _w, const QString & _name, const QString & _tooltip, const char *activePixmap, const char *inactivePixmap, int _idx )
{
setFont( pointSize<8>( font() ) );
@@ -81,7 +81,7 @@ void TabWidget::addTab( QWidget * _w, const QString & _name, const char *active
int w = fontMetrics().width( _name ) + 10;
// Register new tab
widgetDesc d = { _w, activePixmap, inactivePixmap, _name, w } ;
widgetDesc d = { _w, activePixmap, inactivePixmap, _name, _tooltip, w } ;
m_widgets[_idx] = d;
// Position tab's window
@@ -154,7 +154,7 @@ bool TabWidget::event(QEvent *event)
if ( idx != -1 )
{
// Display tab's tooltip
QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].name );
QToolTip::showText( helpEvent->globalPos(), m_widgets[idx].tooltip );
} else
{
// The tooltip event doesn't relate to any tab, let's ignore it
@@ -174,8 +174,11 @@ bool TabWidget::event(QEvent *event)
void TabWidget::mousePressEvent( QMouseEvent * _me )
{
int idx = findTabAtPos( & _me->pos() );
// Find index of tab that has been clicked
QPoint pos = _me->pos();
int idx = findTabAtPos( &pos );
// When found, activate tab that has been clicked
if ( idx != -1 )
{
setActiveTab( idx );

View File

@@ -1434,11 +1434,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
m_miscView = new InstrumentMiscView( m_track, m_tabWidget );
m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 );
m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), "functions_active", "functions_inactive", 2 );
m_tabWidget->addTab( m_effectView, tr( "FX" ), "fx_active", "fx_inactive", 3 );
m_tabWidget->addTab( m_midiView, tr( "MIDI" ), "midi_active", "midi_inactive", 4 );
m_tabWidget->addTab( m_miscView, tr( "MISC" ), "misc_active", "misc_inactive", 5 );
m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), tr( "ENV/LFO" ), "env_lfo_active", "env_lfo_inactive", 1 );
m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), tr( "FUNC" ), "functions_active", "functions_inactive", 2 );
m_tabWidget->addTab( m_effectView, tr( "FX" ), tr( "FX" ), "fx_active", "fx_inactive", 3 );
m_tabWidget->addTab( m_midiView, tr( "MIDI" ), tr( "MIDI" ), "midi_active", "midi_inactive", 4 );
m_tabWidget->addTab( m_miscView, tr( "MISC" ), tr( "MISC" ), "misc_active", "misc_inactive", 5 );
// setup piano-widget
m_pianoView = new PianoView( this );
@@ -1611,7 +1611,7 @@ void InstrumentTrackWindow::updateInstrumentView()
if( m_track->m_instrument != NULL )
{
m_instrumentView = m_track->m_instrument->createView( m_tabWidget );
m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 );
m_tabWidget->addTab( m_instrumentView, tr( "PLUGIN" ), tr( "PLUGIN" ), "plugin_active", "plugin_inactive", 0 );
m_tabWidget->setActiveTab( 0 );
m_ssView->setFunctionsHidden( m_track->m_instrument->flags().testFlag( Instrument::IsSingleStreamed ) );