Skip to content

Commit

Permalink
remove custom fonts from Account and Hotkey models
Browse files Browse the repository at this point in the history
  • Loading branch information
kornes committed Apr 23, 2022
1 parent 7173e2b commit dbff96c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/controllers/accounts/AccountModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void AccountModel::getRowFromItem(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row)
{
setStringItem(row[0], item->toString(), false);
row[0]->setData(QFont("Segoe UI", 10), Qt::FontRole);
}

int AccountModel::beforeInsert(const std::shared_ptr<Account> &item,
Expand All @@ -34,7 +33,7 @@ int AccountModel::beforeInsert(const std::shared_ptr<Account> &item,
auto newRow = this->createRow();

setStringItem(newRow[0], item->getCategory(), false, false);
newRow[0]->setData(QFont("Segoe UI Light", 16), Qt::FontRole);
newRow[0]->setBackground(QBrush(Qt::GlobalColor::darkGray));

this->insertCustomRow(std::move(newRow), proposedIndex);

Expand Down
18 changes: 8 additions & 10 deletions src/controllers/hotkeys/HotkeyModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ std::shared_ptr<Hotkey> HotkeyModel::getItemFromRow(
void HotkeyModel::getRowFromItem(const std::shared_ptr<Hotkey> &item,
std::vector<QStandardItem *> &row)
{
QFont font("Segoe UI", 10);

setStringItem(row[0], item->name(), false);
setStringItem(row[1], item->toString(), false);
if (!item->validAction())
{
font.setStrikeOut(true);
QBrush bgColor(Qt::GlobalColor::darkRed);
row[0]->setBackground(bgColor);
row[1]->setBackground(bgColor);
}

setStringItem(row[0], item->name(), false);
row[0]->setData(font, Qt::FontRole);

setStringItem(row[1], item->toString(), false);
row[1]->setData(font, Qt::FontRole);
}

int HotkeyModel::beforeInsert(const std::shared_ptr<Hotkey> &item,
Expand All @@ -45,12 +41,14 @@ int HotkeyModel::beforeInsert(const std::shared_ptr<Hotkey> &item,
auto newRow = this->createRow();

setStringItem(newRow[0], category, false, false);
newRow[0]->setData(QFont("Segoe UI Light", 16), Qt::FontRole);
QBrush bgColor(Qt::GlobalColor::darkGray);
newRow[0]->setBackground(bgColor);

// make sure category headers aren't editable
for (unsigned long i = 1; i < newRow.size(); i++)
{
setStringItem(newRow[i], "", false, false);
newRow[i]->setBackground(bgColor);
}

this->insertCustomRow(std::move(newRow), proposedIndex);
Expand Down

0 comments on commit dbff96c

Please sign in to comment.