コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: CHTim/Barcode-Decoder
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("Barcode Decoder");

    this->timer = new QTimer(this);
    //QPainter *painter = new QPainter(this);
    Camera *camera = new Camera();
    Process *process = new Process();




    process->moveToThread(&decodeThread);
    decodeThread.start();

    camera->moveToThread(&cameraThread);
    cameraThread.start();


    connect(timer , SIGNAL(timeout()) , camera , SLOT(imgRequest()) );
    connect(camera, SIGNAL(sendImg(cv::Mat)) , ui->play , SLOT(loadImg(cv::Mat)) );
    connect(camera, SIGNAL(sendImg(cv::Mat)) , process , SLOT(getImgAndProcess(cv::Mat)) );
    connect(process, SIGNAL(sendIsBarcaode(bool)) , ui->play , SLOT(slotIsBarcodeLocated(bool)) );
    connect(process, SIGNAL(sendLoc(cv::Rect)) , ui->play , SLOT(slotGetBarcodeLocation(cv::Rect)) );
    connect(process, SIGNAL(sendBarcodeImg(cv::Mat)) , this , SLOT(updateBarcodeImg(cv::Mat)) );
    connect(process, SIGNAL(sendBarcode(QString)) , this , SLOT(updateBarcode(QString)) );
    
    connect(ui->close, SIGNAL(pressed()) , ui->play, SLOT(cleanScrean()) );
    connect(ui->start, SIGNAL(pressed()) , ui->play, SLOT(startDisplay()) );
    //connect(ui->checkBox, SIGNAL(stateChanged(int)) , camera , SLOT(autofocus(int)) );
    connect(ui->focusValue, SIGNAL(sliderReleased()) , this , SLOT(getSliderValue()) );
    //connect(this , SIGNAL(focusNum(int)) , camera , SLOT(focusValue(int)) );
    connect(ui->checkBox , SIGNAL(clicked(bool)) , ui->focusValue, SLOT(setEnabled(bool)) );
    //connect(camera , SIGNAL(cameraCheck(bool)) , this , SLOT(slotCameraCheck(bool)) );
    //connect(ui->start, SIGNAL(pressed()) , camera , SLOT(autoFocusCheck()) );

    connect(ui->start, SIGNAL(pressed()) , camera , SLOT(sendID()) );
    connect(camera, SIGNAL(cameraID(int)) , this, SLOT(checkCamera(int)) );
    connect(this , SIGNAL(focusNum(int)) , this, SLOT(setCameraFocusValue(int)) );
    connect(ui->checkBox , SIGNAL(stateChanged(int)) , this , SLOT(setFocusStatus(int)) );



    //camera->autoFocusCheck();

    ui->close->setEnabled(false);
    ui->checkBox->setEnabled(false);
    ui->focusValue->setEnabled(false);

    this->cameraFocus = false;

    //this->timer->start(33);//using timer to trigger update

}
コード例 #2
0
ファイル: CSlider.cpp プロジェクト: mgaldzic/copasi_api
bool CSlider::setMaxValue(const C_FLOAT64 maxValue)
{
  if (mSliderType != Undefined)
    {
      mMaxValue = maxValue;

      if (mMaxValue < mMinValue)
        {
          mMinValue = mMaxValue;
        }

      if (mpSliderObject && getSliderValue() > mMaxValue)
        {
          this->mValue = this->mMaxValue;
          this->writeToObject();
        }

      return true;
    }
  else
    {
      return false;
    }
}