Scene::Scene( QWidget *parent ) :
    QOpenGLWidget( parent ),
    m_angle( 0 )
{
    connect( &m_timer, SIGNAL( timeout() ),
             this, SLOT( slotRotate() ) );

    m_timer.start( 10 );
}
Esempio n. 2
0
///////////////////////////////////////////////////////////
//                                                       //
// Edit Menu                                             //
//                                                       //
///////////////////////////////////////////////////////////
void WinImage::setupEditMenu()
{
    // Actions
    QAction* rotate = new QAction( "&Rotate", this );
    rotate->setShortcut( Qt::CTRL + Qt::Key_R );
    rotate->setStatusTip("To rotate the image with an angle "
                         "from -10 to 10 degree: ");
    rotate->setWhatsThis("This is a button, stupid!");
    connect( rotate, SIGNAL( triggered()), this, SLOT( slotRotate()));

    QAction* spheric = new QAction( "&Spherize", this );
    spheric->setShortcut( Qt::CTRL + Qt::Key_S );
    spheric->setStatusTip("This will sphereize the image");
    connect( spheric, SIGNAL( triggered()), this, SLOT( slotSpherize()));

    QAction* inflate = new QAction( "&Inflate", this );
    inflate->setShortcut( Qt::CTRL + Qt::Key_I );
    inflate->setStatusTip("To inflate the image, set number from 0 to 0.5");
    connect( inflate, SIGNAL( triggered()), this, SLOT( slotInflate()));

    QAction* distort = new QAction( "&Distort", this );
    distort->setShortcut( Qt::CTRL + Qt::Key_D );
    distort->setStatusTip("To distort the image, please set number "
                          "from -0.51 (Pincushion) to 1.06 (Barrel)");
    connect( distort, SIGNAL( triggered()), this, SLOT( slotDistort()));

    QAction* kaleidoscope = new QAction( "&Kaleidoscope", this );
    kaleidoscope->setShortcut( Qt::CTRL + Qt::Key_K );
    kaleidoscope->setStatusTip("Kaleidoscope");
    connect( kaleidoscope, SIGNAL( triggered()), this, SLOT( slotKaleidoscope()));

    QMenu* edit = new QMenu( "&Edit", menuBar() );
    menuBar()->addMenu( edit);
    edit->addAction( rotate);
    edit->addAction( spheric);
    edit->addAction( inflate);
    edit->addAction( distort);
    edit->addAction( kaleidoscope);
}
// private
void kpMainWindow::setupImageMenuActions ()
{
    KActionCollection *ac = actionCollection ();

    m_actionResizeScale = new KAction (i18n ("R&esize / Scale..."), Qt::CTRL + Qt::Key_E,
        this, SLOT (slotResizeScale ()), ac, "image_resize_scale");

    m_actionCrop = new KAction (i18n ("Se&t as Image (Crop)"), Qt::CTRL + Qt::Key_T,
        this, SLOT (slotCrop ()), ac, "image_crop");

    m_actionAutoCrop = new KAction (autoCropText (), Qt::CTRL + Qt::Key_U,
        this, SLOT (slotAutoCrop ()), ac, "image_auto_crop");

    m_actionFlip = new KAction (i18n ("&Flip..."), Qt::CTRL + Qt::Key_F,
        this, SLOT (slotFlip ()), ac, "image_flip");

    m_actionRotate = new KAction (i18n ("&Rotate..."), Qt::CTRL + Qt::Key_R,
        this, SLOT (slotRotate ()), ac, "image_rotate");

    m_actionSkew = new KAction (i18n ("S&kew..."), Qt::CTRL + Qt::Key_K,
        this, SLOT (slotSkew ()), ac, "image_skew");

    m_actionConvertToBlackAndWhite = new KAction (i18n ("Reduce to Mo&nochrome (Dithered)"), 0,
        this, SLOT (slotConvertToBlackAndWhite ()), ac, "image_convert_to_black_and_white");

    m_actionConvertToGrayscale = new KAction (i18n ("Reduce to &Grayscale"), 0,
        this, SLOT (slotConvertToGrayscale ()), ac, "image_convert_to_grayscale");

    m_actionInvertColors = new KAction (i18n ("&Invert Colors"), Qt::CTRL + Qt::Key_I,
        this, SLOT (slotInvertColors ()), ac, "image_invert_colors");

    m_actionClear = new KAction (i18n ("C&lear"), Qt::CTRL + Qt::SHIFT + Qt::Key_N,
        this, SLOT (slotClear ()), ac, "image_clear");

    m_actionMoreEffects = new KAction (i18n ("&More Effects..."), Qt::CTRL + Qt::Key_M,
        this, SLOT (slotMoreEffects ()), ac, "image_more_effects");

    enableImageMenuDocumentActions (false);
}