fixes for Qt4-version

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@475 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2007-04-21 01:00:00 +00:00
parent 4feb778ddd
commit 4e319102a5
25 changed files with 308 additions and 57 deletions

View File

@@ -1,5 +1,31 @@
2007-04-20 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/ladspa_effect/ladspa_subplugin_features.cpp:
* plugins/patman/patman.cpp:
* plugins/singerbot/singerbot.h:
* plugins/singerbot/singerbot.cpp:
* plugins/live_tool/live_tool.cpp:
* plugins/polyb302/polyb302.cpp:
* include/fifo_buffer.h:
* include/bb_track.h:
* include/audio_device.h:
* include/midi_client.h:
* include/qt3support.h:
* src/audio/audio_sdl.cpp:
* src/audio/audio_jack.cpp:
* src/core/note_play_handle.cpp:
* src/core/track_container.cpp:
* src/core/tool.cpp:
* src/core/setup_dialog.cpp:
* src/core/track.cpp:
* src/core/effect_select_dialog.cpp:
* src/core/main_window.cpp:
* src/widgets/rack_plugin.cpp:
* src/widgets/tool_button.cpp:
* src/widgets/rack_view.cpp:
* src/widgets/effect_label.cpp:
fixes for Qt4-version
* plugins/midi_import/midi_import.cpp:
* src/core/automation_editor.cpp:
* src/core/piano_roll.cpp:

View File

@@ -111,7 +111,11 @@ public:
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
tr( _caption ) ).toUpper(), _parent )
tabWidget::tr( _caption
#ifndef QT3
.toAscii()
#endif
) ).toUpper(), _parent )
{
}

View File

@@ -132,11 +132,7 @@ public:
}
void enableAutomation( track * _track )
{
#ifndef QT3
m_disabled_tracks.removeAll( _track );
#else
m_disabled_tracks.remove( _track );
#endif
}

View File

@@ -49,29 +49,53 @@ public:
m_size( _size )
{
m_buffer = new T[_size];
#ifndef QT3
m_reader_sem.acquire( _size );
#else
m_reader_sem += _size;
#endif
}
~fifoBuffer()
{
delete[] m_buffer;
#ifndef QT3
m_reader_sem.release( m_size );
#else
m_reader_sem -= m_size;
#endif
}
void write( T _element )
{
#ifndef QT3
m_writer_sem.acquire();
#else
m_writer_sem++;
#endif
m_buffer[m_writer_index++] = _element;
m_writer_index %= m_size;
#ifndef QT3
m_reader_sem.release();
#else
m_reader_sem--;
#endif
}
T read( void )
{
#ifndef QT3
m_reader_sem.acquire();
#else
m_reader_sem++;
#endif
T element = m_buffer[m_reader_index++];
m_reader_index %= m_size;
#ifndef QT3
m_writer_sem.release();
#else
m_writer_sem--;
#endif
return( element );
}

View File

@@ -116,7 +116,11 @@ public:
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
tr( _caption ) ).toUpper(), _parent )
tr( _caption
#ifndef QT3
.toAscii()
#endif
) ).toUpper(), _parent )
{
}

View File

@@ -182,6 +182,10 @@ inline QString baseName( const QString & _file )
#define transformed xForm
// QList
#define removeAll remove
// QGridLayout
#define setColumnStretch setColStretch
#define columnCount numCols

View File

@@ -26,15 +26,17 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QString>
#include <QtGui/QLabel>
#include <QtGui/QBoxLayout>
#else
#include <qhbox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qstring.h>
@@ -65,24 +67,41 @@ void ladspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,
QLabel * label = new QLabel( _parent );
label->setText( QWidget::tr( "Name: " ) + lm->getName( lkey ) );
QHBox * maker = new QHBox( _parent );
QWidget * maker = new QWidget( _parent );
QHBoxLayout * l = new QHBoxLayout( maker );
l->setMargin( 0 );
l->setSpacing( 0 );
QLabel * maker_label = new QLabel( maker );
maker_label->setText( QWidget::tr( "Maker: " ) );
maker_label->setAlignment( Qt::AlignTop );
QLabel * maker_content = new QLabel( maker );
maker_content->setText( lm->getMaker( lkey ) );
#ifndef QT3
maker_content->setWordWrap( TRUE );
#else
maker_content->setAlignment( Qt::WordBreak );
maker->setStretchFactor( maker_content, 100 );
#endif
l->setStretchFactor( maker_content, 100 );
QWidget * copyright = new QWidget( _parent );
l = new QHBoxLayout( copyright );
l->setMargin( 0 );
l->setSpacing( 0 );
QHBox * copyright = new QHBox( _parent );
copyright->setMinimumWidth( _parent->minimumWidth() );
QLabel * copyright_label = new QLabel( copyright );
copyright_label->setText( QWidget::tr( "Copyright: " ) );
copyright_label->setAlignment( Qt::AlignTop );
QLabel * copyright_content = new QLabel( copyright );
copyright_content->setText( lm->getCopyright( lkey ) );
#ifndef QT3
copyright_content->setWordWrap( TRUE );
#else
copyright_content->setAlignment( Qt::WordBreak );
copyright->setStretchFactor( copyright_content, 100 );
#endif
l->setStretchFactor( copyright_content, 100 );
QLabel * requiresRealTime = new QLabel( _parent );
requiresRealTime->setText( QWidget::tr( "Requires Real Time: " ) +

View File

@@ -23,7 +23,13 @@
*/
#ifdef QT3
#include "qt3support.h"
#ifndef QT3
#include <QtGui/QKeyEvent>
#else
#include <qwhatsthis.h>
@@ -71,8 +77,15 @@ plugin::descriptor live_tool_plugin_descriptor =
liveTool::liveTool( mainWindow * _window ) :
tool( _window, &live_tool_plugin_descriptor )
{
QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" );
const QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" );
#ifndef QT3
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(), background );
setPalette( pal );
#else
setPaletteBackgroundPixmap( background );
#endif
setFixedSize( background.size() );
#ifdef QT4
@@ -161,12 +174,20 @@ bool liveTool::x11Event( XEvent * _xe )
void liveTool::toggleInstrument( int _n )
{
#ifndef QT3
if( _n > 0 && _n < engine::getBBEditor()->tracks().count() )
{
track * t = engine::getBBEditor()->tracks().at( _n );
t->setMuted( !t->muted() );
}
#else
bool track_exists;
track * t = engine::getBBEditor()->tracks().at( _n, &track_exists );
if( track_exists )
{
t->setMuted( !t->muted() );
}
#endif
}

View File

@@ -23,9 +23,12 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QFileDialog>
#include <QtGui/QDragEnterEvent>
#else
@@ -83,8 +86,15 @@ patmanSynth::patmanSynth( instrumentTrack * _track ) :
instrument( _track, &patman_plugin_descriptor ),
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) )
{
#ifndef QT3
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(),
PLUGIN_NAME::getIconPixmap( "artwork" ) );
setPalette( pal );
#else
setPaletteBackgroundPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) );
#endif
m_openFileButton = new pixmapButton( this, NULL, NULL );
m_openFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openFileButton->move( 200, 90 );
@@ -448,7 +458,11 @@ patmanSynth::load_error patmanSynth::load_patch( const QString & _filename )
{
unload_current_patch();
FILE * fd = fopen( _filename, "rb" );
FILE * fd = fopen( _filename
#ifndef QT3
.toAscii().constData()
#endif
, "rb" );
if( !fd )
{
perror( "fopen" );

View File

@@ -577,7 +577,7 @@ void polyb302Synth::playNote( notePlayHandle * _n, bool )
void polyb302Synth::deleteNotePluginData( notePlayHandle * _n )
{
handleState * hstate = (handleState *)_n->m_pluginData;
m_handleStates.remove( hstate );
m_handleStates.removeAll( hstate );
delete hstate;
}

View File

@@ -23,6 +23,8 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtCore/QDir>
@@ -96,7 +98,15 @@ singerBot::singerBot( instrumentTrack * _track ) :
s_thread->start();
}
#ifndef QT3
setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( backgroundRole(),
PLUGIN_NAME::getIconPixmap( "artwork" ) );
setPalette( pal );
#else
setPaletteBackgroundPixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) );
#endif
QVBoxLayout * vbox = new QVBoxLayout( this );
vbox->setMargin( 10 );
@@ -106,7 +116,6 @@ singerBot::singerBot( instrumentTrack * _track ) :
m_lyrics = new QTextEdit( this );
#ifdef QT4
m_lyrics->setAutoFillBackground( TRUE );
QPalette pal;
pal.setColor( m_lyrics->backgroundRole(), QColor( 64, 64, 64 ) );
m_lyrics->setPalette( pal );
#else
@@ -224,8 +233,13 @@ void singerBot::lyricsChanged( void )
void singerBot::updateWords( void )
{
#ifndef QT3
m_words = m_lyrics->toPlainText().simplified().toLower().
split( ' ' );
#else
m_words = QStringList::split( ' ',
m_lyrics->text().simplifyWhiteSpace().lower() );
#endif
m_words_dirty = FALSE;
}
@@ -255,7 +269,12 @@ void singerBot::createWave( notePlayHandle * _n )
/ 64.0f / engine::getSongEditor()->getTempo() :
0;
int word_index = _n->patternIndex() % m_words.size();
hdata->text = m_words[word_index].ascii();
hdata->text = m_words[word_index].
#ifndef QT3
toAscii().constData();
#else
ascii();
#endif
s_thread->set_data( hdata );
s_thread->unlock_synth();
@@ -338,13 +357,19 @@ sampleBuffer * singerBot::readWave( handle_data * _hdata )
static const int total = 1;
singerBot::synThread::synThread( void ) :
m_handle_semaphore( 1 ),
m_synth_semaphore( 1 )
m_handle_semaphore( total ),
m_synth_semaphore( total )
{
m_handle_semaphore += m_handle_semaphore.total();
m_synth_semaphore += m_synth_semaphore.total();
#ifndef QT3
m_handle_semaphore.acquire( total );
m_synth_semaphore.acquire( total );
#else
m_handle_semaphore += total;
m_synth_semaphore += total;
#endif
}
@@ -352,8 +377,13 @@ singerBot::synThread::synThread( void ) :
singerBot::synThread::~synThread()
{
m_handle_semaphore -= m_handle_semaphore.total();
m_synth_semaphore -= m_synth_semaphore.total();
#ifndef QT3
m_handle_semaphore.release( total );
m_synth_semaphore.release( total );
#else
m_handle_semaphore -= total;
m_synth_semaphore -= total;
#endif
}
@@ -384,9 +414,17 @@ void singerBot::synThread::run( void )
for( ; ; )
{
#ifndef QT3
m_synth_semaphore.acquire();
#else
m_synth_semaphore++;
#endif
text_to_wave();
#ifndef QT3
m_handle_semaphore.release();
#else
m_handle_semaphore--;
#endif
}
}

