mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 15:29:44 -05: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)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
resetComponentEditWidget();
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void KeyComponentWidget::resetComponentEditWidget()
|
||||
{
|
||||
if (m_ui->componentWidgetLayout->isEmpty() || static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
||||
if (!m_ui->componentWidgetLayout->isEmpty()) {
|
||||
auto* item = m_ui->componentWidgetLayout->takeAt(0);
|
||||
if (item->widget()) {
|
||||
delete item->widget();
|
||||
}
|
||||
delete item;
|
||||
if (!m_componentWidget || static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
||||
if (m_componentWidget) {
|
||||
delete m_componentWidget;
|
||||
}
|
||||
|
||||
QWidget* widget = componentEditWidget();
|
||||
m_ui->componentWidgetLayout->addWidget(widget);
|
||||
|
||||
initComponentEditWidget(widget);
|
||||
m_componentWidget = componentEditWidget();
|
||||
m_ui->componentWidgetLayout->addWidget(m_componentWidget);
|
||||
initComponentEditWidget(m_componentWidget);
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(updateSize()));
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -128,6 +129,7 @@ private:
|
||||
Page m_previousPage = Page::AddNew;
|
||||
QString m_componentName;
|
||||
QString m_componentDescription;
|
||||
QPointer<QWidget> m_componentWidget;
|
||||
|
||||
const QScopedPointer<Ui::KeyComponentWidget> m_ui;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user