/*! Set the frame style \param style The bitwise OR between a shape and a shadow. \sa frameStyle(), QFrame::setFrameStyle(), setFrameShadow(), setFrameShape() */ void QwtPlotAbstractGLCanvas::setFrameStyle( int style ) { if ( style != d_data->frameStyle ) { d_data->frameStyle = style; qwtUpdateContentsRect( frameWidth(), canvasWidget() ); canvasWidget()->update(); } }
/*! Set the frame mid line width The default midline width is 0 pixels. \param width Midline width of the frame \sa midLineWidth(), setLineWidth() */ void QwtPlotAbstractGLCanvas::setMidLineWidth( int width ) { width = qMax( width, 0 ); if ( width != d_data->midLineWidth ) { d_data->midLineWidth = width; qwtUpdateContentsRect( frameWidth(), canvasWidget() ); canvasWidget()->update(); } }
void MainWindow::exportToTextFileSlot() { QString sFilename = QFileDialog::getOpenFileName(this, "Load source test file: ",QString(), tr("Text files (*.txt *.*)")); if(sFilename.size()) canvasWidget()->loadTextFile(sFilename); }
void QwtPlotAbstractCanvas::drawCanvas( QPainter *painter ) { QWidget *w = canvasWidget(); painter->save(); if ( !d_data->styleSheet.borderPath.isEmpty() ) { painter->setClipPath( d_data->styleSheet.borderPath, Qt::IntersectClip ); } else { if ( borderRadius() > 0.0 ) { const QRect frameRect = w->property( "frameRect" ).toRect(); painter->setClipPath( borderPath2( frameRect ), Qt::IntersectClip ); } else { painter->setClipRect( w->contentsRect(), Qt::IntersectClip ); } } QwtPlot *plot = qobject_cast< QwtPlot *>( w->parent() ); if ( plot ) plot->drawCanvas( painter ); painter->restore(); }
//! Update the cached information about the current style sheet void QwtPlotAbstractCanvas::updateStyleSheetInfo() { QWidget *w = canvasWidget(); if ( !w->testAttribute( Qt::WA_StyledBackground ) ) return; QwtStyleSheetRecorder recorder( w->size() ); QPainter painter( &recorder ); QStyleOption opt; opt.initFrom(w); w->style()->drawPrimitive( QStyle::PE_Widget, &opt, &painter, w); painter.end(); d_data->styleSheet.hasBorder = !recorder.border.rectList.isEmpty(); d_data->styleSheet.cornerRects = recorder.clipRects; if ( recorder.background.path.isEmpty() ) { if ( !recorder.border.rectList.isEmpty() ) { d_data->styleSheet.borderPath = qwtCombinePathList( w->rect(), recorder.border.pathList ); } } else { d_data->styleSheet.borderPath = recorder.background.path; d_data->styleSheet.background.brush = recorder.background.brush; d_data->styleSheet.background.origin = recorder.background.origin; } }
void MainWindow::saveProjectSlot() { if (!d->m_sOpenedFile.isEmpty()) canvasWidget()->saveProject(d->m_sOpenedFile); else saveProjectAsSlot(); }
void MainWindow::loadProject(const QString& sFilename) { if (!sFilename.startsWith(":/")) { //files from resources d->m_sOpenedFile = sFilename; setWindowTitle(d->m_sOpenedFile); //TODO better logic, open file, new file } canvasWidget()->loadProject(sFilename); }
void QwtPlotAbstractCanvas::drawStyled( QPainter *painter, bool hackStyledBackground ) { fillBackground( painter ); if ( hackStyledBackground ) { // Antialiasing rounded borders is done by // inserting pixels with colors between the // border color and the color on the canvas, // When the border is painted before the plot items // these colors are interpolated for the canvas // and the plot items need to be clipped excluding // the anialiased pixels. In situations, where // the plot items fill the area at the rounded // borders this is noticeable. // The only way to avoid these annoying "artefacts" // is to paint the border on top of the plot items. if ( !d_data->styleSheet.hasBorder || d_data->styleSheet.borderPath.isEmpty() ) { // We have no border with at least one rounded corner hackStyledBackground = false; } } QWidget *w = canvasWidget(); if ( hackStyledBackground ) { painter->save(); // paint background without border painter->setPen( Qt::NoPen ); painter->setBrush( d_data->styleSheet.background.brush ); painter->setBrushOrigin( d_data->styleSheet.background.origin ); painter->setClipPath( d_data->styleSheet.borderPath ); painter->drawRect( w->contentsRect() ); painter->restore(); drawCanvas( painter ); // Now paint the border on top QStyleOptionFrame opt; opt.initFrom( w ); w->style()->drawPrimitive( QStyle::PE_Frame, &opt, painter, w); } else { QStyleOption opt; opt.initFrom( w ); w->style()->drawPrimitive( QStyle::PE_Widget, &opt, painter, w ); drawCanvas( painter ); } }
void MainWindow::backupProjectWithTimeStampSlot() { if(!d->m_sOpenedFile.isEmpty()) { QString sBackupFile = d->m_sOpenedFile; sBackupFile.chop(4); // sBackupFile += QDateTime::currentDateTime().toString("-yyyy_MM_dd-hh_mm"); sBackupFile += ".sem"; canvasWidget()->saveProject(sBackupFile); } }
/*! Invalidate the paint cache and repaint the canvas \sa invalidatePaintCache() */ void QwtPlotAbstractGLCanvas::replot() { invalidateBackingStore(); QWidget *w = canvasWidget(); if ( testPaintAttribute( QwtPlotAbstractGLCanvas::ImmediatePaint ) ) w->repaint( w->contentsRect() ); else w->update( w->contentsRect() ); }
void MainWindow::printCurrentCanvasSlot() { QPrinter printer(QPrinter::HighResolution); QPrintDialog dlg(&printer, this); if (dlg.exec() != QDialog::Accepted) return; QPixmap qpm = QPixmap::grabWidget(canvasWidget()); QPainter painter; qpm = qpm.scaled(printer.pageRect().width(), printer.pageRect().height(), Qt::KeepAspectRatio); painter.begin (&printer); painter.drawPixmap (0, 0, qpm); painter.end(); }
void MainWindow::saveProjectAsSlot() { QString sFilename = QFileDialog::getSaveFileName(this, "Save project as: ", d->m_sOpenedFile.size() ? d->m_sOpenedFile : "untitled.sem", tr("Semaphored project files (*.sem);;All files (*)")); if(sFilename.size()) { QByteArray ext = QFileInfo(sFilename).suffix().toLower().toLatin1(); if(ext != "sem") sFilename += ".sem"; d->m_sOpenedFile = sFilename; setWindowTitle(d->m_sOpenedFile); canvasWidget()->saveProject(d->m_sOpenedFile); } }
QVariant KoPACanvas::inputMethodQuery(Qt::InputMethodQuery query) const { if (query == Qt::ImMicroFocus) { QRectF rect = (toolProxy()->inputMethodQuery(query, *(viewConverter())).toRectF()).toRect(); QPointF scroll(canvasController()->scrollBarValue()); if (canvasController()->canvasMode() == KoCanvasController::Spreadsheet && canvasWidget()->layoutDirection() == Qt::RightToLeft) { scroll.setX(-scroll.x()); } rect.translate(documentOrigin() - scroll); return rect.toRect(); } return toolProxy()->inputMethodQuery(query, *(viewConverter()) ); }
void QwtPlotAbstractGLCanvas::draw( QPainter *painter ) { #if FIX_GL_TRANSLATION if ( painter->paintEngine()->type() == QPaintEngine::OpenGL2 ) { // work around a translation bug of QPaintEngine::OpenGL2 painter->translate( 1, 1 ); } #endif if ( canvasWidget()->testAttribute( Qt::WA_StyledBackground ) ) drawStyled( painter, true ); else drawUnstyled( painter ); if ( frameWidth() > 0 ) drawBorder( painter ); }
void MainWindow::exportCanvasToPdfSlot() { QString fileName = QFileDialog::getSaveFileName(this, "Export to PDF", QString(), "*.pdf"); if (!fileName.isEmpty()) { if (QFileInfo(fileName).suffix().isEmpty()) fileName.append(".pdf"); QPrinter printer(QPrinter::HighResolution); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); QPixmap qpm = QPixmap::grabWidget(canvasWidget()); QPainter painter; qpm = qpm.scaled(printer.pageRect().width(), printer.pageRect().height(), Qt::KeepAspectRatio); painter.begin (&printer); painter.drawPixmap (0, 0, qpm); painter.end(); } }
void MainWindow::exportAsPictureSlot() { QString supportedFormats(""); QString supportedFormatsFilter("Images ("); foreach(QByteArray name,QImageWriter::supportedImageFormats()) supportedFormats += name + " "; supportedFormatsFilter+= "));;SVG files (*.svg);;All files (*)"; QString sOpenedFileBasename = d->m_sOpenedFile.size() ? QFileInfo(d->m_sOpenedFile).baseName() : "untitled"; QString sFilename = QFileDialog::getSaveFileName(this, "Save as picture as: " + supportedFormats, sOpenedFileBasename + ".png", supportedFormatsFilter); if(sFilename.size()) { QByteArray ext = QFileInfo(sFilename).suffix().toLower().toLatin1(); if (ext == "svg" || QImageWriter::supportedImageFormats().contains(ext)) { canvasWidget()->exportToPicture(sFilename); } else { QMessageBox::warning(this,"Picture was not exported", "Your system supports only following formats: " + supportedFormats); } } }
void MainWindow::changeBackgroundSizeSlot(QAction * action) { QSize newSize(canvasWidget()->size()); if (action == d->m_BgSizeDefault) ; else if (action == d->m_BgSize_A5_portrait) newSize = QSize(DragWidget::SIZE_A5_SHORT,DragWidget::SIZE_A5_LONG); else if (action == d->m_BgSize_A5_landscape) newSize = QSize(DragWidget::SIZE_A5_LONG,DragWidget::SIZE_A5_SHORT); else if (action == d->m_BgSize_A4_portrait) newSize = QSize(DragWidget::SIZE_A4_SHORT,DragWidget::SIZE_A4_LONG); else if (action == d->m_BgSize_A4_landscape) newSize = QSize(DragWidget::SIZE_A4_LONG,DragWidget::SIZE_A4_SHORT); else if (action == d->m_BgSize_800_600) newSize = QSize(800,600); else if (action == d->m_BgSize_1024_768) newSize = QSize(1024,768); else if (action == d->m_BgSize_1280_768) newSize = QSize(1280,768); resize(newSize); }
void QwtPlotAbstractCanvas::drawUnstyled( QPainter *painter ) { fillBackground( painter ); QWidget *w = canvasWidget(); if ( w->autoFillBackground() ) { const QRect canvasRect = w->rect(); painter->save(); painter->setPen( Qt::NoPen ); painter->setBrush( w->palette().brush( w->backgroundRole() ) ); const QRect frameRect = w->property( "frameRect" ).toRect(); if ( borderRadius() > 0.0 && ( canvasRect == frameRect ) ) { const int frameWidth = w->property( "frameWidth" ).toInt(); if ( frameWidth > 0 ) { painter->setClipPath( borderPath2( canvasRect ) ); painter->drawRect( canvasRect ); } else { painter->setRenderHint( QPainter::Antialiasing, true ); painter->drawPath( borderPath2( canvasRect ) ); } } else { painter->drawRect( canvasRect ); } painter->restore(); } drawCanvas( painter ); }
void MainWindow::createActions() { d->loadProjectAct = new QAction(QIcon(":/icons/load_project.svg"), tr("L&oad project.."), this); d->loadProjectAct->setStatusTip(tr("Load project from file")); d->loadProjectAct->setShortcut(tr("Ctrl+O")); connect(d->loadProjectAct, SIGNAL(triggered()), this, SLOT(loadProjectSlot())); d->loadProjectInNewInstanceAct = new QAction(QIcon(":/icons/load_project.svg"), tr("Load project in new &instance.."), this); d->loadProjectInNewInstanceAct->setStatusTip(tr("Load project in new instance")); d->loadProjectInNewInstanceAct->setShortcut(tr("Shift+Ctrl+O")); connect(d->loadProjectInNewInstanceAct, SIGNAL(triggered()), this, SLOT(loadProjectInNewInstanceSlot())); d->reloadProjectAct = new QAction(QIcon(":/icons/reload_project.svg"), tr("&Reload project"), this); d->reloadProjectAct->setStatusTip(tr("Reload project..")); d->reloadProjectAct->setShortcut(tr("Ctrl+R")); connect(d->reloadProjectAct, SIGNAL(triggered()), this, SLOT(reloadProjectSlot())); d->saveProjectAct = new QAction(QIcon(":/icons/save_project.svg"), tr("&Save project"), this); d->saveProjectAct->setStatusTip(tr("Save project")); d->saveProjectAct->setShortcut(tr("Ctrl+S")); connect(d->saveProjectAct, SIGNAL(triggered()), this, SLOT(saveProjectSlot())); d->saveProjectAsAct = new QAction(QIcon(":/icons/save_project_as.svg"), tr("Save project &as .."), this); d->saveProjectAsAct->setStatusTip(tr("Save project to different file")); d->saveProjectAsAct->setShortcut(tr("Ctrl+Shift+S")); connect(d->saveProjectAsAct, SIGNAL(triggered()), this, SLOT(saveProjectAsSlot())); d->backupProjectWithTimeStampAct = new QAction(QIcon(":/icons/backup_project_ts.svg"), tr("&Backup project with timestamp"), this); d->backupProjectWithTimeStampAct->setStatusTip(tr("Backup project with timestamp")); d->backupProjectWithTimeStampAct->setShortcut(tr("Ctrl+B")); connect(d->backupProjectWithTimeStampAct, SIGNAL(triggered()), this, SLOT(backupProjectWithTimeStampSlot())); d->exportAsPictureAct = new QAction(QIcon(":/icons/export_as_picture.png"), tr("&Export as a picture.."), this); d->exportAsPictureAct->setStatusTip(tr("Export as a picture")); d->exportAsPictureAct->setShortcut(tr("Ctrl+E")); connect(d->exportAsPictureAct, SIGNAL(triggered()), this, SLOT(exportAsPictureSlot())); d->loadTextFileAct = new QAction(QIcon(":/icons/load_text_file.svg"), tr("&Load text file.."), this); d->loadTextFileAct->setStatusTip(tr("Load text file")); d->loadTextFileAct->setShortcut(tr("Ctrl+L")); connect(d->loadTextFileAct, SIGNAL(triggered()), this, SLOT(loadTextFileSlot())); d->exportAsPdf = new QAction(QIcon(":/icons/export_as_pdf.svg"), tr("Export &To PDF.."), this); d->exportAsPdf->setStatusTip(tr("Export To PDF")); d->exportAsPdf->setShortcut(tr("Ctrl+Shift+P")); connect(d->exportAsPdf, SIGNAL(triggered()), this, SLOT(exportCanvasToPdfSlot())); d->printAct = new QAction(QIcon(":/icons/print.svg"), tr("&Print.."), this); d->printAct->setShortcuts(QKeySequence::Print); d->printAct->setStatusTip(tr("Print the current canvas")); connect(d->printAct, SIGNAL(triggered()), this, SLOT(printCurrentCanvasSlot())); d->quitAct = new QAction(QIcon(":/icons/quit.svg"), tr("&Quit"), this); d->quitAct->setStatusTip(tr("Quit")); d->quitAct->setShortcut(tr("Ctrl+Q")); connect(d->quitAct, SIGNAL(triggered()), this, SLOT(close())); d->deleteAllAct = new QAction(QIcon(":/icons/delete_all.svg"), tr("D&elete All"), this); d->deleteAllAct->setStatusTip(tr("Delete all")); d->deleteAllAct->setShortcut(tr("Ctrl+E")); connect(d->deleteAllAct, SIGNAL(triggered()), d->m_canvasWidget, SLOT(deleteAllItemsSlot())); QActionGroup* backgroundColorGroup = new QActionGroup(this); d->m_BgColorWhiteAction = new QAction(QIcon(":/icons/white-bg.svg"), tr("&White"), this); d->m_BgColorWhiteAction->setCheckable(true); d->m_BgColorGrayAction = new QAction(QIcon(":/icons/gray-bg.svg"), tr("&Gray"), this); d->m_BgColorGrayAction->setCheckable(true); d->m_BgColorCyanAction = new QAction(QIcon(":/icons/cyan-bg.svg"), tr("&Cyan"), this); d->m_BgColorCyanAction->setCheckable(true); d->m_BgDefaultImage1Action = new QAction(QIcon(":/icons/default_image1.png"), tr("&Default background image titles"), this); d->m_BgDefaultImage1Action->setCheckable(true); d->m_BgDefaultImage1Action->setChecked(true); d->m_BgDefaultImage2Action = new QAction(QIcon(":/icons/default_image2.png"), tr("&Default background image painting"), this); d->m_BgDefaultImage2Action->setCheckable(true); d->m_BgImageKanban1Action = new QAction(QIcon(":/icons/bg-kanban1-a5.svg"), tr("&Kanban BTID 4 cols"), this); d->m_BgImageKanban1Action->setCheckable(true); d->m_BgImageKanban1HAction = new QAction(QIcon(":/icons/bg-kanban1-a5h.svg"), tr("&Kanban BTID 4 rows"), this); d->m_BgImageKanban1HAction->setCheckable(true); d->m_BgImageKanban2Action = new QAction(QIcon(":/icons/bg-kanban2-a5.svg"), tr("&Kanban TID 3 cols"), this); d->m_BgImageKanban2Action->setCheckable(true); d->m_BgImageKanban2HAction = new QAction(QIcon(":/icons/bg-kanban2-a5h.svg"), tr("&Kanban TID 3 rows"), this); d->m_BgImageKanban2HAction->setCheckable(true); d->m_BgImageKanban3Action = new QAction(QIcon(":/icons/bg-kanban3-a5.svg"), tr("&Kanban NSID 4 cols"), this); d->m_BgImageKanban3Action->setCheckable(true); d->m_BgImageKanban3HAction = new QAction(QIcon(":/icons/bg-kanban3-a5h.svg"), tr("&Kanban NSID 4 rows"), this); d->m_BgImageKanban3HAction->setCheckable(true); d->m_BgImageReview1Action = new QAction(QIcon(":/icons/bg-review1-a5.svg"), tr("&Review board 4 cols"), this); d->m_BgImageReview1Action->setCheckable(true); d->m_BgImageReview2Action = new QAction(QIcon(":/icons/bg-review2-a5.svg"), tr("&Double review board 6 cols"), this); d->m_BgImageReview2Action->setCheckable(true); d->m_BgUserImageAction = new QAction(QIcon(":/icons/load_background_image.png"), tr("&User background image"), this); d->m_BgUserImageAction->setStatusTip(tr("User background image")); d->m_BgUserImageAction->setCheckable(true); //connect(m_BgUserImageAction, SIGNAL(triggered()), m_canvasWidget, SLOT(loadBackgroundImageSlot())); backgroundColorGroup->addAction(d->m_BgColorWhiteAction); backgroundColorGroup->addAction(d->m_BgColorGrayAction); backgroundColorGroup->addAction(d->m_BgColorCyanAction); backgroundColorGroup->addAction(d->m_BgDefaultImage1Action); backgroundColorGroup->addAction(d->m_BgDefaultImage2Action); backgroundColorGroup->addAction(d->m_BgImageKanban1Action); backgroundColorGroup->addAction(d->m_BgImageKanban1HAction); backgroundColorGroup->addAction(d->m_BgImageKanban2Action); backgroundColorGroup->addAction(d->m_BgImageKanban2HAction); backgroundColorGroup->addAction(d->m_BgImageKanban3Action); backgroundColorGroup->addAction(d->m_BgImageKanban3HAction); backgroundColorGroup->addAction(d->m_BgImageReview1Action); backgroundColorGroup->addAction(d->m_BgImageReview2Action); backgroundColorGroup->addAction(d->m_BgUserImageAction); backgroundColorGroup->setExclusive(true); connect(backgroundColorGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeBackgroundColorSlot(QAction*))); QActionGroup* backgroundSizeGroup = new QActionGroup(this); d->m_BgFixedSize = new QAction(QIcon(":/icons/size.png"), tr("&Fixed size"), this); d->m_BgFixedSize->setCheckable(true); connect(d->m_BgFixedSize, SIGNAL(triggered ( bool )), canvasWidget(), SLOT(setFixedSizeBg(bool ))); connect(canvasWidget(), SIGNAL(changeFixedSize ( bool )), d->m_BgFixedSize, SLOT(setChecked(bool ))); d->m_BgSizeDefault = new QAction(QIcon(":/icons/size.png"), tr("&Default backgound size"), this); d->m_BgSizeDefault->setCheckable(true); d->m_BgSize_A5_landscape = new QAction(QIcon(":/icons/size.png"), tr("&A5 landscape"), this); d->m_BgSize_A5_landscape->setCheckable(true); d->m_BgSize_A5_portrait = new QAction(QIcon(":/icons/size.png"), tr("&A5 portrait"), this); d->m_BgSize_A5_portrait->setCheckable(true); d->m_BgSize_A4_landscape = new QAction(QIcon(":/icons/size.png"), tr("&A4 landscape"), this); d->m_BgSize_A4_landscape->setCheckable(true); d->m_BgSize_A4_portrait = new QAction(QIcon(":/icons/size.png"), tr("&A4 portrait"), this); d->m_BgSize_A4_portrait->setCheckable(true); d->m_BgSize_800_600 = new QAction(QIcon(":/icons/size.png"), tr("&800x600"), this); d->m_BgSize_800_600->setCheckable(true); d->m_BgSize_1024_768 = new QAction(QIcon(":/icons/size.png"), tr("&1024x768"), this); d->m_BgSize_1024_768->setCheckable(true); d->m_BgSize_1280_768 = new QAction(QIcon(":/icons/size.png"), tr("&1280x768"), this); d->m_BgSize_1280_768->setCheckable(true); backgroundSizeGroup->addAction(d->m_BgSizeDefault); backgroundSizeGroup->addAction(d->m_BgSize_A5_landscape); backgroundSizeGroup->addAction(d->m_BgSize_A5_portrait); backgroundSizeGroup->addAction(d->m_BgSize_A4_landscape); backgroundSizeGroup->addAction(d->m_BgSize_A4_portrait); backgroundSizeGroup->addAction(d->m_BgSize_800_600); backgroundSizeGroup->addAction(d->m_BgSize_1024_768); backgroundSizeGroup->addAction(d->m_BgSize_1280_768); connect(backgroundSizeGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeBackgroundSizeSlot(QAction*))); QActionGroup* reloadIntervalGroup = new QActionGroup(this); reloadIntervalGroup->setExclusive(true); connect(reloadIntervalGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeIntervalReloadSlot(QAction*))); QAction* intervalReloadAct(NULL); typedef QPair<int, QString> TimeInterval; foreach (const TimeInterval &interval, QList<TimeInterval>() << qMakePair( 0, tr("OFF")) << qMakePair( 10, tr("10s")) << qMakePair( 60, tr("1min")) << qMakePair( 300, tr("5min")) << qMakePair( 900, tr("15min")) << qMakePair(3600, tr("1h"))) { intervalReloadAct = new QAction(interval.second, this); intervalReloadAct->setCheckable(true); if(interval.first == 0) //default is off intervalReloadAct->setChecked(true); d->automaticReloadIntervalActMap.insert(interval.first, intervalReloadAct ); reloadIntervalGroup->addAction(intervalReloadAct); } d->createDesktopLinkAct = new QAction(QIcon(":/icons/create_link.svg"), tr("&Create desktop link"), this); d->createDesktopLinkAct->setStatusTip(tr("Create desktop link")); connect(d->createDesktopLinkAct, SIGNAL(triggered()), this, SLOT(createDesktopLinkSlot())); d->aboutAct = new QAction(QIcon(":/icons/about.svg"), tr("&About"), this); d->aboutAct->setStatusTip(tr("Show the application's About box")); connect(d->aboutAct, SIGNAL(triggered()), this, SLOT(showAboutDialogSlot())); }
void MainWindow::reloadProjectSlot() { if (d->m_sOpenedFile.size()) //we load only real files canvasWidget()->loadProject(d->m_sOpenedFile); }
void MainWindow::changeBackgroundColorSlot(QAction * action) { //TPDP this could be unified by m_BackgroundPicture, "" - default, filename = picture, QColor::isValidColor - color QColor newColor(Qt::white); if (action == d->m_BgColorWhiteAction ) canvasWidget()->changeBackgroundColor(Qt::white); else if (action == d->m_BgColorGrayAction) canvasWidget()->changeBackgroundColor(Qt::gray); else if (action == d->m_BgColorCyanAction) canvasWidget()->changeBackgroundColor(newColor = Qt::cyan); else if (action == d->m_BgDefaultImage1Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_DEFAULT_1); else if (action == d->m_BgDefaultImage2Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_DEFAULT_2); else if (action == d->m_BgImageKanban1Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_1); else if (action == d->m_BgImageKanban1HAction) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_1H); else if (action == d->m_BgImageKanban2Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_2); else if (action == d->m_BgImageKanban2HAction) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_2H); else if (action == d->m_BgImageKanban3Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_3); else if (action == d->m_BgImageKanban3HAction) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_KANBAN_3H); else if (action == d->m_BgImageReview1Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_REVIEW_1); else if (action == d->m_BgImageReview2Action) canvasWidget()->changeBackgroundImage(DragWidget::BG_IMAGE_REVIEW_2); else if (action == d->m_BgUserImageAction) { canvasWidget()->loadUserBackgroundImage(); } }
void QwtPlotAbstractCanvas::fillBackground( QPainter *painter ) { qwtFillBackground( painter, canvasWidget() ); }
void QwtPlotAbstractCanvas::drawBackground( QPainter *painter ) { qwtDrawBackground( painter, canvasWidget() ); }
/*! Draw the border of the canvas \param painter Painter */ void QwtPlotAbstractCanvas::drawBorder( QPainter *painter ) { const QWidget *w = canvasWidget(); if ( d_data->borderRadius > 0 ) { const int frameWidth = w->property( "frameWidth" ).toInt(); if ( frameWidth > 0 ) { const int frameShape = w->property( "frameShape" ).toInt(); const int frameShadow = w->property( "frameShadow" ).toInt(); const QRectF frameRect = w->property( "frameRect" ).toRect(); QwtPainter::drawRoundedFrame( painter, frameRect, d_data->borderRadius, d_data->borderRadius, w->palette(), frameWidth, frameShape | frameShadow ); } } else { #if QT_VERSION >= 0x040500 const int frameShape = w->property( "frameShape" ).toInt(); const int frameShadow = w->property( "frameShadow" ).toInt(); #if QT_VERSION < 0x050000 QStyleOptionFrameV3 opt; #else QStyleOptionFrame opt; #endif opt.init( w ); opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape ); switch (frameShape) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: { opt.lineWidth = w->property( "lineWidth" ).toInt(); opt.midLineWidth = w->property( "midLineWidth" ).toInt(); break; } default: { opt.lineWidth = w->property( "frameWidth" ).toInt(); break; } } if ( frameShadow == QFrame::Sunken ) opt.state |= QStyle::State_Sunken; else if ( frameShadow == QFrame::Raised ) opt.state |= QStyle::State_Raised; w->style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, w ); #else // TODO: do we really need Qt 4.4 ? #endif } }
QPainterPath QwtPlotAbstractCanvas::borderPath2( const QRect &rect ) const { return qwtBorderPath( canvasWidget(), rect ); }
//! \return The rectangle where the frame is drawn in. QRect QwtPlotAbstractGLCanvas::frameRect() const { const int fw = frameWidth(); return canvasWidget()->contentsRect().adjusted( -fw, -fw, fw, fw ); }