void DirTreeView::keyPressEvent(QKeyEvent *event) { if (event->matches(QKeySequence::Copy)) { copyToClipboard(); return; } if (event->matches(QKeySequence::Cut)) { copyToClipboard(false); return; } if (event->matches(QKeySequence::Paste)) { pasteFromClipboard(); return; } if (event->matches(QKeySequence::Delete)) { deletePressed(); return; } QTreeView::keyPressEvent(event); }
void EditMode::init() { /* Channels page */ connect(m_addChannelButton, SIGNAL(clicked()), this, SLOT(slotAddChannelClicked())); connect(m_removeChannelButton, SIGNAL(clicked()), this, SLOT(slotRemoveChannelClicked())); connect(m_raiseChannelButton, SIGNAL(clicked()), this, SLOT(slotRaiseChannelClicked())); connect(m_lowerChannelButton, SIGNAL(clicked()), this, SLOT(slotLowerChannelClicked())); m_modeNameEdit->setText(m_mode->name()); m_modeNameEdit->setValidator(CAPS_VALIDATOR(this)); refreshChannelList(); /* Heads page */ connect(m_addHeadButton, SIGNAL(clicked()), this, SLOT(slotAddHeadClicked())); connect(m_removeHeadButton, SIGNAL(clicked()), this, SLOT(slotRemoveHeadClicked())); connect(m_editHeadButton, SIGNAL(clicked()), this, SLOT(slotEditHeadClicked())); connect(m_raiseHeadButton, SIGNAL(clicked()), this, SLOT(slotRaiseHeadClicked())); connect(m_lowerHeadButton, SIGNAL(clicked()), this, SLOT(slotLowerHeadClicked())); refreshHeadList(); /* Physical page */ m_phyEdit = new EditPhysical(m_mode->physical(), this); m_phyEdit->show(); physicalLayout->addWidget(m_phyEdit); if (m_mode->useGlobalPhysical() == false) m_overridePhyCheck->setChecked(true); slotPhysicalModeChanged(); connect(m_globalPhyCheck, SIGNAL(clicked(bool)), this, SLOT(slotPhysicalModeChanged())); connect(m_overridePhyCheck, SIGNAL(clicked(bool)), this, SLOT(slotPhysicalModeChanged())); /* Forward copy/paste requests up to reach the main FixtureEditor clipboard */ connect(m_phyEdit, SIGNAL(copyToClipboard(QLCPhysical)), this, SIGNAL(copyToClipboard(QLCPhysical))); connect(m_phyEdit, SIGNAL(requestPasteFromClipboard()), this, SIGNAL(requestPasteFromClipboard())); // Close shortcut QAction* action = new QAction(this); action->setShortcut(QKeySequence(QKeySequence::Close)); connect(action, SIGNAL(triggered(bool)), this, SLOT(reject())); addAction(action); // Geometry QSettings settings; QVariant var = settings.value(KSettingsGeometry); if (var.isValid() == true) restoreGeometry(var.toByteArray()); }
LRESULT RichEdit::ParentWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) { if(msg==WM_NOTIFY && (((LPNMHDR)lParam)->code)== EN_LINK) { ENLINK* enLinkInfo = (ENLINK *)lParam; if(enLinkInfo->msg == WM_LBUTTONUP || enLinkInfo->msg == WM_RBUTTONUP) { LONG utlBeg = enLinkInfo->chrg.cpMin; LONG utlEnd = enLinkInfo->chrg.cpMax; if(utlEnd - utlBeg > 0) { HWND hRichEdit = enLinkInfo->nmhdr.hwndFrom; wchar_t* urlString = new wchar_t[utlEnd-utlBeg+1]; SendMessageW(hRichEdit, EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&enLinkInfo->chrg)); SendMessageW(hRichEdit, EM_GETSELTEXT, 0, reinterpret_cast<LPARAM>(urlString)); switch(enLinkInfo->msg) { case WM_LBUTTONUP: ShellExecuteW(NULL, L"open", urlString, NULL, NULL, SW_SHOWNORMAL); break; case WM_RBUTTONUP: copyToClipboard(hRichEdit, urlString); break; } delete [] urlString; SendMessage(hRichEdit, EM_SETSEL, utlEnd, utlEnd); HideCaret(hRichEdit); } } } return DefSubclassProc(hWnd, msg, wParam, lParam); }
BOOL ModelTreeDialog::doTreeCopy(void) { HTREEITEM hItem = TreeView_GetSelection(m_hTreeView); if (hItem) { TVITEMEX item; memset(&item, 0, sizeof(item)); item.mask = TVIF_PARAM; item.hItem = hItem; if (TreeView_GetItem(m_hTreeView, &item)) { LDModelTree *tree = (LDModelTree *)item.lParam; if (tree) { std::string text = tree->getText(); if (tree->getLineType() == LDLLineTypeEmpty) { text = ""; } text += "\r\n"; if (copyToClipboard(text.c_str())) { SetWindowLongPtr(hWindow, DWLP_MSGRESULT, TRUE); return TRUE; } } } } return FALSE; }
AboutDialog::AboutDialog(MainWindow *main) { this->tabWidget = new QTabWidget; AboutTab* aTab = new AboutTab(main); tabWidget->addTab(aTab, tr("About")); BuildTab* bTab = new BuildTab(); tabWidget->addTab(bTab, tr("Build")); RuntimeTab* rTab = new RuntimeTab(); tabWidget->addTab(rTab, tr("Runtime")); buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); QPushButton* btn = buttonBox->addButton("Copy Info", QDialogButtonBox::ApplyRole); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(btn, SIGNAL(clicked()), this, SLOT(copyToClipboard())); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); mainLayout->addWidget(buttonBox); setLayout(mainLayout); setWindowTitle(tr("About GoldenCheetah")); this->fullInfo = tr( "%1<hr/><hr/>%2<hr/><hr/>%3") .arg(aTab->buildAboutString()) .arg(bTab->buildBuildString()) .arg(rTab->buildRuntimeString()); }
bool CodeEditorComponent::cutToClipboard() { copyToClipboard(); cut(); newTransaction(); return true; }
void QmlConsoleView::contextMenuEvent(QContextMenuEvent *event) { QModelIndex itemIndex = indexAt(event->pos()); QMenu menu; QAction *copy = new QAction(tr("&Copy"), this); copy->setEnabled(itemIndex.isValid()); menu.addAction(copy); QAction *show = new QAction(tr("&Show in Editor"), this); show->setEnabled(canShowItemInTextEditor(itemIndex)); menu.addAction(show); menu.addSeparator(); QAction *clear = new QAction(tr("C&lear"), this); menu.addAction(clear); QAction *a = menu.exec(event->globalPos()); if (a == 0) return; if (a == copy) { copyToClipboard(itemIndex); } else if (a == show) { onRowActivated(itemIndex); } else if (a == clear) { QAbstractProxyModel *proxyModel = qobject_cast<QAbstractProxyModel *>(model()); QmlConsoleItemModel *handler = qobject_cast<QmlConsoleItemModel *>( proxyModel->sourceModel()); handler->clear(); } }
void PixelWidget::keyPressEvent(QKeyEvent *e) { switch (e->key()) { case Qt::Key_Plus: increaseZoom(); break; case Qt::Key_Minus: decreaseZoom(); break; case Qt::Key_PageUp: setGridSize(m_gridSize + 1); break; case Qt::Key_PageDown: setGridSize(m_gridSize - 1); break; case Qt::Key_G: toggleGrid(); break; case Qt::Key_C: if (e->modifiers() & Qt::ControlModifier) copyToClipboard(); break; case Qt::Key_S: if (e->modifiers() & Qt::ControlModifier) { releaseKeyboard(); saveToFile(); } break; case Qt::Key_Control: grabKeyboard(); break; } }
StatsDialog::StatsDialog(QWidget *parent) : QDialog(parent) { mUI.setupUi(this); connect(mUI.mCopyToClipboard, SIGNAL(pressed()), this, SLOT(copyToClipboard())); }
/** *@brief Constructeur. *@param *main_window Fenêtre principale de Thumbnail me. */ VerboseWindow::VerboseWindow(QWidget *main_window) : QDockWidget(main_window) { this->setMinimumWidth(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).width()/4); this->setObjectName("VerboseWindow"); QVBoxLayout *contentLayout = new QVBoxLayout; QHBoxLayout *buttonsLayout = new QHBoxLayout; verboseTextEdit = new QTextEdit(this); verboseTextEdit->setReadOnly(true); clearAllButton = new QPushButton(QIcon(":sprites/recycle-bin-full.png"),tr("Clear all"),this); clearAllButton->setDisabled(true); copyToClipboardButton = new QPushButton(QIcon(":sprites/text clipping.png"),tr("Copy to clipboard"),this); copyToClipboardButton->setDisabled(true); contentLayout->addWidget(verboseTextEdit,0,Qt::AlignVCenter); buttonsLayout->addWidget(copyToClipboardButton); buttonsLayout->addWidget(clearAllButton); contentLayout->addLayout(buttonsLayout); contentWidget = new QWidget(this); contentWidget->setLayout(contentLayout); this->setWidget(contentWidget); this->retranslate(); /*Connections*/ connect(clearAllButton, SIGNAL(clicked()), verboseTextEdit, SLOT(clear())); connect(copyToClipboardButton, SIGNAL(clicked()), this, SLOT(copyToClipboard())); connect(verboseTextEdit, SIGNAL(textChanged()), this, SLOT(enabledButtons())); }
int APIENTRY WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, char* lpCmdLine, int /*nCmdShow*/) { std::string filename = unquote(lpCmdLine); std::string snippetUrl = sendFile(filename.c_str()); copyToClipboard(snippetUrl); return 0; }
void PaintWidget::cutToClipboard() { if( !canCopyOrCutToClipboard() ) return; copyToClipboard(); deleteSelected(); emit StateChanged("Cut"); }
QtGnuplotWindow::QtGnuplotWindow(int id, QtGnuplotEventHandler* eventHandler, QWidget* parent) : QMainWindow(parent) { m_eventHandler = eventHandler; m_id = id; setAttribute(Qt::WA_DeleteOnClose); setWindowIcon(QIcon(":/images/gnuplot")); // Register as the main event receiver if not already created if (m_eventHandler == 0) m_eventHandler = new QtGnuplotEventHandler(this, "qtgnuplot" + QString::number(QCoreApplication::applicationPid())); // Central widget m_widget = new QtGnuplotWidget(m_id, m_eventHandler, this); connect(m_widget, SIGNAL(statusTextChanged(const QString&)), this, SLOT(on_setStatusText(const QString&))); setCentralWidget(m_widget); // Bars m_toolBar = new QToolBar(this); addToolBar(m_toolBar); statusBar()->showMessage(tr("Qt frontend for gnuplot")); // Actions QAction* copyToClipboardAction = new QAction(QIcon(":/images/clipboard" ), tr("Copy to clipboard"), this); QAction* printAction = new QAction(QIcon(":/images/print" ), tr("Print" ), this); QAction* exportAction = new QAction(QIcon(":/images/export" ), tr("Export" ), this); QAction* exportPdfAction = new QAction(QIcon(":/images/exportPDF" ), tr("Export to PDF" ), this); QAction* exportEpsAction = new QAction(QIcon(":/images/exportVector"), tr("Export to EPS" ), this); QAction* exportSvgAction = new QAction(QIcon(":/images/exportVector"), tr("Export to SVG" ), this); QAction* exportPngAction = new QAction(QIcon(":/images/exportRaster"), tr("Export to image" ), this); QAction* settingsAction = new QAction(QIcon(":/images/settings" ), tr("Settings" ), this); connect(copyToClipboardAction, SIGNAL(triggered()), m_widget, SLOT(copyToClipboard())); connect(printAction, SIGNAL(triggered()), m_widget, SLOT(print())); connect(exportPdfAction, SIGNAL(triggered()), m_widget, SLOT(exportToPdf())); connect(exportEpsAction, SIGNAL(triggered()), m_widget, SLOT(exportToEps())); connect(exportSvgAction, SIGNAL(triggered()), m_widget, SLOT(exportToSvg())); connect(exportPngAction, SIGNAL(triggered()), m_widget, SLOT(exportToImage())); connect(settingsAction, SIGNAL(triggered()), m_widget, SLOT(showSettingsDialog())); QMenu* exportMenu = new QMenu(this); exportMenu->addAction(copyToClipboardAction); exportMenu->addAction(printAction); exportMenu->addAction(exportPdfAction); // exportMenu->addAction(exportEpsAction); exportMenu->addAction(exportSvgAction); exportMenu->addAction(exportPngAction); exportAction->setMenu(exportMenu); m_toolBar->addAction(exportAction); createAction(tr("Replot") , 'e', ":/images/replot"); createAction(tr("Show grid") , 'g', ":/images/grid"); createAction(tr("Previous zoom"), 'p', ":/images/zoomPrevious"); createAction(tr("Next zoom") , 'n', ":/images/zoomNext"); createAction(tr("Autoscale") , 'a', ":/images/autoscale"); m_toolBar->addAction(settingsAction); }
DiagnosticsDialog::DiagnosticsDialog( QWidget *parent ) : QDialog( parent ) , ui( new Ui::DiagnosticsDialog ) { ui->setupUi( this ); connect( ui->updateButton, SIGNAL( clicked() ), this, SLOT( updateLogView() ) ); connect( ui->clipboardButton, SIGNAL( clicked() ), this, SLOT( copyToClipboard() ) ); connect( ui->buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); updateLogView(); }
void SafeListView::startDrag() { DBGOUT("Drag started (is targe child: " << m_target_is_child << ")"); SafeDragObject *d = new SafeDragObject(viewport()); Q3ListViewItemIterator it(this, Q3ListViewItemIterator::Selected | Q3ListViewItemIterator::DragEnabled); for(; it.current(); ++it) { SafeListViewItem *item = (SafeListViewItem *)it.current(); d->addItem(item->item()); // copy the user name to the clipboard if(item->rtti() == SafeListViewEntry::RTTI) { SafeEntry *ent = ((SafeListViewEntry *)item)->entry(); copyToClipboard(ent->user()); } } m_drop_target = NULL; m_target_is_child = false; bool drag_ret = d->drag(); DBGOUT("\tdrag() returned " << drag_ret); DBGOUT("\tsrc: " << d->source() << "\ttarget: " << d->target()); // drag was a move if(drag_ret) { DBGOUT("\tMove"); // prevent drops from doing anything when they occur on a child // of the dragged object if(m_target_is_child) { QMessageBox::information(this, "Sorry", "Sorry, but items can't be dragged into their children"); } // delete the item if it's dropped onto this else if(d->source() == d->target()) { // remove the item from the list SafeListViewItem *item = (SafeListViewItem *)selectedItem(); emit deleteItem(item->item()); } } // drag was a copy onto a child else { DBGOUT("\tCopy"); if(m_target_is_child) emit dragObjectDropped(d, m_drop_target); } DBGOUT("\t" << name() << ": Drag ended"); }
ProtocolWidget::ProtocolWidget(QWidget *parent) : QWidget(parent), IgnoredIndicatorRole( Qt::UserRole +1 ), _ui(new Ui::ProtocolWidget) { _ui->setupUi(this); connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString,ProgressInfo)), this, SLOT(slotProgressInfo(QString,ProgressInfo))); connect(ProgressDispatcher::instance(), SIGNAL(itemCompleted(QString,SyncFileItem,PropagatorJob)), this, SLOT(slotItemCompleted(QString,SyncFileItem,PropagatorJob))); connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(slotOpenFile(QTreeWidgetItem*,int))); // Adjust copyToClipboard() when making changes here! QStringList header; header << tr("Time"); header << tr("File"); header << tr("Folder"); header << tr("Action"); header << tr("Size"); _ui->_treeWidget->setHeaderLabels( header ); _ui->_treeWidget->setColumnWidth(1, 180); _ui->_treeWidget->setColumnCount(5); _ui->_treeWidget->setRootIsDecorated(false); _ui->_treeWidget->setTextElideMode(Qt::ElideMiddle); _ui->_treeWidget->header()->setObjectName("ActivityListHeader"); #if defined(Q_OS_MAC) _ui->_treeWidget->setMinimumWidth(400); #endif _ui->_headerLabel->setText(tr("Local sync protocol")); QPushButton *copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); copyBtn->setToolTip( tr("Copy the activity list to the clipboard.")); copyBtn->setEnabled(true); connect(copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard())); // this view is used to display all errors such as real errors, soft errors and ignored files // it is instantiated here, but made accessible via the method issueWidget() so that it can // be embedded into another gui element. _issueItemView = new QTreeWidget(this); header.removeLast(); _issueItemView->setHeaderLabels( header ); _issueItemView->setColumnWidth(1, 180); _issueItemView->setColumnCount(4); _issueItemView->setRootIsDecorated(false); _issueItemView->setTextElideMode(Qt::ElideMiddle); _issueItemView->header()->setObjectName("ActivityErrorListHeader"); }
void KWQTableView::doEditCopy() { if (state() == QAbstractItemView::EditingState) { if (QApplication::focusWidget()) { QLineEdit *lineEdit = static_cast<QLineEdit*>(QApplication::focusWidget()); lineEdit->copy(); } } else { copyToClipboard(this); } }
bool CodeEditorComponent::performCommand (const int commandID) { switch (commandID) { case StandardApplicationCommandIDs::cut: cutToClipboard(); break; case StandardApplicationCommandIDs::copy: copyToClipboard(); break; case StandardApplicationCommandIDs::paste: pasteFromClipboard(); break; case StandardApplicationCommandIDs::del: cut(); break; case StandardApplicationCommandIDs::selectAll: selectAll(); break; case StandardApplicationCommandIDs::undo: undo(); break; case StandardApplicationCommandIDs::redo: redo(); break; default: return false; } return true; }
FormMaterialIndicesManager::FormMaterialIndicesManager(QMainWindow *parent, QGLWidget* qlW_ptr) : FormImageBase(parent), ui(new Ui::FormMaterialIndicesManager) { ui->setupUi(this); imageProp.glWidget_ptr = qlW_ptr; connect(ui->pushButtonOpenMaterialImage,SIGNAL(released()),this,SLOT(open())); connect(ui->pushButtonCopyToClipboard,SIGNAL(released()),this,SLOT(copyToClipboard())); connect(ui->pushButtonPasteFromClipboard,SIGNAL(released()),this,SLOT(pasteFromClipboard())); connect(ui->checkBoxDisableMaterials,SIGNAL(toggled(bool)),this,SLOT(toggleMaterials(bool))); connect(ui->listWidgetMaterialIndices,SIGNAL(currentRowChanged(int)),this,SLOT(changeMaterial(int))); ui->groupBox->setDisabled(true); setAcceptDrops(true); }
ActivityWidget::ActivityWidget(QWidget *parent) : QWidget(parent), _ui(new Ui::ActivityWidget), _notificationRequestsRunning(0) { _ui->setupUi(this); // Adjust copyToClipboard() when making changes here! #if defined(Q_OS_MAC) _ui->_activityList->setMinimumWidth(400); #endif _model = new ActivityListModel(this); ActivityItemDelegate *delegate = new ActivityItemDelegate; delegate->setParent(this); _ui->_activityList->setItemDelegate(delegate); _ui->_activityList->setAlternatingRowColors(true); _ui->_activityList->setModel(_model); _ui->_notifyLabel->hide(); _ui->_notifyScroll->hide(); // Create a widget container for the notifications. The ui file defines // a scroll area that get a widget with a layout as children QWidget *w = new QWidget(this); _notificationsLayout = new QVBoxLayout(this); w->setLayout(_notificationsLayout); _ui->_notifyScroll->setWidget(w); showLabels(); connect(_model, SIGNAL(activityJobStatusCode(AccountState*,int)), this, SLOT(slotAccountActivityStatus(AccountState*,int))); _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); _copyBtn->setToolTip( tr("Copy the activity list to the clipboard.")); connect(_copyBtn, SIGNAL(clicked()), SIGNAL(copyToClipboard())); connect(_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(rowsInserted())); connect( _ui->_activityList, SIGNAL(activated(QModelIndex)), this, SLOT(slotOpenFile(QModelIndex))); connect( &_removeTimer, SIGNAL(timeout()), this, SLOT(slotCheckToCleanWidgets()) ); _removeTimer.setInterval(1000); }
DiagnosticsDialog::DiagnosticsDialog(QWidget* parent): QDialog(parent) { mUI.setupUi(this); QObject::connect( mUI.clipboardButton, SIGNAL(clicked()), this, SLOT(copyToClipboard()) ); QObject::connect( mUI.closeButton, SIGNAL(clicked()), this, SLOT(hide()) ); dumpVersionInfo(); }
ExportDialog::ExportDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ExportDialog) { ui->setupUi(this); QPushButton *button = ui->buttonBox->addButton(tr("Copy to Clipboard"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(copyToClipboard())); #ifdef MOBILE_VERSION this->setWindowState(Qt::WindowMaximized); #else button = ui->buttonBox->addButton(tr("Open Formel Editor"), QDialogButtonBox::ActionRole); connect(button, SIGNAL(clicked()), this, SLOT(openFormelEditor())); #endif }
ProtocolWidget::ProtocolWidget(QWidget *parent) : QWidget(parent), IgnoredIndicatorRole( Qt::UserRole +1 ), _ui(new Ui::ProtocolWidget) { _ui->setupUi(this); connect(ProgressDispatcher::instance(), SIGNAL(progressInfo(QString,Progress::Info)), this, SLOT(slotProgressInfo(QString,Progress::Info))); connect(_ui->_treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(slotOpenFile(QTreeWidgetItem*,int))); // Adjust copyToClipboard() when making changes here! QStringList header; header << tr("Time"); header << tr("File"); header << tr("Folder"); header << tr("Action"); header << tr("Size"); _ui->_treeWidget->setHeaderLabels( header ); _ui->_treeWidget->setColumnWidth(1, 180); _ui->_treeWidget->setColumnCount(5); _ui->_treeWidget->setRootIsDecorated(false); _ui->_treeWidget->setTextElideMode(Qt::ElideMiddle); _ui->_treeWidget->header()->setObjectName("ActivityListHeader"); #if defined(Q_OS_MAC) _ui->_treeWidget->setMinimumWidth(400); #endif connect(this, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString))); _retrySyncBtn = _ui->_dialogButtonBox->addButton(tr("Retry Sync"), QDialogButtonBox::ActionRole); _retrySyncBtn->setEnabled(false); connect(_retrySyncBtn, SIGNAL(clicked()), SLOT(slotRetrySync())); _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); _copyBtn->setToolTip( tr("Copy the activity list to the clipboard.")); _copyBtn->setEnabled(false); connect(_copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard())); ConfigFile cfg; cfg.restoreGeometryHeader(_ui->_treeWidget->header()); }
void CMessageDialog::initializeUi( QMessageBox::Icon iconStyle ) { ui->setupUi(this); ui->label_2->setFrameShape( QFrame::NoFrame ); connect( ui->btnOK, SIGNAL( clicked() ), this, SLOT( close() ) ); connect( ui->btnCopy, SIGNAL( clicked() ), this, SLOT( copyToClipboard() ) ); connect( ui->btnSave, SIGNAL( clicked() ), this, SLOT( save() ) ); QMessageBox* mb = new QMessageBox(); QStyle *style = mb ? mb->style() : QApplication::style(); QIcon tmpIcon; switch( iconStyle ) { case QMessageBox::NoIcon: // Do nothing break; case QMessageBox::Information: tmpIcon = style->standardIcon( QStyle::SP_MessageBoxInformation ); break; case QMessageBox::Warning: tmpIcon = style->standardIcon( QStyle::SP_MessageBoxWarning ); break; case QMessageBox::Critical: tmpIcon = style->standardIcon( QStyle::SP_MessageBoxCritical ); break; case QMessageBox::Question: tmpIcon = style->standardIcon( QStyle::SP_MessageBoxQuestion ); break; } if( tmpIcon.isNull() ) ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), 0, 0 ); else { int iconSize = style->pixelMetric( QStyle::PM_MessageBoxIconSize, 0, mb ); ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), iconSize, iconSize ); ui->label_2->setPixmap( tmpIcon.pixmap( iconSize, iconSize ) ); } delete mb; }
void ThreeDMolDialog::setMolecule(QtGui::Molecule* mol) { if (mol == m_molecule) return; if (m_molecule) m_molecule->disconnect(this); m_molecule = mol; if (!m_molecule) return; connect(m_molecule, SIGNAL(changed(unsigned int)), SLOT(updateLabels())); connect(m_molecule, SIGNAL(destroyed()), SLOT(moleculeDestroyed())); connect(m_ui->exitButton, SIGNAL(clicked()), SLOT(close())); connect(m_ui->copyButton, SIGNAL(clicked()), SLOT(copyToClipboard())); updateLabels(); }
int main (int argc, char* const argv[]) { init(); if (argc == 1 && usage()) return 0; if (parseCmdLine(argc, argv) != 0) return 0; if (optShowHelp && showHelp()) return 0; if (optShowVersion && showVersion()) return 0; curl_global_init(CURL_GLOBAL_ALL); for (int i = 0; i < optFiles.size(); i++) { std::string processed = processImage(optFiles[i], optImageSize); if (processed == "") continue; if (processed != optFiles[i]) tempFiles.push_back(processed); std::string err; std::string output = uploadImage(processed.c_str(), err); if (!userOutput(output) || err.length() > 0) fprintf(stderr, "Upload failed for %s.\n%s\n", optFiles[i].c_str(), err.c_str()); } if (clipBuffer.length() > 0) copyToClipboard(clipBuffer); for (int i = 0; i < tempFiles.size(); i++) remove(tempFiles[i].c_str()); return 0; }
/** * Create and connect actions */ void FunctionBrowser::createActions() { m_actionAddFunction = new QAction("Add function",this); connect(m_actionAddFunction,SIGNAL(triggered()),this,SLOT(addFunction())); m_actionRemoveFunction = new QAction("Remove function",this); connect(m_actionRemoveFunction,SIGNAL(triggered()),this,SLOT(removeFunction())); m_actionFixParameter = new QAction("Fix",this); connect(m_actionFixParameter,SIGNAL(triggered()),this,SLOT(fixParameter())); m_actionRemoveTie = new QAction("Remove tie",this); connect(m_actionRemoveTie,SIGNAL(triggered()),this,SLOT(removeTie())); m_actionAddTie = new QAction("Add tie",this); connect(m_actionAddTie,SIGNAL(triggered()),this,SLOT(addTie())); m_actionFromClipboard = new QAction("Copy from clipboard",this); connect(m_actionFromClipboard,SIGNAL(triggered()),this,SLOT(copyFromClipboard())); m_actionToClipboard = new QAction("Copy to clipboard",this); connect(m_actionToClipboard,SIGNAL(triggered()),this,SLOT(copyToClipboard())); m_actionConstraints = new QAction("Custom",this); connect(m_actionConstraints,SIGNAL(triggered()),this,SLOT(addConstraints())); m_actionConstraints10 = new QAction("10%",this); connect(m_actionConstraints10,SIGNAL(triggered()),this,SLOT(addConstraints10())); m_actionConstraints50 = new QAction("50%",this); connect(m_actionConstraints50,SIGNAL(triggered()),this,SLOT(addConstraints50())); m_actionRemoveConstraints = new QAction("Remove constraints",this); connect(m_actionRemoveConstraints,SIGNAL(triggered()),this,SLOT(removeConstraints())); m_actionRemoveConstraint = new QAction("Remove",this); connect(m_actionRemoveConstraint,SIGNAL(triggered()),this,SLOT(removeConstraint())); }
void HistoryPanel::contextMenuItem(const QPoint &pos) { KMenu menu; KAction* action; action = new KAction(KIcon("tab-new"), i18n("Open"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInCurrentTab())); menu.addAction(action); action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewTab())); menu.addAction(action); action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewWindow())); menu.addAction(action); action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard())); menu.addAction(action); menu.exec(panelTreeView()->mapToGlobal(pos)); }
LRESULT RichEdit::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) { if(msg == WM_LBUTTONUP) HideCaret(hWnd); else if(msg == WM_RBUTTONDOWN) { CHARFORMAT cf; memset(&cf, 0, sizeof(CHARFORMAT)); cf.dwMask = CFM_LINK; SendMessage(hWnd, EM_GETCHARFORMAT, SCF_SELECTION, reinterpret_cast<LPARAM>(&cf)); if(!(cf.dwEffects & CFE_LINK)) { DWORD selBeg, selEnd; SendMessageW(hWnd, EM_GETSEL, (WPARAM)&selBeg, (LPARAM)&selEnd); if(selEnd-selBeg > 0) { wchar_t* urlString = new wchar_t[selEnd-selBeg+1]; SendMessageW(hWnd, EM_GETSELTEXT, 0, reinterpret_cast<LPARAM>(urlString)); copyToClipboard(hWnd, urlString); delete [] urlString; SendMessageW(hWnd, EM_SETSEL, selEnd, selEnd); } } HideCaret(hWnd); } return DefSubclassProc(hWnd, msg, wParam, lParam); }
void CATextView::cutToClipboard() { copyToClipboard(); execCurSelCharRange(); }