mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix double password edit field
This commit is contained in:
parent
f49a8a7f70
commit
e025444c86
@ -168,25 +168,20 @@ void KeyComponentWidget::cancelEdit()
|
|||||||
|
|
||||||
void KeyComponentWidget::showEvent(QShowEvent* event)
|
void KeyComponentWidget::showEvent(QShowEvent* event)
|
||||||
{
|
{
|
||||||
QWidget::showEvent(event);
|
|
||||||
resetComponentEditWidget();
|
resetComponentEditWidget();
|
||||||
|
QWidget::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyComponentWidget::resetComponentEditWidget()
|
void KeyComponentWidget::resetComponentEditWidget()
|
||||||
{
|
{
|
||||||
if (m_ui->componentWidgetLayout->isEmpty() || static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
if (!m_componentWidget || static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
||||||
if (!m_ui->componentWidgetLayout->isEmpty()) {
|
if (m_componentWidget) {
|
||||||
auto* item = m_ui->componentWidgetLayout->takeAt(0);
|
delete m_componentWidget;
|
||||||
if (item->widget()) {
|
|
||||||
delete item->widget();
|
|
||||||
}
|
|
||||||
delete item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* widget = componentEditWidget();
|
m_componentWidget = componentEditWidget();
|
||||||
m_ui->componentWidgetLayout->addWidget(widget);
|
m_ui->componentWidgetLayout->addWidget(m_componentWidget);
|
||||||
|
initComponentEditWidget(m_componentWidget);
|
||||||
initComponentEditWidget(widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, this, SLOT(updateSize()));
|
QTimer::singleShot(0, this, SLOT(updateSize()));
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -128,6 +129,7 @@ private:
|
|||||||
Page m_previousPage = Page::AddNew;
|
Page m_previousPage = Page::AddNew;
|
||||||
QString m_componentName;
|
QString m_componentName;
|
||||||
QString m_componentDescription;
|
QString m_componentDescription;
|
||||||
|
QPointer<QWidget> m_componentWidget;
|
||||||
|
|
||||||
const QScopedPointer<Ui::KeyComponentWidget> m_ui;
|
const QScopedPointer<Ui::KeyComponentWidget> m_ui;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user