customer::customer(QWidget *parent,QSqlDatabase* db1,int mode,QString cusid) : QDialog(parent), ui(new Ui::customer) { this->db1=db1; this->mode=mode; this->cusid=cusid; ui->setupUi(this); QIcon* icon =new QIcon((QString)APATH+"add.jpg"); QIcon* icon1 =new QIcon((QString)APATH+"cancel.png"); QIcon* icon2 =new QIcon((QString)APATH+"edit.png"); ui->pushAddDebit->setIcon(*icon); ui->pushAddDebit->setIconSize(QSize( ui->pushAddDebit->size().width()-5,ui->pushAddDebit->size().height()-5 )); ui->pushLeave->setIcon(*icon1); ui->pushLeave->setIconSize(QSize( ui->pushLeave->size().width()-5,ui->pushLeave->size().height()-5 )); ui->pushCusInsert->setIcon(*icon); ui->pushCusInsert->setIconSize(QSize( ui->pushCusInsert->size().width()-5,ui->pushCusInsert->size().height()-5 )); ui->pushDeleteDebit->setIcon(*icon1); ui->pushDeleteDebit->setIconSize(QSize( ui->pushDeleteDebit->size().width()-5,ui->pushDeleteDebit->size().height()-5 )); ui->pushEditDebit->setIcon(*icon2); ui->pushEditDebit->setIconSize(QSize( ui->pushEditDebit->size().width()-5,ui->pushEditDebit->size().height()-5 )); if (mode==0) //INSERT MODE { ui->pushAddDebit->setEnabled(FALSE); ui->pushCusInsert->setEnabled(FALSE); ui->pushDeleteDebit->setEnabled(FALSE); ui->pushEditDebit->setEnabled(FALSE); } if (mode==1) { QSqlQuery query(*db1); query.exec("select name,email1,email2,active,phone from customers where id="+cusid); query.next(); ui->lineEdit->setText(query.value(0).toString()); ui->lineEmail1->setText(query.value(1).toString()); ui->lineEmail2->setText(query.value(2).toString()); if(query.value(3).toInt()==0) ui->checkActive->setCheckState(Qt::Unchecked); else ui->checkActive->setCheckState(Qt::Checked); ui->linePhone->setText((query.value(4).toString())); ui->pushCusInsert->setEnabled(FALSE); refresh_sql(); } connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(text_changed())); connect(ui->lineEmail1,SIGNAL(textChanged(QString)),this,SLOT(text_changed())); connect(ui->lineEmail2,SIGNAL(textChanged(QString)),this,SLOT(text_changed())); connect(ui->linePhone,SIGNAL(textChanged(QString)),this,SLOT(text_changed())); connect(ui->pushCusInsert,SIGNAL(released()),this,SLOT(insert_customer())); connect(ui->pushAddDebit,SIGNAL(released()),this,SLOT(insert_debit_type())); connect(ui->checkActive,SIGNAL(clicked()),this,SLOT(check_clicked())); connect(ui->pushLeave,SIGNAL(released()),this,SLOT(cancel_clicked())); }
LineEdit::LineEdit(QWidget* parent) : QLineEdit(parent), ExtendedEditor(this) { connect(reset_button_, SIGNAL(clicked()), SIGNAL(Reset())); connect(this, SIGNAL(textChanged(QString)), SLOT(text_changed(QString))); }
QWidget *se_expr_param_t::do_create_widgets() { QWidget *top = new QWidget(); QLabel *label = new QLabel( top); ui::line_edit_t *tmp = new ui::line_edit_t(); QSize s = tmp->sizeHint(); delete tmp; label->move( 0, 0); label->resize( app().ui()->inspector().left_margin() - 5, s.height()); label->setAlignment( Qt::AlignRight | Qt::AlignVCenter); label->setText( name().c_str()); label->setToolTip( id().c_str()); int width = app().ui()->inspector().width() - app().ui()->inspector().left_margin() - 10; int height = 0; std::string str = get_value<std::string>( *this); multi_input_ = new ui::text_edit_t( top); multi_input_->move( app().ui()->inspector().left_margin(), height); multi_input_->resize( width, s.height() * 7); multi_input_->setEnabled( enabled()); multi_input_->setPlainText( str.c_str()); multi_input_->setContextMenuPolicy( Qt::CustomContextMenu); connect( multi_input_, SIGNAL( textHasChanged()), this, SLOT( text_changed())); connect( multi_input_, SIGNAL( customContextMenuRequested( const QPoint&)), this, SLOT( show_context_menu( const QPoint&))); height += multi_input_->height(); top->setMinimumSize( app().ui()->inspector().width(), height); top->setMaximumSize( app().ui()->inspector().width(), height); top->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed); top_widget_ = top; return top; }
FormMessage::FormMessage (QWidget* parent, bool is_reply, const AMessageInfoGUI& info, int edit_id) : FormMessageUI (parent) { m_text_changed = false; if (edit_id != 0) is_reply = false; m_edit_id = edit_id; connect(m_text_view->View->page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(link_clicked(const QUrl&))); connect(m_text_view->View->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SLOT(link_hover(const QString&, const QString&, const QString&))); m_forum_tree = NULL; m_main_form = NULL; m_info = info; if (m_edit_id == 0) { m_info.IDParent = m_info.ID; m_info.ID = 0; } // получение информации о форуме сообщения // работает "по тихому", т.к. если возникнет ошибка, то это не сильно принципиально // и можно продолжать нормальную работу, а не пугать пользователя // https://rsdn.ru/forum/janus/3315591.1 std::auto_ptr<IAStorage> storage(AStorageFactory::getStorage()); if (storage.get() != NULL) { AForumInfo forum_info; if (storage->getForumInfo(m_info.IDForum, forum_info) != false) m_forum_info = forum_info; } // формирование текста при ответе if (is_reply == true) { QString subject = m_info.Subject; QString body = m_info.Message; // // корректировка темы // if (subject.length() > 3 && subject.mid(0, 4) == "Re: ") subject.insert(2, "[2]"); else if (subject.length() > 3 && subject.mid(0, 3) == "Re[") { int pos = subject.indexOf("]"); if (pos != -1) { int num = subject.mid(3, pos - 3).toInt(); if (num == 0) subject = "Re: " + subject; else { subject.remove(3, pos - 3); subject.insert(3, QString::number(num + 1)); } } else subject = "Re: " + subject; } else subject = "Re: " + subject; m_info.Subject = subject; // // корректировка тела сообщения // body = AFormatter::normalizeBody(body, info.UserNick).trimmed(); if (body.length() > 0) body += "\r\n\r\n"; if (info.IDUser == 0) body = QString::fromUtf8("Здравствуйте, Аноним, Вы писали:\r\n\r\n") + body; else body = QString::fromUtf8("Здравствуйте, ") + info.UserNick + QString::fromUtf8(", Вы писали:\r\n\r\n") + body; m_info.Message = body; } // if (is_reply == true) else { // замена HTML спец-символов m_info.Message.replace(">", ">"); m_info.Message.replace("<", "<"); m_info.Message.replace("&", "&"); } // удаление таглайнов QRegExp tagline("\\[tagline\\](.+)\\[/tagline\\]"); tagline.setMinimal(true); m_info.Message.replace(tagline, ""); //m_info.Message = m_info.Message.trimmed(); // установка остальных полей m_text_subject->setText(m_info.Subject); m_text_source->setPlainText(m_info.Message); text_subject_text_changed(m_info.Subject); if (is_reply == true) { QIcon icon; icon.addFile(":/icons/reply16.png", QSize(16, 16)); icon.addFile(":/icons/reply22.png", QSize(22, 22)); icon.addFile(":/icons/reply32.png", QSize(32, 32)); icon.addFile(":/icons/reply48.png", QSize(48, 48)); setWindowIcon(icon); m_text_source->setFocus(); m_text_source->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); } else if (m_edit_id != 0) { QIcon icon; icon.addFile(":/icons/edit16.png", QSize(16, 16)); icon.addFile(":/icons/edit22.png", QSize(22, 22)); icon.addFile(":/icons/edit32.png", QSize(32, 32)); icon.addFile(":/icons/edit48.png", QSize(48, 48)); icon.addFile(":/icons/edit64.png", QSize(64, 64)); setWindowIcon(icon); m_text_source->setFocus(); m_text_source->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); } else { m_text_subject->setFocus(); m_text_subject->selectAll(); } // установка обработчиков формы connect(m_button_send, SIGNAL(triggered()), this, SLOT(button_send_triggered())); connect(m_button_draft, SIGNAL(triggered()), this, SLOT(button_draft_triggered())); connect(m_text_subject, SIGNAL(textChanged(const QString&)), this, SLOT(text_subject_text_changed(const QString&))); connect(m_tab_message, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int))); connect(m_text_source, SIGNAL(textChanged()), this, SLOT(text_changed())); }
void Trace::on_text_changed(const QString &text) { set_name(text); text_changed(); }