Skip to content

Commit 4d0c4f9

Browse files
committed
ui: Remove left and right margins from buttons
In the 31.0.x OBS Studio series, the theme sets top and bottom margins on buttons to 0, but leaves the padding in place left and right. When laying out the buttons in a grid this makes the left and right gutters visibly larger than the top and bottom ones. Fix the problem by manually specifying a stylesheet for each grid button. This problem doesn't exist in the latest 31.1.0 beta release. This is a temporary fix until support is dropped for 31.0.x. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
1 parent a98c96c commit 4d0c4f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ptz-controls.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ PTZControls::PTZControls(QWidget *parent) : QFrame(parent), ui(new Ui::PTZContro
149149
{
150150
instance = this;
151151
ui->setupUi(this);
152+
153+
/* Compatability: Before OBS Studio 31.1.0 the theme had left and right
154+
* margins on widgets which mess with the grid layout used by this
155+
* plugin. If the version is earlier than 31.1.0 then apply an extra
156+
* style sheet to fix */
157+
if (obs_get_version() < MAKE_SEMANTIC_VERSION(31, 1, 0))
158+
this->setStyleSheet("margin-left: 0px; margin-right: 0px");
159+
152160
ui->cameraList->setModel(&ptzDeviceList);
153161
ui->cameraList->setItemDelegate(new PTZDeviceListDelegate(ui->cameraList));
154162
connect(&ptzDeviceList, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,

0 commit comments

Comments
 (0)