View File

@@ -26,7 +26,6 @@
#ifndef _SINGERBOT_H
#define _SINGERBOT_H
#ifdef QT4
#include <QtCore/QThread>
@@ -98,11 +97,19 @@ private:
void unlock_synth( void )
{
#ifndef QT3
m_synth_semaphore.release();
#else
m_synth_semaphore--;
#endif
}
void lock_handle( void )
{
#ifndef QT3
m_handle_semaphore.acquire();
#else
m_handle_semaphore++;
#endif
}

View File

@@ -58,6 +58,8 @@
static const int total = 1;
audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer ) :
audioDevice( _sample_rate, tLimit<int>( configManager::inst()->value(
@@ -67,7 +69,7 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
m_client( NULL ),
m_active( FALSE ),
// m_processCallbackMutex(),
m_stop_semaphore( 1 ),
m_stop_semaphore( total ),
m_outBuf( bufferAllocator::alloc<surroundSampleFrame>(
getMixer()->framesPerAudioBuffer() ) ),
m_framesDoneInCurBuf( 0 ),
@@ -166,7 +168,11 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
}
}
m_stop_semaphore += m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.acquire( total );
#else
m_stop_semaphore += total;
#endif
_success_ful = TRUE;
@@ -177,7 +183,11 @@ audioJACK::audioJACK( const sample_rate_t _sample_rate, bool & _success_ful,
audioJACK::~audioJACK()
{
m_stop_semaphore -= m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.release( total );
#else
m_stop_semaphore -= total;
#endif
while( m_portMap.size() )
{
@@ -261,7 +271,11 @@ void audioJACK::startProcessing( void )
void audioJACK::stopProcessing( void )
{
#ifndef QT3
m_stop_semaphore.acquire();
#else
m_stop_semaphore++;
#endif
}
@@ -414,7 +428,11 @@ int audioJACK::processCallback( jack_nframes_t _nframes, void * _udata )
if( !_this->m_framesToDoInCurBuf )
{
_this->m_stopped = TRUE;
#ifndef QT3
_this->m_stop_semaphore.release();
#else
_this->m_stop_semaphore--;
#endif
}
_this->m_framesDoneInCurBuf = 0;
}

View File

@@ -50,6 +50,7 @@
#include "templates.h"
static const int total = 1;
audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
mixer * _mixer ) :
@@ -58,7 +59,7 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
getMixer()->framesPerAudioBuffer() ) ),
m_convertedBuf_pos( 0 ),
m_convertEndian( FALSE ),
m_stop_semaphore( 1 )
m_stop_semaphore( total )
{
_success_ful = FALSE;
@@ -107,7 +108,11 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
}
m_convertEndian = ( m_audioHandle.format != actual.format );
m_stop_semaphore += m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.acquire( total );
#else
m_stop_semaphore += total;
#endif
_success_ful = TRUE;
}
@@ -118,7 +123,11 @@ audioSDL::audioSDL( const sample_rate_t _sample_rate, bool & _success_ful,
audioSDL::~audioSDL()
{
stopProcessing();
m_stop_semaphore -= m_stop_semaphore.total();
#ifndef QT3
m_stop_semaphore.release( total );
#else
m_stop_semaphore -= total;
#endif
SDL_CloseAudio();
SDL_Quit();
bufferAllocator::free( m_convertedBuf );
@@ -143,7 +152,11 @@ void audioSDL::stopProcessing( void )
{
if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING )
{
#ifndef QT3
m_stop_semaphore.acquire();
#else
m_stop_semaphore++;
#endif
SDL_LockAudio();
SDL_PauseAudio( 1 );
@@ -184,7 +197,11 @@ void audioSDL::sdlAudioCallback( Uint8 * _buf, int _len )
if( !frames )
{
m_stopped = TRUE;
#ifndef QT3
m_stop_semaphore.release();
#else
m_stop_semaphore--;
#endif
memset( _buf, 0, _len );
return;
}

View File

@@ -29,8 +29,10 @@
#ifdef QT4
#include <QtGui/QGroupBox>
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QScrollArea>
#else
@@ -215,12 +217,28 @@ effectList::effectList( QWidget * _parent ) :
tr( "Description" ), this );
#endif
groupbox->setFixedHeight( 200 );
#ifdef QT3
groupbox->setInsideMargin( 2 );
QScrollView * scrollView = new QScrollView( groupbox );
scrollView->setFrameStyle( 0 );
scrollView->setMargin( 10 );
m_descriptionWidget = new QVBox( scrollView->viewport() );
scrollView->addChild( m_descriptionWidget );
#endif
QScrollArea * scrollArea = new QScrollArea( groupbox );
scrollArea->setFrameStyle( 0 );
#ifdef QT3
scrollArea->setMargin( 10 );
#endif
#ifndef QT3
m_descriptionWidget = new QWidget;
QVBoxLayout * l = new QVBoxLayout( m_descriptionWidget );
l->setMargin( 0 );
l->setSpacing( 0 );
scrollArea->setWidget( m_descriptionWidget );
m_descriptionWidget->show();
m_descriptionWidget->setFixedSize( 200, 200 );
#else
m_descriptionWidget = new QVBox( scrollArea->viewport() );
scrollArea->addChild( m_descriptionWidget );
#endif
QVBoxLayout * vboxl = new QVBoxLayout( this );
vboxl->setMargin( 0 );
@@ -247,11 +265,19 @@ effectList::~effectList()
void effectList::onHighlighted( int _pluginIndex )
{
#ifndef QT3
QLayoutItem * i;
while( ( i = m_descriptionWidget->layout() ) != 0 )
{
delete i;
}
#else
QLayoutIterator it = m_descriptionWidget->layout()->iterator();
while( it.current() )
{
it.deleteCurrent();
}
#endif
m_descriptionWidget->hide();
m_currentSelection = m_effectKeys[_pluginIndex];

View File

@@ -532,7 +532,11 @@ void mainWindow::finalize( void )
this ) );
}
}
#ifndef QT3
if( !m_tools_menu->isEmpty() )
#else
if( m_tools_menu->count() )
#endif
{
#ifdef QT4
menuBar()->addMenu( m_tools_menu )->setText( tr( "&Tools" ) );
@@ -1093,9 +1097,13 @@ void mainWindow::fillTemplatesMenu( void )
void mainWindow::showTool( int _idx )
{
#ifndef QT3
#warning TODO: Qt4-implementation
#else
tool * t = m_tools[m_tools_menu->indexOf( _idx )];
t->show();
t->setFocus();
#endif
}

View File

@@ -107,7 +107,7 @@ notePlayHandle::~notePlayHandle()
{
if( detuning() )
{
m_instrumentTrack->m_processHandles.remove( this );
m_instrumentTrack->m_processHandles.removeAll( this );
}
if( m_pluginData != NULL )
{

View File

@@ -556,7 +556,11 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();
it != m_audioIfaceSetupWidgets.end(); ++it )
{
m_audioIfaceNames[tr( it.key() )] = it.key();
m_audioIfaceNames[tr( it.key()
#ifndef QT3
.toAscii()
#endif
)] = it.key();
}
for( trMap::iterator it = m_audioIfaceNames.begin();
it != m_audioIfaceNames.end(); ++it )
@@ -572,7 +576,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
}
#ifdef QT4
m_audioInterfaces->setCurrentIndex( m_audioInterfaces->findText(
tr( engine::getMixer()->audioDevName() ) ) );
tr( engine::getMixer()->audioDevName().toAscii() ) ) );
#else
m_audioInterfaces->setCurrentText(
tr( engine::getMixer()->audioDevName() ) );
@@ -642,7 +646,11 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
for( mswMap::iterator it = m_midiIfaceSetupWidgets.begin();
it != m_midiIfaceSetupWidgets.end(); ++it )
{
m_midiIfaceNames[tr( it.key() )] = it.key();
m_midiIfaceNames[tr( it.key()
#ifndef QT3
.toAscii()
#endif
)] = it.key();
}
for( trMap::iterator it = m_midiIfaceNames.begin();
it != m_midiIfaceNames.end(); ++it )
@@ -659,7 +667,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
#ifdef QT4
m_midiInterfaces->setCurrentIndex( m_midiInterfaces->findText(
tr( engine::getMixer()->midiClientName() ) ) );
tr( engine::getMixer()->midiClientName().toAscii() ) ) );
#else
m_midiInterfaces->setCurrentText(
tr( engine::getMixer()->midiClientName() ) );

