UI: Fix warnings for Qt 5.15

AllDockWidgetFeatures is now deprecated. Use underlying values instead.

Use default QFlags constructor instead of nullptr/0.

Use QWheelEvent::angleDelta() in place of orientation() and delta(), and
position() in place of x() and y().
master
jpark37 2020-06-07 15:31:13 -07:00
parent b1d03ae367
commit c2ddc428b0
10 changed files with 46 additions and 27 deletions

View File

@ -431,7 +431,7 @@
<widget class="OBSBasicStatusBar" name="statusbar"/> <widget class="OBSBasicStatusBar" name="statusbar"/>
<widget class="OBSDock" name="scenesDock"> <widget class="OBSDock" name="scenesDock">
<property name="features"> <property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set> <set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Basic.Main.Scenes</string> <string>Basic.Main.Scenes</string>
@ -566,7 +566,7 @@
</widget> </widget>
<widget class="OBSDock" name="sourcesDock"> <widget class="OBSDock" name="sourcesDock">
<property name="features"> <property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set> <set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Basic.Main.Sources</string> <string>Basic.Main.Sources</string>
@ -702,7 +702,7 @@
</widget> </widget>
<widget class="OBSDock" name="mixerDock"> <widget class="OBSDock" name="mixerDock">
<property name="features"> <property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set> <set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Mixer</string> <string>Mixer</string>
@ -842,7 +842,7 @@
</widget> </widget>
<widget class="OBSDock" name="transitionsDock"> <widget class="OBSDock" name="transitionsDock">
<property name="features"> <property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set> <set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Basic.SceneTransitions</string> <string>Basic.SceneTransitions</string>
@ -1089,7 +1089,7 @@
</widget> </widget>
<widget class="OBSDock" name="controlsDock"> <widget class="OBSDock" name="controlsDock">
<property name="features"> <property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set> <set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Basic.Main.Controls</string> <string>Basic.Main.Controls</string>

View File

