upgrade to qt 6 compliance

This commit is contained in:
itsmattkc
2022-10-28 19:42:14 -07:00
parent 2a595cb4c7
commit 4d80044d6d
69 changed files with 152 additions and 130 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ ColorValuesWidget::ColorValuesWidget(ColorManager *manager, QWidget *parent) :
{
QHBoxLayout* preview_layout = new QHBoxLayout();
preview_layout->setMargin(0);
preview_layout->setContentsMargins(0, 0, 0, 0);
preview_layout->addWidget(new QLabel(tr("Preview")));
+2 -2
View File
@@ -53,7 +53,7 @@ CurveWidget::CurveWidget(QWidget *parent) :
QWidget* workarea = new QWidget();
QVBoxLayout* layout = new QVBoxLayout(workarea);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
splitter->addWidget(workarea);
QHBoxLayout* top_controls = new QHBoxLayout();
@@ -86,7 +86,7 @@ CurveWidget::CurveWidget(QWidget *parent) :
// We use a separate layout for the ruler+view combination so that there's no spacing between them
QVBoxLayout* ruler_view_layout = new QVBoxLayout();
ruler_view_layout->setMargin(0);
ruler_view_layout->setContentsMargins(0, 0, 0, 0);
ruler_view_layout->setSpacing(0);
ruler_view_layout->addWidget(ruler());
+1 -1
View File
@@ -34,7 +34,7 @@ FileField::FileField(QWidget* parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
line_edit_ = new QLineEdit();
connect(line_edit_, &QLineEdit::textChanged, this, &FileField::LineEditChanged);
+1 -1
View File
@@ -146,7 +146,7 @@ QSize FlowLayout::minimumSize() const
foreach (item, itemList)
size = size.expandedTo(item->minimumSize());
size += QSize(2*margin(), 2*margin());
size += QSize(2*contentsMargins().left(), 2*contentsMargins().top());
return size;
}
+3 -3
View File
@@ -38,7 +38,7 @@ ManagedDisplayWidget::ManagedDisplayWidget(QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
if (RenderManager::instance()->backend() == RenderManager::kOpenGL) {
// Create OpenGL widget
@@ -312,11 +312,11 @@ bool ManagedDisplayWidget::eventFilter(QObject *o, QEvent *e)
{
// HACK: QWindows don't seem to receive ContextMenu events on right click (only when pressing
// the menu button on the keyboard) so we handle it manually here
QMouseEvent *ev = static_cast<QMouseEvent*>(e);
/*QMouseEvent *ev = static_cast<QMouseEvent*>(e);
if (ev->button() == Qt::RightButton) {
emit customContextMenuRequested(ev->pos());
return true;
}
}*/
break;
}
default:
@@ -48,6 +48,15 @@ class ManagedDisplayWidgetOpenGL
public:
ManagedDisplayWidgetOpenGL() = default;
virtual ~ManagedDisplayWidgetOpenGL() override
{
if (context()) {
DestroyListener();
disconnect(context(), &QOpenGLContext::aboutToBeDestroyed,
this, &ManagedDisplayWidgetOpenGL::DestroyListener);
}
}
signals:
// Render signals
void OnInit();
+2
View File
@@ -20,6 +20,8 @@
#include "menushared.h"
#include <QActionGroup>
#include "core.h"
#include "common/timecodefunctions.h"
#include "panel/panelmanager.h"
+2 -2
View File
@@ -46,7 +46,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
// Create horizontal layout to place scroll area in (and keyframe editing eventually)
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
QSplitter* splitter = new QSplitter(Qt::Horizontal);
layout->addWidget(splitter);
@@ -113,7 +113,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
QWidget* keyframe_area = new QWidget();
QVBoxLayout* keyframe_area_layout = new QVBoxLayout(keyframe_area);
keyframe_area_layout->setSpacing(0);
keyframe_area_layout->setMargin(0);
keyframe_area_layout->setContentsMargins(0, 0, 0, 0);
// Create ruler object
keyframe_area_layout->addWidget(ruler());
@@ -37,7 +37,7 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
connected_node_(nullptr)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
QSizePolicy p = sizePolicy();
p.setHorizontalStretch(1);
@@ -47,7 +47,7 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
// Set up label area
QHBoxLayout *label_layout = new QHBoxLayout();
label_layout->setSpacing(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")));
label_layout->setMargin(0);
label_layout->setContentsMargins(0, 0, 0, 0);
layout->addLayout(label_layout);
CollapseButton *collapse_btn = new CollapseButton(this);
@@ -33,7 +33,7 @@ NodeParamViewKeyframeControl::NodeParamViewKeyframeControl(bool right_align, QWi
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
if (right_align) {
@@ -31,7 +31,7 @@ NodeParamViewTextEdit::NodeParamViewTextEdit(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
line_edit_ = new QPlainTextEdit();
line_edit_->setUndoRedoEnabled(true);
@@ -567,7 +567,7 @@ void NodeParamViewWidgetBridge::SetProperty(const QString &key, const QVariant &
}
} else { // set specific track/widget
bool ok;
int element = key.midRef(7).toInt(&ok);
int element = key.mid(7).toInt(&ok);
int tracks = NodeValue::get_number_of_keyframe_tracks(data_type);
if (ok && element >= 0 && element < tracks) {
@@ -686,7 +686,7 @@ void NodeParamViewWidgetBridge::SetProperty(const QString &key, const QVariant &
}
} else {
bool ok;
int element = key.midRef(5).toInt(&ok);
int element = key.mid(5).toInt(&ok);
if (ok && element >= 0 && element < tracks) {
static_cast<SliderBase*>(widgets_.at(element))->SetColor(c);
}
+1 -1
View File
@@ -29,7 +29,7 @@ NodeTableWidget::NodeTableWidget(QWidget* parent) :
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
view_ = new NodeTableView();
layout->addWidget(view_);
+1 -1
View File
@@ -13,7 +13,7 @@ NodeViewToolBar::NodeViewToolBar(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
add_node_btn_ = new QPushButton();
connect(add_node_btn_, &QPushButton::clicked, this, &NodeViewToolBar::AddNodeClicked);
+1 -1
View File
@@ -28,7 +28,7 @@ NodeWidget::NodeWidget(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout *outer_layout = new QVBoxLayout(this);
outer_layout->setMargin(0);
outer_layout->setContentsMargins(0, 0, 0, 0);
toolbar_ = new NodeViewToolBar();
outer_layout->addWidget(toolbar_);
+1 -1
View File
@@ -158,7 +158,7 @@ void PanelWidget::SetWidgetWithPadding(QWidget *widget)
{
QWidget* wrapper = new QWidget();
QHBoxLayout* layout = new QHBoxLayout(wrapper);
layout->setMargin(layout->margin() / 2);
layout->setContentsMargins(layout->contentsMargins() / 2);
layout->addWidget(widget);
setWidget(wrapper);
}
+1 -1
View File
@@ -32,7 +32,7 @@ PathWidget::PathWidget(const QString &path, QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
path_edit_ = new QLineEdit();
path_edit_->setText(path);
+1 -1
View File
@@ -68,7 +68,7 @@ ManagedPixelSamplerWidget::ManagedPixelSamplerWidget(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
display_view_ = new PixelSamplerWidget();
display_view_->setTitle(tr("Display"));
@@ -37,7 +37,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
// Create lower controls
QHBoxLayout* lower_control_layout = new QHBoxLayout(this);
lower_control_layout->setSpacing(0);
lower_control_layout->setMargin(0);
lower_control_layout->setContentsMargins(0, 0, 0, 0);
QSizePolicy lower_container_size_policy(QSizePolicy::Maximum, QSizePolicy::Expanding);
lower_container_size_policy.setHorizontalStretch(1);
@@ -51,7 +51,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_left_layout = new QHBoxLayout(lower_left_container_);
lower_left_layout->setSpacing(0);
lower_left_layout->setMargin(0);
lower_left_layout->setContentsMargins(0, 0, 0, 0);
cur_tc_lbl_ = new RationalSlider();
cur_tc_lbl_->SetDisplayType(RationalSlider::kTime);
@@ -73,7 +73,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_middle_layout = new QHBoxLayout(lower_middle_container);
lower_middle_layout->setSpacing(0);
lower_middle_layout->setMargin(0);
lower_middle_layout->setContentsMargins(0, 0, 0, 0);
lower_middle_layout->addStretch();
QSizePolicy btn_sz_policy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@@ -124,7 +124,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
av_btn_widget->setSizePolicy(lower_container_size_policy);
QHBoxLayout* av_btn_layout = new QHBoxLayout(av_btn_widget);
av_btn_layout->setSpacing(0);
av_btn_layout->setMargin(0);
av_btn_layout->setContentsMargins(0, 0, 0, 0);
video_drag_btn_ = new DragButton();
connect(video_drag_btn_, &QPushButton::clicked, this, &PlaybackControls::VideoClicked);
connect(video_drag_btn_, &DragButton::MousePressed, this, &PlaybackControls::VideoPressed);
@@ -143,7 +143,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
QHBoxLayout* lower_right_layout = new QHBoxLayout(lower_right_container_);
lower_right_layout->setSpacing(0);
lower_right_layout->setMargin(0);
lower_right_layout->setContentsMargins(0, 0, 0, 0);
lower_right_layout->addStretch();
end_tc_lbl_ = new QLabel();
@@ -53,7 +53,7 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
// Create layout
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Set up navigation bar
nav_bar_ = new ProjectExplorerNavigation(this);
@@ -33,7 +33,7 @@ ProjectExplorerNavigation::ProjectExplorerNavigation(QWidget *parent) :
{
// Create widget layout
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Create "directory up" button
dir_up_btn_ = new QPushButton(this);
+1 -1
View File
@@ -33,7 +33,7 @@ ProjectToolbar::ProjectToolbar(QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
new_button_ = new QPushButton();
connect(new_button_, &QPushButton::clicked, this, &ProjectToolbar::NewClicked);
+14 -2
View File
@@ -103,14 +103,26 @@ void SliderBase::changeEvent(QEvent *e)
super::changeEvent(e);
}
bool SliderBase::GetLabelSubstitution(const QVariant &v, QString *out) const
{
for (auto it=label_substitutions_.constBegin(); it!=label_substitutions_.constEnd(); it++) {
if (it->first == v) {
*out = it->second;
return true;
}
}
return false;
}
void SliderBase::UpdateLabel()
{
QString s;
if (tristate_) {
s = tr("---");
} else if (label_substitutions_.contains(GetValueInternal())) {
s = label_substitutions_.value(GetValueInternal());
} else if (GetLabelSubstitution(GetValueInternal(), &s)) {
// String will already be set, just pass through
} else {
s = GetFormattedValueToString();
}
+4 -2
View File
@@ -51,7 +51,7 @@ public:
void InsertLabelSubstitution(const QVariant &value, const QString &label)
{
label_substitutions_.insert(value, label);
label_substitutions_.append({value, label});
UpdateLabel();
}
@@ -90,6 +90,8 @@ protected:
virtual void changeEvent(QEvent* e) override;
private:
bool GetLabelSubstitution(const QVariant &v, QString *out) const;
SliderLabel* label_;
FocusableLineEdit* editor_;
@@ -103,7 +105,7 @@ private:
bool format_plural_;
QMap<QVariant, QString> label_substitutions_;
QVector<QPair<QVariant, QString> > label_substitutions_;
private slots:
void LineEditConfirmed();
+1 -1
View File
@@ -42,7 +42,7 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString
QFrame(parent, Qt::Popup)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
setFrameShape(QFrame::Box);
@@ -43,7 +43,7 @@ public:
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(inner_);
RepopulateList();
+1 -1
View File
@@ -34,7 +34,7 @@ ElapsedCounterWidget::ElapsedCounterWidget(QWidget* parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(layout->spacing() * 8);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
elapsed_lbl_ = new QLabel();
layout->addWidget(elapsed_lbl_);
+1 -1
View File
@@ -37,7 +37,7 @@ TaskView::TaskView(QWidget* parent) :
// Create layout for central widget
layout_ = new QVBoxLayout(central_widget_);
layout_->setSpacing(0);
layout_->setMargin(0);
layout_->setContentsMargins(0, 0, 0, 0);
// Add a "stretch" so that TaskViewItems don't try to expand all the way to the bottom
layout_->addStretch();
@@ -30,7 +30,7 @@ TimelineAndTrackView::TimelineAndTrackView(Qt::Alignment vertical_alignment, QWi
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
splitter_ = new QSplitter(Qt::Horizontal);
splitter_->setChildrenCollapsible(false);
+1 -1
View File
@@ -73,7 +73,7 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
{
QVBoxLayout* vert_layout = new QVBoxLayout(this);
vert_layout->setSpacing(0);
vert_layout->setMargin(0);
vert_layout->setContentsMargins(0, 0, 0, 0);
QHBoxLayout* ruler_and_time_layout = new QHBoxLayout();
vert_layout->addLayout(ruler_and_time_layout);
@@ -42,7 +42,7 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent) :
setWidgetResizable(true);
QVBoxLayout* layout = new QVBoxLayout(central);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
if (alignment_ == Qt::AlignBottom) {
@@ -40,7 +40,7 @@ TrackViewItem::TrackViewItem(Track* track, QWidget *parent) :
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
stack_ = new QStackedWidget();
layout->addWidget(stack_);
+1 -1
View File
@@ -38,7 +38,7 @@ Toolbar::Toolbar(QWidget *parent) :
super(parent)
{
layout_ = new FlowLayout(this);
layout_->setMargin(0);
layout_->setContentsMargins(0, 0, 0, 0);
// Create standard tool buttons
btn_pointer_tool_ = CreateToolButton(Tool::kPointer);
+5 -2
View File
@@ -82,7 +82,7 @@ ViewerWidget::ViewerWidget(ViewerDisplayWidget *display, QWidget *parent) :
{
// Set up main layout
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
// Create main OpenGL-based view and sizer
sizer_ = new ViewerSizer();
@@ -166,6 +166,9 @@ ViewerWidget::~ViewerWidget()
foreach (ViewerWindow* window, windows) {
delete window;
}
delete display_widget_;
display_widget_ = nullptr;
}
void ViewerWidget::TimeChangedEvent(const rational &time)
@@ -1146,7 +1149,7 @@ RenderTicketPtr ViewerWidget::GetFrame(const rational &t)
// Frame has been cached, grab the frame
RenderTicketPtr ticket = std::make_shared<RenderTicket>();
ticket->setProperty("time", QVariant::fromValue(t));
QtConcurrent::run(ViewerWidget::DecodeCachedImage, ticket, GetConnectedNode()->video_frame_cache()->GetCacheDirectory(), GetConnectedNode()->video_frame_cache()->GetUuid(), Timecode::time_to_timestamp(t, timebase(), Timecode::kFloor));
QtConcurrent::run(static_cast<void(*)(RenderTicketPtr, const QString &, const QUuid &, const int64_t &)>(ViewerWidget::DecodeCachedImage), ticket, GetConnectedNode()->video_frame_cache()->GetCacheDirectory(), GetConnectedNode()->video_frame_cache()->GetUuid(), Timecode::time_to_timestamp(t, timebase(), Timecode::kFloor));
return ticket;
}
}
+4 -4
View File
@@ -1051,7 +1051,7 @@ void ViewerDisplayWidget::DrawSubtitleTracks()
f.setFamily(family);
}
f.setWeight(OLIVE_CONFIG("DefaultSubtitleWeight").toInt());
f.setWeight(static_cast<QFont::Weight>(OLIVE_CONFIG("DefaultSubtitleWeight").toInt()));
bounding_box.adjust(bounding_box.width()/10, bounding_box.height()/10, -bounding_box.width()/10, -bounding_box.height()/10);
@@ -1145,7 +1145,7 @@ void ViewerDisplayWidget::ForwardDragEventToTextEdit(T *e)
bool ViewerDisplayWidget::ForwardMouseEventToTextEdit(QMouseEvent *event, bool check_if_outside)
{
// Transform screen mouse coords to world mouse coords
QPointF local_pos = GetVirtualPosForTextEdit(event->localPos());
QPointF local_pos = GetVirtualPosForTextEdit(event->position());
if (check_if_outside) {
if (local_pos.x() < 0 || local_pos.x() >= text_edit_->width() || local_pos.y() < 0 || local_pos.y() >= text_edit_->height()) {
@@ -1156,8 +1156,8 @@ bool ViewerDisplayWidget::ForwardMouseEventToTextEdit(QMouseEvent *event, bool c
local_pos = AdjustPosByVAlign(local_pos);
event->setLocalPos(local_pos);
return ForwardEventToTextEdit(event);
QMouseEvent derived(event->type(), local_pos, event->scenePosition(), event->globalPosition(), event->button(), event->buttons(), event->modifiers(), event->source(), event->pointingDevice());
return ForwardEventToTextEdit(&derived);
}
bool ViewerDisplayWidget::ForwardEventToTextEdit(QEvent *event)
-2
View File
@@ -21,8 +21,6 @@
#ifndef VIEWERQUEUE_H
#define VIEWERQUEUE_H
#include <QLinkedList>
#include "codec/frame.h"
namespace olive {
+1 -1
View File
@@ -32,7 +32,7 @@ ViewerWindow::ViewerWindow(QWidget *parent) :
pixel_aspect_(1)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
display_widget_ = new ViewerDisplayWidget();