kmwinfobase.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #include "kmwinfobase.h"
00021 
00022 #include <qlabel.h>
00023 #include <qlineedit.h>
00024 #include <qlayout.h>
00025 
00026 KMWInfoBase::KMWInfoBase(int n, QWidget *parent, const char *name)
00027 : KMWizardPage(parent,name)
00028 {
00029     m_labels.setAutoDelete(false);
00030     m_edits.setAutoDelete(false);
00031 
00032     m_nlines = n;
00033     QGridLayout *lay1 = new QGridLayout(this, m_nlines+3, 2, 0, 10);
00034     lay1->addRowSpacing(1,10);
00035     lay1->setRowStretch(m_nlines+2,1);
00036     lay1->setColStretch(1,1);
00037 
00038     m_info = new QLabel(this);
00039     m_info->setTextFormat(Qt::RichText);
00040     lay1->addMultiCellWidget(m_info,0,0,0,1);
00041 
00042     for (int i=0;i<m_nlines;i++)
00043     {
00044         m_labels.append(new QLabel(this));
00045         m_edits.append(new QLineEdit(this));
00046         lay1->addWidget(m_labels.last(),i+2,0);
00047         lay1->addWidget(m_edits.last(),i+2,1);
00048     }
00049 }
00050 
00051 void KMWInfoBase::setInfo(const QString& s)
00052 {
00053     m_info->setText(s);
00054 }
00055 
00056 void KMWInfoBase::setLabel(int i, const QString& s)
00057 {
00058     if (i >= 0 && i < m_nlines)
00059         m_labels.at(i)->setText(s);
00060 }
00061 
00062 void KMWInfoBase::setText(int i, const QString& s)
00063 {
00064     if (i >= 0 && i < m_nlines)
00065         m_edits.at(i)->setText(s);
00066 }
00067 
00068 QString KMWInfoBase::text(int i)
00069 {
00070     if (i >= 0 && i < m_nlines)
00071         return m_edits.at(i)->text();
00072     return QString::null;
00073 }
00074 
00075 void KMWInfoBase::setCurrent(int i)
00076 {
00077     if (i >= 0 && i < m_nlines)
00078     {
00079         m_edits.at(i)->selectAll();
00080         m_edits.at(i)->setFocus();
00081     }
00082 }
 
This file is part of the documentation for kdeprint Library Version 3.2.0.