From 0e7cb9a0c8b93c165fa8c24729d5a3d64c4b58a5 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 14 Dec 2005 16:51:07 +0000 Subject: [PATCH] small fixes for Qt4 git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@34 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/bb_editor.cpp | 5 +++-- src/core/config_mgr.cpp | 27 +++++++++++++++++++++++++++ src/core/piano_roll.cpp | 2 ++ src/core/setup_dialog.cpp | 16 ++++++++++++++++ src/core/song_editor.cpp | 5 ++++- src/widgets/cpuload_widget.cpp | 9 ++++++--- src/widgets/tab_bar.cpp | 5 +++++ 7 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 860df70bf..699556865 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -74,11 +74,12 @@ bbEditor::bbEditor() : embed::getIconPixmap( "toolbar_bg" ) ) ); m_toolBar->setPalette( pal ); #else - m_toolBar->setErasePixmap( embed::getIconPixmap( "toolbar_bg" ) ); + m_toolBar->setPaletteBackgroundPixmap( embed::getIconPixmap( + "toolbar_bg" ) ); #endif QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); - + tb_layout->setMargin( 0 ); setWindowIcon( embed::getIconPixmap( "bb_track" ) ); diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 87806db87..0f3ca2d01 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -196,6 +196,7 @@ configManager::~configManager() void configManager::createWidgets( void ) { m_mainLayout = new QHBoxLayout( this ); + m_mainLayout->setMargin( 0 ); m_mainLayout->setSpacing( 10 ); m_mainLayout->addSpacing( 8 ); #ifdef QT4 @@ -204,6 +205,7 @@ void configManager::createWidgets( void ) m_contentWidget = new QWidget( this ); m_contentLayout = new QVBoxLayout( m_contentWidget ); + m_contentLayout->setMargin( 0 ); m_contentLayout->setSpacing( 10 ); m_contentLayout->addSpacing( 8 ); #ifdef QT4 @@ -224,8 +226,14 @@ void configManager::createWidgets( void ) QWidget * button_widget = new QWidget( m_contentWidget ); + button_widget->setFixedHeight( 40 ); m_buttonLayout = new QHBoxLayout( button_widget ); + m_buttonLayout->setMargin( 0 ); + m_buttonLayout->setSpacing( 0 ); m_buttonLayout->addStretch( 1 ); +#ifdef QT4 + button_widget->setLayout( m_buttonLayout ); +#endif m_cancelButton = new QPushButton( tr( "&Cancel" ), button_widget ); m_backButton = new QPushButton( tr( "< &Back" ), button_widget ); @@ -256,7 +264,11 @@ void configManager::createWidgets( void ) m_pageIntro = new QWidget( m_contentWidget ); QHBoxLayout * intro_layout = new QHBoxLayout( m_pageIntro ); + intro_layout->setMargin( 0 ); intro_layout->setSpacing( 15 ); +#ifdef QT4 + m_pageIntro->setLayout( intro_layout ); +#endif QLabel * intro_logo_lbl = new QLabel( m_pageIntro ); intro_logo_lbl->setPixmap( embed::getIconPixmap( "wizard_intro" ) ); @@ -288,6 +300,7 @@ void configManager::createWidgets( void ) m_pageWorkingDir = new QWidget( m_contentWidget ); QHBoxLayout * workingdir_layout = new QHBoxLayout( m_pageWorkingDir ); + workingdir_layout->setMargin( 0 ); workingdir_layout->setSpacing( 15 ); QLabel * workingdir_logo_lbl = new QLabel( m_pageWorkingDir ); @@ -299,6 +312,8 @@ void configManager::createWidgets( void ) QWidget * workingdir_content = new QWidget( m_pageWorkingDir ); QVBoxLayout * workingdir_content_layout = new QVBoxLayout( workingdir_content ); + workingdir_content_layout->setMargin( 0 ); + workingdir_content_layout->setSpacing( 0 ); QLabel * workingdir_txt_lbl = new QLabel( tr( "When working with LMMS there needs to " @@ -318,6 +333,7 @@ void configManager::createWidgets( void ) QHBoxLayout * workingdir_input_fields_layout = new QHBoxLayout( workingdir_input_fields ); workingdir_input_fields_layout->setSpacing( 10 ); + workingdir_input_fields_layout->setMargin( 0 ); m_wdLineEdit = new QLineEdit( m_lmmsWorkingDir, workingdir_input_fields ); @@ -346,10 +362,15 @@ void configManager::createWidgets( void ) m_pageFiles = new QWidget( m_contentWidget ); QHBoxLayout * files_layout = new QHBoxLayout( m_pageFiles ); files_layout->setSpacing( 15 ); + files_layout->setMargin( 0 ); QWidget * files_content = new QWidget( m_pageFiles ); QVBoxLayout * files_content_layout = new QVBoxLayout( files_content ); files_content_layout->setSpacing( 10 ); + files_content_layout->setMargin( 0 ); +#ifdef QT4 + files_content->setLayout( files_content_layout ); +#endif QLabel * files_logo_lbl = new QLabel( m_pageFiles ); files_logo_lbl->setPixmap( embed::getIconPixmap( "wizard_files" ) ); @@ -380,6 +401,8 @@ void configManager::createWidgets( void ) QWidget * samples_widget = new QWidget( files_content ); QHBoxLayout * samples_layout = new QHBoxLayout( samples_widget ); samples_layout->setSpacing( 5 ); + samples_layout->setMargin( 0 ); + QLabel * samples_pic_lbl = new QLabel( samples_widget ); samples_pic_lbl->setPixmap( embed::getIconPixmap( "sound_file" ) ); QLabel * samples_txt_lbl = new QLabel( tr( "samples:" ), @@ -409,6 +432,8 @@ void configManager::createWidgets( void ) QWidget * presets_widget = new QWidget( files_content ); QHBoxLayout * presets_layout = new QHBoxLayout( presets_widget ); presets_layout->setSpacing( 5 ); + presets_layout->setMargin( 0 ); + QLabel * presets_pic_lbl = new QLabel( presets_widget ); presets_pic_lbl->setPixmap( embed::getIconPixmap( "preset_file" ) ); QLabel * presets_txt_lbl = new QLabel( tr( "presets:" ), @@ -438,6 +463,8 @@ void configManager::createWidgets( void ) QWidget * projects_widget = new QWidget( files_content ); QHBoxLayout * projects_layout = new QHBoxLayout( projects_widget ); projects_layout->setSpacing( 5 ); + projects_layout->setMargin( 0 ); + QLabel * projects_pic_lbl = new QLabel( projects_widget ); projects_pic_lbl->setPixmap( embed::getIconPixmap( "project_file" ) ); QLabel * projects_txt_lbl = new QLabel( tr( "demo projects:" ), diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index f0d98d44d..241fb8d7a 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -215,6 +215,8 @@ pianoRoll::pianoRoll( void ) : #endif QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); + tb_layout->setMargin( 0 ); + tb_layout->setSpacing( 0 ); // init control-buttons at the top diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index 0e03680de..e40be0c57 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -106,8 +106,12 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : setWindowTitle( tr( "Setup LMMS" ) ); QVBoxLayout * vlayout = new QVBoxLayout( this ); + vlayout->setSpacing( 0 ); + vlayout->setMargin( 0 ); QWidget * settings = new QWidget( this ); QHBoxLayout * hlayout = new QHBoxLayout( settings ); + hlayout->setSpacing( 0 ); + hlayout->setMargin( 0 ); m_tabBar = new tabBar( settings, QBoxLayout::TopToBottom ); m_tabBar->setExclusive( TRUE ); @@ -119,6 +123,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : QWidget * general = new QWidget( ws ); general->setFixedSize( 360, 200 ); QVBoxLayout * gen_layout = new QVBoxLayout( general ); + gen_layout->setSpacing( 0 ); + gen_layout->setMargin( 0 ); labelWidget( general, tr( "General settings" ) ); tabWidget * bufsize_tw = new tabWidget( tr( "BUFFER SIZE" ), general ); @@ -204,6 +210,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : QWidget * audio = new QWidget( ws ); audio->setFixedSize( 360, 200 ); QVBoxLayout * audio_layout = new QVBoxLayout( audio ); + audio_layout->setSpacing( 0 ); + audio_layout->setMargin( 0 ); labelWidget( audio, tr( "Audio settings" ) ); tabWidget * audioiface_tw = new tabWidget( tr( "AUDIO INTERFACE" ), @@ -229,6 +237,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : #endif QHBoxLayout * asw_layout = new QHBoxLayout( asw ); + asw_layout->setSpacing( 0 ); + asw_layout->setMargin( 0 ); //asw_layout->setAutoAdd( TRUE ); #ifdef JACK_SUPPORT @@ -288,6 +298,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : QWidget * midi = new QWidget( ws ); QVBoxLayout * midi_layout = new QVBoxLayout( midi ); + midi_layout->setSpacing( 0 ); + midi_layout->setMargin( 0 ); labelWidget( midi, tr( "MIDI settings" ) ); tabWidget * midiiface_tw = new tabWidget( tr( "MIDI INTERFACE" ), @@ -313,6 +325,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : #endif QHBoxLayout * msw_layout = new QHBoxLayout( msw ); + msw_layout->setSpacing( 0 ); + msw_layout->setMargin( 0 ); //msw_layout->setAutoAdd( TRUE ); #ifdef ALSA_SUPPORT @@ -384,6 +398,8 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : QWidget * buttons = new QWidget( this ); QHBoxLayout * btn_layout = new QHBoxLayout( buttons ); + btn_layout->setSpacing( 0 ); + btn_layout->setMargin( 0 ); QPushButton * ok_btn = new QPushButton( embed::getIconPixmap( "apply" ), tr( "OK" ), buttons ); connect( ok_btn, SIGNAL( clicked() ), this, SLOT( accept() ) ); diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index 2a24aaf5e..ea375509a 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -261,6 +261,8 @@ songEditor::songEditor() : // create widget for visualization- and cpu-load-widget QWidget * vc_w = new QWidget( tb ); QVBoxLayout * vcw_layout = new QVBoxLayout( vc_w ); + vcw_layout->setMargin( 0 ); + vcw_layout->setSpacing( 0 ); vcw_layout->addStretch(); vcw_layout->addWidget( new visualizationWidget( @@ -287,7 +289,8 @@ songEditor::songEditor() : #endif QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); - + tb_layout->setMargin( 0 ); + tb_layout->setSpacing( 0 ); #ifdef QT4 containerWidget()->setParent( cw ); diff --git a/src/widgets/cpuload_widget.cpp b/src/widgets/cpuload_widget.cpp index d832290c2..3a553b4f5 100644 --- a/src/widgets/cpuload_widget.cpp +++ b/src/widgets/cpuload_widget.cpp @@ -98,10 +98,13 @@ void cpuloadWidget::paintEvent( QPaintEvent * ) // background p.drawPixmap( 0, 0, m_background ); - // leds - p.drawPixmap( 23, 3, m_leds, 0, 0, - ( m_leds.width() * m_currentLoad / 300 ) * 3, + int w = ( m_leds.width() * m_currentLoad / 300 ) * 3; + if( w > 0 ) + { + // leds + p.drawPixmap( 23, 3, m_leds, 0, 0, w, m_leds.height() ); + } } QPainter p( this ); p.drawPixmap( 0, 0, m_temp ); diff --git a/src/widgets/tab_bar.cpp b/src/widgets/tab_bar.cpp index 0edc28dd7..da87deccf 100644 --- a/src/widgets/tab_bar.cpp +++ b/src/widgets/tab_bar.cpp @@ -48,6 +48,11 @@ tabBar::tabBar( QWidget * _parent, QBoxLayout::Direction _dir ) : #endif m_exclusive( FALSE ) { + m_layout->setMargin( 0 ); + m_layout->setSpacing( 0 ); +#ifdef QT4 + setLayout( m_layout ); +#endif }