QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas *canvas )
  : QgsMapToolIdentify( canvas )
{
  mToolName = tr( "Identify" );
  setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify ) );
  connect( this, &QgsMapToolIdentify::changedRasterResults, this, &QgsMapToolIdentifyAction::handleChangedRasterResults );
  mIdentifyMenu->setAllowMultipleReturn( true );
  QgsMapLayerAction *attrTableAction = new QgsMapLayerAction( tr( "Show attribute table" ), mIdentifyMenu, QgsMapLayer::VectorLayer, QgsMapLayerAction::MultipleFeatures );
  connect( attrTableAction, &QgsMapLayerAction::triggeredForFeatures, this, &QgsMapToolIdentifyAction::showAttributeTable );
  identifyMenu()->addCustomAction( attrTableAction );
}
QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas * canvas )
    : QgsMapToolIdentify( canvas )
{
  mToolName = tr( "Identify" );
  // set cursor
  QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor );
  mCursor = QCursor( myIdentifyQPixmap, 1, 1 );

  connect( this, SIGNAL( changedRasterResults( QList<IdentifyResult>& ) ), this, SLOT( handleChangedRasterResults( QList<IdentifyResult>& ) ) );

  mIdentifyMenu->setAllowMultipleReturn( true );

  QgsMapLayerAction* attrTableAction = new QgsMapLayerAction( tr( "Show attribute table" ), mIdentifyMenu, QgsMapLayer::VectorLayer, QgsMapLayerAction::MultipleFeatures );
  connect( attrTableAction, SIGNAL( triggeredForFeatures( QgsMapLayer*, const QList<QgsFeature> ) ), this, SLOT( showAttributeTable( QgsMapLayer*, const QList<QgsFeature> ) ) );
  identifyMenu()->addCustomAction( attrTableAction );
}
Exemple #3
0
/*Main menu*/
int mainTerminal()
{
    char opt1[] = "Identify";
    char opt2[] = "About";
    char opt3[] = "Exit";
    int posAct = 1;
    int input = 0;
    const short int posMin = 1;
    const short int posMax = 3;

    clearCommander(0);

    /*Repeating menu loop*/
    while (1 == 1)
    {
        silenceOn();
        /*Let the text be created! Every time!*/
        invardTextLineSlide(20, opt1);
        invardTextLineSlide(21, opt2);
        invardTextLineSlide(22, opt3);
        input = 0;
        /*Text appearance loop*/
        while (1 == 1)
        {
            if (input == KEY_UP)
            {
                posAct--;
            }
            else if (input == KEY_DOWN)
            {
                posAct++;
            }
            /*If ENTER is pressed, exit the loop*/
            else if (input == 10)
            {
                break;
            }
            /*In case if moved outside the min and max boundary*/
            if (posAct > posMax)
            {
                posAct = posMin;
            }
            else if (posAct < posMin)
            {
                posAct = posMax;
            }
            /*Change the text appearance*/
            switch(posAct)
            {
                case 1:
                    attron(A_REVERSE);
                    printCenter(20, opt1, 0);
                    attroff(A_REVERSE);
                    printCenter(21, opt2, 0);
                    printCenter(22, opt3, 0);
                    break;
                case 2:
                    printCenter(20, opt1, 0);
                    attron(A_REVERSE);
                    printCenter(21, opt2, 0);
                    attroff(A_REVERSE);
                    printCenter(22, opt3, 0);
                    break;
                case 3:
                    printCenter(20, opt1, 0);
                    printCenter(21, opt2, 0);
                    attron(A_REVERSE);
                    printCenter(22, opt3, 0);
                    attroff(A_REVERSE);
                    break;
            }
            /*Wait for input*/
            flushinp();
            input = getch();
        }
        switch (posAct)
        {
            case 1:
                /*If the player has successfully logged in*/
                if (identifyMenu() == TRUE)
                {
                    return 0;
                }
                /*If the player has created a new account or left that menu*/
                clearCommander(0);
                break;
            case 2:
                aboutGame();
                clearCommander(0);
                break;
            case 3:
                clearCommander(0);
                return EXIT;
                break;
        }
        /*Run this menu again*/
        continue;
    }
	return 0;
}