Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

linecombo.cpp

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           linecombo.cpp  -  description
00009                              -------------------
00010     begin                : Thu Jul 12 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #include "linecombo.h"
00025 #include "util.h"
00026 
00036 LineCombo::LineCombo(QWidget* pa) : QComboBox(pa)
00037 {
00038     setEditable(false);
00039     setIconSize(QSize(73, 7));
00040     updateList();
00041 }
00042 
00043 void LineCombo::updateList()
00044 {
00045     for (int a = 0; a < 37; a++)
00046     {
00047         addItem(QIcon(createIcon(a)), "");
00048     }
00049 }
00050 
00051 QPixmap LineCombo::createIcon(int type)
00052 {
00053     QPen pen;
00054     QList<double> m_array;
00055     QPixmap pmap(73, 7);
00056     pmap.fill(Qt::transparent);
00057     QPainter p;
00058     p.begin(&pmap);
00059     if (type == 0)
00060         pen = QPen(Qt::black, 3, Qt::SolidLine);
00061     else
00062     {
00063         getDashArray(type + 1, 1, m_array);
00064         pen.setDashPattern(m_array.toVector());
00065     }
00066     pen.setColor(Qt::black);
00067     pen.setWidth(3);
00068     pen.setCapStyle(Qt::FlatCap);
00069     p.setPen(pen);
00070     p.drawLine(2, 3, 73, 3);
00071     p.end();
00072     return pmap;
00073 }
00074 
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.