hlp:桂林国际齿轮泵代码
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
#if 1
|
||||
#include <QtGui>
|
||||
#include "pictextitem.h"
|
||||
#include "picscene.h"
|
||||
#include "moveinput.h"
|
||||
|
||||
extern MoveInput* moveInput;
|
||||
PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene) :
|
||||
QGraphicsTextItem(parent,scene)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||
//setFlag(QGraphicsItem::ItemIsFocusScope);
|
||||
setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
//setTextInteractionFlags(Qt::NoTextInteraction);
|
||||
QFont font;
|
||||
font.setFamily("wenquanyi");
|
||||
font.setPixelSize(12);
|
||||
//document()->setDefaultFont(font);//如果加上这句后,默认的都是wenquanyi 12点阵,看起来这个字体有问题,会黑屏,所以用界面的字体 WenQuanYiMH 代替
|
||||
document()->setDefaultStyleSheet("p { margin: 0; }");
|
||||
document()->setDocumentMargin(0);
|
||||
SpecialConditions = false;
|
||||
CatchCnt1CurrValue = -1;
|
||||
CatchCnt1StartValue = -1;
|
||||
}
|
||||
//! [1]
|
||||
QVariant PicTextItem::itemChange(GraphicsItemChange change,
|
||||
const QVariant &value)
|
||||
{
|
||||
#if 0
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
emit selectedChange(this);
|
||||
return value;
|
||||
#else
|
||||
//qDebug()<<"item posi: "<< pos();
|
||||
if (change == ItemSceneChange && scene()) {
|
||||
// value is the new position.
|
||||
QPointF newPos = value.toPoint();
|
||||
QRectF rect = scene()->sceneRect();
|
||||
if (!rect.contains(newPos)) {
|
||||
// Keep the item inside the scene rect.
|
||||
newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
|
||||
newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
|
||||
//return newPos;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (change == ItemSelectedChange && scene()) {
|
||||
if(moveInput->isHidden() && value == 1){
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
//QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标
|
||||
QRect myRec = moveInput->geometry();
|
||||
moveInput->setGeometry(rec.width()/2,rec.height()/2 ,myRec.width(),myRec.height());
|
||||
|
||||
moveInput->show();
|
||||
}
|
||||
if(value == 0)
|
||||
{
|
||||
moveInput->hide();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
#endif
|
||||
}
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
void PicTextItem::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
// setTextInteractionFlags(Qt::NoTextInteraction);
|
||||
moveInput->hide();
|
||||
emit lostFocus(this);
|
||||
QGraphicsTextItem::focusOutEvent(event);
|
||||
//
|
||||
}
|
||||
//! [2]
|
||||
|
||||
//! [5]
|
||||
void PicTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//if (textInteractionFlags() == Qt::NoTextInteraction)
|
||||
// setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||
//setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
QGraphicsTextItem::mouseDoubleClickEvent(event);
|
||||
//emit itemEdit(toHtml());
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//限制图元拖动范围
|
||||
void PicTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||
{
|
||||
//edit@12-07
|
||||
QPointF newPos = this->pos();
|
||||
//qDebug()<<"mouseReleaseEvent-tem->pos="<<newPos;
|
||||
this->setPos(qCeil(newPos.x()),qCeil(newPos.y()));
|
||||
scene()->update();
|
||||
|
||||
|
||||
// QRectF rect = scene()->sceneRect();
|
||||
// if (!rect.contains(newPos)) {
|
||||
// // Keep the item inside the scene rect.
|
||||
// newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
|
||||
// newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
|
||||
// this->setPos(newPos);
|
||||
// }
|
||||
QGraphicsTextItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void PicTextItem::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
foreach (QGraphicsItem *item, scene()->selectedItems()) {
|
||||
if(event->key() == Qt::Key_Left)
|
||||
{
|
||||
item->moveBy(-1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Right)
|
||||
{
|
||||
item->moveBy(1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Up)
|
||||
{
|
||||
item->moveBy(0, -1);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Down)
|
||||
{
|
||||
item->moveBy(0, 1);
|
||||
}
|
||||
}
|
||||
if(!scene()->selectedItems().empty())
|
||||
{
|
||||
scene()->update();
|
||||
}
|
||||
|
||||
//QPointF newPos = this->pos();
|
||||
//const QRectF rect = scene()->sceneRect();
|
||||
// if (!rect.contains(newPos)) {
|
||||
// // Keep the item inside the scene rect.
|
||||
// newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
|
||||
// newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
|
||||
// //this->setPos(newPos);
|
||||
// //edit@12-09
|
||||
// this->setPos(view->mapToScene(newPos.x(),newPos.y()));
|
||||
// }
|
||||
QGraphicsTextItem::keyPressEvent(event);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,93 @@
|
||||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'dlgmywarring.h'
|
||||
**
|
||||
** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.5)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../dlgmywarring.h"
|
||||
#if !defined(Q_MOC_OUTPUT_REVISION)
|
||||
#error "The header file 'dlgmywarring.h' doesn't include <QObject>."
|
||||
#elif Q_MOC_OUTPUT_REVISION != 63
|
||||
#error "This file was generated using the moc from 4.8.5. It"
|
||||
#error "cannot be used with the include files from this version of Qt."
|
||||
#error "(The moc has changed too much.)"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_MOC_NAMESPACE
|
||||
static const uint qt_meta_data_DlgMyWarring[] = {
|
||||
|
||||
// content:
|
||||
6, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
1, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
0, // flags
|
||||
0, // signalCount
|
||||
|
||||
// slots: signature, parameters, type, tag, flags
|
||||
14, 13, 13, 13, 0x0a,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
|
||||
static const char qt_meta_stringdata_DlgMyWarring[] = {
|
||||
"DlgMyWarring\0\0pushButtonPressed()\0"
|
||||
};
|
||||
|
||||
void DlgMyWarring::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
Q_ASSERT(staticMetaObject.cast(_o));
|
||||
DlgMyWarring *_t = static_cast<DlgMyWarring *>(_o);
|
||||
switch (_id) {
|
||||
case 0: _t->pushButtonPressed(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
Q_UNUSED(_a);
|
||||
}
|
||||
|
||||
const QMetaObjectExtraData DlgMyWarring::staticMetaObjectExtraData = {
|
||||
0, qt_static_metacall
|
||||
};
|
||||
|
||||
const QMetaObject DlgMyWarring::staticMetaObject = {
|
||||
{ &QDialog::staticMetaObject, qt_meta_stringdata_DlgMyWarring,
|
||||
qt_meta_data_DlgMyWarring, &staticMetaObjectExtraData }
|
||||
};
|
||||
|
||||
#ifdef Q_NO_DATA_RELOCATION
|
||||
const QMetaObject &DlgMyWarring::getStaticMetaObject() { return staticMetaObject; }
|
||||
#endif //Q_NO_DATA_RELOCATION
|
||||
|
||||
const QMetaObject *DlgMyWarring::metaObject() const
|
||||
{
|
||||
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
|
||||
}
|
||||
|
||||
void *DlgMyWarring::qt_metacast(const char *_clname)
|
||||
{
|
||||
if (!_clname) return 0;
|
||||
if (!strcmp(_clname, qt_meta_stringdata_DlgMyWarring))
|
||||
return static_cast<void*>(const_cast< DlgMyWarring*>(this));
|
||||
return QDialog::qt_metacast(_clname);
|
||||
}
|
||||
|
||||
int DlgMyWarring::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
{
|
||||
_id = QDialog::qt_metacall(_c, _id, _a);
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 1)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 1;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
QT_END_MOC_NAMESPACE
|
||||
@@ -0,0 +1,174 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'timesettingdialog.ui'
|
||||
**
|
||||
** Created by: Qt User Interface Compiler version 4.8.5
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_TIMESETTINGDIALOG_H
|
||||
#define UI_TIMESETTINGDIALOG_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_TimeSettingDialog
|
||||
{
|
||||
public:
|
||||
QDialogButtonBox *buttonBox;
|
||||
QWidget *gridLayoutWidget;
|
||||
QGridLayout *gridLayout;
|
||||
QSpinBox *spinBoxSecond;
|
||||
QLabel *label_6;
|
||||
QLabel *label_5;
|
||||
QSpinBox *spinBoxMinute;
|
||||
QSpinBox *spinBoxYear;
|
||||
QLabel *label_2;
|
||||
QLabel *label_3;
|
||||
QLabel *label_4;
|
||||
QSpinBox *spinBoxHour;
|
||||
QSpinBox *spinBoxDay;
|
||||
QLabel *label;
|
||||
QSpinBox *spinBoxMonth;
|
||||
|
||||
void setupUi(QDialog *TimeSettingDialog)
|
||||
{
|
||||
if (TimeSettingDialog->objectName().isEmpty())
|
||||
TimeSettingDialog->setObjectName(QString::fromUtf8("TimeSettingDialog"));
|
||||
TimeSettingDialog->resize(449, 149);
|
||||
TimeSettingDialog->setFocusPolicy(Qt::StrongFocus);
|
||||
buttonBox = new QDialogButtonBox(TimeSettingDialog);
|
||||
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
|
||||
buttonBox->setGeometry(QRect(230, 110, 201, 41));
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
gridLayoutWidget = new QWidget(TimeSettingDialog);
|
||||
gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
|
||||
gridLayoutWidget->setGeometry(QRect(10, 10, 431, 91));
|
||||
gridLayout = new QGridLayout(gridLayoutWidget);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
spinBoxSecond = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxSecond->setObjectName(QString::fromUtf8("spinBoxSecond"));
|
||||
spinBoxSecond->setMinimum(0);
|
||||
spinBoxSecond->setMaximum(59);
|
||||
|
||||
gridLayout->addWidget(spinBoxSecond, 1, 5, 1, 1);
|
||||
|
||||
label_6 = new QLabel(gridLayoutWidget);
|
||||
label_6->setObjectName(QString::fromUtf8("label_6"));
|
||||
label_6->setMaximumSize(QSize(40, 16777215));
|
||||
label_6->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label_6, 1, 4, 1, 1);
|
||||
|
||||
label_5 = new QLabel(gridLayoutWidget);
|
||||
label_5->setObjectName(QString::fromUtf8("label_5"));
|
||||
label_5->setMaximumSize(QSize(40, 16777215));
|
||||
label_5->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label_5, 1, 2, 1, 1);
|
||||
|
||||
spinBoxMinute = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxMinute->setObjectName(QString::fromUtf8("spinBoxMinute"));
|
||||
spinBoxMinute->setMinimum(0);
|
||||
spinBoxMinute->setMaximum(59);
|
||||
|
||||
gridLayout->addWidget(spinBoxMinute, 1, 3, 1, 1);
|
||||
|
||||
spinBoxYear = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxYear->setObjectName(QString::fromUtf8("spinBoxYear"));
|
||||
spinBoxYear->setMinimum(1970);
|
||||
spinBoxYear->setMaximum(4000);
|
||||
|
||||
gridLayout->addWidget(spinBoxYear, 0, 1, 1, 1);
|
||||
|
||||
label_2 = new QLabel(gridLayoutWidget);
|
||||
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||
label_2->setMaximumSize(QSize(40, 16777215));
|
||||
label_2->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label_2, 0, 2, 1, 1);
|
||||
|
||||
label_3 = new QLabel(gridLayoutWidget);
|
||||
label_3->setObjectName(QString::fromUtf8("label_3"));
|
||||
label_3->setMaximumSize(QSize(40, 16777215));
|
||||
label_3->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label_3, 0, 4, 1, 1);
|
||||
|
||||
label_4 = new QLabel(gridLayoutWidget);
|
||||
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||
label_4->setMaximumSize(QSize(40, 16777215));
|
||||
label_4->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label_4, 1, 0, 1, 1);
|
||||
|
||||
spinBoxHour = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxHour->setObjectName(QString::fromUtf8("spinBoxHour"));
|
||||
spinBoxHour->setMinimum(0);
|
||||
spinBoxHour->setMaximum(23);
|
||||
spinBoxHour->setValue(0);
|
||||
|
||||
gridLayout->addWidget(spinBoxHour, 1, 1, 1, 1);
|
||||
|
||||
spinBoxDay = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxDay->setObjectName(QString::fromUtf8("spinBoxDay"));
|
||||
spinBoxDay->setMinimum(1);
|
||||
spinBoxDay->setMaximum(31);
|
||||
|
||||
gridLayout->addWidget(spinBoxDay, 0, 5, 1, 1);
|
||||
|
||||
label = new QLabel(gridLayoutWidget);
|
||||
label->setObjectName(QString::fromUtf8("label"));
|
||||
label->setMaximumSize(QSize(40, 16777215));
|
||||
label->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
gridLayout->addWidget(label, 0, 0, 1, 1);
|
||||
|
||||
spinBoxMonth = new QSpinBox(gridLayoutWidget);
|
||||
spinBoxMonth->setObjectName(QString::fromUtf8("spinBoxMonth"));
|
||||
spinBoxMonth->setMinimum(1);
|
||||
spinBoxMonth->setMaximum(12);
|
||||
|
||||
gridLayout->addWidget(spinBoxMonth, 0, 3, 1, 1);
|
||||
|
||||
|
||||
retranslateUi(TimeSettingDialog);
|
||||
QObject::connect(buttonBox, SIGNAL(accepted()), TimeSettingDialog, SLOT(accept()));
|
||||
QObject::connect(buttonBox, SIGNAL(rejected()), TimeSettingDialog, SLOT(reject()));
|
||||
|
||||
QMetaObject::connectSlotsByName(TimeSettingDialog);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QDialog *TimeSettingDialog)
|
||||
{
|
||||
TimeSettingDialog->setWindowTitle(QApplication::translate("TimeSettingDialog", "Dialog", 0, QApplication::UnicodeUTF8));
|
||||
label_6->setText(QApplication::translate("TimeSettingDialog", "\347\247\222:", 0, QApplication::UnicodeUTF8));
|
||||
label_5->setText(QApplication::translate("TimeSettingDialog", "\345\210\206\357\274\232", 0, QApplication::UnicodeUTF8));
|
||||
label_2->setText(QApplication::translate("TimeSettingDialog", "\346\234\210\357\274\232", 0, QApplication::UnicodeUTF8));
|
||||
label_3->setText(QApplication::translate("TimeSettingDialog", "\346\227\245:", 0, QApplication::UnicodeUTF8));
|
||||
label_4->setText(QApplication::translate("TimeSettingDialog", "\346\227\266\357\274\232", 0, QApplication::UnicodeUTF8));
|
||||
label->setText(QApplication::translate("TimeSettingDialog", "\345\271\264\357\274\232", 0, QApplication::UnicodeUTF8));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class TimeSettingDialog: public Ui_TimeSettingDialog {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_TIMESETTINGDIALOG_H
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user