fix #943
This commit is contained in:
parent
64b33e3907
commit
057738a78d
@ -9,6 +9,7 @@
|
||||
#include "miscellaneous/settings.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QWidgetAction>
|
||||
@ -146,10 +147,32 @@ void MessagesToolBar::handleMessageHighlighterChange(QAction* action) {
|
||||
|
||||
m_btnMessageHighlighter->setDefaultAction(checked_tasks_std.empty() ? m_menuMessageHighlighter->actions().constFirst()
|
||||
: checked_tasks_std.front());
|
||||
saveToolButtonSelection(HIGHLIGHTER_ACTION_NAME, FROM_STD_LIST(QList<QAction*>, checked_tasks_std));
|
||||
|
||||
if (checked_tasks_std.size() > 1) {
|
||||
drawNumberOfCriterias(m_btnMessageHighlighter, checked_tasks_std.size());
|
||||
}
|
||||
|
||||
saveToolButtonSelection(QSL(HIGHLIGHTER_ACTION_NAME), FROM_STD_LIST(QList<QAction*>, checked_tasks_std));
|
||||
emit messageHighlighterChanged(task);
|
||||
}
|
||||
|
||||
void MessagesToolBar::drawNumberOfCriterias(QToolButton* btn, int count) {
|
||||
QPixmap px(128, 128);
|
||||
px.fill(Qt::GlobalColor::transparent);
|
||||
|
||||
QPainter p(&px);
|
||||
|
||||
auto fon = p.font();
|
||||
|
||||
fon.setPixelSize(40);
|
||||
p.setFont(fon);
|
||||
|
||||
p.drawPixmap(0, 0, 80, 80, btn->defaultAction()->icon().pixmap(128, 128));
|
||||
p.drawText(65, 65, 50, 50, Qt::AlignmentFlag::AlignCenter, QString::number(count));
|
||||
|
||||
btn->setIcon(px);
|
||||
}
|
||||
|
||||
void MessagesToolBar::handleMessageFilterChange(QAction* action) {
|
||||
MessagesProxyModel::MessageListFilter task = action->data().value<MessagesProxyModel::MessageListFilter>();
|
||||
std::list<QAction*> checked_tasks_std = boolinq::from(m_menuMessageFilter->actions())
|
||||
@ -180,7 +203,12 @@ void MessagesToolBar::handleMessageFilterChange(QAction* action) {
|
||||
|
||||
m_btnMessageFilter->setDefaultAction(checked_tasks_std.empty() ? m_menuMessageFilter->actions().constFirst()
|
||||
: checked_tasks_std.front());
|
||||
saveToolButtonSelection(FILTER_ACTION_NAME, FROM_STD_LIST(QList<QAction*>, checked_tasks_std));
|
||||
|
||||
if (checked_tasks_std.size() > 1) {
|
||||
drawNumberOfCriterias(m_btnMessageFilter, checked_tasks_std.size());
|
||||
}
|
||||
|
||||
saveToolButtonSelection(QSL(FILTER_ACTION_NAME), FROM_STD_LIST(QList<QAction*>, checked_tasks_std));
|
||||
emit messageFilterChanged(task);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ class MessagesToolBar : public BaseToolBar {
|
||||
void initializeHighlighter();
|
||||
void activateAction(const QString& action_name, QWidgetAction* widget_action);
|
||||
void saveToolButtonSelection(const QString& button_name, const QList<QAction*>& actions) const;
|
||||
void drawNumberOfCriterias(QToolButton* btn, int count);
|
||||
|
||||
private:
|
||||
QWidgetAction* m_actionMessageHighlighter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user