mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 09:22:18 -07:00
manual delete
This commit is contained in:
parent
005ec27e15
commit
e8de848017
2 changed files with 11 additions and 1 deletions
|
|
@ -6,7 +6,7 @@
|
|||
#include <QScreen>
|
||||
|
||||
SettingsButtonWidget::SettingsButtonWidget(QWidget *parent)
|
||||
: QWidget(parent), button(new QToolButton(this)), popup(new SettingsPopupWidget(this))
|
||||
: QWidget(parent), button(new QToolButton(this)), popup(new SettingsPopupWidget(nullptr))
|
||||
{
|
||||
button->setIcon(QPixmap("theme:icons/cogwheel"));
|
||||
button->setCheckable(true);
|
||||
|
|
@ -20,6 +20,13 @@ SettingsButtonWidget::SettingsButtonWidget(QWidget *parent)
|
|||
setLayout(layout);
|
||||
}
|
||||
|
||||
SettingsButtonWidget::~SettingsButtonWidget()
|
||||
{
|
||||
// We don't parent the popup because it might lead to better behavior on certain window managers.
|
||||
// So we have to manually delete it
|
||||
popup->deleteLater();
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::addSettingsWidget(QWidget *toAdd) const
|
||||
{
|
||||
popup->addSettingsWidget(toAdd);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class SettingsButtonWidget : public QWidget
|
|||
|
||||
public:
|
||||
explicit SettingsButtonWidget(QWidget *parent = nullptr);
|
||||
|
||||
~SettingsButtonWidget() override;
|
||||
|
||||
void addSettingsWidget(QWidget *toAdd) const;
|
||||
void removeSettingsWidget(QWidget *toRemove) const;
|
||||
void setButtonIcon(QPixmap iconMap);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue