1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-03 10:25:02 +00:00

Minor log widget code optimizations.

This commit is contained in:
sledgehammer999 2016-01-24 18:41:38 +02:00
parent 6a281bef8f
commit b0c324ace8
2 changed files with 3 additions and 13 deletions

View File

@ -47,7 +47,7 @@ LogListWidget::LogListWidget(int max_lines, QWidget *parent) :
QAction *copyAct = new QAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this); QAction *copyAct = new QAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this);
QAction *clearAct = new QAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Clear"), this); QAction *clearAct = new QAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Clear"), this);
connect(copyAct, SIGNAL(triggered()), SLOT(copySelection())); connect(copyAct, SIGNAL(triggered()), SLOT(copySelection()));
connect(clearAct, SIGNAL(triggered()), SLOT(clearLog())); connect(clearAct, SIGNAL(triggered()), SLOT(clear()));
addAction(copyAct); addAction(copyAct);
addAction(clearAct); addAction(clearAct);
setContextMenuPolicy(Qt::ActionsContextMenu); setContextMenuPolicy(Qt::ActionsContextMenu);
@ -55,14 +55,10 @@ LogListWidget::LogListWidget(int max_lines, QWidget *parent) :
void LogListWidget::keyPressEvent(QKeyEvent *event) void LogListWidget::keyPressEvent(QKeyEvent *event)
{ {
if (event->matches(QKeySequence::Copy)) { if (event->matches(QKeySequence::Copy))
copySelection(); copySelection();
return; else if (event->matches(QKeySequence::SelectAll))
}
if (event->matches(QKeySequence::SelectAll)) {
selectAll(); selectAll();
return;
}
} }
void LogListWidget::appendLine(const QString &line) void LogListWidget::appendLine(const QString &line)
@ -90,8 +86,3 @@ void LogListWidget::copySelection()
QApplication::clipboard()->setText(strings.join("\n")); QApplication::clipboard()->setText(strings.join("\n"));
} }
void LogListWidget::clearLog()
{
clear();
}

View File

@ -48,7 +48,6 @@ public slots:
protected slots: protected slots:
void copySelection(); void copySelection();
void clearLog();
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);