Beispiel #1
0
FMMatchRaster::FMMatchRaster ( QWidget * parent )
		:QDialog ( parent )
{
	setupUi ( this );
	QSettings settings;
	m_compsize = settings.value ( "MatchRaster/CompareSize", 120 ).toInt();
	m_matchLimit = settings.value ( "MatchRaster/Limit", 800.0 ).toDouble();
	m_minRefSize = settings.value ( "MatchRaster/ReferenceSize", 160 ).toInt();

	m_progressValue = 0;
	m_waitingForButton = false;
	waitingFont = 0;
	refCodepoint = 0;


	connect ( browseButton,SIGNAL ( clicked() ),this, SLOT ( browseImage() ) );
	connect ( grabZoom , SIGNAL ( valueChanged(int) ) ,this, SLOT ( zoomChanged(int)) );
	connect ( grabModeBox , SIGNAL ( toggled(bool) ) ,this, SLOT ( enterGrabMode(bool) ) );
	connect ( tweakRectBox, SIGNAL(toggled(bool)),this,SLOT(switchControlRect(bool)));
	connect ( letter,SIGNAL ( textChanged ( const QString & ) ),this,SLOT ( addImage ( const QString & ) ) );
	connect ( searchButton,SIGNAL ( clicked() ),this,SLOT ( search() ) );

	connect ( iView,SIGNAL ( rectChange ( QRect ) ),this,SLOT ( recordCurrentRect ( QRect ) ) );
	connect ( iView,SIGNAL ( selColorChanged ( QRgb ) ),this,SLOT ( recordCurrentColor ( QRgb ) ) );

	connect ( buttonBox,SIGNAL ( rejected() ),this,SLOT ( slotRefuseFont() ) );
	connect ( buttonBox,SIGNAL ( accepted() ),this,SLOT ( slotAcceptFont() ) );

	connect ( stopButton,SIGNAL ( clicked() ), this, SLOT ( slotStop() ) );
}
PlotFrame::PlotFrame(QWidget *parent) :
    QFrame(parent), ui(new Ui::PlotFrame), plotScene(NULL), plotView(NULL)
{
    // GUI Configuration
    ui->setupUi(this);

    // Create scene
    this->plotScene = new PlotScene(this);

    // Create view
    this->plotView = new PlotView(this->plotScene);
    this->plotView->setAutoFillBackground(true);
    this->plotView->setRenderHint(QPainter::Antialiasing);
    this->plotView->setSizePolicy(QSizePolicy::Expanding,
                                  QSizePolicy::Expanding);

    // Layouts configuration
    this->topScaleLayout    = new QVBoxLayout;
    this->bottomScaleLayout = new QVBoxLayout;
    this->leftScaleLayout   = new QHBoxLayout;
    this->rightScaleLayout  = new QHBoxLayout;

    this->ui->plotLayout->addLayout(this->topScaleLayout, 0, 1, 1, 3);
    this->ui->plotLayout->addLayout(this->bottomScaleLayout, 5, 1, 1, 3);
    this->ui->plotLayout->addLayout(this->leftScaleLayout, 1, 0, 3, 1);
    this->ui->plotLayout->addLayout(this->rightScaleLayout, 1, 5, 3, 1);
    this->ui->plotLayout->addWidget(this->plotView, 1, 1, 3, 3);

    // Manage tool button state
    this->ui->showCurvesToolButton->setChecked(
                this->plotScene->curvesAreVisible());
    this->ui->showPointsToolButton->setChecked(
                this->plotScene->pointsAreVisible());
    this->ui->showLineToolButton->setChecked(
                this->plotScene->curveLabelsAreVisible());

    // Connect GUI signals to slots | Use autoconnect and call scene slots ?
    connect(this->ui->showCurvesToolButton, SIGNAL(toggled(bool)),
            this->plotScene, SLOT(setCurvesVisible(bool)));
    connect(this->ui->showPointsToolButton, SIGNAL(toggled(bool)),
            this->plotScene, SLOT(setPointsVisible(bool)));
    connect(this->ui->zoomOutToolButton, SIGNAL(clicked()),
            this->plotView, SLOT(zoomOut()));

    // Connect signals and slots of view and scene
    connect(this->plotView, SIGNAL(rectChange(QRectF)),
            this, SLOT(adaptScales(QRectF)));
    connect(this->plotView, SIGNAL(beginSelection()),
            this->plotScene, SLOT(lockSelectionAbility()));
    connect(this->plotView, SIGNAL(finishSelection()),
            this->plotScene, SLOT(unlockSelectionAbility()));
    connect(this->plotView, SIGNAL(mousePosChanged(QPointF,QPointF)),
            this->plotScene, SLOT(displayLabels(QPointF,QPointF)));
    connect(this->plotView, SIGNAL(mousePressed(QPointF)),
            this->plotScene, SLOT(slotDeTest(QPointF)));

    setMouseTracking(true);
}
Beispiel #3
0
Rect::Rect(QGraphicsItem *parent) :  m_x(0), m_y(0), QGraphicsRectItem(parent) {
    this->setRect(m_x, m_y, 100, 100);
    this->setAcceptDrops(true);
    QObject::connect(this, SIGNAL(rectChange()), this, SLOT(slRectChange()));
    this->m_rectUpAn = new QPropertyAnimation(this, "rect"); // the animation will change rect and emit rectChange signal
    this->m_rectDownAn = new QPropertyAnimation(this, "rect");

    this->m_rectUpAn->setDuration(150);
    this->m_rectUpAn->setStartValue(this->rect()); // animation start point
    this->m_rectUpAn->setKeyValueAt(0.7, QRectF(-6, -6, 120, 120)); // animation end point
    this->m_rectUpAn->setEndValue(QRectF(-3, -3, 110, 110));

    this->m_rectDownAn->setDuration(150);;
    this->m_rectDownAn->setStartValue(this->rect());
    this->m_rectDownAn->setEndValue(QRectF(0, 0, 100, 100));

    this->m_mainStatus = new QStateMachine(this);
    QState *rectDragStart = new QState(this->m_mainStatus);
    QState *rectDragEnd = new QState(this->m_mainStatus);

    QSignalTransition *transition = rectDragStart->addTransition(this, SIGNAL(rectDragStart()), rectDragEnd);
    transition->addAnimation(this->m_rectUpAn);

    transition = rectDragEnd->addTransition(this, SIGNAL(rectDragEnd()), rectDragStart);
    transition->addAnimation(this->m_rectDownAn);

    this->m_mainStatus->addState(rectDragStart);
    this->m_mainStatus->addState(rectDragEnd);
    this->m_mainStatus->setInitialState(rectDragStart);

    this->m_mainStatus->start();

    this->setFlag(QGraphicsItem::ItemIsMovable, true);
    this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
    this->setFlag(QGraphicsItem::ItemIsFocusable, true);
    this->setFlag(QGraphicsItem::ItemAcceptsInputMethod, true);
}