Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a combobox instead of a lineedit widget for library search history #3171

Merged
merged 27 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d1a0c3b
Use a combobox instead of a lineedit widget and utalize the combobox
poelzi Oct 12, 2020
0d491ad
WSearchLineEdit: apply library font to both QLineEdit and QListView
ronso0 Oct 13, 2020
b992c17
Fix resize problem, update history behaviour
poelzi Oct 13, 2020
1a5b9d5
Merge branch 'apply-lib-font' of https://github.com/ronso0/mixxx into…
poelzi Oct 13, 2020
b74f850
Implement control object for navigating history
poelzi Oct 13, 2020
407ae68
Allow tab key emulation to reach search bar again.
poelzi Oct 14, 2020
118f4e5
WSearchLineEdit: fully enable controllers to scroll previous search q…
ronso0 Oct 15, 2020
5797c14
WSearchLineEdit: when focused use [Library],GoToItem to jump to track…
ronso0 Oct 15, 2020
11a4a34
Fix debug assert in searchbox
poelzi Oct 17, 2020
9424035
fix wrong control name
poelzi Oct 17, 2020
e711daf
Clearer variable naming. Remove spam log entries.
poelzi Oct 17, 2020
824bc57
fix typo, rename variable
poelzi Oct 17, 2020
864f4f7
Merge branch 'main' into searchbox-combo
ronso0 Oct 26, 2020
6529419
Merge branch 'main' of https://github.com/mixxxdj/mixxx into searchbo…
poelzi Oct 26, 2020
6d26c26
Take layout direction into account when writing stylesheet
poelzi Oct 26, 2020
cec5382
Add ctrl + space to open/close search history
poelzi Oct 26, 2020
db327fd
Start search on enter
poelzi Oct 26, 2020
a1f8358
Merge branch 'searchbox-combo' of github.com:poelzi/mixxx into search…
poelzi Oct 26, 2020
9d995a6
Use function to return current history index.
poelzi Oct 26, 2020
0c78b61
remove unnecessary casts
poelzi Oct 26, 2020
d108955
fix selection after clearing the search field
poelzi Oct 27, 2020
0b5adb2
Rename history search control, fix typo
poelzi Oct 27, 2020
f12cb97
Check for values ge 1.0
poelzi Oct 27, 2020
94dfdb2
rename padding argument
poelzi Oct 29, 2020
8fdd642
make pre commit happy again
poelzi Oct 29, 2020
787f770
fix camelcase
poelzi Oct 29, 2020
9e29613
Fix widget size on very long entries in the history
poelzi Oct 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/widget/wsearchlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ const QString kEmptySearch = QStringLiteral("");

const QString kDisabledText = QStringLiteral("- - -");

inline QString clearButtonStyleSheet(int pxPaddingRight) {
constexpr int kClearbuttonClearence = 1;
poelzi marked this conversation as resolved.
Show resolved Hide resolved

inline QString clearButtonStyleSheet(int pxPaddingRight, Qt::LayoutDirection direction) {
DEBUG_ASSERT(pxPaddingRight >= 0);
return QString(
QStringLiteral("WSearchLineEdit { padding-right: %1px; }"))
.arg(pxPaddingRight);
if (direction == Qt::RightToLeft) {
return QString(
QStringLiteral("WSearchLineEdit { padding-left: %1px; }"))
.arg(pxPaddingRight);
} else {
return QString(
QStringLiteral("WSearchLineEdit { padding-right: %1px; }"))
.arg(pxPaddingRight);
}
}
poelzi marked this conversation as resolved.
Show resolved Hide resolved

int verifyDebouncingTimeoutMillis(int debouncingTimeoutMillis) {
Expand Down Expand Up @@ -134,7 +142,9 @@ WSearchLineEdit::WSearchLineEdit(QWidget* pParent)
QSize clearButtonSize = m_clearButton->sizeHint();

// Ensures the text does not obscure the clear image.
setStyleSheet(clearButtonStyleSheet(clearButtonSize.width() + m_frameWidth + 1));
setStyleSheet(clearButtonStyleSheet(
clearButtonSize.width() + m_frameWidth + kClearbuttonClearence,
layoutDirection()));

refreshState();
}
Expand Down Expand Up @@ -451,12 +461,15 @@ void WSearchLineEdit::updateClearButton(const QString& text) {
// Disable while placeholder is shown
m_clearButton->setVisible(false);
// no right padding
setStyleSheet(clearButtonStyleSheet(0));
setStyleSheet(clearButtonStyleSheet(0, layoutDirection()));
} else {
// Enable otherwise
m_clearButton->setVisible(true);
// make sure the text won't be drawn behind the Clear button icon
setStyleSheet(clearButtonStyleSheet(m_innerHeight + m_frameWidth));
setStyleSheet(clearButtonStyleSheet(
m_innerHeight + m_dropButtonWidth +
m_frameWidth + kClearbuttonClearence,
layoutDirection()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/widget/wsearchlineedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WSearchLineEdit : public QComboBox, public WBaseWidget {

// TODO(XXX): Replace with a public slot
static void setDebouncingTimeoutMillis(int debouncingTimeoutMillis);
virtual void showPopup();
virtual void showPopup() override;

explicit WSearchLineEdit(QWidget* pParent);
~WSearchLineEdit() override = default;
Expand Down