⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lxremittancelistviewitem.cc

📁 LxBank是一个基于Qt/X的家庭储蓄应用程序
💻 CC
字号:
// ****************************************************************************// // LxBank - home-banking for Linux using the HBCI standard// // Author: Franz Zimmermann                                   83043 Bad Aibling// // Copyright (C) 2002-2003 Franz Zimmermann  -  arafang@users.sourceforge.net// // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.// // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.// // ***************************************************************************//// ***************************************************************************// /*! \file    \brief LxRemittanceListViewItem: List view item for LxBank remittance list view*/ // ***************************************************************************//// $Name:  $//// $State: Exp $//// $Log: LxRemittanceListViewItem.cc,v $// Revision 1.8  2003/04/12 00:38:56  arafang// Fix problems with assignment QString to string//// Revision 1.7  2003/02/08 15:25:21  franz// Mail address changed.//// Revision 1.6  2003/01/03 17:15:32  franz// LxUserAddWizard able to create a DDV-Card user.//// Revision 1.5  2003/01/02 15:04:45  franz// Started to use the openHBCI lib.//// Revision 1.4  2002/07/04 23:18:31  franz// Optimize performance of class LxAccount.// Add account close function.//// Revision 1.3  2002/06/02 22:03:19  franz// Remittance view lists improved.// Remittance work dialogs implemented.//// Revision 1.2  2002/05/15 00:38:18  franz// Started to switch to Qt3.// Class LxRemittanceViewButton renamed to LxPushButton.// Layout of LxAccountSelectDialog improved.//// Revision 1.1  2002/05/05 18:31:35  franz// Started with the implementatation of remittance views.////#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stream.h>#include <math.h>#include "LxRemittanceListViewItem.h"#include <qpainter.h> LxRemittanceListViewItem::LxRemittanceListViewItem (QListView * parent, 						    QString     label1, QString srtkey1, // number						    QStringList label2, QString srtkey2, // dates						    QString     label3,                  // receiver						    QStringList label4, QString srtkey4, // account-no/blz						    QString     label5, QString srtkey5, // amount						    QString     label6,                  // currency						    QStringList label7,                  // text						    QString     label8,                  // tan						    LxRemittance *rem)  : QListViewItem (parent, label1, label2[0], label3, label4[0], label5, label6, label7[0], label8),    rm(rem), lv(parent), dates(label2), accblz(label4), remText(label7), sortKey1(srtkey1), sortKey2(srtkey2),     sortKey3(label3), sortKey4(srtkey4), sortKey5(srtkey5), sortKey6(label6), sortKey7(label7[0]),    sortKey8(label8){  int w1, w2;  QFontMetrics fm(parent->font());  textHeight = fm.height();  textLeading = fm.leading();  textSpacing = textHeight + textLeading;  totalItemHeight = 2 * textSpacing + textHeight/2;  // number  width1 = fm.boundingRect( label1 ).width();  // dates  w1 = fm.boundingRect( label2[0] ).width();  if (label2.count() == 2 ){    w2 = fm.boundingRect( label2[1] ).width();  }else{    w2 = 0;  }  width2 = w1 < w2 ? w2 : w1;  // receiver  width3 = fm.boundingRect( label3 ).width();    // account-no and blz  w1 = fm.boundingRect( label4[0] ).width();  w2 = fm.boundingRect( label4[1] ).width();  width4 = w1 < w2 ? w2 : w1;  // amount  width5 = fm.boundingRect( label5 ).width();  // currency  width6 = fm.boundingRect( label6 ).width();  // text  w1 = fm.boundingRect( label7[0] ).width();  w2 = fm.boundingRect( label7[1] ).width();  width7 = w1 < w2 ? w2 : w1;  // tan  width8 = fm.boundingRect( label8 ).width();  width1 *= 102; width1 /= 100;  width2 *= 102; width2 /= 100;  width3 *= 102; width3 /= 100;  width4 *= 102; width4 /= 100;  width5 *= 102; width5 /= 100;  width6 *= 102; width6 /= 100;  width7 *= 102; width7 /= 100;  width8 *= 102; width8 /= 100;}QString LxRemittanceListViewItem::key ( int column, bool ascending ) const{  switch (column){  case 0:    return sortKey1;  case 1:    return sortKey2;  case 2:    return sortKey3;  case 3:    return sortKey4;  case 4:    return sortKey5;  case 5:    return sortKey6;  case 6:    return sortKey7;  case 7:    return sortKey8;  }  return QString::null;}void LxRemittanceListViewItem::setHeight ( int h ){  QListViewItem::setHeight ( h );}void LxRemittanceListViewItem::setup (){  //   QListViewItem::setup ();  widthChanged ( 0 );  widthChanged ( 1 );  widthChanged ( 3 );  widthChanged ( 4 );  widthChanged ( 5 );  widthChanged ( 6 );  widthChanged ( 7 );  setHeight ( totalItemHeight );}int LxRemittanceListViewItem::width ( const QFontMetrics & fm, 				      const QListView * lv, int c ) const{  switch (c){  case 0:    return width1;  case 1:    return width2;  case 2:    return width3;  case 3:    return width4;  case 4:    return width5;  case 5:    return width6;  case 6:    return width7;  case 7:    return width8;  }  return 0;}void LxRemittanceListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, 					int column, int width, int align ){  QPen pn = p->pen();  QRect rec( 0, 0, width, totalItemHeight );  QRect backRec( 0, 0, width, textSpacing );  if ( isSelected() ){    p->fillRect( rec, cg.highlight() );    pn.setColor( cg.highlightedText() );    p->fillRect( backRec, cg.dark() );  }else{    p->eraseRect( rec );    pn.setColor(cg.text());    p->fillRect( backRec, cg.button() );  }  p->setPen(pn);  int y = textHeight;  QRect txtRec( lv->itemMargin(), 0, width - 2 * lv->itemMargin(), textSpacing );    switch ( column ){  case 1:    y = 0;     txtRec.setTop( y );    txtRec.setBottom( y + textSpacing );    p->drawText ( txtRec, align, dates[0] );    if (dates.count() == 2 ){      y += textSpacing;      txtRec.setTop( y );      txtRec.setBottom( y + textSpacing );      p->drawText ( txtRec, align, dates[1] );    }    break;  case 3:    y = 0;     txtRec.setTop( y );    txtRec.setBottom( y + textSpacing );    p->drawText ( txtRec, align, accblz[0] );    y += textSpacing;    txtRec.setTop( y );    txtRec.setBottom( y + textSpacing );    p->drawText ( txtRec, align, accblz[1] );    break;  case 6:    y = 0;     txtRec.setTop( y );    txtRec.setBottom( y + textSpacing );    p->drawText ( txtRec, align, remText[0] );    y += textSpacing;    txtRec.setTop( y );    txtRec.setBottom( y + textSpacing );    p->drawText ( txtRec, align, remText[1] );    break;  case 0:  case 2:  case 4:  case 5:  case 7:    p->drawText ( txtRec, align, text(column) );  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -