fix qlayout error

This commit is contained in:
Malte Jürgens 2023-02-15 02:21:41 +01:00
parent c52daab420
commit 36c8cfedb7
No known key found for this signature in database
GPG key ID: D29FBD5F93C0CFC3
4 changed files with 13 additions and 16 deletions

View file

@ -9,7 +9,7 @@
#include <QSizePolicy>
#include <QVBoxLayout>
StreamDialog::StreamDialog() : QWidget() {
StreamDialog::StreamDialog(QWidget *parent) : QDialog(parent) {
setAttribute(Qt::WA_QuitOnClose, false);
{
@ -22,8 +22,7 @@ StreamDialog::StreamDialog() : QWidget() {
layout->addWidget(m_videoGroupBox);
{
auto videoLayout = new QVBoxLayout(this);
m_videoGroupBox->setLayout(videoLayout);
auto videoLayout = new QVBoxLayout(m_videoGroupBox);
auto resolutionLabel = new QLabel(this);
resolutionLabel->setText("Resolution");
@ -60,15 +59,14 @@ StreamDialog::StreamDialog() : QWidget() {
layout->addWidget(m_audioGroupBox);
{
auto audioLayout = new QVBoxLayout(this);
m_audioGroupBox->setLayout(audioLayout);
auto audioLayout = new QVBoxLayout(m_audioGroupBox);
auto targetLabel = new QLabel(this);
targetLabel->setText("Audio Source");
audioLayout->addWidget(targetLabel);
{
auto targetLayout = new QHBoxLayout(this);
auto targetLayout = new QHBoxLayout();
audioLayout->addLayout(targetLayout);
m_targetComboBox = new QComboBox(this);
@ -88,8 +86,6 @@ StreamDialog::StreamDialog() : QWidget() {
button->setText("Start Stream");
connect(button, &QPushButton::clicked, this, &StreamDialog::startStream);
layout->addWidget(button, Qt::AlignRight | Qt::AlignBottom);
setLayout(layout);
}
setWindowTitle("discord-screenaudio Stream Dialog");

View file

@ -5,11 +5,11 @@
#include <QGroupBox>
#include <QWidget>
class StreamDialog : public QWidget {
class StreamDialog : public QDialog {
Q_OBJECT
public:
explicit StreamDialog();
explicit StreamDialog(QWidget *parent = nullptr);
private:
QComboBox *m_targetComboBox;

View file

@ -74,7 +74,8 @@ void UserScript::setupShortcutsDialog() {
}
void UserScript::setupStreamDialog() {
connect(&m_streamDialog, &StreamDialog::requestedStreamStart, this,
m_streamDialog = new StreamDialog(MainWindow::instance());
connect(m_streamDialog, &StreamDialog::requestedStreamStart, this,
&UserScript::startStream);
}
@ -156,9 +157,9 @@ void UserScript::startStream(bool video, bool audio, int width, int height,
}
void UserScript::showStreamDialog() {
if (m_streamDialog.isHidden())
m_streamDialog.setHidden(false);
if (m_streamDialog->isHidden())
m_streamDialog->setHidden(false);
else
m_streamDialog.activateWindow();
m_streamDialog.updateTargets();
m_streamDialog->activateWindow();
m_streamDialog->updateTargets();
}

View file

@ -30,7 +30,7 @@ public:
private:
QProcess m_virtmicProcess;
StreamDialog m_streamDialog;
StreamDialog *m_streamDialog;
bool m_kxmlgui = false;
bool m_kglobalaccel = false;
#ifdef KXMLGUI