Skip to content

Commit

Permalink
Fix SplitterStyle destruction (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjeffer authored Feb 9, 2025
1 parent b3b0a24 commit f7c03bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ void MainWindow::setupMainWindow()
#endif
ui->listviewLabel1->setFont(titleFont);
ui->listviewLabel2->setFont(titleFont);
m_splitterStyle = new SplitterStyle();
m_splitterStyle = new SplitterStyle(this);
m_splitter->setStyle(m_splitterStyle);
m_splitter->setHandleWidth(0);
setNoteListLoading();
Expand Down
5 changes: 4 additions & 1 deletion src/splitterstyle.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "splitterstyle.h"

SplitterStyle::SplitterStyle() { }
SplitterStyle::SplitterStyle(QObject *parent) : QProxyStyle()
{
setParent(parent); // to ensure proper object destruction
}

void SplitterStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
const QWidget *w) const
Expand Down
8 changes: 4 additions & 4 deletions src/splitterstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

class SplitterStyle : public QProxyStyle
{
Q_OBJECT
public:
SplitterStyle();
SplitterStyle(QObject *parent);

// QStyle interface
public:
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
const QWidget *w) const override;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
const QWidget *w) const override;
};

#endif // SPLITTERSTYLE_H

0 comments on commit f7c03bd

Please sign in to comment.