View File

@@ -28,6 +28,9 @@
#include "tool.h"
#include "main_window.h"
#ifndef QT3
#include <QtGui/QIcon>
#endif

View File

@@ -1891,11 +1891,7 @@ void track::addAutomationPattern( automationPattern * _pattern )
void track::removeAutomationPattern( automationPattern * _pattern )
{
#ifndef QT3
m_automation_patterns.removeAll( _pattern );
#else
m_automation_patterns.remove( _pattern );
#endif
}

View File

@@ -345,7 +345,12 @@ void trackContainer::clearAllTracks( void )
const trackWidget * trackContainer::trackWidgetAt( const int _y ) const
{
const int abs_y = _y + m_scrollArea->contentsY();
const int abs_y = _y +
#ifndef QT3
m_scrollArea->viewport()->y();
#else
m_scrollArea->contentsY();
#endif
int y_cnt = 0;
for( trackWidgetVector::const_iterator it = m_trackWidgets.begin();
it != m_trackWidgets.end(); ++it )

View File

@@ -59,6 +59,9 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
m_effWidget = new effectTabWidget( engine::getMainWindow()->workspace(),
m_track,
m_track->getAudioPort() );
#ifndef QT3
engine::getMainWindow()->workspace()->addWindow( m_effWidget );
#endif
m_effWidget->setFixedSize( 240, 242 );
m_effWidget->hide();
connect( m_effWidget, SIGNAL( closed() ),

View File

@@ -182,10 +182,9 @@ rackPlugin::rackPlugin( QWidget * _parent,
#endif
m_controlView = m_effect->createControlDialog( m_track );
/* engine::getMainWindow()->workspace(),
new ControlDialog(
engine::getMainWindow()->workspace(),
m_effect, m_track );*/
#ifndef QT3
engine::getMainWindow()->workspace()->addWindow( m_controlView );
#endif
connect( m_controlView, SIGNAL( closed() ),
this, SLOT( closeEffects() ) );
m_controlView->hide();

View File

@@ -25,9 +25,11 @@
*/
#include "qt3support.h"
#ifdef QT4
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#else
@@ -48,10 +50,12 @@ rackView::rackView( QWidget * _parent, track * _track, audioPort * _port ) :
m_mainLayout = new QVBoxLayout( this );
m_mainLayout->setMargin( 0 );
m_mainLayout->setSpacing( 0 );
m_scrollArea = new QScrollArea( this );
m_scrollArea->setFixedSize( 230, 184 );
#ifdef QT4
m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
m_scrollArea->setPalette( QApplication::palette( m_scrollArea ) );
#else
m_scrollArea->setVScrollBarMode( QScrollArea::AlwaysOn );
#endif
@@ -74,10 +78,9 @@ void rackView::addEffect( effect * _e )
#ifdef QT4
if( !m_scrollArea->widget() )
{
QWidget * w = new QWidget( m_scrollArea->viewport() );
QVBoxLayout * vb = new QVBoxLayout( w );
w->show();
QWidget * w = new QWidget;
m_scrollArea->setWidget( w );
w->show();
}
QWidget * w = m_scrollArea->widget();
#else

View File

@@ -29,7 +29,6 @@
#include "tooltip.h"
const QColor toolButton::s_stdColor = QColor( 216, 216, 216 );
const QColor toolButton::s_hlColor = QColor( 240, 240, 240 );
@@ -44,6 +43,11 @@ toolButton::toolButton( const QPixmap & _pixmap, const QString & _tooltip,
{
#ifndef QT3
setAutoFillBackground( TRUE );
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
#endif
if( _receiver != NULL && _slot != NULL )
{
@@ -70,8 +74,10 @@ toolButton::~toolButton()
void toolButton::enterEvent( QEvent * )
{
#ifdef QT4
QPalette pal;
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorHighlighted );
pal.setColor( QPalette::Window, m_colorHighlighted );
pal.setColor( QPalette::Button, m_colorHighlighted );
setPalette( pal );
#else
setPaletteBackgroundColor( m_colorHighlighted );
@@ -84,8 +90,10 @@ void toolButton::enterEvent( QEvent * )
void toolButton::leaveEvent( QEvent * )
{
#ifdef QT4
QPalette pal;
QPalette pal = palette();
pal.setColor( backgroundRole(), m_colorStandard );
pal.setColor( QPalette::Window, m_colorStandard );
pal.setColor( QPalette::Button, m_colorStandard );
setPalette( pal );
#else
setPaletteBackgroundColor( m_colorStandard );