Skip to content

Commit

Permalink
Fix layout and alignment of Entry and Group edit views
Browse files Browse the repository at this point in the history
* Fixes #5321 - Text alignment in the general tab of the entry and group edit views is fixed
* Fixes #5300 - Errant scrollbar in the general tab is fixed
* Fixes #4852 - Tabbing into notes field works as expected. To tab out, currently only Shift+Tab works.
  • Loading branch information
droidmonkey committed Sep 26, 2020
1 parent 3c5bd0f commit 55e4889
Show file tree
Hide file tree
Showing 8 changed files with 562 additions and 490 deletions.
18 changes: 12 additions & 6 deletions src/gui/EditWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ void EditWidget::addPage(const QString& labelText, const QIcon& icon, QWidget* w
* from automatic resizing and it now should be able to fit into a user's monitor even if the monitor is only 768
* pixels high.
*/
auto* scrollArea = new QScrollArea(m_ui->stackedWidget);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setWidget(widget);
scrollArea->setWidgetResizable(true);
m_ui->stackedWidget->addWidget(scrollArea);
if (widget->inherits("QScrollArea")) {
m_ui->stackedWidget->addWidget(widget);
} else {
auto* scrollArea = new QScrollArea(m_ui->stackedWidget);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setFrameShadow(QFrame::Plain);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setSizeAdjustPolicy(QScrollArea::AdjustToContents);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(widget);
m_ui->stackedWidget->addWidget(scrollArea);
}
m_ui->categoryList->addCategory(labelText, icon);
}

Expand Down
5 changes: 4 additions & 1 deletion src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
, m_historyUi(new Ui::EditEntryWidgetHistory())
, m_browserUi(new Ui::EditEntryWidgetBrowser())
, m_customData(new CustomData())
, m_mainWidget(new QWidget())
, m_mainWidget(new QScrollArea())
, m_advancedWidget(new QWidget())
, m_iconsWidget(new EditWidgetIcons())
, m_autoTypeWidget(new QWidget())
Expand Down Expand Up @@ -178,6 +178,9 @@ void EditEntryWidget::setupMain()

m_mainUi->expirePresets->setMenu(createPresetsMenu());
connect(m_mainUi->expirePresets->menu(), SIGNAL(triggered(QAction*)), this, SLOT(useExpiryPreset(QAction*)));

// HACK: Align username text with other line edits. Qt does not let you do this with an application stylesheet.
m_mainUi->usernameComboBox->lineEdit()->setStyleSheet("padding-left: 8px;");
}

void EditEntryWidget::setupAdvanced()
Expand Down
3 changes: 2 additions & 1 deletion src/gui/entry/EditEntryWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QModelIndex>
#include <QPointer>
#include <QScopedPointer>
#include <QScrollArea>
#include <QTimer>

#include "config-keepassx.h"
Expand Down Expand Up @@ -174,7 +175,7 @@ private slots:
const QScopedPointer<Ui::EditEntryWidgetBrowser> m_browserUi;
const QScopedPointer<CustomData> m_customData;

QWidget* const m_mainWidget;
QScrollArea* const m_mainWidget;
QWidget* const m_advancedWidget;
EditWidgetIcons* const m_iconsWidget;
QWidget* const m_autoTypeWidget;
Expand Down
Loading

0 comments on commit 55e4889

Please sign in to comment.