diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp index 68a8d7d4a..72742b5ac 100644 --- a/src/gui/EditWidget.cpp +++ b/src/gui/EditWidget.cpp @@ -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); } diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 53aa04efa..d7d8b7b32 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -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()) @@ -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() diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h index 3d1835396..e359d1029 100644 --- a/src/gui/entry/EditEntryWidget.h +++ b/src/gui/entry/EditEntryWidget.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "config-keepassx.h" @@ -174,7 +175,7 @@ private: const QScopedPointer m_browserUi; const QScopedPointer m_customData; - QWidget* const m_mainWidget; + QScrollArea* const m_mainWidget; QWidget* const m_advancedWidget; EditWidgetIcons* const m_iconsWidget; QWidget* const m_autoTypeWidget; diff --git a/src/gui/entry/EditEntryWidgetMain.ui b/src/gui/entry/EditEntryWidgetMain.ui index f96481a3f..183ca0388 100644 --- a/src/gui/entry/EditEntryWidgetMain.ui +++ b/src/gui/entry/EditEntryWidgetMain.ui @@ -1,278 +1,306 @@ - - - EditEntryWidgetMain - - - - 0 - 0 - 496 - 420 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 10 - - - 8 - - - - - - - - 0 - 1 - - - - - 0 - 100 - - - - Notes field - - - - - - - true - - - Toggle the checkbox to reveal the notes section. - - - Qt::AlignTop - - - - - - - - - Username field - - - - - - - - - Toggle notes visible - - - Toggle notes visible - - - Notes: - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - 8 - - - - - false - - - Expiration field - - - true - - - - - - - - 0 - 0 - - - - Expiration Presets - - - Expiration presets - - - Presets - - - - - - - - - Password: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - URL: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 8 - - - - - Url field - - - https://example.com - - - - - - - Download favicon for URL - - - Download favicon for URL - - - - - - - - - Title: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Title field - - - - - - - Username: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Password field - - - QLineEdit::Password - - - - - - - 0 - - - - - Toggle expiration - - - Toggle expiration - - - Expires: - - - - - - - - - - PasswordEdit - QLineEdit -
gui/PasswordEdit.h
- 1 -
- - URLEdit - QLineEdit -
gui/URLEdit.h
- 1 -
-
- - titleEdit - usernameComboBox - passwordEdit - urlEdit - fetchFaviconButton - expireCheck - expireDatePicker - expirePresets - notesEnabled - notesEdit - - - -
+ + + EditEntryWidgetMain + + + + 0 + 0 + 539 + 523 + + + + Edit Entry + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + + + 0 + 0 + 539 + 523 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 10 + + + 8 + + + + + + + + 0 + 1 + + + + + 0 + 100 + + + + Notes field + + + + + + + true + + + Toggle the checkbox to reveal the notes section. + + + Qt::AlignTop + + + + + + + + + Username field + + + + + + + + + Toggle notes visible + + + Toggle notes visible + + + Notes: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 8 + + + + + false + + + Expiration field + + + true + + + + + + + + 0 + 0 + + + + Expiration Presets + + + Expiration presets + + + Presets + + + + + + + + + Password: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + URL: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 8 + + + + + Url field + + + https://example.com + + + + + + + Download favicon for URL + + + Download favicon for URL + + + + + + + + + Title: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Title field + + + + + + + Username: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Password field + + + QLineEdit::Password + + + + + + + 0 + + + + + Toggle expiration + + + Toggle expiration + + + Expires: + + + + + + + + + + + PasswordEdit + QLineEdit +
gui/PasswordEdit.h
+ 1 +
+ + URLEdit + QLineEdit +
gui/URLEdit.h
+ 1 +
+
+ + titleEdit + usernameComboBox + passwordEdit + urlEdit + fetchFaviconButton + expireCheck + expireDatePicker + expirePresets + notesEnabled + notesEdit + + + +
diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index b77e49864..ba79cce18 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -62,7 +62,7 @@ private: EditGroupWidget::EditGroupWidget(QWidget* parent) : EditWidget(parent) , m_mainUi(new Ui::EditGroupWidgetMain()) - , m_editGroupWidgetMain(new QWidget()) + , m_editGroupWidgetMain(new QScrollArea()) , m_editGroupWidgetIcons(new EditWidgetIcons()) , m_editWidgetProperties(new EditWidgetProperties()) , m_group(nullptr) diff --git a/src/gui/group/EditGroupWidget.h b/src/gui/group/EditGroupWidget.h index cc8738d8c..ed1bb0179 100644 --- a/src/gui/group/EditGroupWidget.h +++ b/src/gui/group/EditGroupWidget.h @@ -20,6 +20,7 @@ #include #include +#include #include "core/Group.h" #include "gui/EditWidget.h" @@ -78,7 +79,7 @@ private: const QScopedPointer m_mainUi; - QPointer m_editGroupWidgetMain; + QPointer m_editGroupWidgetMain; QPointer m_editGroupWidgetIcons; QPointer m_editWidgetProperties; diff --git a/src/gui/group/EditGroupWidgetMain.ui b/src/gui/group/EditGroupWidgetMain.ui index 9531cc847..faa8a30ff 100644 --- a/src/gui/group/EditGroupWidgetMain.ui +++ b/src/gui/group/EditGroupWidgetMain.ui @@ -1,215 +1,243 @@ EditGroupWidgetMain - + 0 0 - 410 - 430 + 539 + 523 - - - 0 + + Edit Group + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + + + 0 + 0 + 539 + 523 + - - 0 - - - 0 - - - 0 - - - 10 - - - 8 - - - - - Toggle expiration - - - Expires: - - - - - - - Name field - - - - - - - false - - - Expiration field - - - true - - - - - - - Use default Auto-Type sequence of parent group - - - - - - - Auto-Type: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Search: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Auto-Type toggle for this and sub groups - - - - - - - - - Notes: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 0 - - - - - - - - false - - - Default auto-type sequence field - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 120 - - - - Notes field - - - - - - - Name: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Set default Auto-Type sequence - - - - - - - Search toggle for this and sub groups - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + 0 + + + 0 + + + 0 + + + 0 + + + 10 + + + 8 + + + + + Toggle expiration + + + Expires: + + + + + + + Name field + + + + + + + false + + + Expiration field + + + true + + + + + + + Use default Auto-Type sequence of parent group + + + + + + + Auto-Type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Search: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Auto-Type toggle for this and sub groups + + + + + + + + + Notes: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 0 + + + + + + + + false + + + Default auto-type sequence field + + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 120 + + + + Notes field + + + + + + + Name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Set default Auto-Type sequence + + + + + + + Search toggle for this and sub groups + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + editName diff --git a/src/gui/styles/base/basestyle.qss b/src/gui/styles/base/basestyle.qss index 012c7cd0e..ff5d915bb 100644 --- a/src/gui/styles/base/basestyle.qss +++ b/src/gui/styles/base/basestyle.qss @@ -64,3 +64,8 @@ DatabaseWidget #SearchBanner, DatabaseWidget #KeeShareBanner { border: 1px solid palette(dark); padding: 2px; } + +QPlainTextEdit, QTextEdit { + background-color: palette(base); + padding-left: 4px; +}