hlp:桂林国际齿轮泵代码

This commit is contained in:
kite_lucs
2026-10-09 10:25:24 +08:00
commit fd606b3c81
2447 changed files with 999531 additions and 0 deletions
@@ -0,0 +1,143 @@
/*
* MyTextEdit.cpp
*
* Created on: Aug 7, 2013
* Author: yiyu
* QQ:1036184468
* Descriptoin:
*/
#include <MyTextEdit.h>
#include "SysPara.h"
#include <QTextDocument>
#include <QTextCursor>
#include <QTextBlockFormat>
#include <QTextBlock>
#include <QDebug>
#include <QKeyEvent>
#include <QWSServer>
MyTextEdit::MyTextEdit(QWidget *parent):QTextEdit(parent){
this->document()->setDocumentMargin(0);
// QTextDocument *doc = this->document(); //获取文档对象
// QTextFrame *rootFrame = doc->rootFrame(); //获取根框架
// QTextFrameFormat frameFormat; //创建框架格式
// frameFormat.setBorderBrush(Qt::red); //设置边界颜色
// frameFormat.setBorder(0); //设置边界宽度
// rootFrame->setFrameFormat(frameFormat); //给框架使用格式
//this->setTextInteractionFlags(Qt::TextEditable);//不能选中
this->setLineWrapMode(QTextEdit::NoWrap);
for(QTextBlock textBlock = this->document()->begin();
textBlock != this->document()->end();
textBlock = textBlock.next()){
QTextBlockFormat textBlockFormat = textBlock.blockFormat();
textBlockFormat.setBottomMargin(0);
QTextCursor textCursor = this->textCursor();
textCursor.setBlockFormat(textBlockFormat);
this->setTextCursor(textCursor);
}
}
void MyTextEdit::dragEnterEvent ( QDragEnterEvent * e ){
e->ignore();
}
void MyTextEdit::dragLeaveEvent ( QDragLeaveEvent * e ){
e->ignore();
}
void MyTextEdit::dragMoveEvent ( QDragMoveEvent * e ){
e->ignore();
}
void MyTextEdit::mouseDoubleClickEvent ( QMouseEvent * e ){
e->ignore();
}
void MyTextEdit::mousePressEvent(QMouseEvent * e)
{
//获取点击的下标
// qDebug() << e->x() << ":" << e->y();
if(this->toPlainText().length()>1 && cursorForPosition(e->pos()).atEnd())
{
int textHeight=this->height();
QPoint currentPt=e->pos();
QTextCursor textCursor=cursorForPosition(currentPt);
while(textCursor.atEnd() && 0<--textHeight && 0<currentPt.y())
{
int textWidth=this->width();
currentPt.setX(e->pos().x());
currentPt.setY(currentPt.y()-5);
textCursor=cursorForPosition(currentPt);
while(textCursor.atEnd() && 0<--textWidth && 0<currentPt.x())
{
currentPt.setX(currentPt.x()-8);
textCursor=cursorForPosition(currentPt);
}
}
if(0<currentPt.x() && 0<currentPt.y())
{
currentPt.setX(e->pos().x()+8);
this->setTextCursor(cursorForPosition(currentPt));
return;
}
}
if(e->button() == Qt::LeftButton)
{
QWSServer::sendKeyEvent(0,Qt::Key_Left1,Qt::NoModifier,true,false);
QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件
QWSServer::sendKeyEvent(0,Qt::Key_Right1,Qt::NoModifier,true,false);
QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false);
//setCursor();
//QTextCursor textCursor = this->textCursor();
//textCursor.clearSelection();
//textCursor.setPosition(e->x());
//textCursor.setBlockFormat(textBlockFormat);
//this->setTextCursor(textCursor);
}
// if(e->button() == Qt::RightButton)
// {
// e->ignore();
// }
// else
{
QTextEdit::mousePressEvent(e);
}
}
//bool MyTextEdit::qwsEvent ( QWSEvent * event ){
//}
//void MyTextEdit::mouseMoveEvent ( QMouseEvent * e ){
// e->ignore();
//}
//
//void MyTextEdit::changeEvent ( QEvent * event ){
// if(event->type()==QEvent::FontChange)
// {
// }
// QTextEdit::changeEvent(event);
//}
//void MyTextEdit::mouseReleaseEvent(QMouseEvent * e)
//{
// QTextCursor textCursor = this->textCursor();
// textCursor.clearSelection();
// QTextEdit::mouseReleaseEvent(e);
//}
@@ -0,0 +1,37 @@
#ifndef DIALOGFONTSIZE_H
#define DIALOGFONTSIZE_H
#include <QDialog>
namespace Ui {
class DialogFontSize;
}
class DialogFontSize : public QDialog
{
Q_OBJECT
public:
explicit DialogFontSize(QWidget *parent = 0);
~DialogFontSize();
void getValue(int *size);
void setValue(int value);
QFont font;
QString getFontFamily();
QFont getFont();
void GetFileInfo();//String fileName, String fileDate
public slots:
void ChangeFont(QString fontFamily);
void Button7HoriL(bool ok);
void Button7HoriR(bool ok);
private slots:
void on_pushButton_pressed();
private:
Ui::DialogFontSize *ui;
};
#endif // DIALOGFONTSIZE_H