Пример #1
0
void PDFFactory::createActions()
{
    openAction = new QAction(tr("&Open"), this);
    openAction->setIcon(QIcon(":/images/open.png"));
    openAction->setShortcut(tr("Ctrl+O"));
    openAction->setStatusTip(tr("Open a PDF"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    exportAction = new QAction(tr("&Export a single file"), this);
    exportAction->setIcon(QIcon(":/images/export.png"));
    exportAction->setShortcut(tr("Ctrl+S"));
    exportAction->setStatusTip(tr("Export the selected file to a new PDF"));
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportFile()));

    exportAllAction = new QAction(tr("Export all"), this);
    exportAllAction->setIcon(QIcon(":/images/exportall.png"));
    exportAllAction->setShortcut(tr("Shift+Ctrl+S"));
    exportAllAction->setStatusTip(tr("Export all to multiple PDF files"));
    connect(exportAllAction, SIGNAL(triggered()), this, SLOT(exportAllFiles()));

    cutAction = new QAction(tr("C&ut"), this);
    cutAction->setIcon(QIcon(":/images/cut.png"));
    cutAction->setShortcut(tr("Ctrl+X"));
    cutAction->setStatusTip(tr("Cut selected contents to clipboard"));
    connect(cutAction, SIGNAL(triggered()), pdfTableView, SLOT(cutSelected()));

    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setIcon(QIcon(":/images/copy.png"));
    copyAction->setShortcut(tr("Ctrl+C"));
    copyAction->setStatusTip(tr("Copy selected contents to clipboard"));
    connect(copyAction, SIGNAL(triggered()), pdfTableView, SLOT(copySelected()));

    pasteAction = new QAction(tr("&Paste"), this);
    pasteAction->setIcon(QIcon(":/images/paste.png"));
    pasteAction->setShortcut(tr("Ctrl+V"));
    pasteAction->setStatusTip(tr("Paste clipboard's contents into current selection"));
    //connect(pasteAction, SIGNAL(triggered()), textEdit, SLOT(paste()));

    deleteAction = new QAction(tr("&Delete"), this);
    deleteAction->setIcon(QIcon(":/images/delete.png"));
    deleteAction->setShortcut(tr("Ctrl+D"));
    deleteAction->setStatusTip(tr("Delete selected contents"));
    connect(deleteAction, SIGNAL(triggered()), pdfTableView, SLOT(deleteSelected()));

    rotateAction = new QAction(tr("&Rotate"), this);
    rotateAction->setIcon(QIcon(":/images/rotate.png"));
    rotateAction->setShortcut(tr("Ctrl+R"));
    rotateAction->setStatusTip(tr("Rotate selected pages"));
    connect(rotateAction, SIGNAL(triggered()), pdfTableView, SLOT(rotateSelected()));

    aboutAction = new QAction(tr("A&bout"), this);
    aboutAction->setIcon(QIcon(":/images/about.png"));
    aboutAction->setStatusTip(tr("About this program"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}
ossimQtVceCanvasWidget::ossimQtVceCanvasWidget(QWidget* parent, 
                                               QString name)
   :QCanvasView(parent, name)
{
   theSelectionRect    = NULL;
   theLineObject       = NULL;
   theMouseButtonState = Qt::NoButton;
   setAcceptDrops(true);
   theCanvasUtility = new ossimQtVceCanvasContainerUtility(this);
   thePopupMenu = new QPopupMenu(this);
   thePopupMenu->hide();
   thePopupMenu->clear();
   thePopupMenu->insertItem("Copy", this, SLOT(copySelected()));
   thePopupMenu->insertItem("Paste", this, SLOT(paste()));
   thePopupMenu->insertItem("Cut", this, SLOT(cutSelected()));
   thePopupMenu->insertSeparator();
   thePopupMenu->insertItem("Execute", this, SLOT(executeSelected()));
}