void MainWindow::on_m_stress_triggered() { off_ct = true; if (ui->m_stress->isChecked()) on_m_proccessing_triggered(); else { QTextCursor cur(ui->textEdit->document()); QString word; QChar end_of_buf; QString wrong_char = "?!., ;:\'\"\\/+><@#~`$%^&*(){}|\n\r\t\a\?"; fake_text = ui->textEdit->toHtml(); progress->setMaximum(ui->textEdit->toPlainText().length()); progress->setValue(0); while (cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor)) { progress->setValue(progress->value()+1); word = cur.selectedText(); end_of_buf = word[word.length()-1]; if (wrong_char.contains(end_of_buf) || end_of_buf.unicode()==8233) { QTextCursor cur2 (ui->textEdit->document()); cur2.setPosition(cur.position()); cur2.movePosition(QTextCursor::PreviousCharacter); if (cur2.charFormat().foreground().color()!=QColor("red") && cur2.charFormat().foreground().color()!=QColor("blue")) { cur.clearSelection(); word.clear(); continue; } word = cur.selectedText(); cur.removeSelectedText(); cur.insertText(word,QTextCharFormat()); cur.clearSelection(); } } if (!cur.selectedText().isEmpty()) { QTextCursor cur2 (ui->textEdit->document()); if (cur2.charFormat().foreground().color()==QColor("red") || cur2.charFormat().foreground().color()==QColor("blue")) { word = cur.selectedText(); cur.removeSelectedText(); cur.insertText(word,QTextCharFormat()); } } tpl = ui->textEdit->toPlainText().length(); refresh_ur(false); oper_stack.insert(oper_stack.begin(),1, oper_info(1,1,1, fake_text,ui->textEdit->toHtml() )); fake_text = ui->textEdit->toHtml(); } off_ct = false; }
QLoginDlg::QLoginDlg(QWidget *parent) :QDialog(parent) { /*对象实例化*/ lblUser=new QLabel(tr("<img src='../p1.png' width=80 height=30/>"),this); edtUser=new QLineEdit(tr("输入用户名"),this); btnLogin=new QPushButton(tr("登录"),this); /*对象初始化:大小,位置*/ lblUser->resize(80,30); edtUser->resize(150,30); btnLogin->resize(100,30); lblUser->move(20,20); edtUser->move(100,20); btnLogin->move(30,120); this->resize(270,180); this->move((1024-270)/2,(768-180)/2); QCursor cur(Qt::CrossCursor); this->setCursor(cur); QCursor cur2(Qt::UpArrowCursor); btnLogin->setCursor(cur2); this->setToolTip(tr("<s>我是提示</s>")); btnLogin->setToolTip(tr("我是登录")); QIcon ico("../p1.png"); this->setWindowIcon(ico); /* QFont font(tr("文鼎PL中楷Uni"),20,100,true); lblUser->setFont(font); */ this->setWindowTitle(tr("BOSS-登录界面")); this->setVisible(true); }
/* ------------------------------------------------------------------------ */ bool Platform_Layer_Info:: cmp(Platform_Layer_Info const& p) const { // Compare sizes of bimaps first if(this->_bimap.left.size() != p._bimap.left.size()) return false; // Compare layout (which device maps to which platform, in order) if(this->indices() != p.indices()) return false; // Compare Platforms and Devices one by one typedef Bimap::left_const_iterator It; It cur1(_bimap.left.begin()); It cur2(p._bimap.left.begin()); It end1(_bimap.left.end()); It end2(p._bimap.left.end()); for(; cur1 != end1 && cur2 != end2; ++cur1, ++cur2) { if(*(cur1->first) != *(cur2->first) || *(cur1->second) != *(cur2->second)) return false; } return true; }
/** * Constructor. */ QG_GraphicView::QG_GraphicView(QWidget* parent, const char* name, Qt::WindowFlags f) : QWidget(parent, f), RS_GraphicView() { setObjectName(name); setBackground(background); redrawMethod=RS2::RedrawAll; isSmoothScrolling = false; PixmapLayer1=PixmapLayer2=PixmapLayer3=NULL; layout = new QGridLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 0); layout->setColumnStretch(2, 0); layout->setRowStretch(0, 1); layout->setRowStretch(1, 0); hScrollBar = new QG_ScrollBar(Qt::Horizontal, this); hScrollBar->setSingleStep(50); hScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(hScrollBar, 1, 0); layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0); connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int))); vScrollBar = new QG_ScrollBar(Qt::Vertical, this); vScrollBar->setSingleStep(50); vScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(vScrollBar, 0, 2); layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2); connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotVScrolled(int))); // Mouse Cursors: QPixmap cur1(":ui/cur_cad_bmp.png"); QPixmap cur2(":ui/cur_glass_bmp.png"); QPixmap cur3(":ui/cur_del_bmp.png"); QPixmap cur4(":ui/cur_select_bmp.png"); QPixmap cur5(":ui/cur_hand_bmp.png"); #ifdef Q_OS_WIN32 curCad = new QCursor(cur1, 16, 16); curMagnifier = new QCursor(cur2, 12, 12); curDel = new QCursor(cur3, 16, 16); curSelect = new QCursor(cur4, 16, 16); curHand = new QCursor(cur5, 15, 15); #else curCad = new QCursor(cur1, 15, 15); curMagnifier = new QCursor(cur2, 12, 12); curDel = new QCursor(cur3, 15, 15); curSelect = new QCursor(cur4, 15, 15); curHand = new QCursor(cur5, 15, 15); #endif // Dummy widgets for scrollbar corners: //layout->addWidget(new QWidget(this), 1, 1); //QWidget* w = new QWidget(this); //w->setEraseColor(QColor(255,0,0)); gridStatus = new QLabel("-", this); gridStatus->setAlignment(Qt::AlignRight); layout->addWidget(gridStatus, 1, 1, 1, 2); layout->addItem(new QSpacerItem(50, 0), 0, 1); setMouseTracking(true); // flickering under win: //setFocusPolicy(WheelFocus); setFocusPolicy(Qt::NoFocus); // See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window) setAttribute(Qt::WA_NoMousePropagation); //update entities to selected entities to the current active layer RS_SETTINGS->beginGroup("/Modify"); m_bUpdateLayer=(RS_SETTINGS->readEntry("/ModifyEntitiesToActiveLayer", "0")=="1"); RS_SETTINGS->writeEntry("/ModifyEntitiesToActiveLayer", m_bUpdateLayer?1:0); RS_SETTINGS->endGroup(); }
void ChrGetListAction::run_indbpool( otl_connect *pconn) { try { pconn->auto_commit_off(); #ifdef OTL_ODBC pconn->set_transaction_isolation_level( otl_tran_serializable); #endif otl_stream cur( 50, DBPROC_CHRGETLIST, *pconn, otl_implicit_select); cur << uuid_.userid_ << (short)GLOBALCONFIG_INS->get_regionsn(); //获取角色列表 while( !cur.eof()) { short sv, rc, pf; NS_STL::string strname, petname; ChrListInfo* chr =FRAMEWK_NEW ChrListInfo(); cur >> chr->chrid_ >> strname >> rc >> pf >> sv >> chr->lastposx_ >> chr->lastposy_ >> chr->lastposz_ >> chr->lastfacing_ >> chr->hp_ >> chr->mp_ >> chr->exp_ >> chr->level_ >> chr->moneys_ >> chr->petid_ >> chr->petcode_ >> petname; chr->name_ =strname; chr->petname_ =petname; chr->race_ =rc; chr->sex_ =sv; chr->profession_ =pf; chr->equiplen_ =CHRITEMS_MAX; chrs_.push_back( chr); } cur.close(); //获取avatar列表 otl_stream cur2( 50, DBPROC_CHRGETAVLIST, *pconn, otl_implicit_select); cur2 << uuid_.userid_ << (short)GLOBALCONFIG_INS->get_regionsn(); int cid, icode; short iav, inp; while( !cur2.eof()) { cur2 >> cid >> iav >> icode >> inp; ChrListInfo* pc =get_chrinfo( cid); if( pc == 0) continue; if( inp < 0 || inp >= CHRITEMS_MAX) continue; pc->equips_[inp] =icode; } pconn->commit(); } catch( otl_exception& e){ pconn->rollback(); MODULE_LOG_ERROR( MODULE_DATABASE, "ChrGetListAction::run_indbpool exception code:%d msg:%s ", e.code, e.msg); } }