Skip to content

Commit

Permalink
bookmarks: Update tag color when changed in a popup dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
vladisslav2011 committed Nov 10, 2024
1 parent 38bfeb6 commit c33fb0a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/qtgui/bookmarkstaglist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ void BookmarksTagList::changeColor(int row, int /*column*/)
return;

info->color=color;
updateTags();
item(row,0)->setBackground(color);
emit colorChanged();
Bookmarks::Get().save();
}

Expand Down
1 change: 1 addition & 0 deletions src/qtgui/bookmarkstaglist.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class BookmarksTagList : public QTableWidget
QMenu* popupMenu{nullptr};

signals:
void colorChanged();

public slots:
void updateTags();
Expand Down
6 changes: 6 additions & 0 deletions src/qtgui/dockbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ DockBookmarks::DockBookmarks(QWidget *parent) :
connect(buttonBox, SIGNAL(accepted()), tagsDialog, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), tagsDialog, SLOT(reject()));
connect(dialogTaglist, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(dialog_tableWidgetTagList_itemChanged(QTableWidgetItem *)));
connect(dialogTaglist, SIGNAL(colorChanged()), this, SLOT(dialog_tableWidgetTagList_colorChanged()));

QVBoxLayout *mainLayout = new QVBoxLayout(tagsDialog);
mainLayout->addWidget(dialogTaglist);
Expand Down Expand Up @@ -242,6 +243,11 @@ void DockBookmarks::dialog_tableWidgetTagList_itemChanged(QTableWidgetItem *item
}
}

void DockBookmarks::dialog_tableWidgetTagList_colorChanged()
{
updateTags();
}

bool DockBookmarks::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::KeyPress)
Expand Down
1 change: 1 addition & 0 deletions src/qtgui/dockbookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private slots:
//void on_delButton_clicked();
void on_tableWidgetTagList_itemChanged(QTableWidgetItem* item);
void dialog_tableWidgetTagList_itemChanged(QTableWidgetItem *item);
void dialog_tableWidgetTagList_colorChanged();
void ShowContextMenu(const QPoint&pos);
bool DeleteSelectedBookmark();
bool tuneHere();
Expand Down

0 comments on commit c33fb0a

Please sign in to comment.