Changeset 33:506d8313314b
- 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
| r32 |
r33 |
|
| 4 | 4 | |
|---|
| 5 | 5 | FloatWidget::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) |
|---|
| 7 | 7 | { |
|---|
| 8 | 8 | setWindowTitle("Milli phone"); |
|---|
| … | … | |
| 12 | 12 | |
|---|
| 13 | 13 | textBrowser = new QTextBrowser(0); |
|---|
| 14 | | textBrowser->setMaximumHeight(100); |
|---|
| | 14 | textBrowser->setMinimumHeight(100); |
|---|
| 15 | 15 | textBrowser->setOpenExternalLinks(true); |
|---|
| 16 | 16 | send = new QPushButton(QIcon(":/images/enCom.png"),tr("Send"),0); |
|---|
| … | … | |
| 19 | 19 | //send->setMaximumSize(60,60); |
|---|
| 20 | 20 | textEdit = new QTextEdit (0); |
|---|
| 21 | | textEdit->setMaximumHeight(100); |
|---|
| | 21 | //textEdit->setMaximumHeight(100); |
|---|
| 22 | 22 | //textEdit->setMaximumHeight(60); |
|---|
| 23 | 23 | label = new QGroupBox(0); |
|---|
| … | … | |
| 33 | 33 | groupBox->setLayout(layH); |
|---|
| 34 | 34 | |
|---|
| 35 | | QVBoxLayout * layV = new QVBoxLayout; |
|---|
| | 35 | /*QVBoxLayout * layV = new QVBoxLayout; |
|---|
| 36 | 36 | layV->setMargin(4); |
|---|
| 37 | 37 | layV->setSpacing(4); |
|---|
| 38 | 38 | layV->addWidget(label,10); |
|---|
| 39 | 39 | layV->addWidget(textBrowser); |
|---|
| 40 | | layV->addWidget(groupBox); |
|---|
| | 40 | layV->addWidget(groupBox);*/ |
|---|
| 41 | 41 | |
|---|
| 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); |
|---|
| 45 | 50 | connect(send,SIGNAL(clicked()),this,SLOT(sendClicked())); |
|---|
| 46 | 51 | |
|---|
| … | … | |
| 113 | 118 | painter.drawPixmap(re, pix); |
|---|
| 114 | 119 | |
|---|
| 115 | | } |
|---|
| | 120 | } |
|---|
| 116 | 121 | } |
|---|
| 117 | 122 | |
|---|
| … | … | |
| 136 | 141 | |
|---|
| 137 | 142 | //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>"; |
|---|
| 139 | 144 | if(callSelected == cid) |
|---|
| 140 | 145 | { |
|---|
| … | … | |
| 146 | 151 | } |
|---|
| 147 | 152 | textBrowser->setHtml(str); |
|---|
| | 153 | textBrowser->moveCursor(QTextCursor::End); |
|---|
| 148 | 154 | } |
|---|
| 149 | 155 | |
|---|
| 150 | 156 | map.insert(cid,str); |
|---|
| 151 | 157 | } |
|---|
| | 158 | void 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 | } |
|---|
| 152 | 169 | |
|---|
| 153 | 170 | void FloatWidget::sendClicked() |
|---|
| … | … | |
| 160 | 177 | |
|---|
| 161 | 178 | 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); |
|---|
| 163 | 181 | //textBrowser->append(str); |
|---|
| 164 | 182 | textEdit->clear(); |
|---|
| r32 |
r33 |
|
| 6 | 6 | #include "xmlwrapper.h" |
|---|
| 7 | 7 | |
|---|
| 8 | | class FloatWidget :public QWidget |
|---|
| | 8 | |
|---|
| | 9 | class FloatWidget :public QSplitter |
|---|
| 9 | 10 | { |
|---|
| 10 | 11 | Q_OBJECT |
|---|
| … | … | |
| 33 | 34 | |
|---|
| 34 | 35 | public slots: |
|---|
| | 36 | void textChanged(); |
|---|
| 35 | 37 | void lineSelectedChanged(int); |
|---|
| 36 | 38 | void callSelectedChanged(int); |
|---|