Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TxqListBoxText.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------
00002 //
00003 // File:    TxqListBoxText.h
00004 //
00005 // Purpose: This class is a QListBoxText item to be used to set the text
00006 //          to bold font if desired.
00007 //
00008 // Version: $Id: TxqListBoxText.h,v 1.2 2002/01/09 21:22:37 kgl Exp $
00009 //
00010 // Copyright (c) 2002 by Tech-X Corporation.  All rights reserved.
00011 //
00012 // Author:  Kelly G. Luetkemeyer
00013 //
00014 //--------------------------------------------------------------------
00015 
00016 #ifndef TXQ_LIST_BOX_TEXT_H
00017 #define TXQ_LIST_BOX_TEXT_H
00018 
00019 // Qt includes
00020 #include <qlistbox.h>
00021 #include <qpainter.h>
00022 #include <qfont.h>
00023 
00024 #include <iostream.h>
00025 
00031 class TxqListBoxText : public QListBoxText
00032 { 
00033 
00034 public:
00035 
00041    TxqListBoxText( const QString & text = QString::null , bool bold =false) 
00042                                                       : QListBoxText(text) {
00043      boldFlag = bold;
00044    }
00045 
00049    ~TxqListBoxText() {}
00050 
00055   bool boldSelected() {return boldFlag;}
00056 
00061   void setBoldSelect(bool b) {boldFlag = b;}
00062 
00063 protected:
00064 
00068   virtual void paint ( QPainter *p) {
00069      p->save();
00070      if ( boldSelected() ) {
00071        QFont f = p->font();
00072        f.setBold( TRUE);
00073        p->setFont( f );
00074      }
00075      QListBoxText::paint(p);
00076      p->restore();
00077   }
00078 
00079 private:
00080 
00084   bool boldFlag;
00085 
00086 };
00087 
00088 #endif 
Copyright Tech-X Corporation, all rights reserved.