这篇教程C++ updatePreview函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中updatePreview函数的典型用法代码示例。如果您正苦于以下问题:C++ updatePreview函数的具体用法?C++ updatePreview怎么用?C++ updatePreview使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了updatePreview函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: QWidgetActionvoid QgsFontButton::prepareMenu(){ //we need to tear down and rebuild this menu every time it is shown. Otherwise the space allocated to any //QgsColorSwatchGridAction is not recalculated by Qt and the swatch grid may not be the correct size //for the number of colors shown in the grid. Note that we MUST refresh color swatch grids every time this //menu is opened, otherwise color schemes like the recent color scheme grid are meaningless mMenu->clear(); QWidgetAction *sizeAction = new QWidgetAction( mMenu ); QWidget *sizeWidget = new QWidget(); QVBoxLayout *sizeLayout = new QVBoxLayout(); sizeLayout->setMargin( 0 ); sizeLayout->setContentsMargins( 0, 0, 0, 3 ); sizeLayout->setSpacing( 2 ); QString fontHeaderLabel; switch ( mMode ) { case ModeTextRenderer: fontHeaderLabel = tr( "Font size (%1)" ).arg( QgsUnitTypes::toString( mFormat.sizeUnit() ) ); break; case ModeQFont: fontHeaderLabel = tr( "Font size (pt)" ); break; } QgsMenuHeader *sizeLabel = new QgsMenuHeader( fontHeaderLabel ); sizeLayout->addWidget( sizeLabel ); QgsDoubleSpinBox *sizeSpin = new QgsDoubleSpinBox( nullptr ); sizeSpin->setDecimals( 4 ); sizeSpin->setMaximum( 1e+9 ); sizeSpin->setShowClearButton( false ); sizeSpin->setValue( mMode == ModeTextRenderer ? mFormat.size() : mFont.pointSizeF() ); connect( sizeSpin, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, [ = ]( double value ) { switch ( mMode ) { case ModeTextRenderer: mFormat.setSize( value ); break; case ModeQFont: mFont.setPointSizeF( value ); break; } updatePreview(); emit changed(); } ); QHBoxLayout *spinLayout = new QHBoxLayout(); spinLayout->setMargin( 0 ); spinLayout->setContentsMargins( 4, 0, 4, 0 ); spinLayout->addWidget( sizeSpin ); sizeLayout->addLayout( spinLayout ); sizeWidget->setLayout( sizeLayout ); sizeAction->setDefaultWidget( sizeWidget ); sizeWidget->setFocusProxy( sizeSpin ); sizeWidget->setFocusPolicy( Qt::StrongFocus ); mMenu->addAction( sizeAction ); QMenu *recentFontMenu = new QMenu( tr( "Recent fonts" ), mMenu ); Q_FOREACH ( const QString &family, QgsFontUtils::recentFontFamilies() ) { QAction *fontAction = new QAction( family, recentFontMenu ); QFont f = fontAction->font(); f.setFamily( family ); fontAction->setFont( f ); fontAction->setToolTip( family ); recentFontMenu->addAction( fontAction ); if ( ( mMode == ModeTextRenderer && family == mFormat.font().family() ) || ( mMode == ModeQFont && family == mFont.family() ) ) { fontAction->setCheckable( true ); fontAction->setChecked( true ); } auto setFont = [this, family] { switch ( mMode ) { case ModeTextRenderer: { QgsTextFormat newFormat = mFormat; QFont f = newFormat.font(); f.setFamily( family ); newFormat.setFont( f ); setTextFormat( newFormat ); QgsFontUtils::addRecentFontFamily( mFormat.font().family() ); break; } case ModeQFont: { QFont font = mFont; font.setFamily( family ); setCurrentFont( font ); QgsFontUtils::addRecentFontFamily( family ); break; } }//.........这里部分代码省略.........
开发者ID:cz172638,项目名称:QGIS,代码行数:101,
示例2: connectvoid KSnapshot::performGrab(){ int x = 0; int y = 0; grabber->releaseMouse(); grabber->hide(); grabTimer.stop(); title.clear(); windowClass.clear(); if ( mode() == ChildWindow ) { WindowGrabber wndGrab; connect( &wndGrab, SIGNAL(windowGrabbed(QPixmap)), SLOT(slotWindowGrabbed(QPixmap)) ); wndGrab.exec(); QPoint offset = wndGrab.lastWindowPosition(); x = offset.x(); y = offset.y(); qDebug() << "last window position is" << offset; } else if ( mode() == WindowUnderCursor ) { snapshot = WindowGrabber::grabCurrent( includeDecorations() ); QPoint offset = WindowGrabber::lastWindowPosition(); x = offset.x(); y = offset.y(); // If we're showing decorations anyway then we'll add the title and window // class to the output image meta data. if ( includeDecorations() ) { title = WindowGrabber::lastWindowTitle(); } } else if ( mode() == CurrentScreen ) { qDebug() << "Desktop Geom2 = " << QApplication::desktop()->geometry(); QDesktopWidget *desktop = QApplication::desktop(); int screenId = desktop->screenNumber( QCursor::pos() ); qDebug() << "Screenid2 = " << screenId; QRect geom = desktop->screenGeometry( screenId ); qDebug() << "Geometry2 = " << geom; x = geom.x(); y = geom.y(); snapshot = QPixmap::grabWindow( desktop->winId(), x, y, geom.width(), geom.height() ); } else { snapshot = QPixmap::grabWindow( QApplication::desktop()->winId() ); }#ifdef HAVE_X11_EXTENSIONS_XFIXES_H if (haveXFixes && includePointer()) { grabPointerImage(x, y); }#endif // HAVE_X11_EXTENSIONS_XFIXES_H if ( snapshot.isNull() ) { mainWidget->ok_btn->setEnabled(false); mainWidget->save_btn->setEnabled(false); } else { mainWidget->ok_btn->setEnabled(true); mainWidget->save_btn->setEnabled(true); } updatePreview(); QApplication::restoreOverrideCursor(); modified = true; updateCaption(); if (savedPosition != QPoint(-1, -1)) { move(savedPosition); } show();}
开发者ID:Berrrry,项目名称:Qtqq,代码行数:76,
示例3: QSplitterDesktopwidget::Desktopwidget (QWidget *parent) : QSplitter (parent) { _model = new Dirmodel ();// _model->setLazyChildCount (true); _dir = new Dirview (this); _dir->setModel (_model); _contents = new Desktopmodel (this); QWidget *group = createToolbar(); _view = new Desktopview (group); QVBoxLayout *lay = new QVBoxLayout (group); lay->setContentsMargins (0, 0, 0, 0); lay->setSpacing (2); lay->addWidget (_toolbar); lay->addWidget (_view); connect (_view, SIGNAL (itemPreview (const QModelIndex &, int, bool)), this, SLOT (slotItemPreview (const QModelIndex &, int, bool)));#ifdef USE_PROXY _proxy = new Desktopproxy (this); _proxy->setSourceModel (_contents); _view->setModel (_proxy);// printf ("contents=%p, proxy=%p/n", _contents, _proxy); // set up the model converter _modelconv = new Desktopmodelconv (_contents, _proxy); // setup another one for Desktopmodel, which only allows assertions _modelconv_assert = new Desktopmodelconv (_contents, _proxy, false);#else _proxy = 0; _view->setModel (_contents); _modelconv = new Desktopmodelconv (_contents); // setup another one for Desktopmodel, which only allows assertions _modelconv_assert = new Desktopmodelconv (_contents, false);#endif _view->setModelConv (_modelconv); _contents->setModelConv (_modelconv_assert); _delegate = new Desktopdelegate (_modelconv, this); _view->setItemDelegate (_delegate); connect (_delegate, SIGNAL (itemClicked (const QModelIndex &, int)), this, SLOT (slotItemClicked (const QModelIndex &, int))); connect (_delegate, SIGNAL (itemPreview (const QModelIndex &, int, bool)), this, SLOT (slotItemPreview (const QModelIndex &, int, bool))); connect (_delegate, SIGNAL (itemDoubleClicked (const QModelIndex &)), this, SLOT (openStack (const QModelIndex &))); connect (_contents, SIGNAL (undoChanged ()), this, SIGNAL (undoChanged ())); connect (_contents, SIGNAL (dirChanged (QString&, QModelIndex&)), this, SLOT (slotDirChanged (QString&, QModelIndex&))); connect (_contents, SIGNAL (beginningScan (const QModelIndex &)), this, SLOT (slotBeginningScan (const QModelIndex &))); connect (_contents, SIGNAL (endingScan (bool)), this, SLOT (slotEndingScan (bool))); connect (_contents, SIGNAL(updateRepositoryList (QString &, bool)), this, SLOT(slotUpdateRepositoryList (QString &, bool))); // position the items when the model is reset, otherwise things // move and look ugly for a while connect (_contents, SIGNAL (modelReset ()), _view, SLOT (setPositions ())); createPage(); // and when there are no selected items connect (_view, SIGNAL (pageLost()), _page, SLOT (slotReset ())); _parent = parent; _pendingMatch = QString::null; _updating = false; // setup the preview timer _timer = new QTimer (); _timer->setSingleShot (true); connect (_timer, SIGNAL(timeout()), this, SLOT(updatePreview())); connect (_dir, SIGNAL (clicked (const QModelIndex&)), this, SLOT (dirSelected (const QModelIndex&))); connect (_dir, SIGNAL (activated (const QModelIndex&)), this, SLOT (dirSelected (const QModelIndex&))); connect (_model, SIGNAL(droppedOnFolder(const QMimeData *, QString &)), this, SLOT(slotDroppedOnFolder(const QMimeData *, QString &))); /* notice when the current directory is fully displayed so we can handle any pending action */ connect (_contents, SIGNAL (updateDone()), this, SLOT (slotUpdateDone())); // connect signals from the directory tree connect (_dir->_new, SIGNAL (triggered ()), this, SLOT (newDir ())); connect (_dir->_rename, SIGNAL (triggered ()), this, SLOT (renameDir ())); connect (_dir->_delete, SIGNAL (triggered ()), this, SLOT (deleteDir ())); connect (_dir->_refresh, SIGNAL (triggered ()), this, SLOT (refreshDir ()));//.........这里部分代码省略.........
开发者ID:sglass68,项目名称:paperman,代码行数:101,
示例4: PreviewWidgetvoid PreviewEditor::buildWidget(){ previewWidget = new PreviewWidget(this); locationIDE = new QComboBox(this); int i=0; foreach(const QString &loc, Data::locations().list()) locationIDE->addItem(loc, i++); saveCountE = new SpinBox16(this); curSaveE = new SpinBox32(this); autoGroup = new QGroupBox(tr("Auto.")); autoGroup->setCheckable(true); hpLeaderE = new SpinBox16(autoGroup); hpMaxLeaderE = new SpinBox16(autoGroup); gilsE = new SpinBox32(autoGroup); timeE = new TimeWidget(autoGroup); nivLeaderE = new SpinBox8(autoGroup); discE = new SpinBox32(autoGroup); discE->setRange(1, double(MAX_INT32) + 1.0); QComboBox *comboBox; QList<QIcon> icons; for(int i=0 ; i<16 ; ++i) { icons.append(QIcon(QString(":/images/icons/perso%1.png").arg(i))); } for(int i=0 ; i<3 ; ++i) { partyE.append(comboBox = new QComboBox(autoGroup)); comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); comboBox->addItem("-", 255); for(int j=0 ; j<16 ; ++j) { comboBox->addItem(icons.at(j), Data::names().at(j), j); } } QHBoxLayout *partyL = new QHBoxLayout; partyL->addWidget(partyE.first()); partyL->addWidget(partyE.at(1)); partyL->addWidget(partyE.last()); partyL->setContentsMargins(QMargins()); QGridLayout *autoL = new QGridLayout(autoGroup); autoL->addWidget(new QLabel(tr("HP leader (inutilisé)"), autoGroup), 0, 0); autoL->addWidget(hpLeaderE, 0, 1); autoL->addWidget(new QLabel(tr("HP max. leader (inutilisé)"), autoGroup), 0, 2); autoL->addWidget(hpMaxLeaderE, 0, 3); autoL->addWidget(new QLabel(tr("Niveau leader"), autoGroup), 0, 4); autoL->addWidget(nivLeaderE, 0, 5); autoL->addWidget(new QLabel(tr("Argent"), autoGroup), 1, 0); autoL->addWidget(gilsE, 1, 1); autoL->addWidget(new QLabel(tr("Temps"), autoGroup), 1, 2); autoL->addWidget(timeE, 1, 3); autoL->addWidget(new QLabel(tr("Disque"), autoGroup), 1, 4); autoL->addWidget(discE, 1, 5); autoL->addWidget(new QLabel(tr(" C++ updateProjectionMatrix函数代码示例 C++ updatePositions函数代码示例
|