Пример #1
0
//////////////////////////////////////////////////////////////////////////////
// Update the neighbors descendant by making it point to the other neighbor's 
// descendant, neighbor being neigh, other neighbor is other
//////////////////////////////////////////////////////////////////////////////
void doCompress(node* thisNode, node* left, node* right,int lindex,int rindex) 
{
  deprintf("Contracting %d \n", thisNode->nId); 
  setupVertexCluster (thisNode, COMPRESS_EVENT, currentTree, &oldRootList); 

  shortCut (thisNode,left,right,lindex,rindex, CLUSTER_OFFSET_ZERO);
  shortCut (thisNode,right,left,rindex,lindex, CLUSTER_OFFSET_ONE);

  bin_cluster* cl = (bin_cluster*) thisNode->vertex->cl;

  cl->affected = IS_AFFECTED;
  //cl->endpoints = 2;
  cl->endp1 = left->nId;
  cl->endp2 = right->nId;
}
Пример #2
0
bool NoteItem::eventFilter(QObject *obj, QEvent *ev)
{
    QEvent::Type type = ev->type();
    QObject* textBrowser = findChild<QObject *>("contentWidget");
    switch(type) {
        case QEvent::MouseButtonDblClick:
            setActiveItem(this);
            g_mainWindow->editActiveNote();
            return true;
        case QEvent::MouseButtonPress:
        case QEvent::FocusIn:
            if(s_activeNote != this){
                setActiveItem(this);
            }
            break;
        case QEvent::KeyPress:
            if(obj==textBrowser && s_activeNote == this){
                QKeyEvent *keyEvent = static_cast<QKeyEvent*>(ev);
                int k = keyEvent->key();
                if(m_readOnly || keyEvent->modifiers() == Qt::AltModifier) {
                    return shortCut(k);
                }
            }
            break;
        default:
            break;
    }
    return QFrame::eventFilter(obj,ev);
}
Пример #3
0
LargePhotoView::LargePhotoView(QString path, QWidget *parent, ThumbnailView *listArea) : QWidget(parent) {
    layout = new QGridLayout(this);
    this->listArea = listArea;

    fullscreen = false;

    photoWidget = new LargePhotoWidget(path,this);
    layout->addWidget(photoWidget,1,0);

    toolbar = new QToolBar("",this);
    layout->addWidget(toolbar,2,0);
    setLayout(layout);

    QString shortCut("O");
    QAction *action = toolbar->addAction(QIcon::fromTheme("folder"),getShortcutLabel("Open in file manager",shortCut),
                                         this,SLOT(openInFileManager()));
    action->setShortcut(QKeySequence(shortCut));
    shortCut = QString("E");
    action = toolbar->addAction(QIcon::fromTheme("image-x-generic"),getShortcutLabel("Edit photo in other application",shortCut),
                                this,SLOT(editPhoto()));
    action->setShortcut(QKeySequence(shortCut));
    toolbar->addSeparator();
    shortCut = QString("Ctrl+Shift+R");
    action = toolbar->addAction(QIcon::fromTheme("object-rotate-left"),getShortcutLabel("Rotate anti-clockwise",shortCut),
                                this,SLOT(rotatePhotoAntiClockwise()));
    action->setShortcut(QKeySequence(shortCut));
    shortCut = QString("Ctrl+R");
    action = toolbar->addAction(QIcon::fromTheme("object-rotate-right"),getShortcutLabel("Rotate clockwise",shortCut),
                                this,SLOT(rotatePhotoClockwise()));
    action->setShortcut(QKeySequence(shortCut));

    toolbar->addSeparator();

    shortCut = QString("Escape");
    action = toolbar->addAction(QIcon::fromTheme("go-up"),getShortcutLabel("Back to event",shortCut),
                                this,SLOT(backAction()));
    action->setShortcut(QKeySequence(shortCut));

    shortCut = QString("Left");
    action = toolbar->addAction(QIcon::fromTheme("go-previous"),getShortcutLabel("Previous photo",shortCut),
                                this,SLOT(prevPhoto()));
    action->setShortcut(QKeySequence(shortCut));

    shortCut = QString("Right");
    action = toolbar->addAction(QIcon::fromTheme("go-next"),getShortcutLabel("Next photo",shortCut),
                                this,SLOT(nextPhoto()));
    action->setShortcut(QKeySequence(shortCut));

    toolbar->addSeparator();

    shortCut = QString("F11");
    action = toolbar->addAction(QIcon::fromTheme("view-fullscreen"),getShortcutLabel("Toggle Fullscreen",shortCut),this,SLOT(toggleFullscreen()));
    action->setShortcut(QKeySequence(shortCut));

    connect(photoWidget,SIGNAL(doubleClicked()),this,SLOT(toggleFullscreen()));

    setFocus();
}