コード例 #1
0
void ApercuBGLabel::mousePressEvent(QMouseEvent *event)
{
    if(event->button() != Qt::LeftButton)	return;

    if(event->x()>=0 && event->x()<32 && event->y()>=0 && event->y()<32) {
        savePixmap();
    }
}
コード例 #2
0
void WizScreenShotWidget::initSelectedMenu()
{
    savePixmapAction = new QAction(tr("Save constituency"), this);
    cancelAction = new QAction(tr("Reselect"), this);
    quitAction = new QAction(tr("Quit"), this);
    contextMenu = new QMenu(this);

    connect(savePixmapAction, SIGNAL(triggered()), this, SLOT(savePixmap()));
    connect(cancelAction, SIGNAL(triggered()), this, SLOT(cancelSelectedRect()));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));
}
コード例 #3
0
void ScreenshotsWidget::initSelectedMenu()
{
    sendPixmapAction = new QAction(tr("发送截图"),this);
    savePixmapAction = new QAction(tr("保存截图"),this);
    cancelAction = new QAction(tr("重选"),this);
    quitAction = new QAction(tr("退出"),this);
    contextMenu = new QMenu(this);

    connect(sendPixmapAction,SIGNAL(triggered()),this,SLOT(sendPixmap()));
    connect(savePixmapAction,SIGNAL(triggered()),this,SLOT(savePixmap()));
    connect(cancelAction,SIGNAL(triggered()),this,SLOT(cancelSelectedRect()));
    connect(quitAction,SIGNAL(triggered()),this,SLOT(hide()));
}
コード例 #4
0
ファイル: capture_wgt.cpp プロジェクト: z80/chassis
void CaptureWgt::slotPixmap()
{
    QFileDialog d( this );
    d.setWindowTitle( "Save pixmap as" );
    d.setNameFilter( "PNG files (*.png)" );
    d.setFileMode( QFileDialog::AnyFile );
    d.setAcceptMode( QFileDialog::AcceptSave );
    d.setOptions( 0 );
    if ( d.exec() )
    {
        QStringList fileNames = d.selectedFiles();
        if ( fileNames.size() < 1 )
            return;
        QString fileName = fileNames.at( 0 );
        savePixmap( fileName );
    }
}
コード例 #5
0
ファイル: customwebview.cpp プロジェクト: Akon32/leechcraft
	void CustomWebView::contextMenuEvent (QGraphicsSceneContextMenuEvent *e)
	{
		QPointer<QMenu> menu (new QMenu ());
		QWebHitTestResult r = page ()->
			mainFrame ()->hitTestContent (e->pos ().toPoint ());

		IHookProxy_ptr proxy (new Util::DefaultHookProxy ());

		emit hookWebViewContextMenu (proxy, this, e, r,
				menu, WVSStart);

		if (!r.linkUrl ().isEmpty ())
		{
			QUrl url = r.linkUrl ();
			QString text = r.linkText ();

			if (XmlSettingsManager::Instance ()->
					property ("TryToDetectRSSLinks").toBool ())
			{
				bool hasAtom = text.contains ("Atom");
				bool hasRSS = text.contains ("RSS");

				if (hasAtom || hasRSS)
				{
					LeechCraft::Entity e;
					if (hasAtom)
					{
						e.Additional_ ["UserVisibleName"] = "Atom";
						e.Mime_ = "application/atom+xml";
					}
					else
					{
						e.Additional_ ["UserVisibleName"] = "RSS";
						e.Mime_ = "application/rss+xml";
					}

					e.Entity_ = url;
					e.Parameters_ = LeechCraft::FromUserInitiated |
						LeechCraft::OnlyHandle;

					bool ch = false;
					emit couldHandle (e, &ch);
					if (ch)
					{
						QList<QVariant> datalist;
						datalist << url
							<< e.Mime_;
						menu->addAction (tr ("Subscribe"),
								this,
								SLOT (subscribeToLink ()))->setData (datalist);
						menu->addSeparator ();
					}
				}
			}

			menu->addAction (tr ("Open &here"),
					this, SLOT (openLinkHere ()))->setData (url);
			menu->addAction (tr ("Open in new &tab"),
					this, SLOT (openLinkInNewTab ()))->setData (url);
			menu->addSeparator ();
			menu->addAction (tr ("&Save link..."),
					this, SLOT (saveLink ()));

			QList<QVariant> datalist;
			datalist << url
				<< text;
			menu->addAction (tr ("&Bookmark link..."),
					this, SLOT (bookmarkLink ()))->setData (datalist);

			menu->addSeparator ();
			if (!page ()->selectedText ().isEmpty ())
				menu->addAction (pageAction (QWebPage::Copy));
			menu->addAction (tr ("&Copy link"),
					this, SLOT (copyLink ()));
			if (page ()->settings ()->testAttribute (QWebSettings::DeveloperExtrasEnabled))
				menu->addAction (pageAction (QWebPage::InspectElement));
		}
		else if (page ()->selectedText ().contains (UrlInText))
		{
			menu->addAction (tr ("Open as link"),
					this, SLOT (openLinkInNewTab ()))->
							setData (page ()->selectedText ());
		}

		emit hookWebViewContextMenu (proxy, this, e, r,
				menu, WVSAfterLink);

		if (!r.imageUrl ().isEmpty ())
		{
			if (!menu->isEmpty ())
				menu->addSeparator ();
			menu->addAction (tr ("Open image here"),
					this, SLOT (openImageHere ()))->setData (r.imageUrl ());
			menu->addAction (tr ("Open image in new tab"),
					this, SLOT (openImageInNewTab ()));
			menu->addSeparator ();
			menu->addAction (tr ("Save image..."),
					this, SLOT (saveImage ()));

			QAction *spx = menu->addAction (tr ("Save pixmap..."),
					this, SLOT (savePixmap ()));
			spx->setToolTip (tr ("Saves the rendered pixmap without redownloading."));
			spx->setProperty ("Poshuku/OrigPX", r.pixmap ());
			spx->setProperty ("Poshuku/OrigURL", r.imageUrl ());

			menu->addAction (tr ("Copy image"),
					this, SLOT (copyImage ()));
			menu->addAction (tr ("Copy image location"),
					this, SLOT (copyImageLocation ()))->setData (r.imageUrl ());
		}

		emit hookWebViewContextMenu (proxy, this, e, r,
				menu, WVSAfterImage);

		bool hasSelected = !page ()->selectedText ().isEmpty ();
		if (hasSelected)
		{
			if (!menu->isEmpty ())
				menu->addSeparator ();
			menu->addAction (pageAction (QWebPage::Copy));
		}

		if (r.isContentEditable ())
			menu->addAction (pageAction (QWebPage::Paste));

		if (hasSelected)
		{
			Browser_->Find_->setData (page ()->selectedText ());
			menu->addAction (Browser_->Find_);
			menu->addAction (tr ("Search..."),
					this, SLOT (searchSelectedText ()));
		}

		emit hookWebViewContextMenu (proxy, this, e, r,
				menu, WVSAfterSelectedText);

		if (menu->isEmpty ())
			menu = page ()->createStandardContextMenu ();

		if (!menu->isEmpty ())
			menu->addSeparator ();

		menu->addAction (Browser_->Add2Favorites_);
		menu->addSeparator ();
		menu->addAction (Browser_->Print_);
		menu->addAction (Browser_->PrintPreview_);
		menu->addSeparator ();
		menu->addAction (Browser_->ViewSources_);
		menu->addAction (Browser_->SavePage_);
		menu->addSeparator ();
		menu->addAction (pageAction (QWebPage::ReloadAndBypassCache));
		menu->addAction (Browser_->ReloadPeriodically_);
		menu->addAction (Browser_->NotifyWhenFinished_);
		menu->addSeparator ();
		menu->addAction (Browser_->ChangeEncoding_->menuAction ());

		emit hookWebViewContextMenu (proxy, this, e, r,
				menu, WVSAfterFinish);

		if (!menu->isEmpty ())
			menu->exec (Browser_->GetGraphicsView ()->viewport ()->
					mapToGlobal (e->pos ().toPoint ()));
		else
			QGraphicsWebView::contextMenuEvent (e);

		if (menu)
			delete menu;
	}
