Skip to content

Commit

Permalink
Fix more Qt deprecation warnings (#6615)
Browse files Browse the repository at this point in the history
* Add <QHash> to PluginFactory.h

* Handle one more deprecated QTextStream::endl

* Replace QLayout::setMargin with setContentsMargins

* Replace Qt::MidButton with Qt::MiddleButton

* Replace QPalette::Background with QPalette::Window

* Fix deprecation warnings in LcdFloatSpinBox
  • Loading branch information
PhysSong authored Jan 18, 2023
1 parent 158bb50 commit f89d52f
Show file tree
Hide file tree
Showing 36 changed files with 69 additions and 62 deletions.
1 change: 1 addition & 0 deletions include/PluginFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <string>

#include <QFileInfo>
#include <QHash>
#include <QList>
#include <QString>
#include <QVector>
Expand Down
4 changes: 2 additions & 2 deletions plugins/LadspaBrowser/LadspaBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ LadspaBrowserView::LadspaBrowserView( ToolPlugin * _tool ) :
{
auto hlayout = new QHBoxLayout(this);
hlayout->setSpacing( 0 );
hlayout->setMargin( 0 );
hlayout->setContentsMargins(0, 0, 0, 0);

m_tabBar = new TabBar( this, QBoxLayout::TopToBottom );
m_tabBar->setExclusive( true );
Expand Down Expand Up @@ -166,7 +166,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt,
tab->setFixedSize( 500, 400 );
auto layout = new QVBoxLayout(tab);
layout->setSpacing( 0 );
layout->setMargin( 0 );
layout->setContentsMargins(0, 0, 0, 0);

const QString type = "<b>" + tr( "Type:" ) + "</b> ";
auto title = new QLabel(type + _txt, tab);
Expand Down
6 changes: 3 additions & 3 deletions plugins/LadspaBrowser/LadspaDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ LadspaDescription::LadspaDescription( QWidget * _parent,
auto descriptionBox = new QGroupBox(tr("Description"), this);
auto descriptionLayout = new QVBoxLayout(descriptionBox);
descriptionLayout->setSpacing( 0 );
descriptionLayout->setMargin( 0 );
descriptionLayout->setContentsMargins(0, 0, 0, 0);

m_scrollArea = new QScrollArea( descriptionBox );
descriptionLayout->addWidget( m_scrollArea );
Expand Down Expand Up @@ -130,7 +130,7 @@ void LadspaDescription::update( const ladspa_key_t & _key )

auto maker = new QWidget(description);
auto makerLayout = new QHBoxLayout(maker);
makerLayout->setMargin( 0 );
makerLayout->setContentsMargins(0, 0, 0, 0);
makerLayout->setSpacing( 0 );
layout->addWidget( maker );

Expand All @@ -145,7 +145,7 @@ void LadspaDescription::update( const ladspa_key_t & _key )

auto copyright = new QWidget(description);
auto copyrightLayout = new QHBoxLayout(copyright);
copyrightLayout->setMargin( 0 );
copyrightLayout->setContentsMargins(0, 0, 0, 0);
copyrightLayout->setSpacing( 0 );
layout->addWidget( copyright );

Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaBrowser/LadspaPortDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ LadspaPortDialog::LadspaPortDialog( const ladspa_key_t & _key )

auto vlayout = new QVBoxLayout(this);
vlayout->setSpacing( 0 );
vlayout->setMargin( 0 );
vlayout->setContentsMargins(0, 0, 0, 0);

int pc = manager->getPortCount( _key );

Expand Down
4 changes: 2 additions & 2 deletions plugins/LadspaEffect/LadspaSubPluginFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,

auto maker = new QWidget(_parent);
auto l = new QHBoxLayout(maker);
l->setMargin( 0 );
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing( 0 );

auto maker_label = new QLabel(maker);
Expand All @@ -85,7 +85,7 @@ void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,

auto copyright = new QWidget(_parent);
l = new QHBoxLayout( copyright );
l->setMargin( 0 );
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing( 0 );

copyright->setMinimumWidth( _parent->minimumWidth() );
Expand Down
2 changes: 1 addition & 1 deletion plugins/VstBase/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ void VstPlugin::createUI( QWidget * parent )
QHBoxLayout * l = new QHBoxLayout( helper );
QWidget * target = new QWidget( helper );
l->setSpacing( 0 );
l->setMargin( 0 );
l->setContentsMargins(0, 0, 0, 0);
l->addWidget( target );

// we've to call that for making sure, Qt created the windows
Expand Down
7 changes: 6 additions & 1 deletion src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,12 @@ void Song::loadProject( const QString & fileName )
else
{
QTextStream(stderr) << tr("Can't load project: "
"Project file contains local paths to plugins.") << endl;
"Project file contains local paths to plugins.")
#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
<< Qt::endl;
#else
<< endl;
#endif
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/lv2/Lv2SubPluginFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void Lv2SubPluginFeatures::fillDescriptionWidget(QWidget *parent,

auto maker = new QWidget(parent);
auto l = new QHBoxLayout(maker);
l->setMargin(0);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);

auto maker_label = new QLabel(maker);
Expand All @@ -98,7 +98,7 @@ void Lv2SubPluginFeatures::fillDescriptionWidget(QWidget *parent,

auto copyright = new QWidget(parent);
l = new QHBoxLayout(copyright);
l->setMargin(0);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
copyright->setMinimumWidth(parent->minimumWidth());

Expand Down
2 changes: 1 addition & 1 deletion src/gui/AutomatableModelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void AutomatableModelView::mousePressEvent( QMouseEvent* event )
new gui::StringPairDrag( "automatable_model", QString::number( modelUntyped()->id() ), QPixmap(), widget() );
event->accept();
}
else if( event->button() == Qt::MidButton )
else if( event->button() == Qt::MiddleButton )
{
modelUntyped()->reset();
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/EffectRackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ EffectRackView::EffectRackView( EffectChain* model, QWidget* parent ) :
ModelView( nullptr, this )
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setMargin( 5 );
mainLayout->setContentsMargins(5, 5, 5, 5);

m_effectsGroupBox = new GroupBox( tr( "EFFECTS CHAIN" ) );
mainLayout->addWidget( m_effectsGroupBox );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void FileBrowser::addContentCheckBox()
auto filterWidget = new QWidget(contentParent());
filterWidget->setFixedHeight(15);
auto filterWidgetLayout = new QHBoxLayout(filterWidget);
filterWidgetLayout->setMargin(0);
filterWidgetLayout->setContentsMargins(0, 0, 0, 0);
filterWidgetLayout->setSpacing(0);

auto configCheckBox = [this, &filterWidgetLayout](QCheckBox* box)
Expand Down Expand Up @@ -119,7 +119,7 @@ FileBrowser::FileBrowser(const QString & directories, const QString & filter,
searchWidget->setFixedHeight( 24 );

auto searchWidgetLayout = new QHBoxLayout(searchWidget);
searchWidgetLayout->setMargin( 0 );
searchWidgetLayout->setContentsMargins(0, 0, 0, 0);
searchWidgetLayout->setSpacing( 0 );

m_filterEdit = new QLineEdit( searchWidget );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/LadspaControlView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
m_ctl( _ctl )
{
auto layout = new QHBoxLayout(this);
layout->setMargin( 0 );
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing( 0 );

LedCheckBox * link = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/LmmsPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ QPalette LmmsPalette::palette() const
{
QPalette pal = QApplication::style()->standardPalette();

pal.setColor( QPalette::Background, background() );
pal.setColor( QPalette::Window, background() );
pal.setColor( QPalette::WindowText, windowText() );
pal.setColor( QPalette::Base, base() );
pal.setColor( QPalette::ButtonText, buttonText() );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/LmmsStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void LmmsStyle::drawComplexControl( ComplexControl control,
/* else if( control == CC_ScrollBar )
{
painter->fillRect( option->rect, QApplication::palette().color( QPalette::Active,
QPalette::Background ) );
QPalette::Window ) );
}*/
QProxyStyle::drawComplexControl( control, option, painter, widget );
Expand Down
6 changes: 3 additions & 3 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ MainWindow::MainWindow() :
auto main_widget = new QWidget(this);
auto vbox = new QVBoxLayout(main_widget);
vbox->setSpacing( 0 );
vbox->setMargin( 0 );
vbox->setContentsMargins(0, 0, 0, 0);

auto w = new QWidget(main_widget);
auto hbox = new QHBoxLayout(w);
hbox->setSpacing( 0 );
hbox->setMargin( 0 );
hbox->setContentsMargins(0, 0, 0, 0);

auto sideBar = new SideBar(Qt::Vertical, w);

Expand Down Expand Up @@ -206,7 +206,7 @@ MainWindow::MainWindow() :

// add layout for organizing quite complex toolbar-layouting
m_toolBarLayout = new QGridLayout( m_toolBar/*, 2, 1*/ );
m_toolBarLayout->setMargin( 0 );
m_toolBarLayout->setContentsMargins(0, 0, 0, 0);
m_toolBarLayout->setSpacing( 0 );

vbox->addWidget( m_toolBar );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/MixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ MixerView::MixerView() :
m->setHook( this );

//QPalette pal = palette();
//pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
//pal.setColor( QPalette::Window, QColor( 72, 76, 88 ) );
//setPalette( pal );

setAutoFillBackground( true );
Expand All @@ -79,7 +79,7 @@ MixerView::MixerView() :
chLayout = new QHBoxLayout( m_channelAreaWidget );
chLayout->setSizeConstraint( QLayout::SetMinimumSize );
chLayout->setSpacing( 0 );
chLayout->setMargin( 0 );
chLayout->setContentsMargins(0, 0, 0, 0);
m_channelAreaWidget->setLayout(chLayout);

// create rack layout before creating the first channel
Expand Down
2 changes: 1 addition & 1 deletion src/gui/PluginBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ PluginBrowser::PluginBrowser( QWidget * _parent ) :
addContentWidget( m_view );

auto view_layout = new QVBoxLayout(m_view);
view_layout->setMargin( 5 );
view_layout->setContentsMargins(5, 5, 5, 5);
view_layout->setSpacing( 5 );


Expand Down
2 changes: 1 addition & 1 deletion src/gui/SampleTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
// init own layout + widgets
setFocusPolicy(Qt::StrongFocus);
auto vlayout = new QVBoxLayout(this);
vlayout->setMargin(0);
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing(0);

auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/SideBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SideBarWidget::SideBarWidget( const QString & _title, const QPixmap & _icon,
m_contents = new QWidget( this );
m_layout = new QVBoxLayout( m_contents );
m_layout->setSpacing( 5 );
m_layout->setMargin( 0 );
m_layout->setContentsMargins(0, 0, 0, 0);
m_closeBtn = new QPushButton(embed::getIconPixmap("close"), QString(), this);
m_closeBtn->resize(m_buttonSize);
m_closeBtn->setToolTip(tr("Close"));
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/SongEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ SongEditor::SongEditor( Song * song ) :
// create widget for oscilloscope- and cpu-load-widget
auto vc_w = new QWidget(tb);
auto vcw_layout = new QVBoxLayout(vc_w);
vcw_layout->setMargin( 0 );
vcw_layout->setContentsMargins(0, 0, 0, 0);
vcw_layout->setSpacing( 0 );

vcw_layout->addStretch();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editors/TrackContainerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ TrackContainerView::TrackContainerView( TrackContainer * _tc ) :
//keeps the direction of the widget, undepended on the locale
setLayoutDirection( Qt::LeftToRight );
auto layout = new QVBoxLayout(this);
layout->setMargin( 0 );
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing( 0 );
layout->addWidget( m_scrollArea );

auto scrollContent = new QWidget;
m_scrollLayout = new QVBoxLayout( scrollContent );
m_scrollLayout->setMargin( 0 );
m_scrollLayout->setContentsMargins(0, 0, 0, 0);
m_scrollLayout->setSpacing( 0 );
m_scrollLayout->setSizeConstraint( QLayout::SetMinAndMaxSize );

Expand Down
4 changes: 2 additions & 2 deletions src/gui/instrument/InstrumentFunctionViews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ InstrumentFunctionNoteStackingView::InstrumentFunctionNoteStackingView( Instrume
m_chordRangeKnob( new Knob( knobBright_26 ) )
{
auto topLayout = new QHBoxLayout(this);
topLayout->setMargin( 0 );
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->addWidget( m_chordsGroupBox );

auto mainLayout = new QGridLayout(m_chordsGroupBox);
Expand Down Expand Up @@ -109,7 +109,7 @@ InstrumentFunctionArpeggioView::InstrumentFunctionArpeggioView( InstrumentFuncti
m_arpModeComboBox( new ComboBox() )
{
auto topLayout = new QHBoxLayout(this);
topLayout->setMargin( 0 );
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->addWidget( m_arpGroupBox );

auto mainLayout = new QGridLayout(m_arpGroupBox);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/instrument/InstrumentMidiIOView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) :
m_wpBtn( nullptr )
{
auto layout = new QVBoxLayout(this);
layout->setMargin( 5 );
layout->setContentsMargins(5, 5, 5, 5);
m_midiInputGroupBox = new GroupBox( tr( "ENABLE MIDI INPUT" ) );
layout->addWidget( m_midiInputGroupBox );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/instrument/InstrumentMiscView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ InstrumentMiscView::InstrumentMiscView(InstrumentTrack *it, QWidget *parent) :
QWidget(parent)
{
auto layout = new QVBoxLayout(this);
layout->setMargin(5);
layout->setContentsMargins(5, 5, 5, 5);

// Master pitch toggle
m_pitchGroupBox = new GroupBox(tr("GLOBAL TRANSPOSITION"));
Expand Down
4 changes: 2 additions & 2 deletions src/gui/instrument/InstrumentTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// init own layout + widgets
setFocusPolicy( Qt::StrongFocus );
auto vlayout = new QVBoxLayout(this);
vlayout->setMargin( 0 );
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing( 0 );

auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this);
Expand Down Expand Up @@ -246,7 +246,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// FUNC tab
auto instrumentFunctions = new QWidget(m_tabWidget);
auto instrumentFunctionsLayout = new QVBoxLayout(instrumentFunctions);
instrumentFunctionsLayout->setMargin( 5 );
instrumentFunctionsLayout->setContentsMargins(5, 5, 5, 5);
m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking );
m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/instrument/PianoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ PianoView::PianoView(QWidget *parent) :
// create a layout for ourselves
auto layout = new QVBoxLayout(this);
layout->setSpacing( 0 );
layout->setMargin( 0 );
layout->setContentsMargins(0, 0, 0, 0);
layout->addSpacing( PIANO_BASE+PW_WHITE_KEY_HEIGHT );
layout->addWidget( m_pianoScroll );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/modals/ControllerConnectionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ ControllerConnectionDialog::ControllerConnectionDialog( QWidget * _parent,

auto btn_layout = new QHBoxLayout(buttons);
btn_layout->setSpacing( 0 );
btn_layout->setMargin( 0 );
btn_layout->setContentsMargins(0, 0, 0, 0);

auto select_btn = new QPushButton(embed::getIconPixmap("add"), tr("OK"), buttons);
connect( select_btn, SIGNAL(clicked()),
Expand Down
4 changes: 2 additions & 2 deletions src/gui/modals/EffectSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx,
hbox->addWidget(textualInfoWidget);

auto textWidgetLayout = new QVBoxLayout(textualInfoWidget);
textWidgetLayout->setMargin( 4 );
textWidgetLayout->setContentsMargins(4, 4, 4, 4);
textWidgetLayout->setSpacing( 0 );

if ( m_currentSelection.desc->subPluginFeatures )
{
auto subWidget = new QWidget(textualInfoWidget);
auto subLayout = new QVBoxLayout(subWidget);
subLayout->setMargin( 4 );
subLayout->setContentsMargins(4, 4, 4, 4);
subLayout->setSpacing( 0 );
m_currentSelection.desc->subPluginFeatures->
fillDescriptionWidget( subWidget, &m_currentSelection );
Expand Down
Loading

0 comments on commit f89d52f

Please sign in to comment.