void CQParameterSetsWidget::slotBtnDeleteClicked() { if (mpTblParameterSets->hasFocus()) {deleteSelected();} updateDeleteBtns(); }
void SCgMainWindow::initializeActions() { QUndoStack* undoStack = mScene->undoStack(); QAction* actionRedo = undoStack->createRedoAction(mScene); actionRedo->setShortcut(QKeySequence::Redo); // actionRedo->setShortcutContext(Qt::WidgetShortcut); QAction* actionUndo = undoStack->createUndoAction(mScene); actionUndo->setShortcut(QKeySequence::Undo); // actionUndo->setShortcutContext(Qt::WidgetShortcut); QAction* actionDelete = new QAction("Delete", mScene); actionDelete->setShortcut(QKeySequence::Delete); connect(actionDelete, SIGNAL(triggered()), mInputHandler, SLOT(deleteSelected())); actionDelete->setShortcutContext(Qt::WidgetShortcut); QAction* actionDeleteJustContour = new QAction("Delete just contour", mScene); actionDeleteJustContour->setShortcut( QKeySequence(tr("Backspace")) ); connect(actionDeleteJustContour, SIGNAL(triggered()), mInputHandler, SLOT(deleteJustContour())); actionDeleteJustContour->setShortcutContext(Qt::WidgetShortcut); mView->addAction(actionDeleteJustContour); mView->addAction(actionDelete); mView->addAction(actionRedo); mView->addAction(actionUndo); }
void CodeEditor::contextMenuEvent(QContextMenuEvent* event) { QMenu menu(this); QAction* act = menu.addAction(tr("&Undo"), this, SLOT(undo())); //, QKeySequence::Undo); act->setEnabled(document()->isUndoAvailable()); act = menu.addAction(tr("&Redo"), this, SLOT(redo())); //, QKeySequence::Redo); act->setEnabled(document()->isRedoAvailable()); menu.addSeparator(); act = menu.addAction(tr("Cu&t"), this, SLOT(cut())); //, QKeySequence::Cut); act->setEnabled(textCursor().hasSelection()); act = menu.addAction(tr("&Copy"), this, SLOT(copy())); //, QKeySequence::Copy); act->setEnabled(textCursor().hasSelection()); act = menu.addAction(tr("&Paste"), this, SLOT(paste())); //, QKeySequence::Paste); act->setEnabled(canPaste()); act = menu.addAction(tr("Delete"), this, SLOT(deleteSelected())); //, QKeySequence::Delete); act->setEnabled(textCursor().hasSelection()); act = menu.addAction(tr("Select All"), this, SLOT(selectAll())); //, QKeySequence::SelectAll); act->setEnabled(!document()->isEmpty()); menu.addSeparator(); menu.addAction(tr("Fold All"), this, SLOT(foldAll())); menu.addAction(tr("Unfold All"), this, SLOT(unfoldAll())); menu.addSeparator(); menu.addAction(tr("Toggle comment"), this, SLOT(toggleComment())); menu.addSeparator(); menu.addAction(tr("UPPERCASE"), this, SLOT(toUpperCase())); menu.addAction(tr("lowercase"), this, SLOT(toLowerCase())); menu.exec(event->globalPos()); }
void SLineEdit::contextMenuEvent(QContextMenuEvent *event) { bool selection = hasSelectedText(); bool ro = isReadOnly(); QMenu menu(this); if (selection && !ro) menu.addAction(SCHAT_ICON(EditCut), tr("Cut"), this, SLOT(cut())); if (selection) menu.addAction(SCHAT_ICON(EditCopy), tr("Copy"), this, SLOT(cut())); if (!ro && !QApplication::clipboard()->text().isEmpty()) menu.addAction(SCHAT_ICON(EditPaste), tr("Paste"), this, SLOT(paste())); if (selection && !ro) menu.addAction(SCHAT_ICON(Remove), tr("Delete"), this, SLOT(deleteSelected())); if (!menu.isEmpty()) menu.addSeparator(); if (!text().isEmpty() && text() != selectedText()) menu.addAction(SCHAT_ICON(EditSelectAll), tr("Select All"), this, SLOT(selectAll())); if (!menu.isEmpty()) menu.exec(event->globalPos()); }
void Editor::cut() { if (!activeStack() || selection_->empty()) return; copy(); deleteSelected(); }
void FavoritesTreeView::keyPressEvent (QKeyEvent *e) { if (e->key () == Qt::Key_Delete && selectionModel ()->currentIndex ().isValid ()) emit deleteSelected (selectionModel ()->currentIndex ()); QTreeView::keyPressEvent (e); }
void PaintWidget::cutToClipboard() { if( !canCopyOrCutToClipboard() ) return; copyToClipboard(); deleteSelected(); emit StateChanged("Cut"); }
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())); }
LayerList::LayerList(QWidget *parent) : QDockWidget(tr("Layers"), parent), _client(0), _selected(0), _noupdate(false), _op(false), _lockctrl(false) { _ui = new Ui_LayerBox; QWidget *w = new QWidget(this); setWidget(w); _ui->setupUi(w); _ui->layerlist->setDragEnabled(true); _ui->layerlist->viewport()->setAcceptDrops(true); _ui->layerlist->setEnabled(false); _ui->layerlist->setSelectionMode(QAbstractItemView::SingleSelection); // Populate blend mode combobox for(int b=0;b<paintcore::BLEND_MODES;++b) { if(paintcore::BLEND_MODE[b].layermode) _ui->blendmode->addItem( QApplication::translate("paintcore", paintcore::BLEND_MODE[b].name), paintcore::BLEND_MODE[b].id ); } // Layer menu _layermenu = new QMenu(this); _menuHideAction = _layermenu->addAction(tr("Hide from self"), this, SLOT(hideSelected())); _menuHideAction->setCheckable(true); _menuRenameAction = _layermenu->addAction(tr("Rename"), this, SLOT(renameSelected())); _menuMergeAction = _layermenu->addAction(tr("Merge down"), this, SLOT(mergeSelected())); _menuDeleteAction = _layermenu->addAction(tr("Delete"), this, SLOT(deleteSelected())); // Layer ACL menu _aclmenu = new LayerAclMenu(this); _ui->lockButton->setMenu(_aclmenu); connect(_ui->layerlist, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(layerContextMenu(QPoint))); connect(_ui->addButton, SIGNAL(clicked()), this, SLOT(addLayer())); connect(_ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteOrMergeSelected())); connect(_ui->opacity, SIGNAL(valueChanged(int)), this, SLOT(opacityAdjusted())); connect(_ui->blendmode, SIGNAL(currentIndexChanged(int)), this, SLOT(blendModeChanged())); connect(_aclmenu, SIGNAL(layerAclChange(bool, QList<uint8_t>)), this, SLOT(changeLayerAcl(bool, QList<uint8_t>))); selectionChanged(QItemSelection()); // The opacity update timer is used to limit the rate of layer // update messages sent over the network when the user drags or scrolls // on the opacity slider. _opacityUpdateTimer = new QTimer(this); _opacityUpdateTimer->setSingleShot(true); connect(_opacityUpdateTimer, SIGNAL(timeout()), this, SLOT(sendOpacityUpdate())); }
bool EmoticonViewer::eventFilter(QObject *obj, QEvent *e) { if (obj == _ui->listView) { switch (e->type()) { case QEvent::KeyPress: { int key = static_cast<QKeyEvent *>(e)->key(); if (key == Qt::Key_Delete || key == Qt::Key_Backspace) deleteSelected(); break; } default: break; } } return false; }
void ckvdApp::keyPressed(int key) { switch (key) { case OF_KEY_UP: if (_pSelectedGrabber) _pSelectedGrabber->moveBy(0,-1); break; case OF_KEY_DOWN: if (_pSelectedGrabber) _pSelectedGrabber->moveBy(0,1); break; case OF_KEY_LEFT: if (_pSelectedGrabber) _pSelectedGrabber->moveBy(-1,0); break; case OF_KEY_RIGHT: if (_pSelectedGrabber) _pSelectedGrabber->moveBy(1,0); break; case OF_KEY_DEL: case OF_KEY_BACKSPACE: if (_pSelectedGrabber && !_pUI->hasKeyboardFocus()) deleteSelected(); break; } }
/** * \brief Slot to handle toolbar actions * * This is just a dispatcher method that calls the appropriate acction * handler slot. */ void TaskMainWindow::handleToolbarAction(QAction *action) { debug(LOG_DEBUG, DEBUG_LOG, 0, "toolbar action called"); if (action == ui->actionStartQueue) { startQueue(); return; } if (action == ui->actionStopQueue) { stopQueue(); return; } if (action == ui->actionDelete) { deleteSelected(); return; } if (action == ui->actionDownload) { downloadSelected(); return; } }
void OptMapToolDeleteLink::canvasReleaseEvent( QMouseEvent * e ) { QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas ); OptLineLayer* lineLayer = qobject_cast<OptLineLayer*>(vlayer); if ( NULL == lineLayer ) { QMessageBox::information(NULL, "", "only link layer can be edited"); return; } QgsRubberBand rubberBand( mCanvas, true ); QRect selectRect( 0, 0, 0, 0 ); QgsMapToolSelectUtils::expandSelectRectangle( selectRect, vlayer, e->pos() ); QgsMapToolSelectUtils::setRubberBand( mCanvas, selectRect, &rubberBand ); QgsGeometry* selectGeom = rubberBand.asGeometry(); bool doDifference = e->modifiers() & Qt::ControlModifier ? true : false; QgsMapToolSelectUtils::setSelectFeatures( mCanvas, selectGeom, false, doDifference, true ); delete selectGeom; rubberBand.reset( true ); deleteSelected( vlayer ); }
void LayerList::deleteOrMergeSelected() { Q_ASSERT(_client); QModelIndex index = currentSelection(); if(!index.isValid()) return; net::LayerListItem layer = index.data().value<net::LayerListItem>(); QMessageBox box(QMessageBox::Question, tr("Delete layer"), tr("Really delete \"%1\"?").arg(layer.title), QMessageBox::NoButton ); box.addButton(tr("Delete"), QMessageBox::DestructiveRole); // Offer the choice to merge down only if there is a layer // below this one. QPushButton *merge = 0; if(canMergeCurrent()) { merge = box.addButton(tr("Merge down"), QMessageBox::DestructiveRole); box.setInformativeText(tr("Press merge down to merge the layer with the first visible layer below instead of deleting.")); } QPushButton *cancel = box.addButton(tr("Cancel"), QMessageBox::RejectRole); box.setDefaultButton(cancel); box.exec(); QAbstractButton *choice = box.clickedButton(); if(choice != cancel) { if(choice==merge) mergeSelected(); else deleteSelected(); } }
// ****************************************************************************************** // Create the main content widget // ****************************************************************************************** QWidget* VirtualJointsWidget::createContentsWidget() { // Main widget QWidget *content_widget = new QWidget( this ); // Basic widget container QVBoxLayout *layout = new QVBoxLayout( this ); // Table ------------ ------------------------------------------------ data_table_ = new QTableWidget( this ); data_table_->setColumnCount(4); data_table_->setSortingEnabled(true); data_table_->setSelectionBehavior( QAbstractItemView::SelectRows ); connect( data_table_, SIGNAL( cellDoubleClicked( int, int ) ), this, SLOT( editDoubleClicked( int, int ) ) ); connect( data_table_, SIGNAL( cellClicked( int, int ) ), this, SLOT( previewClicked( int, int ) ) ); layout->addWidget( data_table_ ); // Set header labels QStringList header_list; header_list.append("Virtual Joint Name"); header_list.append("Child Link"); header_list.append("Parent Frame"); header_list.append("Type"); data_table_->setHorizontalHeaderLabels(header_list); // Bottom Buttons -------------------------------------------------- QHBoxLayout *controls_layout = new QHBoxLayout(); // Spacer QWidget *spacer = new QWidget( this ); spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); controls_layout->addWidget( spacer ); // Edit Selected Button btn_edit_ = new QPushButton( "&Edit Selected", this ); btn_edit_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred ); btn_edit_->setMaximumWidth(300); btn_edit_->hide(); // show once we know if there are existing poses connect(btn_edit_, SIGNAL(clicked()), this, SLOT(editSelected())); controls_layout->addWidget(btn_edit_); controls_layout->setAlignment( btn_edit_, Qt::AlignRight ); // Delete Selected Button btn_delete_ = new QPushButton( "&Delete Selected", this ); connect( btn_delete_, SIGNAL(clicked()), this, SLOT( deleteSelected() ) ); controls_layout->addWidget( btn_delete_ ); controls_layout->setAlignment(btn_delete_, Qt::AlignRight); // Add VJoint Button QPushButton *btn_add = new QPushButton( "&Add Virtual Joint", this ); btn_add->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred ); btn_add->setMaximumWidth(300); connect(btn_add, SIGNAL(clicked()), this, SLOT(showNewScreen())); controls_layout->addWidget(btn_add); controls_layout->setAlignment( btn_add, Qt::AlignRight ); // Add layout layout->addLayout( controls_layout ); // Set layout ----------------------------------------------------- content_widget->setLayout(layout); return content_widget; }
/* * Draws & initializes all the widgets of the main window */ void MainWindow::initWidgets() { setPlainCaption("QtKam"); /* Construct Actions */ saveAction = KStdAction::save(this, SLOT(saveSelected()),this); quitAction = KStdAction::quit(this, SLOT(close()),this); deleteAction = new KAction(i18n("Delete"), "edittrash", Key_Delete, this, SLOT(deleteSelected()), this); downloadThumbsAction = new KAction(i18n("Download Thumbs"), "queue", CTRL + Key_T, this, SLOT(downloadThumbs()), this); selectAllAction = new KAction(i18n("Select &All"), SHIFT + Key_A, this, SLOT(selectAll()), this); invertSelectionAction = new KAction(i18n("&Invert Selection"), SHIFT + Key_I, this, SLOT(selectInverse()), this); clearSelectionAction = new KAction(i18n("&Clear Selection"), SHIFT + Key_N, this, SLOT(selectNone()), this); selectCameraAction = new KAction(i18n("Select &Camera"), CTRL + Key_C, this, SLOT(selectCamera()), this); initCameraAction = new KAction(i18n("Reset Camera"), "connect_creating", CTRL + Key_R, this, SLOT(initCamera()), this); configureCameraAction = new KAction(i18n("&Configure"), 0, this, SLOT(configureCamera()), this); cameraInformationAction = new KAction(i18n("&Information"), 0, this, SLOT(cameraInformation()), this); cameraManualAction = new KAction(i18n("&Manual"), 0, this, SLOT(cameraManual()), this); cameraAboutAction = new KAction(i18n("&About the driver"), 0, this, SLOT(cameraAbout()), this); /* Initialize actions */ saveAction->setEnabled(false); deleteAction->setEnabled(false); /* Create & initialize icon view */ iconView = new KIconView(this); iconView->setMode(KIconView::Select); iconView->setSelectionMode(KIconView::Multi); iconView->setItemsMovable(false); iconView->setResizeMode(KIconView::Adjust); connect(iconView,SIGNAL(selectionChanged()), this,SLOT(selectionChanged())); setCentralWidget(iconView); /* Create file menu */ fileMenu = new KPopupMenu(); saveAction->plug(fileMenu); deleteAction->plug(fileMenu); fileMenu->insertSeparator(); quitAction->plug(fileMenu); /* Create edit menu */ editMenu = new KPopupMenu(); selectAllAction->plug(editMenu); invertSelectionAction->plug(editMenu); clearSelectionAction->plug(editMenu); /* Create command menu */ commandMenu = new KPopupMenu(); initCameraAction->plug(commandMenu); downloadThumbsAction->plug(commandMenu); /* Camera menu */ cameraMenu = new KPopupMenu(); selectCameraAction->plug(cameraMenu); cameraMenu->insertSeparator(); configureCameraAction->plug(cameraMenu); cameraInformationAction->plug(cameraMenu); cameraManualAction->plug(cameraMenu); cameraAboutAction->plug(cameraMenu); /* Help menu */ help = helpMenu(); /* Menu Bar */ menuBar()->insertItem(i18n("&File"), fileMenu); menuBar()->insertItem(i18n("&Edit"), editMenu); menuBar()->insertItem(i18n("&Command"),commandMenu); menuBar()->insertItem(i18n("C&amera"),cameraMenu); menuBar()->insertItem(i18n("&Help"), help); /* Create toolbar */ downloadThumbsAction->plug(toolBar()); saveAction->plug(toolBar()); deleteAction->plug(toolBar()); }
void InputWidget::createActions() { //-- Rename input renameAction = new QAction(this); renameAction->setObjectName(QString::fromUtf8("rename")); renameAction->setEnabled(true); renameAction->setText(QApplication::translate("InputWidget", "Rename", 0, QApplication::UnicodeUTF8)); renameAction->connect(renameAction,SIGNAL(activated()),this,SLOT(rename())); //-- New input newinputAction = new QAction(this); newinputAction->setObjectName(QString::fromUtf8("newInput")); newinputAction->setEnabled(true); newinputAction->setText(QApplication::translate("InputWidget", "New Input", 0, QApplication::UnicodeUTF8)); newinputAction->connect(newinputAction,SIGNAL(activated()),this,SLOT(newInput())); //-- Delete last deleteinputAction = new QAction(this); deleteinputAction->setObjectName(QString::fromUtf8("deleteInput")); deleteinputAction->setEnabled(true); deleteinputAction->setText(QApplication::translate("InputWidget", "Delete last Input", 0, QApplication::UnicodeUTF8)); deleteinputAction->connect(deleteinputAction,SIGNAL(activated()),this,SLOT(deleteLast())); //-- Delete selected deleteselectedinputAction = new QAction(this); deleteselectedinputAction->setObjectName(QString::fromUtf8("deleteSelectedInput")); deleteselectedinputAction->setEnabled(true); deleteselectedinputAction->setText(QApplication::translate("InputWidget", "Delete selected Input", 0, QApplication::UnicodeUTF8)); deleteselectedinputAction->connect(deleteselectedinputAction,SIGNAL(activated()),this,SLOT(deleteSelected())); //-- Input Up inputupAction = new QAction(this); inputupAction->setObjectName(QString::fromUtf8("moveupInput")); inputupAction->setEnabled(true); inputupAction->setText(QApplication::translate("InputWidget", "Move up", 0, QApplication::UnicodeUTF8)); inputupAction->connect(inputupAction,SIGNAL(activated()),this,SLOT(moveUp())); //-- Input Down inputdownAction = new QAction(this); inputdownAction->setObjectName(QString::fromUtf8("movedownInput")); inputdownAction->setEnabled(true); inputdownAction->setText(QApplication::translate("InputWidget", "Move down", 0, QApplication::UnicodeUTF8)); inputdownAction->connect(inputdownAction,SIGNAL(activated()),this,SLOT(moveDown())); }
void SCgView::createActions() { QAction* sep = new QAction(this); sep->setSeparator(true); mActionsList.append(sep); mActionChangeContent = new QAction(mWindow->findIcon("edit-content-change.png"),tr("Set content"),mWindow); mActionChangeContent->setShortcut(QKeySequence( tr("C") )); connect(mActionChangeContent, SIGNAL(triggered()), this, SLOT(changeContent())); mActionShowContent = new QAction(tr("Show content"),mWindow); mActionShowContent->setCheckable(true); mActionShowContent->setShortcut(QKeySequence( tr("H") )); connect(mActionShowContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool))); mActionShowAllContent = new QAction(tr("Show all content"), mWindow); connect(mActionShowAllContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool))); mActionHideAllContent = new QAction(tr("Hide all content"), mWindow); connect(mActionHideAllContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool))); mActionDeleteContent = new QAction(mWindow->findIcon("edit-content-delete.png"), tr("Delete content"), mWindow); mActionDeleteContent->setShortcut(QKeySequence( tr("D") )); connect(mActionDeleteContent, SIGNAL(triggered()), this, SLOT(deleteContent())); mActionChangeIdtf = new QAction(mWindow->findIcon("edit-change-idtf.png"), tr("Change identifier"), mWindow); mActionChangeIdtf->setShortcut(QKeySequence( tr("I") )); connect(mActionChangeIdtf, SIGNAL(triggered()), this, SLOT(changeIdentifier())); mActionDelete = new QAction(QIcon::fromTheme("edit-delete", mWindow->findIcon("edit-delete.png")), tr("Delete"), mWindow); mActionDelete->setShortcut(QKeySequence::Delete); connect(mActionDelete, SIGNAL(triggered()), this, SLOT(deleteSelected())); mActionContourDelete = new QAction(mWindow->findIcon("edit-delete.png"), tr("Delete contour"), mWindow); mActionContourDelete->setShortcut( QKeySequence(tr("Backspace")) ); connect(mActionContourDelete, SIGNAL(triggered()), this, SLOT(deleteJustContour())); mActionSwapPairOrient = new QAction(mWindow->findIcon("edit-swap-pair.png"), tr("Swap orientation"), mWindow); mActionSwapPairOrient->setShortcut( QKeySequence(tr("S"))); connect(mActionSwapPairOrient, SIGNAL(triggered()), this, SLOT(swapPairOrient())); mActionCopy = new QAction(QIcon::fromTheme("edit-copy", mWindow->findIcon("edit-copy.png")), tr("Copy"),this); mActionCopy->setShortcut(QKeySequence::Copy); connect(mActionCopy, SIGNAL(triggered()), mWindow, SLOT(copy())); mActionCut = new QAction(QIcon::fromTheme("edit-cut", mWindow->findIcon("edit-cut.png")), tr("Cut"),this); mActionCut->setShortcut(QKeySequence::Cut); connect(mActionCut, SIGNAL(triggered()), mWindow, SLOT(cut())); mActionPaste = new QAction(QIcon::fromTheme("edit-paste", mWindow->findIcon("edit-paste.png")), tr("Paste"),this); mActionPaste->setShortcut(QKeySequence::Paste); connect(mActionPaste, SIGNAL(triggered()), mWindow, SLOT(paste())); mActionSelectAll = new QAction(QIcon::fromTheme("edit-select-all", mWindow->findIcon("edit-select-all.png")), tr("Select All"),this); mActionSelectAll->setShortcut(QKeySequence::SelectAll); connect(mActionSelectAll, SIGNAL(triggered()), this, SLOT(selectAllCommand())); mActionsList.append(mActionChangeContent); mActionsList.append(mActionShowContent); mActionsList.append(mActionShowAllContent); mActionsList.append(mActionHideAllContent); mActionsList.append(mActionDeleteContent); sep = new QAction(this); sep->setSeparator(true); mActionsList.append(sep); mActionsList.append(mActionChangeIdtf); mActionsList.append(mActionSwapPairOrient); sep = new QAction(this); sep->setSeparator(true); mActionsList.append(sep); mActionsList.append(mActionCopy); mActionsList.append(mActionCut); mActionsList.append(mActionPaste); sep = new QAction(this); sep->setSeparator(true); mActionsList.append(sep); mActionsList.append(mActionSelectAll); sep = new QAction(this); sep->setSeparator(true); mActionsList.append(sep); mActionsList.append(mActionContourDelete); mActionsList.append(mActionDelete); }
void ObjectManager::keyPressEvent(QKeyEvent *event) { if (event->key() == 16777223) { //delete deleteSelected(); } }
void SchemaEditor::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Backspace || e->key() == Qt::Key_Delete) deleteSelected(); }
void SchemaEditor::slotDeleteSelected() { deleteSelected(); }
void ActionsCtrlDlg::OnActionctrlDeleteClick( wxCommandEvent& event ) { deleteSelected(); }
MainWindow::MainWindow( int argc, char *argv[], QWidget *parent ) : QMainWindow( parent ) { eventLoop = NULL; modeAuto = false; ui.setupUi( this ); ui.desktopType->addItem( "KDE", "kde" ); ui.desktopType->addItem( "w2k/xp", "winxp" ); ui.sourceType->addItem( "Astronomic POD", "apod" ); ui.sourceType->addItem( "Earth Science POD", "epod" ); connect( ui.updateNow, SIGNAL( clicked() ), this, SLOT( updateImage() ) ); connect( ui.updateAll, SIGNAL( clicked() ), this, SLOT( updateAll() ) ); connect( ui.pbSaveSettings, SIGNAL( clicked() ), this, SLOT( saveSettings() ) ); connect( ui.pbBrowseImageLocation, SIGNAL( clicked() ), this, SLOT( browseImageLocation() ) ); connect( ui.listView, SIGNAL( clicked ( const QModelIndex & ) ), this, SLOT( listViewclicked( const QModelIndex & ) ) ); connect( ui.pbDeleteSelected, SIGNAL( clicked() ), this, SLOT( deleteSelected() ) ); connect( ui.pbSetBackground, SIGNAL( clicked() ), this, SLOT( setAsBackground() ) ); connect( ui.installDesktop, SIGNAL( clicked() ), this, SLOT( installDesktop() ) ); connect( ui.installAutostart, SIGNAL( clicked() ), this, SLOT( installAutostart() ) ); connect( ui.removeDesktop, SIGNAL( clicked() ), this, SLOT( removeDesktop() ) ); connect( ui.removeAutostart, SIGNAL( clicked() ), this, SLOT( removeAutostart() ) ); connect( ui.textBrowser, SIGNAL( anchorClicked ( const QUrl & ) ), this, SLOT( anchorClicked ( const QUrl & ) ) ); QCoreApplication::setOrganizationName( "MySoft" ); QCoreApplication::setOrganizationDomain( "wollewolle.de" ); QCoreApplication::setApplicationName( "qapod" ); settings = new QSettings( QCoreApplication::applicationDirPath () + "/qapod.ini", QSettings::IniFormat ); if ( !settings->contains( "imagelocation" ) ) { settings->setValue( "imagelocation", "/tmp/apod" ); ui.tabWidget->setCurrentIndex( 1 ); } ui.imageLocation->setText( settings->value( "imagelocation" ).toString() ); if ( !settings->contains( "sourcetype" ) ) settings->setValue( "sourcetype", "apod" ); ui.sourceType->setCurrentIndex( ui.sourceType->findData( settings->value( "sourcetype" ).toString() ) ); if ( !settings->contains( "bgwidth" ) ) settings->setValue( "bgwidth", "1280" ); ui.bgWidth->setText( settings->value( "bgwidth" ).toString() ); if ( !settings->contains( "bgheight" ) ) settings->setValue( "bgheight", "1024" ); ui.bgHeight->setText( settings->value( "bgheight" ).toString() ); if ( !settings->contains( "thumbwidth" ) ) settings->setValue( "thumbwidth", "100" ); ui.thumbWidth->setText( settings->value( "thumbwidth" ).toString() ); if ( !settings->contains( "thumbheight" ) ) settings->setValue( "thumbheight", "100" ); ui.thumbHeight->setText( settings->value( "thumbheight" ).toString() ); if ( !settings->contains( "desktop" ) ) settings->setValue( "desktop", "kde" ); ui.desktopType->setCurrentIndex( ui.desktopType->findData( settings->value( "desktop" ).toString() ) ); if ( !settings->contains( "autoupdateimage" ) ) settings->setValue( "autoupdateimage", "0" ); ui.autoUpdateImage->setCheckState( ( Qt::CheckState ) settings->value( "autoupdateimage" ).toInt() ); if ( !settings->contains( "autobackground" ) ) settings->setValue( "autobackground", "0" ); ui.autoBackground->setCheckState( ( Qt::CheckState ) settings->value( "autobackground" ).toInt() ); if ( !settings->contains( "autoclose" ) ) settings->setValue( "autoclose", "0" ); ui.autoClose->setCheckState( ( Qt::CheckState ) settings->value( "autoclose" ).toInt() ); ui.progressBar->setValue( 0 ); // command line parsing QStringList args; for ( int iii = 0; iii < argc; iii++ ) args.append( argv[ iii ] ); if ( args.contains( "auto" ) ) modeAuto = true; if ( modeAuto ) qDebug() << "auto!"; // update list, would be useless if autoclose if ( !( modeAuto && ( settings->value( "autoclose" ).toInt() == 2 ) ) ) updateList(); // update image if ( modeAuto && ( settings->value( "autoupdateimage" ).toInt() == 2 ) ) updateImage(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); form = new Form(this); view = new GraphicsView(form, this); setCentralWidget(view); itemWidget = new ItemWidget(ui->propertyWidget); itemWidget->setHidden(true); connect(view, SIGNAL(mouseDoubleClick()), itemWidget, SLOT(selectPicture())); formWidget = new FormWidget(ui->propertyWidget); formWidget->connectForm(form); formWidget->update(form); ui->propertyWidget->setWidget(formWidget); fontCombo = new QFontComboBox(this); ui->formatToolBar->insertWidget(ui->actionBold, fontCombo); insertGroup = new QActionGroup(this); insertGroup->addAction(ui->actionSelect); insertGroup->addAction(ui->actionPaint); connect(insertGroup, SIGNAL(triggered(QAction*)), this, SLOT(insertObject(QAction*))); ui->actionLeft->setData(Qt::AlignLeft); ui->actionCenter->setData(Qt::AlignHCenter); ui->actionRight->setData(Qt::AlignRight); zoomGroup = new QActionGroup(this); zoomGroup->addAction(ui->actionActualSize); zoomGroup->addAction(ui->actionFitWidth); zoomGroup->addAction(ui->actionFitHeight); connect(zoomGroup, SIGNAL(triggered(QAction*)), this, SLOT(zoom(QAction*))); ui->actionActualSize->setData(GraphicsView::ActualSize); ui->actionFitWidth->setData(GraphicsView::FitWidth); ui->actionFitHeight->setData(GraphicsView::FitHeight); horzAlignGroup = new QActionGroup(this); horzAlignGroup->addAction(ui->actionLeft); horzAlignGroup->addAction(ui->actionCenter); horzAlignGroup->addAction(ui->actionRight); connect(horzAlignGroup, SIGNAL(triggered(QAction*)), this, SLOT(horzAlign(QAction*))); sizeGroup = new QActionGroup(this); sizeGroup->addAction(ui->actionShrinkWidth); sizeGroup->addAction(ui->actionGrowWidth); sizeGroup->addAction(ui->actionPageWidth); sizeGroup->addAction(ui->actionShrinkHeight); sizeGroup->addAction(ui->actionGrowHeight); sizeGroup->addAction(ui->actionPageHeight); sizeGroup->addAction(ui->actionShrinkBoth); sizeGroup->addAction(ui->actionGrowBoth); sizeGroup->addAction(ui->actionPageBoth); ui->actionShrinkWidth->setData(Form::ShrinkWidth); ui->actionGrowWidth->setData(Form::GrowWidth); ui->actionPageWidth->setData(Form::PageWidth); ui->actionShrinkHeight->setData(Form::ShrinkHeight); ui->actionGrowHeight->setData(Form::GrowHeight); ui->actionPageHeight->setData(Form::PageHeight); ui->actionShrinkBoth->setData(Form::ShrinkBoth); ui->actionGrowBoth->setData(Form::GrowBoth); ui->actionPageBoth->setData(Form::PageBoth); connect(sizeGroup, SIGNAL(triggered(QAction*)), this, SLOT(size(QAction*))); connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newForm())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openForm())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveForm())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveFormAs())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveFormAsPdf())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpenPrintData, SIGNAL(triggered()), this, SLOT(openPrintData())); connect(ui->actionPageSetup, SIGNAL(triggered()), form, SLOT(pageSetup())); connect(ui->actionPagePreview, SIGNAL(triggered()), this, SLOT(preview())); connect(ui->actionSend, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionFullScreen, SIGNAL(triggered()), this, SLOT(fullScreen())); connect(ui->actionMargins, SIGNAL(toggled(bool)), form, SLOT(showMargins(bool))); connect(ui->actionGrid, SIGNAL(toggled(bool)), form, SLOT(showGrid(bool))); connect(ui->actionPrintData, SIGNAL(toggled(bool)), form, SLOT(showData(bool))); connect(ui->actionSelectAll, SIGNAL(triggered()), form, SLOT(selectAll())); connect(ui->actionDelete, SIGNAL(triggered()), form, SLOT(deleteSelected())); connect(ui->actionProperties, SIGNAL(toggled(bool)), ui->propertyWidget, SLOT(setVisible(bool))); connect(ui->actionMoveForwards, SIGNAL(triggered()), form, SLOT(moveForwards())); connect(ui->actionMoveBackwards, SIGNAL(triggered()), form, SLOT(moveBackwards())); connect(ui->actionAlignLeft, SIGNAL(triggered()), form, SLOT(alignLeft())); connect(ui->actionAlignRight, SIGNAL(triggered()), form, SLOT(alignRight())); connect(ui->actionAlignTop, SIGNAL(triggered()), form, SLOT(alignTop())); connect(ui->actionAlignBottom, SIGNAL(triggered()), form, SLOT(alignBottom())); connect(ui->actionCut, SIGNAL(triggered()), form, SLOT(cut())); connect(ui->actionCopy, SIGNAL(triggered()), form, SLOT(copy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(paste())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateViewMenu())); connect(form, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(form, SIGNAL(changed()), this, SLOT(formChanged())); connect(view, SIGNAL(doneRubberBanding(QRectF)), this, SLOT(doneRubberBanding(QRectF))); connectForm(); loadSettings(); QTimer::singleShot(0, this, SLOT(init())); }
MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), fetcher(new Fetcher), local(new LocalFetcher), source(IMAGE_SOURCE_UNKNOWN) { ui->setupUi(this); QStringList sources; sources.append("Google"); sources.append("Local file"); // sources.append("Picsearch"); ui->cbSource->addItems(sources); ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE); fetcher->hide(); local->hide(); ui->menuFile->addAction(actionNewTab); ui->menuFile->addAction(actionLoadSession); ui->menuFile->addAction(actionSaveSession); ui->menuFile->addAction(actionQuit); ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen); ui->tbFullScreen->setDefaultAction(actionFullscreen); ui->tbNewTab->setDefaultAction(actionNewTab); ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms); ui->tbSave->setDefaultAction(actionSaveSession); ui->glTools->addWidget(fetcher,0,6,2,1); ui->glTools->addWidget(local,0,6,2,1); updateSource(); connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource())); ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab); QList<QKeySequence> keys; keys << Qt::Key_Delete << Qt::Key_Backspace; ui->actionDeleteSelected->setShortcuts(keys); // These are necessary if the actions are to remain accessible when the menubar is hidden: this->addAction(ui->actionViewOnlyMode); this->addAction(ui->actionResetTransforms); this->addAction(ui->actionZoomToFit); this->addAction(ui->actionIntroduction); this->addAction(ui->actionTips); this->addAction(ui->actionOpenDirectory); this->addAction(ui->actionOpenFile); this->addAction(ui->actionDeleteSelected); this->addAction(ui->actionUncropSelected); this->addAction(ui->actionCentreInView); this->addAction(ui->actionResetRotation); this->addAction(ui->actionResetScale); this->addAction(ui->actionScaleToFit); this->addAction(actionFullscreen); this->addAction(actionLoadSession); this->addAction(actionSaveSession); this->addAction(actionNewTab); this->addAction(actionQuit); connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp())); connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips())); connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool))); connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences())); connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); initBlacklistDocker(); initInfoDocker(); initView(parent); dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY); dlMgr = new QNetworkAccessManager(this); connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms())); connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit())); connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory())); connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile())); connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected())); connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected())); connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection())); connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation())); connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale())); connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit())); ui->verticalLayout->removeWidget(ui->toolWidget); ui->toolBar->addWidget(ui->toolWidget); setCentralWidget(gvMain); ui->thumbBar->addWidget(gvCarousel); ui->statusBar->addWidget(fetcher->getStatusText(),0); ui->statusBar->addWidget(fetcher->getProgressBar(),1); connect(this,SIGNAL(settingsChanged()),this,SLOT(loadSettings())); loadSettings(); }
m_model = new %ModelClassName%(this); m_proxyModel = new QSortFilterProxyModel(this); m_editWdg = new %EditWidgetClassName%(); m_editDialog = new EditDialog(m_editWdg, this); m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterKeyColumn(%ModelClassName%::NameCol); ui->tableView->horizontalHeader()->setDefaultSectionSize(%ModelClassName%::IdCol, 50); ui->tableView->setModel(m_proxyModel, %ModelClassName%::IdCol, Qt::DisplayRole); connect(ui->btnAdd, SIGNAL(clicked()), SLOT(add())); connect(ui->btnEdit, SIGNAL(clicked()), SLOT(editCurrent())); connect(ui->btnDelete, SIGNAL(clicked()), SLOT(deleteSelected())); connect(ui->btnPrint, SIGNAL(print(Report&)), SLOT(slotPrint(Report&))); connect(ui->edFind, SIGNAL(textEdited(QString)), m_proxyModel, SLOT(setFilterRegExp(QString))); connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(viewDoubleClicked(QModelIndex))); restoreSettings(); } %TableClassName%::~%TableClassName%() { saveSettings(); delete ui; } AdvTableView *%TableClassName%::view() const {
void EditLayer::onMessage( unsigned int type, unsigned long param1, unsigned long param2 ) { switch (type) { case MSG_DELETESELECTED: deleteSelected(); break; case MSG_CHANGEITEMTYPE: changeEnemyType(param1, param2); break; case MSG_CHANGEITEMRINGTYPE: changeEnemyRingType(param1, param2); break; case MSG_CHANGEBOXTYPE: changeBlockBoxType(param1, param2); break; case MSG_CHANGESELECTED: { hidePropertyLayer(); hideBlockBoxPropertyLayer(); int old_sel = param1; int new_sel = param2; Node* pNode = this->getChildByTag(old_sel); if (pNode) pNode->removeChildByTag(TAG_SELECTED_RECT); Sprite* pSelected = dynamic_cast<Sprite*>(this->getChildByTag(new_sel)); if (pSelected) drawSelectedRect(pSelected); } break; case MSG_ADDBLOCK: { switch (param1) { case kBlockBox: addBlock(Vec2(200, 200)); break; case kBlockWheel: addWheel(Vec2(300, 300)); break; case kBlockVortex: addVortex(Vec2(400, 400)); break; case kBlockBomb: addBomb(Vec2(500, 500)); break; default: break; } } break; case MSG_ADDENEMYITEM: addEnemy(BallBase::kTypeNormal1, Vec2(100, 100), BallBase::kTypeBulletUnknown); break; case MSG_SAVESTAGE: { _sectionId = param1; _stageId = param2; save(); } break; case MSG_SETBULLETCOUNT: { _bulletCounter[param1] = param2; updateBulletCount(); } break; default: break; } }