コード例 #6
0
ファイル: mapview.cpp プロジェクト: minsoub/MapView
// Action create
void MapView::createActions()
{
	openAction = new QAction(tr("&Open"),this);
	openAction->setIcon(QIcon(":/images/open.png"));
	openAction->setShortcut(QKeySequence::Open);
	openAction->setStatusTip(tr("Open a map file"));
	connect(openAction,SIGNAL(triggered()),this,SLOT(open()));

	saveAllAction = new QAction(tr("&Save All"),this);
	saveAllAction->setIcon(QIcon(":/images/save.png"));
	saveAllAction->setShortcut(QKeySequence::Save);
	saveAllAction->setStatusTip(tr("Save map and user layer to disk and database"));
	connect(saveAllAction,SIGNAL(triggered()),this,SLOT(saveall()));

	//file save
	saveFileAction = new QAction(tr("Save &File"),this);
	saveFileAction->setIcon(QIcon(":/images/save.png"));
	saveFileAction->setShortcut(tr("Ctrl+Shift+S"));
	saveFileAction->setStatusTip(tr("Save map to disk including user layer"));
	connect(saveFileAction,SIGNAL(triggered()),main,   SLOT(save()));

	//save as
	saveAsAction = new QAction(tr("Save &As"),this);
	saveAsAction->setIcon(QIcon(":/images/saveas.png"));
	saveAsAction->setShortcut(tr("Ctrl+A"));
	saveAsAction->setStatusTip(tr("Save map to disk with new file name including user layer"));
	connect(saveAsAction,SIGNAL(triggered()),this,SLOT(saveas()));

	//load ul from db
	GetUserLayerFromDbAction=new QAction(tr("Load U&L from Db"),this);
	GetUserLayerFromDbAction->setIcon(QIcon(":/images/fromdb.png"));
	GetUserLayerFromDbAction->setStatusTip(tr("Get user layer from database"));
	connect(GetUserLayerFromDbAction,SIGNAL(triggered()),main,SLOT(getulfromdb()));

	//save ul to db
	LoadUserLayerToDbAction =new QAction(tr("Save UL to &Db"),this);
	LoadUserLayerToDbAction->setIcon(QIcon(":/images/todb.png"));
	LoadUserLayerToDbAction->setStatusTip(tr("Save user layer to database"));
	connect(LoadUserLayerToDbAction,SIGNAL(triggered()),main,SLOT(saveultodb()));

	makeMapFromDBAction = new QAction(tr("Make map file from Db"), this);
	//makeMapFromDBAction->setIcon(QIcon(":/images/todb.png"));
	makeMapFromDBAction->setStatusTip(tr("Create Map file from database"));
	connect(makeMapFromDBAction,SIGNAL(triggered()),main,SLOT(makeMapFromDb()));

	//panel
	leftpanelVisibleAction = new QAction(tr("&Layer Panel Hide"),this);
	leftpanelVisibleAction->setIcon(QIcon(":/images/layer_blue.png"));
	leftpanelVisibleAction->setShortcut(tr("Ctrl+L"));
	leftpanelVisibleAction->setStatusTip(tr("hide show layer panel (Ctrl+L)"));
	connect(leftpanelVisibleAction,SIGNAL(triggered()),this,SLOT(setLeftPanelVisible()));

	objectpanelVisibleAction = new QAction(tr("&Object Panel Hide"),this);
	objectpanelVisibleAction->setIcon(QIcon(":/images/panel_blue.png"));
	objectpanelVisibleAction->setShortcut(tr("Ctrl+P"));
	objectpanelVisibleAction->setStatusTip(tr("hide or show object panel (Ctrl+P)"));
	connect(objectpanelVisibleAction,SIGNAL(triggered()),this,SLOT(setObjectPanelVisible()));

	//map control
	zoomInAction = new QAction(tr("zoom &in"),this);
	zoomInAction->setIcon(QIcon(":/images/zoomin.png"));
	zoomInAction->setStatusTip(tr("Zoom in map, short key : + "));
	connect(zoomInAction,SIGNAL(triggered()),this,SLOT(zoomIn()));

	zoomOutAction = new QAction(tr("zoom &out"),this);
	zoomOutAction->setIcon(QIcon(":/images/zoomout.png"));
	zoomOutAction->setStatusTip(tr("Zoom out map, short key : - "));
	connect(zoomOutAction,SIGNAL(triggered()),this,SLOT(zoomOut()));

	moveHomeAction = new QAction(tr("se&t Init"),this);
	moveHomeAction->setIcon(QIcon(":/images/sethome.png"));
	moveHomeAction->setStatusTip(tr("move to initiali zoom and postion"));
	connect(moveHomeAction,SIGNAL(triggered()),this,SLOT(moveHome()));

	moveLeftAction = new QAction(tr("move &Left"),this);
	moveLeftAction->setIcon(QIcon(":/images/arrow_left.png"));
	moveLeftAction->setStatusTip(tr("move map to left , short key : arrow left "));
	connect(moveLeftAction,SIGNAL(triggered()),this,SLOT(moveLeft()));

	moveRightAction = new QAction(tr("move &Right"),this);
	moveRightAction->setIcon(QIcon(":/images/arrow_right.png"));
	moveRightAction->setStatusTip(tr("move map to right, short key : arrow right"));
	connect(moveRightAction,SIGNAL(triggered()),this,SLOT(moveRight()));

	moveUpAction = new QAction(tr("move &Up"),this);
	moveUpAction->setIcon(QIcon(":/images/arrow_up.png"));
	moveUpAction->setStatusTip(tr("move map to upper , short key : arrow up"));
	connect(moveUpAction,SIGNAL(triggered()),this,SLOT(moveUp()));

	moveDownAction = new QAction(tr("move &Down"),this);
	moveDownAction->setIcon(QIcon(":/images/arrow_down.png"));
	moveDownAction->setStatusTip(tr("move map to down , short key : arrow down"));
	connect(moveDownAction,SIGNAL(triggered()),this,SLOT(moveDown()));

	//compass
	drawCrossAction = new QAction(tr("show &Compass"),this);
	drawCrossAction->setIcon(QIcon(":/images/cross.png"));
	drawCrossAction->setStatusTip(tr("show compass "));
	drawCrossAction->setCheckable(true);
	drawCrossAction->setChecked(false);
	connect(drawCrossAction,SIGNAL(triggered(bool)),main,SLOT(showBearingCircle(bool)));

	//경위도
	drawLatlonAction = new QAction(tr("show &Lat lon"),this);
	drawLatlonAction->setIcon(QIcon(":/images/latlon.png"));
	drawLatlonAction->setStatusTip(tr("show latitude and longitude"));
	drawLatlonAction->setCheckable(true);
	drawLatlonAction->setChecked(true);
	connect(drawLatlonAction,SIGNAL(triggered(bool)),main,SLOT(showLatLon(bool)));

	//id text 표시여부
	drawLayerIdAction = new QAction(tr("show Layer &Id"),this);
	drawLayerIdAction->setIcon(QIcon(":/images/idvisible.png"));
	drawLayerIdAction->setStatusTip(tr("show  id text on map"));
	drawLayerIdAction->setCheckable(true);
	drawLayerIdAction->setChecked(false);
	//connect(drawLayerIdAction,SIGNAL(triggered()),this,SLOT(drawLayerId()));
	connect(drawLayerIdAction,SIGNAL(triggered(bool)),main,SLOT(onoffLayerIdText(bool)));

	savePixmapAction = new QAction(tr("save map &image"),this);
	savePixmapAction->setStatusTip(tr("save map to file"));
	connect(savePixmapAction,SIGNAL(triggered()),this,SLOT(savePixmap()));

	exitAction = new QAction(tr("E&xit"),this);
	exitAction->setIcon(QIcon(":/images/quit.png"));
	exitAction->setShortcut(tr("Ctrl+Q"));
	exitAction->setStatusTip(tr("Exit the application"));
	connect(exitAction,SIGNAL(triggered()),this,SLOT(close()));

	//거리와 방향을 표시
	pointdistanceAction = new QAction(tr("Distance and Direction"),this);
	pointdistanceAction->setIcon(QIcon(":/images/pointdistance.png"));
	pointdistanceAction->setStatusTip(tr("display distance and direction from a point"));
	pointdistanceAction->setCheckable(true);
	connect(pointdistanceAction,SIGNAL(triggered(bool)),main,SLOT(onoffDistancBearing(bool)));

	// Track Report Menu
	trackCreateAction = new QAction(tr("Create"), this);
	trackCreateAction->setStatusTip(tr("Track Report Create"));
	connect(trackCreateAction, SIGNAL(triggered()), main, SLOT(trackCreate()));

	trackSaveAction = new QAction(tr("Save"), this);
	trackSaveAction->setStatusTip(tr("Track Report Save"));
	connect(trackSaveAction, SIGNAL(triggered()), main, SLOT(trackSave()));

	trackOpenAction = new QAction(tr("Open"), this);
	trackOpenAction->setStatusTip(tr("Track Report Open"));
	connect(trackOpenAction, SIGNAL(triggered()), main, SLOT(trackOpen()));

	trackOptionAction = new QAction(tr("Options"), this);
	trackOptionAction->setStatusTip(tr("Track Report Options select"));
	connect(trackOptionAction, SIGNAL(triggered()), main, SLOT(trackOption()));

	trackClTableAction = new QAction(tr("Clear Table"), this);
	trackClTableAction->setStatusTip(tr("Track Report Clear Table"));
	connect(trackClTableAction, SIGNAL(triggered()), main, SLOT(trackClTable()));

	trackClPanelAction = new QAction(tr("Clear Panel"), this);
	trackClPanelAction->setStatusTip(tr("Track Report Clear Panel"));
	connect(trackClPanelAction, SIGNAL(triggered()), main, SLOT(trackClPanel()));

	trackPrintAction = new QAction(tr("Print"), this);
	trackPrintAction->setStatusTip(tr("Track Report Print"));
	connect(trackPrintAction, SIGNAL(triggered()), main, SLOT(trackPrint()));
}