本文整理汇总了C++中preview函数的典型用法代码示例。如果您正苦于以下问题:C++ preview函数的具体用法?C++ preview怎么用?C++ preview使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preview函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preview
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MainWindow::execute:
//
// Determine which action was triggered and execute respective action.
// Skip this if action is not image-processing related: open(), quit()
//
void
MainWindow::execute(QAction* action)
{
// skip over menu ops that don't require image processing
QString name = action->text();
if(name == QString("&Open") || name == QString("&Quit")) {
m_code = -1;
return;
}
// get code from action
m_code = action->data().toInt();
// set output radio button to true
m_radioDisplay[1]->setChecked(true);
// use code to index into stack widget and array of filters
m_stackWidgetPanels->setCurrentIndex(m_code);
m_imageFilterType[m_code]->applyFilter(m_imageSrc, m_imageDst);
preview();
}
示例2: switch
void KIconConfig::EffectSetup(int state)
{
int viewedGroup = (mUsage == KIconLoader::LastGroup) ? KIconLoader::FirstGroup : mUsage;
QPixmap pm = mpLoader->loadIcon(mExample, KIconLoader::NoGroup, mSizes[viewedGroup]);
QImage img = pm.toImage();
QString caption;
switch (state)
{
case 0 : caption = i18n("Setup Default Icon Effect"); break;
case 1 : caption = i18n("Setup Active Icon Effect"); break;
case 2 : caption = i18n("Setup Disabled Icon Effect"); break;
}
KIconEffectSetupDialog dlg(mEffects[viewedGroup][state], mDefaultEffect[state], caption, img, this);
if (dlg.exec() == QDialog::Accepted)
{
if (mUsage == KIconLoader::LastGroup) {
for (int i=0; i<KIconLoader::LastGroup; i++)
mEffects[i][state] = dlg.effect();
} else {
mEffects[mUsage][state] = dlg.effect();
}
// AK - can this call be moved therefore removing
// code duplication?
emit changed(true);
if (mUsage == KIconLoader::LastGroup) {
for (int i=0; i<KIconLoader::LastGroup; i++)
mbChanged[i] = true;
} else {
mbChanged[mUsage] = true;
}
}
preview(state);
}
示例3: preview
QImage QgsSymbolV2::bigSymbolPreviewImage()
{
QImage preview( QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
preview.fill( 0 );
QPainter p( &preview );
p.setRenderHint( QPainter::Antialiasing );
p.translate( 0.5, 0.5 ); // shift by half a pixel to avoid blurring due antialising
if ( mType == QgsSymbolV2::Marker )
{
p.setPen( QPen( Qt::gray ) );
p.drawLine( 0, 50, 100, 50 );
p.drawLine( 50, 0, 50, 100 );
}
QgsRenderContext context = QgsSymbolLayerV2Utils::createRenderContext( &p );
startRender( context );
if ( mType == QgsSymbolV2::Line )
{
QPolygonF poly;
poly << QPointF( 0, 50 ) << QPointF( 99, 50 );
static_cast<QgsLineSymbolV2*>( this )->renderPolyline( poly, 0, context );
}
else if ( mType == QgsSymbolV2::Fill )
{
QPolygonF polygon;
polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 );
static_cast<QgsFillSymbolV2*>( this )->renderPolygon( polygon, NULL, 0, context );
}
else // marker
{
static_cast<QgsMarkerSymbolV2*>( this )->renderPoint( QPointF( 50, 50 ), 0, context );
}
stopRender( context );
return preview;
}
示例4: fi
void ImportASCIIDialog::changePreviewFile(const QString& path)
{
if (path.isEmpty())
return;
if (d_current_path.isEmpty()){//avoid importing the first file which is by default selected in the file dialog
d_current_path = path;
return;
}
QFileInfo fi(path);
if (!fi.exists() || fi.isDir() || !fi.isFile())
return;
if (!fi.isReadable()){
QMessageBox::critical(this, tr("QtiPlot - File openning error"),
tr("You don't have the permission to open this file: <b>%1</b>").arg(path));
return;
}
d_current_path = path;
preview();
}
示例5: QDialog
SchedulePrintDialog::SchedulePrintDialog( ScheduleWidget * widget )
: QDialog( widget )
, mScheduleWidget( widget )
{
setupUi(this);
for( int i=0; pageSizeNames[i]; i++ )
mPageSizeCombo->addItem( pageSizeNames[i] );
connect( mPreviewButton, SIGNAL( clicked() ), SLOT( preview() ) );
connect( mPrintButton, SIGNAL( clicked() ), SLOT( print() ) );
connect( mSavePdfButton, SIGNAL( clicked() ), SLOT( savePdf() ) );
mFontTree->setHeaderLabels( QStringList() << "Location" << "Font" );
connect( mFontTree, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), SLOT( updateFont( QTreeWidgetItem * ) ) );
mDisplayOptions = widget->mDisplayOptions;
ScheduleDisplayOptions & dops = mDisplayOptions;
setupFontItem( mFontTree, "Header Month/Year", &dops.headerMonthYearFont );
setupFontItem( mFontTree, "Header Day/Week", &dops.headerDayWeekFont );
setupFontItem( mFontTree, "Panel", &dops.panelFont );
setupFontItem( mFontTree, "Cell Day", &dops.cellDayFont );
setupFontItem( mFontTree, "Entry", &dops.entryFont );
setupFontItem( mFontTree, "Entry Hours", &dops.entryHoursFont );
}
示例6: switch
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: addFiles(); break;
case 1: about(); break;
case 2: next(); break;
case 3: preview(); break;
case 4: doubleclickplay(); break;
case 5: stateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
case 6: tick((*reinterpret_cast< qint64(*)>(_a[1]))); break;
case 7: sourceChanged((*reinterpret_cast< const Phonon::MediaSource(*)>(_a[1]))); break;
case 8: metaStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
case 9: aboutToFinish(); break;
case 10: tableClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
default: ;
}
_id -= 11;
}
return _id;
}
示例7: QDialog
DesktopBackgroundDialog::DesktopBackgroundDialog(RazorSettings * cfg, int screen, int desktop, QSize desktopSize, const QBrush & brush, QWidget * parent)
: QDialog(parent),
m_desktopSize(desktopSize),
m_type(RazorWorkSpaceManager::BackgroundColor),
m_config(cfg),
m_screen(screen),
m_desktop(desktop)
{
setupUi(this);
// center it to current desktop
move(parent->geometry().center() - geometry().center());
// read current wallpaper brush
if (brush.texture().isNull())
{
m_color = brush.color();
preview();
}
else
{
QPixmap p = brush.texture().scaled(previewLabel->size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
previewLabel->setPixmap(p);
}
connect(colorButton, SIGNAL(clicked()),
this, SLOT(colorButton_clicked()));
connect(wallpaperButton, SIGNAL(clicked()),
this, SLOT(wallpaperButton_clicked()));
connect(systemButton, SIGNAL(clicked()),
this, SLOT(systemButton_clicked()));
connect(keepAspectCheckBox, SIGNAL(toggled(bool)),
this, SLOT(preview()));
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
keepAspectCheckBox->setEnabled(false);
}
示例8: dialog
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MainWindow::open:
//
// Open input image.
//
void
MainWindow::open() {
QFileDialog dialog(this);
// open the last known working directory
if(!m_currentDir.isEmpty())
dialog.setDirectory(m_currentDir);
// display existing files and directories
dialog.setFileMode(QFileDialog::ExistingFile);
// invoke native file browser to select file
m_file = dialog.getOpenFileName(this,
"Open File", m_currentDir,
"Images (*.jpg *.png *.ppm *.pgm *.bmp);;All files (*)");
// verify that file selection was made
if(m_file.isNull()) return;
// save current directory
QFileInfo f(m_file);
m_currentDir = f.absolutePath();
// DISABLE IMAGING FUNCTIONALITY FOR NOW....
// read input image
m_imageIn = IP_readImage(qPrintable(m_file));
if(m_radioMode[1]->isChecked())
IP_castImage(m_imageIn, BW_IMAGE, m_imageSrc);
else IP_castImage(m_imageIn, RGB_IMAGE, m_imageSrc);
// init vars
m_width = m_imageSrc->width ();
m_height = m_imageSrc->height();
preview();
}
示例9: previewDimension
void StatePreview::generateImage( const QSize& wallDimensions,
const ContentWindowPtrs &contentWindows )
{
QSize previewDimension( wallDimensions );
previewDimension.scale( PREVIEW_IMAGE_SIZE, Qt::KeepAspectRatio );
// Transparent image
QImage preview( previewDimension, QImage::Format_ARGB32 );
preview.fill( qRgba( 0, 0, 0, 0 ));
QPainter painter( &preview );
// Paint all Contents at their correct location
BOOST_FOREACH( ContentWindowPtr window, contentWindows )
{
if( window->getContent()->getType() == CONTENT_TYPE_PIXEL_STREAM )
continue;
const QRectF& winCoord = window->getCoordinates();
const QRectF area( winCoord.x() * preview.size().width(),
winCoord.y() * preview.size().height(),
winCoord.width() * preview.size().width(),
winCoord.height() * preview.size().height( ));
const QString& filename = window->getContent()->getURI();
ThumbnailGeneratorPtr generator =
ThumbnailGeneratorFactory::getGenerator( filename, THUMBNAIL_SIZE );
const QImage image = generator->generate( filename );
painter.drawImage( area, image );
}
painter.end();
previewImage_ = preview;
}
示例10: assert
void PreviewToggleCommand::postProcess() {
TApp *app = TApp::instance();
CleanupSettingsModel *model = CleanupSettingsModel::instance();
TXshSimpleLevel *sl;
TFrameId fid;
model->getCleanupFrame(sl, fid);
assert(sl);
if (!sl) return;
// Retrieve transformed image
TRasterImageP transformed;
{
TRasterImageP original;
TAffine transform;
model->getPreviewData(original, transformed, transform);
if (!transformed) return;
}
// Perform post-processing
TRasterImageP preview(
TCleanupper::instance()->processColors(transformed->getRaster()));
TPointD dpi;
transformed->getDpi(dpi.x, dpi.y);
preview->setDpi(dpi.x, dpi.y);
transformed = TRasterImageP();
// Substitute current frame image with previewed one
sl->setFrame(fid, preview);
TApp::instance()->getCurrentLevel()->notifyLevelChange();
}
示例11: gfilter_dialog
static void
gfilter_dialog(GFilterArgs *args,
GwyContainer *data,
GwyDataField *dfield,
GwyDataField *mfield,
gint id,
GQuark mquark)
{
GtkWidget *dialog, *table, *vbox, *hbox, *scwin, *hbox2, *label;
GtkTreeView *treeview;
GtkTreeSelection *selection;
GFilterControls controls;
gint response, row, i;
GwySIUnit *siunit;
GwyPixmapLayer *layer;
controls.args = args;
controls.mask = mfield;
controls.in_init = TRUE;
controls.computed = FALSE;
siunit = gwy_si_unit_new(NULL);
for (i = 0; i < NQUANTITIES; i++) {
controls.vf[i]
= gwy_si_unit_get_format_with_digits(siunit,
GWY_SI_UNIT_FORMAT_VFMARKUP,
1.0, 4, NULL);
}
g_object_unref(siunit);
dialog = gtk_dialog_new_with_buttons(_("Filter Grains"),
NULL, 0, NULL);
gtk_dialog_add_action_widget(GTK_DIALOG(dialog),
gwy_stock_like_button_new(_("_Update"),
GTK_STOCK_EXECUTE),
RESPONSE_PREVIEW);
gtk_dialog_add_button(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button(GTK_DIALOG(dialog),
GTK_STOCK_OK, GTK_RESPONSE_OK);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), RESPONSE_PREVIEW,
!args->update);
gwy_help_add_to_proc_dialog(GTK_DIALOG(dialog), GWY_HELP_DEFAULT);
controls.dialog = dialog;
hbox = gtk_hbox_new(FALSE, 2);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 4);
vbox = gtk_vbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 4);
controls.mydata = gwy_container_new();
gwy_container_set_object_by_name(controls.mydata, "/0/data", dfield);
mfield = gwy_data_field_duplicate(mfield);
gwy_container_set_object_by_name(controls.mydata, "/0/mask", mfield);
g_object_unref(mfield);
gwy_app_sync_data_items(data, controls.mydata, id, 0, FALSE,
GWY_DATA_ITEM_PALETTE,
GWY_DATA_ITEM_MASK_COLOR,
GWY_DATA_ITEM_RANGE,
GWY_DATA_ITEM_REAL_SQUARE,
0);
controls.view = gwy_data_view_new(controls.mydata);
layer = gwy_layer_basic_new();
g_object_set(layer,
"data-key", "/0/data",
"gradient-key", "/0/base/palette",
"range-type-key", "/0/base/range-type",
"min-max-key", "/0/base",
NULL);
gwy_data_view_set_data_prefix(GWY_DATA_VIEW(controls.view), "/0/data");
gwy_data_view_set_base_layer(GWY_DATA_VIEW(controls.view), layer);
layer = gwy_layer_mask_new();
gwy_pixmap_layer_set_data_key(layer, "/0/mask");
gwy_layer_mask_set_color_key(GWY_LAYER_MASK(layer), "/0/mask");
gwy_data_view_set_alpha_layer(GWY_DATA_VIEW(controls.view), layer);
gwy_set_data_preview_size(GWY_DATA_VIEW(controls.view), PREVIEW_SIZE);
gtk_box_pack_start(GTK_BOX(vbox), controls.view, FALSE, FALSE, 0);
controls.update = gtk_check_button_new_with_mnemonic(_("I_nstant updates"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(controls.update),
args->update);
gtk_box_pack_start(GTK_BOX(vbox), controls.update, FALSE, FALSE, 0);
g_signal_connect_swapped(controls.update, "toggled",
G_CALLBACK(update_changed), &controls);
hbox2 = gtk_hbox_new(FALSE, 6);
gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic(_("_Mask color:"));
gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
controls.color_button = gwy_color_button_new();
gwy_color_button_set_use_alpha(GWY_COLOR_BUTTON(controls.color_button),
TRUE);
load_mask_color(controls.color_button,
gwy_data_view_get_data(GWY_DATA_VIEW(controls.view)));
//.........这里部分代码省略.........
示例12: p
// virtual
void CustomRuler::paintEvent(QPaintEvent *e)
{
QStylePainter p(this);
const QRect &paintRect = e->rect();
p.setClipRect(paintRect);
p.fillRect(paintRect, palette().midlight().color());
// Draw zone background
const int zoneStart = (int)(m_zoneStart * m_factor);
const int zoneEnd = (int)((m_zoneEnd + 1)* m_factor);
int zoneHeight = LABEL_SIZE * 0.8;
p.fillRect(zoneStart - m_offset, MAX_HEIGHT - zoneHeight + 1, zoneEnd - zoneStart, zoneHeight - 1, m_zoneBG);
double f, fend;
const int offsetmax = ((paintRect.right() + m_offset) / FRAME_SIZE + 1) * FRAME_SIZE;
int offsetmin;
p.setPen(palette().text().color());
// draw time labels
if (paintRect.y() < LABEL_SIZE) {
offsetmin = (paintRect.left() + m_offset) / m_textSpacing;
offsetmin = offsetmin * m_textSpacing;
for (f = offsetmin; f < offsetmax; f += m_textSpacing) {
QString lab;
if (KdenliveSettings::frametimecode())
lab = QString::number((int)(f / m_factor + 0.5));
else
lab = m_timecode.getTimecodeFromFrames((int)(f / m_factor + 0.5));
p.drawText(f - m_offset + 2, LABEL_SIZE, lab);
}
}
p.setPen(palette().dark().color());
offsetmin = (paintRect.left() + m_offset) / littleMarkDistance;
offsetmin = offsetmin * littleMarkDistance;
// draw the little marks
fend = m_scale * littleMarkDistance;
if (fend > 5) {
QLineF l(offsetmin - m_offset, LITTLE_MARK_X, offsetmin - m_offset, MAX_HEIGHT);
for (f = offsetmin; f < offsetmax; f += fend) {
l.translate(fend, 0);
p.drawLine(l);
}
}
offsetmin = (paintRect.left() + m_offset) / mediumMarkDistance;
offsetmin = offsetmin * mediumMarkDistance;
// draw medium marks
fend = m_scale * mediumMarkDistance;
if (fend > 5) {
QLineF l(offsetmin - m_offset - fend, MIDDLE_MARK_X, offsetmin - m_offset - fend, MAX_HEIGHT);
for (f = offsetmin - fend; f < offsetmax + fend; f += fend) {
l.translate(fend, 0);
p.drawLine(l);
}
}
offsetmin = (paintRect.left() + m_offset) / bigMarkDistance;
offsetmin = offsetmin * bigMarkDistance;
// draw big marks
fend = m_scale * bigMarkDistance;
if (fend > 5) {
QLineF l(offsetmin - m_offset, LABEL_SIZE, offsetmin - m_offset, MAX_HEIGHT);
for (f = offsetmin; f < offsetmax; f += fend) {
l.translate(fend, 0);
p.drawLine(l);
}
}
// draw zone handles
if (zoneStart > 0) {
QPolygon pa(4);
pa.setPoints(4, zoneStart - m_offset + FONT_WIDTH / 2, MAX_HEIGHT - zoneHeight, zoneStart - m_offset, MAX_HEIGHT - zoneHeight, zoneStart - m_offset, MAX_HEIGHT, zoneStart - m_offset + FONT_WIDTH / 2, MAX_HEIGHT);
p.drawPolyline(pa);
}
if (zoneEnd > 0) {
QColor center(Qt::white);
center.setAlpha(150);
QRect rec(zoneStart - m_offset + (zoneEnd - zoneStart - zoneHeight) / 2 + 2, MAX_HEIGHT - zoneHeight + 2, zoneHeight - 4, zoneHeight - 4);
p.fillRect(rec, center);
p.drawRect(rec);
QPolygon pa(4);
pa.setPoints(4, zoneEnd - m_offset - FONT_WIDTH / 2, MAX_HEIGHT - zoneHeight, zoneEnd - m_offset, MAX_HEIGHT - zoneHeight, zoneEnd - m_offset, MAX_HEIGHT, zoneEnd - m_offset - FONT_WIDTH / 2, MAX_HEIGHT );
p.drawPolyline(pa);
}
// draw Rendering preview zones
if (!m_hidePreview) {
p.setPen(palette().dark().color());
p.drawLine(paintRect.left(), MAX_HEIGHT, paintRect.right(), MAX_HEIGHT);
p.fillRect(paintRect.left(), MAX_HEIGHT + 1, paintRect.width(), PREVIEW_SIZE - 1, palette().mid().color());
QColor preview(Qt::green);
preview.setAlpha(120);
double chunkWidth = KdenliveSettings::timelinechunks() * m_factor;
foreach(int frame, m_renderingPreviews) {
double xPos = frame * m_factor - m_offset;
if (xPos + chunkWidth < paintRect.x() || xPos > paintRect.right())
continue;
QRectF rec(xPos, MAX_HEIGHT + 1, chunkWidth, PREVIEW_SIZE - 1);
//.........这里部分代码省略.........
示例13: preview
void BilateralDialog::previewButtonPressed() {
emit preview(ui->diameterSlider->value(),ui->sigmaCSlider->value(),ui->sigmaSSlider->value());
}
示例14: setPreview
void DekeystoningWidget::setPreview(QPixmap pixmap)
{
previewPixmap = pixmap;
if (preview())
ui->view->setPixmap(pixmap);
}
示例15: setModified
void PopupAppearance::onCurrentIndexChanged(int)
{
setModified(true);
preview();
}