BUGFIX: Elide status bar text if it is too wide

This commit is contained in:
Christophe Dumez
2010-10-26 17:57:07 +00:00
parent a2aa462030
commit 27f257ba03
2 changed files with 12 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.4.9 * Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.4.9
- BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog - BUGFIX: Fix crash when pressing enter in save path field in torrent addition dialog
- BUGFIX: Elide status bar text if it is too wide
* Sun Oct 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.8 * Sun Oct 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.8
- BUGFIX: Fix possible crash on manual peer ban - BUGFIX: Fix possible crash on manual peer ban

View File

@@ -38,6 +38,7 @@
#include <QGridLayout> #include <QGridLayout>
#include <QPushButton> #include <QPushButton>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QFontMetrics>
#include "bittorrent.h" #include "bittorrent.h"
#include "speedlimitdlg.h" #include "speedlimitdlg.h"
#include "preferences.h" #include "preferences.h"
@@ -163,11 +164,16 @@ public:
public slots: public slots:
void showRestartRequired() { void showRestartRequired() {
// Restart required notification // Restart required notification
QLabel *restartLbl = new QLabel(tr("qBittorrent needs to be restarted")); const QString restart_text = tr("qBittorrent needs to be restarted");
restartLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24))); QLabel *restartIconLbl = new QLabel();
restartLbl->setToolTip(tr("qBittorrent needs to be restarted")); restartIconLbl->setPixmap(QPixmap(":/Icons/oxygen/dialog-warning.png").scaled(QSize(24,24)));
bar->insertWidget(0,restartLbl); restartIconLbl->setToolTip(restart_text);
bar->insertWidget(1, new QLabel(tr("qBittorrent needs to be restarted"))); bar->insertWidget(0,restartIconLbl);
QLabel *restartLbl = new QLabel();
restartLbl->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
bar->insertWidget(1, restartLbl);
QFontMetrics fm(restartLbl->font());
restartLbl->setText(fm.elidedText(restart_text, Qt::ElideRight, restartLbl->width()));
} }
void stopTimer() { void stopTimer() {