本文整理汇总了C++中preview函数的典型用法代码示例。如果您正苦于以下问题:C++ preview函数的具体用法?C++ preview怎么用?C++ preview使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preview函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:johanneschrist,项目名称:Image-Processing,代码行数:27,代码来源:MainWindow.cpp
示例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);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:40,代码来源:icons.cpp
示例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;
}
开发者ID:dengchangtao,项目名称:Quantum-GIS,代码行数:39,代码来源:qgssymbolv2.cpp
示例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();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:23,代码来源:ImportASCIIDialog.cpp
示例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 );
}
开发者ID:EntityFXCode,项目名称:arsenalsuite,代码行数:23,代码来源:scheduleprintdialog.cpp
示例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;
}
开发者ID:lcygithub,项目名称:C_Plus,代码行数:24,代码来源:moc_mainwindow.cpp
示例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);
}
开发者ID:Odeskguru,项目名称:razor-qt,代码行数:36,代码来源:desktopbackgrounddialog.cpp
示例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();
}
开发者ID:johanneschrist,项目名称:Image-Processing,代码行数:41,代码来源:MainWindow.cpp
示例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;
}
开发者ID:holstgr-kaust,项目名称:DisplayCluster,代码行数:36,代码来源:StatePreview.cpp
示例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();
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:36,代码来源:cleanuppreview.cpp
示例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)));
//.........这里部分代码省略.........
开发者ID:DavidMercier,项目名称:gwyddion,代码行数:101,代码来源:grain_filter.c
示例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);
//.........这里部分代码省略.........
开发者ID:JongHong,项目名称:kdenlive,代码行数:101,代码来源:customruler.cpp
示例13: preview
void BilateralDialog::previewButtonPressed() {
emit preview(ui->diameterSlider->value(),ui->sigmaCSlider->value(),ui->sigmaSSlider->value());
}
开发者ID:mbobowsk,项目名称:DarQwin,代码行数:3,代码来源:bilateraldialog.cpp
示例14: setPreview
void DekeystoningWidget::setPreview(QPixmap pixmap)
{
previewPixmap = pixmap;
if (preview())
ui->view->setPixmap(pixmap);
}
开发者ID:tibob,项目名称:yasw,代码行数:6,代码来源:dekeystoningwidget.cpp
示例15: setModified
void PopupAppearance::onCurrentIndexChanged(int)
{
setModified(true);
preview();
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:5,代码来源:popupappearance.cpp
示例16: getView
int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
MODULE* module = NULL;
KIGFX::VIEW* view = getView();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
BOARD* board = getModel<BOARD>();
// Add a VIEW_GROUP that serves as a preview for the new item
KIGFX::VIEW_GROUP preview( view );
view->Add( &preview );
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
controls->ShowCursor( true );
controls->SetSnapping( true );
Activate();
m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_HAND, _( "Add footprint" ) );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
VECTOR2I cursorPos = controls->GetCursorPosition();
if( evt->IsCancel() || evt->IsActivate() )
{
if( module )
{
board->Delete( module ); // it was added by LoadModuleFromLibrary()
module = NULL;
preview.Clear();
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
controls->ShowCursor( true );
}
else
break;
if( evt->IsActivate() ) // now finish unconditionally
break;
}
else if( module && evt->Category() == TC_COMMAND )
{
if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
{
module->Rotate( module->GetPosition(), m_frame->GetRotationAngle() );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
{
module->Flip( module->GetPosition() );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
else if( evt->IsClick( BUT_LEFT ) )
{
if( !module )
{
// Pick the module to be placed
module = m_frame->LoadModuleFromLibrary( wxEmptyString,
m_frame->Prj().PcbFootprintLibs(),
true, NULL );
if( module == NULL )
continue;
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
// Add all the drawable parts to preview
preview.Add( module );
module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
else
{
// Place the selected module
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
view->Add( module );
module->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
m_frame->OnModify();
m_frame->SaveCopyInUndoList( module, UR_NEW );
// Remove from preview
preview.Remove( module );
module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
module = NULL; // to indicate that there is no module that we currently modify
}
bool placing = ( module != NULL );
controls->SetAutoPan( placing );
controls->CaptureCursor( placing );
controls->ShowCursor( !placing );
}
else if( module && evt->IsMotion() )
{
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
//.........这里部分代码省略.........
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:101,代码来源:pcb_editor_control.cpp
示例17: KCModule
KIconConfig::KIconConfig(const KComponentData &inst, QWidget *parent)
: KCModule(inst, parent)
{
QGridLayout *top = new QGridLayout(this );
top->setColumnStretch(0, 1);
top->setColumnStretch(1, 1);
// Use of Icon at (0,0) - (1, 0)
QGroupBox *gbox = new QGroupBox(i18n("Use of Icon"), this);
top->addWidget(gbox, 0, 0, 2, 1);
QBoxLayout *g_vlay = new QVBoxLayout(gbox);
mpUsageList = new QListWidget(gbox);
connect(mpUsageList, SIGNAL(currentRowChanged(int)), SLOT(slotUsage(int)));
g_vlay->addWidget(mpUsageList);
KSeparator *sep = new KSeparator( Qt::Horizontal, this );
top->addWidget(sep, 1, 1);
// Preview at (2,0) - (2, 1)
QGridLayout *g_lay = new QGridLayout();
g_lay->setSpacing( 0);
top->addLayout(g_lay, 2, 0, 1, 2 );
g_lay->addItem(new QSpacerItem(0, fontMetrics().lineSpacing()), 0, 0);
QPushButton *push;
push = addPreviewIcon(0, i18nc("@label The icon rendered by default", "Default"), this, g_lay);
connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup0()));
push = addPreviewIcon(1, i18nc("@label The icon rendered as active", "Active"), this, g_lay);
connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup1()));
push = addPreviewIcon(2, i18nc("@label The icon rendered as disabled", "Disabled"), this, g_lay);
connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup2()));
m_pTab1 = new QWidget(this);
m_pTab1->setObjectName( QLatin1String("General Tab" ));
top->addWidget(m_pTab1, 0, 1);
QGridLayout *grid = new QGridLayout(m_pTab1);
grid->setColumnStretch(1, 1);
grid->setColumnStretch(2, 1);
// Size
QLabel *lbl = new QLabel(i18n("Size:"), m_pTab1);
lbl->setFixedSize(lbl->sizeHint());
grid->addWidget(lbl, 0, 0, Qt::AlignLeft);
mpSizeBox = new QComboBox(m_pTab1);
connect(mpSizeBox, SIGNAL(activated(int)), SLOT(slotSize(int)));
lbl->setBuddy(mpSizeBox);
grid->addWidget(mpSizeBox, 0, 1, Qt::AlignLeft);
mpAnimatedCheck = new QCheckBox(i18n("Animate icons"), m_pTab1);
connect(mpAnimatedCheck, SIGNAL(toggled(bool)), SLOT(slotAnimatedCheck(bool)));
grid->addWidget(mpAnimatedCheck, 2, 0, 1, 2, Qt::AlignLeft);
grid->setRowStretch(3, 10);
top->activate();
init();
read();
apply();
preview();
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:63,代码来源:icons.cpp
示例18: preview
void KIconConfig::preview()
{
preview(0);
preview(1);
preview(2);
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:6,代码来源:icons.cpp
示例19: preview
MeasureMarkersWindow::~MeasureMarkersWindow() {
//关闭摄像头
if (mbPlay)
preview();
}
开发者ID:Marco-LIU,项目名称:reconstruction-3d,代码行数:5,代码来源:MeasureMarkersWindows.cpp
示例20: KDialog
KIconEffectSetupDialog::KIconEffectSetupDialog(const Effect &effect,
const Effect &defaultEffect,
const QString &caption, const QImage &image,
QWidget *parent, char *name)
: KDialog( parent ),
mEffect(effect),
mDefaultEffect(defaultEffect),
mExample(image)
{
setObjectName( name );
setModal( true );
setCaption( caption );
setButtons( Default|Ok|Cancel );
mpEffect = new KIconEffect;
QLabel *lbl;
QGroupBox *frame;
QGridLayout *grid;
QWidget *page = new QWidget(this);
setMainWidget(page);
QGridLayout *top = new QGridLayout(page);
top->setMargin(0);
top->setColumnStretch(0,1);
top->setColumnStretch(1,2);
top->setRowStretch(1,1);
lbl = new QLabel(i18n("&Effect:"), page);
top->addWidget(lbl, 0, 0, Qt::AlignLeft);
mpEffectBox = new QListWidget(page);
mpEffectBox->addItem(i18n("No Effect"));
mpEffectBox->addItem(i18n("To Gray"));
mpEffectBox->addItem(i18n("Colorize"));
mpEffectBox->addItem(i18n("Gamma"));
mpEffectBox->addItem(i18n("Desaturate"));
mpEffectBox->addItem(i18n("To Monochrome"));
connect(mpEffectBox, SIGNAL(currentRowChanged(int)), SLOT(slotEffectType(int)));
top->addWidget(mpEffectBox, 1, 0, 2, 1, Qt::AlignLeft);
lbl->setBuddy(mpEffectBox);
mpSTCheck = new QCheckBox(i18n("&Semi-transparent"), page);
connect(mpSTCheck, SIGNAL(toggled(bool)), SLOT(slotSTCheck(bool)));
top->addWidget(mpSTCheck, 3, 0, Qt::AlignLeft);
frame = new QGroupBox(i18n("Preview"), page);
top->addWidget(frame, 0, 1, 2, 1);
grid = new QGridLayout(frame);
grid->addItem(new QSpacerItem(0, fontMetrics().lineSpacing()), 0, 0);
grid->setRowStretch(1, 1);
mpPreview = new QLabel(frame);
mpPreview->setAlignment(Qt::AlignCenter);
mpPreview->setMinimumSize(105, 105);
grid->addWidget(mpPreview, 1, 0);
mpEffectGroup = new QGroupBox(i18n("Effect Parameters"), page);
top->addWidget(mpEffectGroup, 2, 1, 2, 1);
QFormLayout *form = new QFormLayout(mpEffectGroup);
mpEffectSlider = new QSlider(Qt::Horizontal, mpEffectGroup);
mpEffectSlider->setMinimum(0);
mpEffectSlider->setMaximum(100);
mpEffectSlider->setPageStep(5);
connect(mpEffectSlider, SIGNAL(valueChanged(int)), SLOT(slotEffectValue(int)));
form->addRow(i18n("&Amount:"), mpEffectSlider);
mpEffectLabel = static_cast<QLabel *>(form->labelForField(mpEffectSlider));
mpEColButton = new KColorButton(mpEffectGroup);
connect(mpEColButton, SIGNAL(changed(const QColor &)),
SLOT(slotEffectColor(const QColor &)));
form->addRow(i18n("Co&lor:"), mpEColButton);
mpEffectColor = static_cast<QLabel *>(form->labelForField(mpEColButton));
mpECol2Button = new KColorButton(mpEffectGroup);
connect(mpECol2Button, SIGNAL(changed(const QColor &)),
SLOT(slotEffectColor2(const QColor &)));
form->addRow(i18n("&Second color:"), mpECol2Button);
mpEffectColor2 = static_cast<QLabel *>(form->labelForField(mpECol2Button));
init();
preview();
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:84,代码来源:icons.cpp
注:本文中的preview函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论