LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
widthiconprovider.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "widthiconprovider.h"
10#include <QIcon>
11
12namespace LC::Util
13{
15 : QQuickImageProvider (Pixmap)
16 {
17 }
18
20 {
21 auto list = idStr.split ('/', Qt::SkipEmptyParts);
22 if (list.isEmpty ())
23 return QPixmap ();
24
26 if (realSize.width () <= 0)
27 {
28 bool ok = false;
29 const int width = list.last ().toDouble (&ok);
30 realSize = width > 0 ? QSize (width, width) : QSize (32, 32);
31 if (ok)
32 list.removeLast ();
33 }
34
35 const auto& icon = GetIcon (list);
36
37 if (size)
38 *size = icon.actualSize (realSize);
39
40 return icon.pixmap (realSize);
41 }
42}
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
Reimplemented from QDeclarativeImageProvider::requestPixmap().
virtual QIcon GetIcon(const QStringList &path)=0
Implement this method to return a proper QIcon for path.
Container< T > Filter(const Container< T > &c, F f)
Definition prelude.h:118