Esempio n. 1
0
void MainWindow::initSwitchFrame()
{
    leftFrame = new FloatFrame(this);
    leftFrame->setFillBackground(false);
    leftFrame->setHideInterval(400);
    connect(leftFrame, SIGNAL(mouseClicked()), viewer, SLOT(prePic()));

    QLabel *lb = new QLabel(leftFrame);
    lb->setPixmap(QPixmap(":/Left2.png"));
    leftFrame->addWidget(lb);

    QHBoxLayout *hlayout = new QHBoxLayout(leftFrame);
    hlayout->setAlignment(Qt::AlignCenter);
    hlayout->addWidget(lb);
    leftFrame->setLayout(hlayout);


    rightFrame = new FloatFrame(this);
    rightFrame->setFillBackground(false);
    rightFrame->setHideInterval(400);
    connect(rightFrame, SIGNAL(mouseClicked()), viewer, SLOT(nextPic()));

    lb = new QLabel(rightFrame);
    lb->setPixmap(QPixmap(":/Right2.png"));
    rightFrame->addWidget(lb);

    hlayout = new QHBoxLayout(rightFrame);
    hlayout->setAlignment(Qt::AlignCenter);
    hlayout->addWidget(lb);
    rightFrame->setLayout(hlayout);


    leftFrame->installEventFilter(this);
    rightFrame->installEventFilter(this);
}
QGraphicsObject * RefrigerationSystemItemDelegate::view(QSharedPointer<OSListItem> dataSource)
{
  QGraphicsObject * itemView = NULL;

  if( QSharedPointer<RefrigerationSystemListItem> listItem = dataSource.dynamicCast<RefrigerationSystemListItem>() )
  {
    RefrigerationSystemMiniView * refrigerationSystemMiniView = new RefrigerationSystemMiniView();

    bool bingo;
    bingo = connect(refrigerationSystemMiniView->removeButtonItem,SIGNAL(mouseClicked()),dataSource.data(),SLOT(remove()));
    OS_ASSERT(bingo);

    bingo = connect(refrigerationSystemMiniView->zoomInButtonItem,SIGNAL(mouseClicked()),dataSource.data(),SLOT(zoomInOnSystem()));
    OS_ASSERT(bingo);

    refrigerationSystemMiniView->setName(listItem->systemName());

    itemView = refrigerationSystemMiniView;
  }
  else if( dataSource.dynamicCast<RefrigerationSystemListDropZoneItem>() )
  {
    RefrigerationSystemDropZoneView * refrigerationSystemDropZoneView = new RefrigerationSystemDropZoneView();

    bool bingo;
    bingo = connect(refrigerationSystemDropZoneView,SIGNAL(componentDropped(const OSItemId &)),
                    qobject_cast<RefrigerationSystemListController *>(dataSource->controller()),SLOT(addSystem(const OSItemId &)));
    OS_ASSERT(bingo);

    itemView = refrigerationSystemDropZoneView;
  }
Esempio n. 3
0
/* processing mouse click events over label */
void KbfxPixmapLabel::mousePressEvent ( QMouseEvent * e )
{
	e->accept();
	ButtonState _btn = e->button();
	kdDebug() << "Mouse Clicked: " << _btn << endl;
	emit clicked();
	emit mouseClicked ();
	emit mouseClicked ( _btn );
}
Esempio n. 4
0
/*左击鼠标事件*/
void CheckersPicture::mousePressEvent(QMouseEvent *event)
{
    if (event->buttons() & Qt::LeftButton) {
        qreal i = (event->pos().x() - p.x()) * (n)/side;
        qreal j = (double)n - (event->pos().y() - p.y()) * (n)/side - 1;
        if (color==BLACK)
            emit mouseClicked((int)i,(int)j);
        else
            emit mouseClicked(n -1 - (int)i, n - 1 - (int)j);
    }
}
Esempio n. 5
0
void HowToPlay::handleEvents(SDL_Event& event)
{
    if(event.type == SDL_MOUSEBUTTONDOWN)
    {
        mouseClicked();
    }
}
Esempio n. 6
0
void HighScore::handleEvents(SDL_Event& event)
{
    if(event.type == SDL_MOUSEBUTTONDOWN)
    {
		mouseClicked();
	}
}
MakeupWaterItem::MakeupWaterItem(QGraphicsItem * parent)
  : GridItem(parent)
{
  setHGridLength(2);
  setVGridLength(2);

  QPixmap waterMainPixmap(":/images/water_main_alone.png");
  QPixmap waterMainPressPixmap(":/images/water_main_alone_press.png");
  QPixmap waterMainOverPixmap(":/images/water_main_alone_over.png");

  m_mainsSupplyButton = new ButtonItem(waterMainPixmap,waterMainPressPixmap,waterMainOverPixmap,this);

  m_mainsSupplyButton->setToolTip("Go back to water mains editor");

  m_mainsSupplyButton->setPos(75,0); 

  QPixmap hotWaterSupplyPixmap(":/images/loop_button.png");
  QPixmap hotWaterSupplyPressPixmap(":/images/loop_button_press.png");
  QPixmap hotWaterSupplyOverPixmap(":/images/loop_button_over.png");

  m_hotWaterSupplyButton = new ButtonItem(hotWaterSupplyPixmap,hotWaterSupplyPressPixmap,
                                                     hotWaterSupplyOverPixmap,this);


  m_hotWaterSupplyButton->setToolTip("Go back to hot water supply system");

  connect(m_hotWaterSupplyButton,SIGNAL(mouseClicked()),this,SLOT(onHotWaterSupplyButtonClicked()));

  m_hotWaterSupplyButton->setPos(90,137);
}
Esempio n. 8
0
 void InputMapper::mouseButtonClickEventHandlerCallback(GLFWwindow* window, int button, int action, int mods)
 {
     auto inputMapper = reinterpret_cast<InputMapper*>(glfwGetWindowUserPointer(window));
     double xPos, yPos;
     glfwGetCursorPos(window, &xPos, &yPos);
     if (inputMapper) inputMapper->mouseClicked(button, action, mods, xPos, yPos);
 }
Esempio n. 9
0
void LevelComplete::handleEvents(SDL_Event& event)
{
    if(event.type == SDL_MOUSEBUTTONDOWN)
    {
        mouseClicked();
    }
}
Esempio n. 10
0
void Title::handleEvents(SDL_Event& e, Engine* engine)
{
	if(e.type == SDL_MOUSEBUTTONDOWN)
	{
		mouseClicked(e, engine);
	}
}
Esempio n. 11
0
void CoordinateCaptureMapTool::canvasReleaseEvent( QgsMapMouseEvent * thepEvent )
{
  QgsPoint myOriginalPoint =
    mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x(), thepEvent->y() );
  emit mouseClicked( myOriginalPoint );

  //make a little box for display

  QgsPoint myPoint1 =
    mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() - 1, thepEvent->y() - 1 );
  QgsPoint myPoint2 =
    mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() + 1, thepEvent->y() - 1 );
  QgsPoint myPoint3 =
    mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() + 1, thepEvent->y() + 1 );
  QgsPoint myPoint4 =
    mCanvas->getCoordinateTransform()->toMapCoordinates( thepEvent->x() - 1, thepEvent->y() + 1 );

  mpRubberBand->reset( QgsWkbTypes::PolygonGeometry );
  // convert screen coordinates to map coordinates
  mpRubberBand->addPoint( myPoint1, false ); //true - update canvas
  mpRubberBand->addPoint( myPoint2, false ); //true - update canvas
  mpRubberBand->addPoint( myPoint3, false ); //true - update canvas
  mpRubberBand->addPoint( myPoint4, true ); //true - update canvas
  mpRubberBand->show();
}
void CustomGraphicsView::mousePressEvent(QMouseEvent *event)
{
    if(event->type() == QMouseEvent::MouseButtonPress)
    {
        emit mouseClicked(QPoint(event->pos().x(),event->pos().y()));
        event->accept();
    }
}
Esempio n. 13
0
void end_lesson(int min,int sec,int eff,int err, int speed)
{
	int change=0,y,x;
	show_summary(min, sec, eff, err, speed);
	draw_3dbox(260,220,320,240,15);
	settextstyle(0,0,1);
	color_text(280,227,"Ok",3);
	showMouse();
	while(1)
	{
		while(1)
		{
			x=getMouseX(); /* get the mouse position*/
			y=getMouseY();
			if(x>=260&&x<=320&&y>=220&&y<=240 && !change)
			{
				change = 1;
				settextstyle(0,0,1);
				hideMouse();
				draw_3dbox(260,220,320,240,6);	/* change the color of the box*/
				/* change the text color*/
				color_text(280,227,"Ok",15);   /*cursor on yes*/
				showMouse();
			}

			if((x<=260||x>=320||y<=220||y>=240)&& change)
			{
				change = 0;
				hideMouse();
				draw_3dbox(260,220,320,240,15);
				/* when mouse moves away change the color to normal one*/
				color_text(280,227,"Ok",3);
				showMouse();         /*cursor on yes/no*/
			}

			if(mouseClicked())
			{
				x=getMouseX();       /*get the position where mouse is clicked*/
				y=getMouseY();
				while(1)
					if(mouseReleased())		/* get the position*/
						break;			/* where mouse is clicked*/
				break;					/* and released */
			}
		}/*end of while 2 which changes color of button*/

		/*check the position of mouse clicked*/
		if(x>=260&&x<=320&&y>=220&&y<=240)  // back
		{
			hideMouse();
			up_down_button(260,220,320,240,280,227,19,15,15,6);
			break;
		}
	}/*end of while 1*/

}
Esempio n. 14
0
//---------------------------------------------------------------------------
//
// The user clicked on the widget
//
void AmorWidget::mouseReleaseEvent(TQMouseEvent *me)
{
    if ( dragging )
	emit dragged( me->globalPos() - clickPos, true );
    else if ( me->state() == Qt::RightButton )
	emit mouseClicked(clickPos);

    clickPos = TQPoint();
    dragging = false;
}
Esempio n. 15
0
void AbstractMargin::mouseReleaseEvent( QMouseEvent* event )
{
    QWidget::mouseReleaseEvent( event );
    
    if ( d->linePressed != -1 && d->linePressed == d->lineAt( event->pos() ) ) {
        emit mouseClicked( d->line, event->button(), event->buttons(), event->modifiers() );
    }
    
    d->linePressed = -1;
}
Esempio n. 16
0
NielsenVis::NielsenVis(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::NielsenVis),
    hasDDIData(false)
{
    ui->setupUi(this);

    // Set the initial value of the status area
    ui->statusBar->showMessage("Please add the necessary CSV data files.");

    // Bind unique identifiers to the radio buttons
    ui->sortStyles->setId(ui->Name, ALPHA_SORT);
    ui->sortStyles->setId(ui->Int, INTER_SORT);
    ui->sortStyles->setId(ui->Plan, PLANN_SORT);
    ui->sortStyles->setId(ui->Final, FINAL_SORT);

    /////////////// END RADIO BUTTON STUFF ///////////////

    // Connect all radio buttons to DisplayManager sort orders
    connect(ui->sortStyles, SIGNAL(buttonClicked(int)), &renderer, SLOT(setSortOrder(int)));

    // Connect buttons to local file dialog functions
    connect(ui->Planning, SIGNAL(clicked()), this, SLOT(findPlanningData()));
    connect(ui->Interim, SIGNAL(clicked()), this, SLOT(findCurrentData()));
    connect(ui->FinalCsv, SIGNAL(clicked()), this, SLOT(findFinalData()));

    // Connect the gotDataFile signal to the display manager
    connect(this, SIGNAL(gotDataFile(string,eDataType)), &renderer, SLOT(updateFile(string,eDataType)));

    // Make the combo box populate when the DDIMatrix changes
    connect(&renderer, SIGNAL(ddiDataAdded(list<string>,list<string>)),
            this, SLOT(updateDDI(list<string>,list<string>)));
    connect(ui->PrimKey, SIGNAL(activated(int)), this, SLOT(populateCBox(int)));

    // Set off the event chain when the Add Graph button is clicked
    connect(ui->Add, SIGNAL(clicked()), this, SLOT(prepareChartAdd()));
    connect(this, SIGNAL(chartAddRequest(string,bool)), &renderer, SLOT(chartAdd(string, bool)));
    connect(&renderer, SIGNAL(requestRedraw()), ui->Render, SLOT(chartAdded()));

    // Make the display manager resize its contents when the window resizes
    connect(ui->Render, SIGNAL(resized(int,int)), &renderer, SLOT(renderAreaResized(int,int)));

    // Make the display manager report what files it has
    connect(&renderer, SIGNAL(updateStatusLine(QString)), ui->statusBar, SLOT(showMessage(QString)));

    // Allow display manager to handle mouse actions within the render area
    connect(ui->Render, SIGNAL(mouseMoved(int,int)), &renderer, SLOT(handleMouseMove(int,int)));
    connect(ui->Render, SIGNAL(mouseClicked()), &renderer, SLOT(handleClick()));

    ////////////// END EVENT BINDING //////////////////

    // Set the display manager on the render widget
    ui->Render->setDisplayManager(&renderer);
}
Esempio n. 17
0
bool ScalePicker::eventFilter(QObject *object, QEvent *e)
{
    if ( object->inherits("QwtScaleWidget") && 
        e->type() == QEvent::MouseButtonPress )
    {
        mouseClicked((const QwtScaleWidget *)object,
            ((QMouseEvent *)e)->pos());
        return true;
    }

    return QObject::eventFilter(object, e);
}
Esempio n. 18
0
void CamLabel::mousePressEvent(QMouseEvent *ev)
{
    if(ev->buttons() & Qt::LeftButton)
    {
//        qDebug() << "mouse signal sent.";
        emit mouseClicked(ev->x(), ev->y());
//        emit mousePressed(ev->x(), ev->y());
    }
    if(ev->buttons() & Qt::RightButton)
    {
        prevx = ev->x();
        prevy = ev->y();
    }
}
Esempio n. 19
0
VRFTerminalView::VRFTerminalView()
  : m_terminalPixmap(QPixmap(":images/vrf_unit.png"))
{
  bool bingo;
  double x = VRFSystemView::margin;

  removeButtonItem = new RemoveButtonItem();
  removeButtonItem->setParentItem(this);
  removeButtonItem->setPos(x,(VRFSystemView::terminalViewHeight - removeButtonItem->boundingRect().height()) / 2.0);
  bingo = connect(removeButtonItem,SIGNAL(mouseClicked()),this,SLOT(onRemoveTerminalClicked()));
  OS_ASSERT(bingo);

  x = x + removeButtonItem->boundingRect().width() + VRFSystemView::margin;

  terminalIconButton = new ButtonItem(m_terminalPixmap,m_terminalPixmap,m_terminalPixmap);
  terminalIconButton->setParentItem(this);
  terminalIconButton->setPos(x,(VRFSystemView::terminalViewHeight - terminalIconButton->boundingRect().height()) / 2.0);
  bingo = connect(terminalIconButton,SIGNAL(mouseClicked()),this,SLOT(onTerminalIconClicked()));
  OS_ASSERT(bingo);

  x = x + terminalIconButton->boundingRect().width() + VRFSystemView::margin;

  zoneDropZone = new VRFThermalZoneDropZoneView();
  zoneDropZone->setParentItem(this);
  zoneDropZone->setPos(x,(VRFSystemView::terminalViewHeight - zoneDropZone->boundingRect().height()) / 2.0);
  bingo = connect(zoneDropZone,SIGNAL(componentDropped(const OSItemId &)),this,SLOT(onComponenDroppedOnZone(const OSItemId &)));
  OS_ASSERT(bingo);

  x = x + zoneDropZone->boundingRect().width() + VRFSystemView::margin;

  removeZoneButtonItem = new RemoveButtonItem();
  removeZoneButtonItem->setParentItem(this);
  removeZoneButtonItem->setPos(zoneDropZone->x() + zoneDropZone->boundingRect().width() - 10,zoneDropZone->y() - 10);
  removeZoneButtonItem->setVisible(false);
  bingo = connect(removeZoneButtonItem,SIGNAL(mouseClicked()),this,SLOT(onRemoveZoneClicked()));
  OS_ASSERT(bingo);
}
Esempio n. 20
0
void ImageDisplayListener::mouseReleaseEvent ( QMouseEvent * event )
{
    bool left;
    if(event->button() == Qt::LeftButton) {
        left = true;
    } else {
        left = false;
    }

    int mouseX = event->x();
    int mouseY = event->y();

    emit mouseClicked((int)((float)mouseX),
					  (int)((float)mouseY), brushSize, left);
}
Esempio n. 21
0
void OpenGLWindow::mousePressEvent( QMouseEvent *ev )
{
    if( ev->button() == Qt::LeftButton ) {
        emit mouseClicked();

        if( d->thread ) {
            QPoint pos = ev->pos();
            int id = d->thread->subframeId( d->renderId, pos.x(), pos.y() );
            if( id >= 0 ) {
                d->thread->setActive( d->renderId, id );
                emit subframeClicked( id );
            }
        }
    }
}
Esempio n. 22
0
KateFileTree::KateFileTree(QWidget *parent): QTreeView(parent)
{
  setAcceptDrops(false);
  setIndentation(12);
  setAllColumnsShowFocus(true);

  setTextElideMode(Qt::ElideLeft);

  connect( this, SIGNAL(clicked(QModelIndex)), this, SLOT(mouseClicked(QModelIndex)));

  m_filelistCloseDocument = new QAction( KIcon("window-close"), i18n( "Close" ), this );
  connect( m_filelistCloseDocument, SIGNAL(triggered()), this, SLOT(slotDocumentClose()) );
  m_filelistCloseDocument->setWhatsThis(i18n("Close the current document."));

  m_filelistCopyFilename = new QAction( KIcon("copy"), i18n( "Copy Filename" ), this );
  connect( m_filelistCopyFilename, SIGNAL(triggered()), this, SLOT(slotCopyFilename()) );
  m_filelistCopyFilename->setWhatsThis(i18n("Copy the filename of the file."));

  QActionGroup *modeGroup = new QActionGroup(this);

  m_treeModeAction = setupOption(modeGroup, KIcon("view-list-tree"), i18n("Tree Mode"),
                                 i18n("Set view style to Tree Mode"),
                                 SLOT(slotTreeMode()), true);

  m_listModeAction = setupOption(modeGroup, KIcon("view-list-text"), i18n("List Mode"),
                                 i18n("Set view style to List Mode"),
                                 SLOT(slotListMode()), false);

  QActionGroup *sortGroup = new QActionGroup(this);

  m_sortByFile = setupOption(sortGroup, KIcon(), i18n("Document Name"),
                             i18n("Sort by Document Name"),
                             SLOT(slotSortName()), true);


  m_sortByPath = setupOption(sortGroup, KIcon(), i18n("Document Path"),
                             i18n("Sort by Document Path"),
                             SLOT(slotSortPath()), false);

  m_sortByOpeningOrder =  setupOption(sortGroup, KIcon(), i18n("Opening Order"),
                             i18n("Sort by Opening Order"),
                             SLOT(slotSortOpeningOrder()), false);

  QPalette p = palette();
  p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
  p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText));
  setPalette(p);
}
Esempio n. 23
0
void PaintWidget::release(QVariantList list, QVariantList idlist) {
	if ( m_fixed )
		return;
	QPointF pos = *touch_current_pos.begin();
	for (unsigned i = 0; i < list.size(); i++) {
		touch_start_pos.remove(idlist[i].toInt());
		touch_current_pos.remove(idlist[i].toInt());
	}
	
	if (touch_current_pos.size() == 0 && !m_drag) {
		IRenderer* renderer = MapData::instance()->renderer();
		if ( renderer == NULL )
			return;
		emit mouseClicked( renderer->PointToCoordinate( pos.x() - width() / 2, pos.y() - height() / 2, m_request ) );
	}
}
Esempio n. 24
0
void ButtonItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
  if( m_mouseDown )
  {
    m_mouseDown = false;

    this->update();

    if( shape().contains(event->pos()) )
    {
      event->accept();

      emit mouseClicked();
    }
  }
}
Esempio n. 25
0
bool ScalePicker::eventFilter( QObject *object, QEvent *event )
{
    if ( event->type() == QEvent::MouseButtonPress )
    {
        QwtScaleWidget *scaleWidget = qobject_cast<QwtScaleWidget *>( object );
        if ( scaleWidget )
        {
            QMouseEvent *mouseEvent = static_cast<QMouseEvent *>( event );
            mouseClicked( scaleWidget, mouseEvent->pos() );

            return true;
        }
    }

    return QObject::eventFilter( object, event );
}
Esempio n. 26
0
void PaintWidget::mouseReleaseEvent( QMouseEvent* event )
{
	event->accept();
	m_mouseDown = false;
	if ( m_fixed )
		return;
	if ( m_drag )
		return;
	if ( event->button() != Qt::LeftButton )
		return;

	IRenderer* renderer = MapData::instance()->renderer();
	if ( renderer == NULL )
		return;

	emit mouseClicked( renderer->PointToCoordinate( event->x() - width() / 2, event->y() - height() / 2, m_request ) );
}
Esempio n. 27
0
GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
{
	// check if Google Sat Maps are installed
	// if not, check if they are in a known location
	MapThemeManager mtm;
	QStringList list = mtm.mapThemeIds();
	QString theme, subsurfaceDataPath;
	QDir marble;
	bool foundGoogleMap = false;
	Q_FOREACH(theme, list)
		if (theme == "earth/googlesat/googlesat.dgml")
			foundGoogleMap = true;
	if (!foundGoogleMap) {
		subsurfaceDataPath = getSubsurfaceDataPath("marbledata");
		if (subsurfaceDataPath != "")
			MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
	}
	messageWidget = new KMessageWidget(this);
	messageWidget->setCloseButtonVisible(false);
	messageWidget->setHidden(true);

	setMapThemeId("earth/googlesat/googlesat.dgml");
	//setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
	setProjection(Marble::Spherical);

	setAnimationsEnabled(true);
	setShowClouds(false);
	setShowBorders(false);
	setShowPlaces(true);
	setShowCrosshairs(false);
	setShowGrid(false);
	setShowOverviewMap(false);
	setShowScaleBar(true);
	setShowCompass(false);
	connect(this, SIGNAL(mouseClickGeoPosition(qreal, qreal, GeoDataCoordinates::Unit)),
			this, SLOT(mouseClicked(qreal, qreal, GeoDataCoordinates::Unit)));

	setMinimumHeight(0);
	setMinimumWidth(0);
	editingDiveCoords = 0;
	fixZoomTimer = new QTimer();
	connect(fixZoomTimer, SIGNAL(timeout()), this, SLOT(fixZoom()));
	fixZoomTimer->setSingleShot(true);
}
HotWaterSupplyItem::HotWaterSupplyItem(QGraphicsItem * parent)
  : GridItem(parent)
{
  setHGridLength(2);

  setEnableHighlight(false);

  QPixmap hotWaterSupplyPixmap(":/images/loop_button.png");
  QPixmap hotWaterSupplyOverPixmap(":/images/loop_button_over.png");
  QPixmap hotWaterSupplyPressPixmap(":/images/loop_button_press.png");

  m_hotWaterSupplyButton = new ButtonItem(hotWaterSupplyPixmap,hotWaterSupplyPressPixmap,
                                          hotWaterSupplyOverPixmap,this);

  m_hotWaterSupplyButton->setToolTip("Go back to hot water supply system");

  connect(m_hotWaterSupplyButton,SIGNAL(mouseClicked()),this,SLOT(onHotWaterSupplyButtonClicked()));

  m_hotWaterSupplyButton->setPos(105.9,37);
}
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
    mCrs.createFromSrsId( GEOCRS_ID );	// initialize the CRS object

    connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );

    setSourceCrs();	//set up the source CRS
    mTransform.setDestCRS( mCrs );	// set the CRS in the transform
    mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 8 : 3;	// precision depends on CRS units

    // Create the action for tool
    mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this );
    // Set the what's this text
    mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
    // Connect the action to the run
    connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
    // Add the icon to the toolbar
    mQGisIface->addToolBarIcon( mQActionPointer );
    mQGisIface->addPluginToMenu( tr( "&Coordinate Capture" ), mQActionPointer );

    // create our map tool
    mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
    connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
    connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );


    // create a little widget with x and y display to put into our dock widget
    QWidget * mypWidget = new QWidget();
    QGridLayout *mypLayout = new QGridLayout( mypWidget );
    mypLayout->setColumnMinimumWidth( 0, 36 );
    mypWidget->setLayout( mypLayout );

    QToolButton * mypUserCrsToolButton = new QToolButton( mypWidget );
    mypUserCrsToolButton->setIcon( QIcon( ":/coordinatecapture/geographic.png" ) );
    mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
    connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );

    QLabel * mypCRSLabel = new QLabel( mypWidget );
    mypCRSLabel->setPixmap( QPixmap( ":/coordinatecapture/transformed.png" ) );
    mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

    mpUserCrsEdit = new QLineEdit( mypWidget );
    mpUserCrsEdit->setReadOnly( true );
    mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS" ) );

    mpCanvasEdit = new QLineEdit( mypWidget );
    mpCanvasEdit->setReadOnly( true );
    mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system" ) );

    QPushButton * mypCopyButton = new QPushButton( mypWidget );
    mypCopyButton->setText( tr( "Copy to clipboard" ) );
    connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) );

    mpTrackMouseButton = new QToolButton( mypWidget );
    mpTrackMouseButton->setCheckable( true );
    mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
    mpTrackMouseButton->setChecked( false );
    mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) );

    mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
    mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
    mypLayout->addWidget( mypCRSLabel, 1, 0 );
    mypLayout->addWidget( mpCanvasEdit, 1, 1 );
    mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
    mypLayout->addWidget( mypCopyButton, 2, 1 );


    //create the dock widget
    mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
    mpDockWidget->setObjectName( "CoordinateCapture" );
    mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
    mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

    // now add our custom widget to the dock - ownership of the widget is passed to the dock
    mpDockWidget->setWidget( mypWidget );

}
Esempio n. 30
0
void FloatFrame::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button() & Qt::LeftButton)
        emit mouseClicked();
}