@ -1686,7 +1686,7 @@ bool WidgetInfo::ColorChanged(const char *setting)
long long val = obs_data_get_int(view->settings, setting); long long val = obs_data_get_int(view->settings, setting);
QColor color = color_from_int(val); QColor color = color_from_int(val);
QColorDialog::ColorDialogOptions options = 0; QColorDialog::ColorDialogOptions options;
/* The native dialog on OSX has all kinds of problems, like closing /* The native dialog on OSX has all kinds of problems, like closing
* other open QDialogs on exit, and * other open QDialogs on exit, and

View File

@ -24,7 +24,7 @@ signals:
public: public:
OBSQTDisplay(QWidget *parent = nullptr, OBSQTDisplay(QWidget *parent = nullptr,
Qt::WindowFlags flags = nullptr); Qt::WindowFlags flags = Qt::WindowFlags());
virtual QPaintEngine *paintEngine() const override; virtual QPaintEngine *paintEngine() const override;

View File

@ -264,7 +264,7 @@ void ExecuteFuncSafeBlockMsgBox(std::function<void()> func,
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowCloseButtonHint); dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowCloseButtonHint);
dlg.setWindowTitle(title); dlg.setWindowTitle(title);
dlg.setText(text); dlg.setText(text);
dlg.setStandardButtons(0); dlg.setStandardButtons(QMessageBox::StandardButtons());
auto wait = [&]() { auto wait = [&]() {
func(); func();

View File

@ -29,7 +29,7 @@ public:
OBSSignal destroyedSignal; OBSSignal destroyedSignal;
OBSSourceLabel(const obs_source_t *source, QWidget *parent = nullptr, OBSSourceLabel(const obs_source_t *source, QWidget *parent = nullptr,
Qt::WindowFlags f = 0) Qt::WindowFlags f = Qt::WindowFlags())
: QLabel(obs_source_get_name(source), parent, f), : QLabel(obs_source_get_name(source), parent, f),
renamedSignal(obs_source_get_signal_handler(source), "rename", renamedSignal(obs_source_get_signal_handler(source), "rename",
&OBSSourceLabel::SourceRenamed, this), &OBSSourceLabel::SourceRenamed, this),

View File

@ -830,7 +830,7 @@ AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent)
streamPage->ui->preferHardware->setChecked(preferHardware); streamPage->ui->preferHardware->setChecked(preferHardware);
} }
setOptions(0); setOptions(QWizard::WizardOptions());
setButtonText(QWizard::FinishButton, setButtonText(QWizard::FinishButton,
QTStr("Basic.AutoConfig.ApplySettings")); QTStr("Basic.AutoConfig.ApplySettings"));
setButtonText(QWizard::BackButton, QTStr("Back")); setButtonText(QWizard::BackButton, QTStr("Back"));

View File

@ -314,22 +314,32 @@ bool OBSBasicInteraction::HandleMouseWheelEvent(QWheelEvent *event)
int xDelta = 0; int xDelta = 0;
int yDelta = 0; int yDelta = 0;
const QPoint angleDelta = event->angleDelta();
if (!event->pixelDelta().isNull()) { if (!event->pixelDelta().isNull()) {
if (event->orientation() == Qt::Horizontal) if (angleDelta.x())
xDelta = event->pixelDelta().x(); xDelta = event->pixelDelta().x();
else else
yDelta = event->pixelDelta().y(); yDelta = event->pixelDelta().y();
} else { } else {
if (event->orientation() == Qt::Horizontal) if (angleDelta.x())
xDelta = event->delta(); xDelta = angleDelta.x();
else else
yDelta = event->delta(); yDelta = angleDelta.y();
} }
if (GetSourceRelativeXY(event->x(), event->y(), mouseEvent.x, #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
mouseEvent.y)) const QPointF position = event->position();
const int x = position.x();
const int y = position.y();
#else
const int x = event->x();
const int y = event->y();
#endif
if (GetSourceRelativeXY(x, y, mouseEvent.x, mouseEvent.y)) {
obs_source_send_mouse_wheel(source, &mouseEvent, xDelta, obs_source_send_mouse_wheel(source, &mouseEvent, xDelta,
yDelta); yDelta);
}
return true; return true;
} }

View File

@ -221,7 +221,9 @@ OBSBasic::OBSBasic(QWidget *parent)
statsDock = new OBSDock(); statsDock = new OBSDock();
statsDock->setObjectName(QStringLiteral("statsDock")); statsDock->setObjectName(QStringLiteral("statsDock"));
statsDock->setFeatures(QDockWidget::AllDockWidgetFeatures); statsDock->setFeatures(QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
statsDock->setWindowTitle(QTStr("Basic.Stats")); statsDock->setWindowTitle(QTStr("Basic.Stats"));
addDockWidget(Qt::BottomDockWidgetArea, statsDock); addDockWidget(Qt::BottomDockWidgetArea, statsDock);
statsDock->setVisible(false); statsDock->setVisible(false);
@ -6982,7 +6984,9 @@ void OBSBasic::on_lockUI_toggled(bool lock)
{ {
QDockWidget::DockWidgetFeatures features = QDockWidget::DockWidgetFeatures features =
lock ? QDockWidget::NoDockWidgetFeatures lock ? QDockWidget::NoDockWidgetFeatures
: QDockWidget::AllDockWidgetFeatures; : (QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
QDockWidget::DockWidgetFeatures mainFeatures = features; QDockWidget::DockWidgetFeatures mainFeatures = features;
mainFeatures &= ~QDockWidget::QDockWidget::DockWidgetClosable; mainFeatures &= ~QDockWidget::QDockWidget::DockWidgetClosable;
@ -7652,7 +7656,9 @@ QAction *OBSBasic::AddDockWidget(QDockWidget *dock)
bool lock = ui->lockUI->isChecked(); bool lock = ui->lockUI->isChecked();
QDockWidget::DockWidgetFeatures features = QDockWidget::DockWidgetFeatures features =
lock ? QDockWidget::NoDockWidgetFeatures lock ? QDockWidget::NoDockWidgetFeatures
: QDockWidget::AllDockWidgetFeatures; : (QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
dock->setFeatures(features); dock->setFeatures(features);

View File

@ -495,13 +495,15 @@ void OBSBasicPreview::keyReleaseEvent(QKeyEvent *event)
void OBSBasicPreview::wheelEvent(QWheelEvent *event) void OBSBasicPreview::wheelEvent(QWheelEvent *event)
{ {
if (scrollMode && IsFixedScaling() && if (scrollMode && IsFixedScaling()) {
event->orientation() == Qt::Vertical) { const int delta = event->angleDelta().y();
if (event->delta() > 0) if (delta != 0) {
SetScalingLevel(scalingLevel + 1); if (delta > 0)
else if (event->delta() < 0) SetScalingLevel(scalingLevel + 1);
SetScalingLevel(scalingLevel - 1); else
emit DisplayResized(); SetScalingLevel(scalingLevel - 1);
emit DisplayResized();
}
} }
OBSQTDisplay::wheelEvent(event); OBSQTDisplay::wheelEvent(event);

View File

@ -105,7 +105,8 @@ private:
void ProcessClick(const vec2 &pos); void ProcessClick(const vec2 &pos);
public: public:
OBSBasicPreview(QWidget *parent, Qt::WindowFlags flags = 0); OBSBasicPreview(QWidget *parent,
Qt::WindowFlags flags = Qt::WindowFlags());
~OBSBasicPreview(); ~OBSBasicPreview();
static OBSBasicPreview *Get(); static OBSBasicPreview *Get();