summaryrefslogtreecommitdiffstats
path: root/examples/network
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network')
-rw-r--r--examples/network/torrent/mainwindow.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index efdf187174..f80c2c6975 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -129,12 +129,12 @@ MainWindow::MainWindow(QWidget *parent)
// Set header resize modes and initial section sizes
QFontMetrics fm = fontMetrics();
QHeaderView *header = torrentView->header();
- header->resizeSection(0, fm.width("typical-name-for-a-torrent.torrent"));
- header->resizeSection(1, fm.width(headers.at(1) + " "));
- header->resizeSection(2, fm.width(headers.at(2) + " "));
- header->resizeSection(3, qMax(fm.width(headers.at(3) + " "), fm.width(" 1234.0 KB/s ")));
- header->resizeSection(4, qMax(fm.width(headers.at(4) + " "), fm.width(" 1234.0 KB/s ")));
- header->resizeSection(5, qMax(fm.width(headers.at(5) + " "), fm.width(tr("Downloading") + " ")));
+ header->resizeSection(0, fm.horizontalAdvance("typical-name-for-a-torrent.torrent"));
+ header->resizeSection(1, fm.horizontalAdvance(headers.at(1) + " "));
+ header->resizeSection(2, fm.horizontalAdvance(headers.at(2) + " "));
+ header->resizeSection(3, qMax(fm.horizontalAdvance(headers.at(3) + " "), fm.horizontalAdvance(" 1234.0 KB/s ")));
+ header->resizeSection(4, qMax(fm.horizontalAdvance(headers.at(4) + " "), fm.horizontalAdvance(" 1234.0 KB/s ")));
+ header->resizeSection(5, qMax(fm.horizontalAdvance(headers.at(5) + " "), fm.horizontalAdvance(tr("Downloading") + " ")));
// Create common actions
QAction *newTorrentAction = new QAction(QIcon(":/icons/bottom.png"), tr("Add &new torrent"), this);
@@ -174,14 +174,14 @@ MainWindow::MainWindow(QWidget *parent)
bottomBar->addWidget(new QLabel(tr("Max download:")));
bottomBar->addWidget(downloadLimitSlider);
bottomBar->addWidget((downloadLimitLabel = new QLabel(tr("0 KB/s"))));
- downloadLimitLabel->setFixedSize(QSize(fm.width(tr("99999 KB/s")), fm.lineSpacing()));
+ downloadLimitLabel->setFixedSize(QSize(fm.horizontalAdvance(tr("99999 KB/s")), fm.lineSpacing()));
bottomBar->addSeparator();
uploadLimitSlider = new QSlider(Qt::Horizontal);
uploadLimitSlider->setRange(0, 1000);
bottomBar->addWidget(new QLabel(tr("Max upload:")));
bottomBar->addWidget(uploadLimitSlider);
bottomBar->addWidget((uploadLimitLabel = new QLabel(tr("0 KB/s"))));
- uploadLimitLabel->setFixedSize(QSize(fm.width(tr("99999 KB/s")), fm.lineSpacing()));
+ uploadLimitLabel->setFixedSize(QSize(fm.horizontalAdvance(tr("99999 KB/s")), fm.lineSpacing()));
#ifdef Q_OS_OSX
setUnifiedTitleAndToolBarOnMac(true);
@@ -220,7 +220,7 @@ QSize MainWindow::sizeHint() const
// Add up the sizes of all header sections. The last section is
// stretched, so its size is relative to the size of the width;
// instead of counting it, we count the size of its largest value.
- int width = fontMetrics().width(tr("Downloading") + " ");
+ int width = fontMetrics().horizontalAdvance(tr("Downloading") + " ");
for (int i = 0; i < header->count() - 1; ++i)
width += header->sectionSize(i);