⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 factor.cpp

📁 一个基于QT的电网监控程序
💻 CPP
字号:
#include "factor.h" #include <qframe.h>#include <qlabel.h>#include <qlcdnumber.h>#include <qslider.h>#include <qspinbox.h>#include <qlayout.h>#include <qvariant.h>#include <qtooltip.h>#include <qwhatsthis.h>#include <qfont.h>Factor::Factor( QWidget* parent,  const char* name)    : QFrame( parent, name){    if ( !name )	setName( "factor" );   current_value=0;    resize( 425, 300 );        QFont font(  this->font() );    font.setFamily( "adobe-courier" );    font.setPointSize( 16 );    this->setFont( font );     this->setFrameShape( QFrame::NoFrame );    this->setFrameShadow( QFrame::Raised );    TextLabel1 = new QLabel( this, "TextLabel1" );    QFont TextLabel1_font(  TextLabel1->font() );    TextLabel1_font.setPointSize( 18 );    TextLabel1->setFont( TextLabel1_font );     TextLabel1->setGeometry( QRect( 130, 20, 250, 50 ) );     TextLabel1->setText( tr( "PhaseA Current Factor" ) );        TextLabel2 = new QLabel( this, "TextLabel2" );    QFont TextLabel2_font(  TextLabel2->font() );    TextLabel2_font.setPointSize( 18 );    TextLabel2->setFont( TextLabel2_font );     TextLabel2->setGeometry( QRect( 50, 220, 120, 50 ) );     TextLabel2->setText( tr( "OutPut" ) );    LCDNumber1 = new QLCDNumber( this, "LCDNumber1" );    LCDNumber1->setGeometry( QRect( 150, 200, 216, 90 ) );     LCDNumber1->setNumDigits( 6 );    LCDNumber1->setSegmentStyle( QLCDNumber::Filled );    Slider1 = new QSlider( this, "Slider1" );    Slider1->setGeometry( QRect( 30, 90, 255, 41 ) );     Slider1->setMaxValue( 5000 );    Slider1->setOrientation( QSlider::Horizontal );    Slider1->setValue(0);    SpinBox1 = new QSpinBox( this, "SpinBox1" );    SpinBox1->setGeometry( QRect( 300, 86, 110, 51 ) );     SpinBox1->setLineWidth( 1 );    SpinBox1->setMaxValue( 5000 );    SpinBox1->setValue(0);    // signals and slots connections    connect( Slider1, SIGNAL( valueChanged(int) ), this, SLOT( value_sys(int) ) );    connect( SpinBox1, SIGNAL( valueChanged(int) ), this, SLOT( value_sys(int)) );    connect(this,SIGNAL(LcdNum1_send(double)),LCDNumber1,SLOT(display(double)));}Factor::~Factor(){}void Factor::SetTitle(const QString &title){	TextLabel1->setText(title);}void Factor::setLcdNumber1(double num){	emit LcdNum1_send(num);}void Factor::value_sys(int number){	if(current_value!=number){	 current_value=number;	 Slider1->setValue(number);	 SpinBox1->setValue(number);	}}void Factor::SetCurrentValue(int number){	current_value=number;	Slider1->setValue(number);	SpinBox1->setValue(number);}int Factor::GetCurrentValue(){	return current_value;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -