Skip to content

Commit

Permalink
added random placeholder selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Odizinne committed Oct 19, 2024
1 parent afbfad3 commit 549c9c5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/NoteWidget/notewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <QTextStream>
#include <QPainter>
#include <QPropertyAnimation>
#include <QRandomGenerator>

using namespace Utils;
const int resizeMargin = 10;
Expand Down Expand Up @@ -243,6 +244,23 @@ void NoteWidget::paintEvent(QPaintEvent *event) {
}

void NoteWidget::setTitleColor() {
QStringList placeholders = {
"shopping list",
"Give it a name",
"Name this note",
"My super note",
"Remember This",
"Quick Thoughts",
"Note to Self",
"Code Snippets",
"Work in Progress",
"Ideas",
"Workflows"
};

int randomIndex = QRandomGenerator::global()->bounded(placeholders.size());
QString randomPlaceholder = placeholders[randomIndex];

QPalette palette = ui->noteTitleLineEdit->palette();
if (getTheme() == "dark") {
palette.setColor(QPalette::Text, getAccentColor("dark2"));
Expand All @@ -251,7 +269,7 @@ void NoteWidget::setTitleColor() {
}
ui->noteTitleLineEdit->setPalette(palette);

ui->noteTitleLineEdit->setPlaceholderText("Name this note");
ui->noteTitleLineEdit->setPlaceholderText(randomPlaceholder);
}

void NoteWidget::mousePressEvent(QMouseEvent *event) {
Expand Down

0 comments on commit 549c9c5

Please sign in to comment.