# HG changeset patch # User Chris Cannam # Date 1481802852 0 # Node ID 7609580fb05a8ade15ee12a6a85b2af7814dc046 # Parent 9907be1c4f89912c63c59daa376cf1b69e39c3e1 Make play params area of property box look a bit better on OSX diff -r 9907be1c4f89 -r 7609580fb05a files.pri --- a/files.pri Thu Dec 15 11:53:52 2016 +0000 +++ b/files.pri Thu Dec 15 11:54:12 2016 +0000 @@ -66,6 +66,7 @@ widgets/NotifyingComboBox.h \ widgets/NotifyingPushButton.h \ widgets/NotifyingTabBar.h \ + widgets/NotifyingToolButton.h \ widgets/Panner.h \ widgets/PluginParameterBox.h \ widgets/PluginParameterDialog.h \ @@ -144,6 +145,7 @@ widgets/NotifyingComboBox.cpp \ widgets/NotifyingPushButton.cpp \ widgets/NotifyingTabBar.cpp \ + widgets/NotifyingToolButton.cpp \ widgets/Panner.cpp \ widgets/PluginParameterBox.cpp \ widgets/PluginParameterDialog.cpp \ diff -r 9907be1c4f89 -r 7609580fb05a widgets/NotifyingPushButton.h --- a/widgets/NotifyingPushButton.h Thu Dec 15 11:53:52 2016 +0000 +++ b/widgets/NotifyingPushButton.h Thu Dec 15 11:54:12 2016 +0000 @@ -13,14 +13,15 @@ COPYING included with this distribution for more information. */ -#ifndef _NOTIFYING_PUSH_BUTTON_H_ -#define _NOTIFYING_PUSH_BUTTON_H_ +#ifndef SV_NOTIFYING_PUSH_BUTTON_H +#define SV_NOTIFYING_PUSH_BUTTON_H #include /** - * Very trivial enhancement to QPushButton to make it emit signals when - * the mouse enters and leaves (for context help). + * Very trivial enhancement to QPushButton to make it emit signals + * when the mouse enters and leaves (for context help). See also + * NotifyingToolButton */ class NotifyingPushButton : public QPushButton diff -r 9907be1c4f89 -r 7609580fb05a widgets/PropertyBox.cpp --- a/widgets/PropertyBox.cpp Thu Dec 15 11:53:52 2016 +0000 +++ b/widgets/PropertyBox.cpp Thu Dec 15 11:54:12 2016 +0000 @@ -34,12 +34,14 @@ #include "NotifyingCheckBox.h" #include "NotifyingComboBox.h" #include "NotifyingPushButton.h" +#include "NotifyingToolButton.h" #include "ColourNameDialog.h" #include #include #include #include +#include #include #include #include @@ -150,7 +152,7 @@ m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); m_mainBox->addWidget(m_viewPlayFrame); - QHBoxLayout *layout = new QHBoxLayout; + QGridLayout *layout = new QGridLayout; m_viewPlayFrame->setLayout(layout); layout->setMargin(layout->margin() / 2); @@ -158,14 +160,17 @@ #ifdef DEBUG_PROPERTY_BOX SVDEBUG << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName() << ") params " << params << endl; #endif - + + QSize buttonSize = WidgetScale::scaleQSize(QSize(26, 26)); + int col = 0; + if (params) { - - m_playButton = new NotifyingPushButton; + + m_playButton = new NotifyingToolButton; m_playButton->setCheckable(true); m_playButton->setIcon(IconLoader().load("speaker")); m_playButton->setChecked(!params->isPlayMuted()); - layout->addWidget(m_playButton); + m_playButton->setFixedSize(buttonSize); connect(m_playButton, SIGNAL(toggled(bool)), this, SLOT(playAudibleButtonChanged(bool))); connect(m_playButton, SIGNAL(mouseEntered()), @@ -174,10 +179,11 @@ this, SLOT(mouseLeftWidget())); connect(params, SIGNAL(playAudibleChanged(bool)), this, SLOT(playAudibleChanged(bool))); - layout->setAlignment(m_playButton, Qt::AlignVCenter); LevelPanToolButton *levelPan = new LevelPanToolButton; - layout->addWidget(levelPan); + levelPan->setFixedSize(buttonSize); + levelPan->setImageSize((buttonSize.height() * 3) / 4); + layout->addWidget(levelPan, 0, col++, Qt::AlignCenter); connect(levelPan, SIGNAL(levelChanged(float)), this, SLOT(playGainControlChanged(float))); connect(levelPan, SIGNAL(panChanged(float)), @@ -191,13 +197,14 @@ connect(levelPan, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); + layout->addWidget(m_playButton, 0, col++, Qt::AlignCenter); + if (params->getPlayClipId() != "") { - NotifyingPushButton *playParamButton = new NotifyingPushButton; + QToolButton *playParamButton = new QToolButton; playParamButton->setObjectName("playParamButton"); playParamButton->setIcon(IconLoader().load("faders")); - playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24)); - playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24)); - layout->addWidget(playParamButton); + playParamButton->setFixedSize(buttonSize); + layout->addWidget(playParamButton, 0, col++, Qt::AlignCenter); connect(playParamButton, SIGNAL(clicked()), this, SLOT(editPlayParameters())); connect(playParamButton, SIGNAL(mouseEntered()), @@ -207,23 +214,21 @@ } } - layout->insertStretch(-1, 10); + layout->setColumnStretch(col++, 10); if (layer) { QLabel *showLabel = new QLabel(tr("Show")); - layout->addWidget(showLabel); - layout->setAlignment(showLabel, Qt::AlignVCenter); + layout->addWidget(showLabel, 0, col++, Qt::AlignVCenter | Qt::AlignRight); m_showButton = new LEDButton(Qt::blue); - layout->addWidget(m_showButton); + layout->addWidget(m_showButton, 0, col++, Qt::AlignVCenter | Qt::AlignLeft); connect(m_showButton, SIGNAL(stateChanged(bool)), this, SIGNAL(showLayer(bool))); connect(m_showButton, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); connect(m_showButton, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); - layout->setAlignment(m_showButton, Qt::AlignVCenter); } } diff -r 9907be1c4f89 -r 7609580fb05a widgets/PropertyBox.h --- a/widgets/PropertyBox.h Thu Dec 15 11:53:52 2016 +0000 +++ b/widgets/PropertyBox.h Thu Dec 15 11:54:12 2016 +0000 @@ -27,6 +27,7 @@ class QVBoxLayout; class QLabel; class LEDButton; +class QToolButton; class NotifyingPushButton; class PropertyBox : public QFrame @@ -81,7 +82,7 @@ QFrame *m_viewPlayFrame; QVBoxLayout *m_mainBox; LEDButton *m_showButton; - NotifyingPushButton *m_playButton; + QToolButton *m_playButton; std::map m_groupLayouts; std::map m_propertyControllers; };