linecombo.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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