source: trunk/examples/showimg/imagefip.cpp@ 10

Last change on this file since 10 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1/****************************************************************************
2** $Id: imagefip.cpp 2 2005-11-16 15:49:26Z dmik $
3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5**
6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation.
8**
9*****************************************************************************/
10
11#include "imagefip.h"
12#include <qimage.h>
13
14/* XPM */
15static const char *image_xpm[] = {
16"17 15 9 1",
17" c #7F7F7F",
18". c #FFFFFF",
19"X c #00B6FF",
20"o c #BFBFBF",
21"O c #FF6C00",
22"+ c #000000",
23"@ c #0000FF",
24"# c #6CFF00",
25"$ c #FFB691",
26" ..XX",
27" ........o .XXX",
28" .OOOOOOOo. XXX+",
29" .O@@@@@@+++XXX++",
30" .O@@@@@@O.XXX+++",
31" .O@@@@@@OXXX+++.",
32" .O######XXX++...",
33" .O#####XXX++....",
34" .O##$#$XX+o+....",
35" .O#$$$$$+.o+....",
36" .O##$$##O.o+....",
37" .OOOOOOOO.o+....",
38" ..........o+....",
39" ooooooooooo+....",
40"+++++++++++++...."
41};
42
43ImageIconProvider::ImageIconProvider( QWidget *parent, const char *name ) :
44 QFileIconProvider( parent, name ),
45 imagepm(image_xpm)
46{
47 fmts = QImage::inputFormats();
48}
49
50ImageIconProvider::~ImageIconProvider()
51{
52}
53
54const QPixmap * ImageIconProvider::pixmap( const QFileInfo &fi )
55{
56 QString ext = fi.extension().upper();
57 if ( fmts.contains(ext) ) {
58 return &imagepm;
59 } else {
60 return QFileIconProvider::pixmap(fi);
61 }
62}
Note: See TracBrowser for help on using the repository browser.