Changeset 33:506d8313314b

Show
Ignore:
Timestamp:
11/09/07 11:09:45 (1 year ago)
Author:
Nikita@Luc
Tags:

tip

Message:

change flatWidget

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • floatwidget.cpp

    r32 r33  
    44 
    55FloatWidget::FloatWidget(QWidget * parent , PhApiHead * _phapi ,xmlWrapper * _xml) 
    6 :QWidget(parent),phapi(_phapi),callSelected(-1),ligneSelected(-1),xml(_xml) 
     6:QSplitter(parent),phapi(_phapi),callSelected(-1),ligneSelected(-1),xml(_xml) 
    77{ 
    88        setWindowTitle("Milli phone"); 
     
    1212 
    1313        textBrowser = new QTextBrowser(0); 
    14         textBrowser->setMaximumHeight(100); 
     14        textBrowser->setMinimumHeight(100); 
    1515        textBrowser->setOpenExternalLinks(true); 
    1616        send = new QPushButton(QIcon(":/images/enCom.png"),tr("Send"),0); 
     
    1919        //send->setMaximumSize(60,60); 
    2020        textEdit = new QTextEdit (0); 
    21         textEdit->setMaximumHeight(100); 
     21        //textEdit->setMaximumHeight(100); 
    2222        //textEdit->setMaximumHeight(60); 
    2323        label = new QGroupBox(0); 
     
    3333        groupBox->setLayout(layH); 
    3434         
    35         QVBoxLayout * layV = new QVBoxLayout; 
     35        /*QVBoxLayout * layV = new QVBoxLayout; 
    3636        layV->setMargin(4); 
    3737        layV->setSpacing(4); 
    3838        layV->addWidget(label,10); 
    3939        layV->addWidget(textBrowser); 
    40         layV->addWidget(groupBox); 
     40        layV->addWidget(groupBox);*/ 
    4141 
    42         setLayout(layV); 
    43          
    44         connect(textEdit,SIGNAL(returnPressed()),this,SLOT(sendClicked())); 
     42        setOrientation(Qt::Vertical); 
     43        addWidget(label); 
     44        setStretchFactor(0,10); 
     45        addWidget(textBrowser); 
     46        //setStretchFactor(1,2); 
     47        addWidget(groupBox); 
     48 
     49        //setLayout(layV); 
    4550        connect(send,SIGNAL(clicked()),this,SLOT(sendClicked())); 
    4651 
     
    113118                painter.drawPixmap(re, pix); 
    114119 
    115         }       
     120        } 
    116121} 
    117122 
     
    136141         
    137142        //QString str = QTime::currentTime().toString()+" "+from+"\n"+message+"\n"; 
    138         QString str = textBrowser->toHtml()+QTime::currentTime().toString()+" "+from+"</br><br>"+message+"</br><br></br>"; 
     143        QString str =textBrowser->toHtml()+"<span style=\"color: red\">"+QTime::currentTime().toString()+" "+from+"</span></br><br><span style=\"color: black\">"+message+"</span></br><br></br>"; 
    139144        if(callSelected == cid) 
    140145        { 
     
    146151                } 
    147152                textBrowser->setHtml(str); 
     153                textBrowser->moveCursor(QTextCursor::End); 
    148154        } 
    149155 
    150156        map.insert(cid,str); 
    151157}        
     158void FloatWidget::textChanged () 
     159{ 
     160        QString str = textEdit->toPlainText(); 
     161        if(!str.isEmpty()) 
     162        { 
     163                if(str.at(str.count() - 1)== QChar('\n')) 
     164                { 
     165                        qDebug() << "aez"; 
     166                } 
     167        } 
     168} 
    152169 
    153170void FloatWidget::sendClicked() 
     
    160177 
    161178                phapi->sendMessage(callSelected,phapi->mapCallInfo.value(callSelected)->contact,str); 
    162                 textBrowser->setHtml(textBrowser->toHtml()+QTime::currentTime().toString()+" "+phapi->mapLineInfo.value(ligneSelected).pseudo+"</br><br>"+str+"</br><br></br>"); 
     179                textBrowser->setHtml("<span style=\"color: blue\">"+textBrowser->toHtml()+QTime::currentTime().toString()+" "+phapi->mapLineInfo.value(ligneSelected).pseudo+"</span></br><br><span style=\"color: black\">"+str+"</span></br><br></br>"); 
     180                textBrowser->moveCursor(QTextCursor::End); 
    163181                //textBrowser->append(str); 
    164182                textEdit->clear(); 
  • floatwidget.h

    r32 r33  
    66#include "xmlwrapper.h" 
    77 
    8 class FloatWidget :public QWidget 
     8 
     9class FloatWidget :public QSplitter 
    910{ 
    1011        Q_OBJECT 
     
    3334 
    3435public slots: 
     36        void textChanged(); 
    3537        void lineSelectedChanged(int); 
    3638        void callSelectedChanged(int);