void 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; } } }; connect( fontAction, &QAction::triggered, this, setFont ); }
void 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(); }
Desktopwidget::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 ())); connect (_dir->_add_recent, SIGNAL (triggered ()), this, SLOT (addToRecent ())); connect (_dir->_add_repository, SIGNAL (triggered ()), this, SLOT (slotAddRepository ())); connect (_dir->_remove_repository, SIGNAL (triggered ()), this, SLOT (slotRemoveRepository ())); setStretchFactor(indexOf(_dir), 0); QList<int> size; if (!getSettingsSizes ("desktopwidget/", size)) { size.append (200); size.append (1000); size.append (400); } setSizes (size); connect (_view, SIGNAL (popupMenu (QModelIndex &)), this, SLOT (slotPopupMenu (QModelIndex &))); // allow top level to see our view messages connect (_view, SIGNAL (newContents (QString)), this, SIGNAL (newContents (QString))); addActions(); /* unfortunately when we first run maxview it starts with the main window un-maximised. This means that scrollToLast() doesn't quite scroll far enough for the maximised view which appears soon afterwards. As a hack for the moment, we do another scroll 1 second after starting up */ QTimer::singleShot(1000, _view, SLOT (scrollToLast())); }
void 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("Équipe"), autoGroup), 2, 0); autoL->addLayout(partyL, 2, 1, 1, 5); QGridLayout *layout = new QGridLayout(this); layout->addWidget(previewWidget, 0, 0, 1, 6, Qt::AlignCenter); layout->addWidget(new QLabel(tr("Lieu affiché")), 1, 0); layout->addWidget(locationIDE, 1, 1); layout->addWidget(new QLabel(tr("Nombre de sauvegardes")), 1, 2); layout->addWidget(saveCountE, 1, 3); layout->addWidget(new QLabel(tr("Sauvegarde courante")), 1, 4); layout->addWidget(curSaveE, 1, 5); layout->addWidget(autoGroup, 2, 0, 1, 6); layout->setRowStretch(3, 1); connect(autoGroup, SIGNAL(toggled(bool)), SLOT(setGroupDisabled(bool))); connect(nivLeaderE, SIGNAL(valueChanged(int)), SLOT(updatePreview())); connect(gilsE, SIGNAL(valueChanged(double)), SLOT(updatePreview())); connect(timeE, SIGNAL(valueChanged()), SLOT(updatePreview())); connect(discE, SIGNAL(valueChanged(double)), SLOT(updatePreview())); connect(locationIDE, SIGNAL(currentIndexChanged(int)), SLOT(updatePreview())); foreach(QComboBox *cb, partyE) { connect(cb, SIGNAL(currentIndexChanged(int)), SLOT(updatePreview())); }
void RaceDialog::onSelectNextFace(MyGUI::Widget*) { mFaceIndex = wrap(mFaceIndex + 1, mAvailableHeads.size()); updatePreview(); }
void PreferencesBase::boldChanged( bool b ) { currentStyle.font.setBold( b ); updatePreview(); }
void PreferencesBase::underlineChanged( bool b ) { currentStyle.font.setUnderline( b ); updatePreview(); }
void CSSEdit::setCSS(const QString &css) { m_elements.clear(); bool inBlock = false; QString element; QString currentProperty; QString currentValue; for (int i = 0; i < css.length(); ++i) { if (! inBlock) { element.clear(); for (; i < css.length() && css[i] != '{'; ++i) if (! css[i].isSpace()) element += css[i]; if (i < css.length() && css[i] == '{') { inBlock = true; ++i; } } else { currentProperty.clear(); for (; i < css.length() && css[i] != ':'; ++i) if (! css[i].isSpace()) currentProperty += css[i]; if (! inBlock) continue; currentValue.clear(); char quote = '\0'; for (++i; i < css.length() && css[i] != ';'; ++i) { if (quote) { if (css[i] == quote) { while (i < css.length() && css[i] != ';') ++i; break; } else currentValue += css[i]; } else if (! css[i].isSpace()) { if (css[i] == '\'' || css[i] == '\"') quote = css[i].toLatin1(); else currentValue += css[i]; } } m_elements[element][currentProperty] = currentValue; while (css[i + 1].isSpace()) ++i; if (css[i + 1] == '}') { ++i; inBlock = false; } } } updateElementCombo(); updatePreview(); }
void QgsSymbolV2SelectorWidget::setExpressionContext( QgsExpressionContext *context ) { mPresetExpressionContext.reset( context ); layerChanged(); updatePreview(); }
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent) : DCOPObject("interface"), KDialogBase(parent, name, true, QString::null, Help|User1, User1, true, KStdGuiItem::quit() ) { grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM ); grabber->move( -1000, -1000 ); grabber->installEventFilter( this ); KStartupInfo::appStarted(); QVBox *vbox = makeVBoxMainWidget(); mainWidget = new KSnapshotWidget( vbox, "mainWidget" ); connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot())); connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) ); connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) ); connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) ); connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) ); grabber->show(); grabber->grabMouse( waitCursor ); if ( !grabCurrent ) snapshot = QPixmap::grabWindow( qt_xrootwin() ); else { mainWidget->setMode( WindowUnderCursor ); mainWidget->setIncludeDecorations( true ); performGrab(); } updatePreview(); grabber->releaseMouse(); grabber->hide(); KConfig *conf=KGlobal::config(); conf->setGroup("GENERAL"); mainWidget->setDelay(conf->readNumEntry("delay",0)); mainWidget->setMode( conf->readNumEntry( "mode", 0 ) ); mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true)); filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" )); // Make sure the name is not already being used while(KIO::NetAccess::exists( filename, false, this )) { autoincFilename(); } connect( &grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); connect( &updateTimer, SIGNAL( timeout() ), this, SLOT( updatePreview() ) ); QTimer::singleShot( 0, this, SLOT( updateCaption() ) ); KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false); QPushButton *helpButton = actionButton( Help ); helpButton->setPopup(helpMenu->menu()); KAccel* accel = new KAccel(this); accel->insert(KStdAccel::Quit, kapp, SLOT(quit())); accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user without showing the file dialog."), CTRL+SHIFT+Key_S, this, SLOT(slotSave())); accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs())); // accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs())); accel->insert( "SaveAs", i18n("Save Snapshot &As..."), i18n("Save the snapshot to the file specified by the user."), CTRL+Key_A, this, SLOT(slotSaveAs())); accel->insert(KStdAccel::Print, this, SLOT(slotPrint())); accel->insert(KStdAccel::New, this, SLOT(slotGrab())); accel->insert(KStdAccel::Copy, this, SLOT(slotCopy())); accel->insert( "Quit2", Key_Q, this, SLOT(slotSave())); accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs())); accel->insert( "Print2", Key_P, this, SLOT(slotPrint())); accel->insert( "New2", Key_N, this, SLOT(slotGrab())); accel->insert( "New3", Key_Space, this, SLOT(slotGrab())); setEscapeButton( User1 ); connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) ); mainWidget->btnNew->setFocus(); }
void CSSEdit::setElementsAliases(const QHash<QString, QString> &aliases) { m_elementsAliases = aliases; updateElementCombo(); updatePreview(); }
void setLayer( QgsSymbolLayerV2* layer ) { mLayer = layer; updatePreview(); }
instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, const std::shared_ptr<cpu_thread>& _cpu, CPUDisAsm* _disasm) : QDialog(parent) , pc(_pc) , cpu(_cpu) , disasm(_disasm) { setWindowTitle(tr("Edit instruction")); setAttribute(Qt::WA_DeleteOnClose); setMinimumSize(300, sizeHint().height()); const auto cpu = _cpu.get(); cpu_offset = g_system == system_type::ps3 && cpu->id_type() != 1 ? static_cast<SPUThread&>(*cpu).offset : 0; QString instruction = qstr(fmt::format("%08x", vm::ps3::read32(cpu_offset + pc).value())); QVBoxLayout* vbox_panel(new QVBoxLayout()); QHBoxLayout* hbox_panel(new QHBoxLayout()); QVBoxLayout* vbox_left_panel(new QVBoxLayout()); QVBoxLayout* vbox_right_panel(new QVBoxLayout()); QHBoxLayout* hbox_b_panel(new QHBoxLayout()); QPushButton* button_ok(new QPushButton(tr("Ok"))); QPushButton* button_cancel(new QPushButton(tr("Cancel"))); button_ok->setFixedWidth(80); button_cancel->setFixedWidth(80); QLabel* t1_text = new QLabel(tr("Address: "), this); QLabel* t2_text = new QLabel(tr("Instruction: "), this); QLabel* t3_text = new QLabel(tr("Preview: "), this); QLabel* t1_addr = new QLabel(qstr(fmt::format("%08x", pc)), this); t2_instr = new QLineEdit(this); t2_instr->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); t2_instr->setPlaceholderText(instruction); t2_instr->setText(instruction); t2_instr->setMaxLength(8); t2_instr->setMaximumWidth(65); t3_preview = new QLabel("", this); // Layouts vbox_left_panel->addWidget(t1_text); vbox_left_panel->addWidget(t2_text); vbox_left_panel->addWidget(t3_text); vbox_right_panel->addWidget(t1_addr); vbox_right_panel->addWidget(t2_instr); vbox_right_panel->addWidget(t3_preview); vbox_right_panel->setAlignment(Qt::AlignLeft); hbox_b_panel->addWidget(button_ok); hbox_b_panel->addWidget(button_cancel); hbox_b_panel->setAlignment(Qt::AlignCenter); // Main Layout hbox_panel->addLayout(vbox_left_panel); hbox_panel->addSpacing(10); hbox_panel->addLayout(vbox_right_panel); vbox_panel->addLayout(hbox_panel); vbox_panel->addSpacing(10); vbox_panel->addLayout(hbox_b_panel); setLayout(vbox_panel); setModal(true); // Events connect(button_ok, &QAbstractButton::pressed, [=]() { bool ok; ulong opcode = t2_instr->text().toULong(&ok, 16); if (!ok) QMessageBox::critical(this, tr("Error"), tr("This instruction could not be parsed.\nNo changes were made.")); else vm::ps3::write32(cpu_offset + pc, (u32)opcode); accept(); }); connect(button_cancel, &QAbstractButton::pressed, this, &instruction_editor_dialog::reject); connect(t2_instr, &QLineEdit::textChanged, this, &instruction_editor_dialog::updatePreview); updatePreview(); }
void Anaglyph::changeChoosenView(int fViewSelected){ mViewSelected = fViewSelected; updatePreview(); }
//! [7] QCheckBox *ControllerWindow::createCheckBox(const QString &text) { QCheckBox *checkBox = new QCheckBox(text); connect(checkBox, SIGNAL(clicked()), this, SLOT(updatePreview())); return checkBox; }
void MainWindow::resizeEvent ( QResizeEvent * event ) { QMainWindow::resizeEvent( event ); updatePreview(); }
//! [8] QRadioButton *ControllerWindow::createRadioButton(const QString &text) { QRadioButton *button = new QRadioButton(text); connect(button, SIGNAL(clicked()), this, SLOT(updatePreview())); return button; }
void QgsVectorRandomColorRampV2Dialog::setCount( int val ) { mRamp->setCount( val ); updatePreview(); }
void PreferencesBase::italicChanged( bool b ) { currentStyle.font.setItalic( b ); updatePreview(); }
void QgsVectorRandomColorRampV2Dialog::setSat1( int val ) { mRamp->setSatMin( val ); updatePreview(); }
void SeaView::cancelPreview() { m_fields[0]->cancelPreview(); m_fields[1]->cancelPreview(); updatePreview(m_last_preview); }
void QgsVectorRandomColorRampV2Dialog::setVal2( int val ) { mRamp->setValMax( val ); updatePreview(); }
void DlgSettingsColorFilter::slotDividerLow (double xCenter) { m_modelColorFilterAfter->setLow (m_cmbCurveName->currentText(), xCenter / (double) PROFILE_SCENE_WIDTH ()); updatePreview(); }
void __fastcall TForm1::ratioClick(TObject *Sender) { img->Proportional ^= 1 ; updatePreview(); outTypeChange(0); }
void RaceDialog::onSelectNextHair(MyGUI::Widget*) { mHairIndex = wrap(mHairIndex + 1, mAvailableHairs.size()); updatePreview(); }
void __fastcall TForm1::stretchClick(TObject *Sender) { img->Stretch ^= 1 ; updatePreview(); outTypeChange(0); }
KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode ) : QDialog(parent), KSnapshotObject(), modified(true), savedPosition(QPoint(-1, -1)) { // TEMPORARY Make sure "untitled" enters the string freeze for 4.6, // as explained in http://lists.kde.org/?l=kde-graphics-devel&m=128942871430175&w=2 const QString untitled = QString(tr("untitled")); setWindowTitle(""); grabber = new QWidget( 0, Qt::X11BypassWindowManagerHint ); // TODO X11 (Xinerama and Twinview, actually) and Windows use different coordinates for the two monitors case // // On Windows, there are two displays. The origin (0, 0) ('o') is the top left of display 1. If display 2 is to the left, then coordinates in display 2 are negative: // .-------. // | |o-----. // | 2 | | // | | 1 | // ._______.._____. // // On Xinerama and Twinview, there is only one display and two screens. The origin (0, 0) ('o') is the top left of the display: // o-------. // | |.-----. // | 2 | | // | | 1 | // ._______.._____. // // Instead of moving to (-10000, -10000), we should compute how many displays are and make sure we move to somewhere out of the total coordinates. // - Windows: use GetSystemMetrics ( http://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx ) // If moving to a negative position, we need to count the size of the dialog; moving to a positive position avoids having to compute the size of the dialog grabber->move( -10000, -10000 ); // FIXME Read above grabber->installEventFilter( this ); QVBoxLayout *vbox = new QVBoxLayout( this ); setLayout(vbox); mainWidget = new KSnapshotWidget(); vbox->addWidget(mainWidget); connect(mainWidget->ok_btn, SIGNAL(clicked()), SLOT(onOkBtnClicked())); connect(mainWidget->cancel_btn, SIGNAL(clicked()), SLOT(onCancelBtnClicked())); connect(mainWidget->save_btn, SIGNAL(clicked()), SLOT(onSaveBtnClicked())); connect(mainWidget->help_btn, SIGNAL(clicked()), SLOT(onHelpBtnClicked())); connect(mainWidget->lblImage, SIGNAL(startDrag()), SLOT(slotDragSnapshot())); connect(mainWidget->btnNew, SIGNAL(clicked()), SLOT(slotGrab())); connect(mainWidget->comboMode, SIGNAL(activated(int)), SLOT(slotModeChanged(int))); if (qApp->desktop()->numScreens() < 2) { mainWidget->comboMode->removeItem(CurrentScreen); } mainWidget->spinDelay->setSuffix(tr(" second", " seconds")); grabber->show(); grabber->grabMouse(); #ifdef HAVE_X11_EXTENSIONS_XFIXES_H { int tmp1, tmp2; //Check whether the XFixes extension is available Display *dpy = QX11Info::display(); if (!XFixesQueryExtension( dpy, &tmp1, &tmp2 )) { mainWidget->cbIncludePointer->hide(); mainWidget->lblIncludePointer->hide(); } } #elif !defined(Q_WS_WIN) mainWidget->cbIncludePointer->hide(); mainWidget->lblIncludePointer->hide(); #endif setMode(KSnapshotObject::Region); qDebug() << "Mode = " << mode; if ( mode == KSnapshotObject::FullScreen ) { snapshot = QPixmap::grabWindow( QApplication::desktop()->winId() ); #ifdef HAVE_X11_EXTENSIONS_XFIXES_H if ( haveXFixes && includePointer() ) grabPointerImage(0, 0); #endif } else if ( mode == KSnapshotObject::CurrentScreen ) { qDebug() << "Desktop Geom = " << QApplication::desktop()->geometry(); QDesktopWidget *desktop = QApplication::desktop(); int screenId = desktop->screenNumber( QCursor::pos() ); qDebug() << "Screenid = " << screenId; QRect geom = desktop->screenGeometry( screenId ); qDebug() << "Geometry = " << screenId; snapshot = QPixmap::grabWindow( desktop->winId(), geom.x(), geom.y(), geom.width(), geom.height() ); } else { setMode( mode ); switch(mode) { case KSnapshotObject::WindowUnderCursor: { setIncludeDecorations( true ); performGrab(); break; } case KSnapshotObject::ChildWindow: { slotGrab(); break; } case KSnapshotObject::Region: { grabRegion(); break; } case KSnapshotObject::FreeRegion: { grabFreeRegion(); break; } default: break; } } //When we use argument to take snapshot we mustn't hide it. if (mode != KSnapshotObject::ChildWindow) { grabber->releaseMouse(); grabber->hide(); } setDelay(0); file_path_ = QQGlobal::tempDir() + "/snapshot/snapshot.png"; connect( &grabTimer, SIGNAL(timeout()), this, SLOT(grabTimerDone()) ); connect( &updateTimer, SIGNAL(timeout()), this, SLOT(updatePreview()) ); QTimer::singleShot( 0, this, SLOT(updateCaption()) ); new QShortcut( Qt::Key_S, mainWidget->ok_btn, SLOT(animateClick())); new QShortcut( Qt::Key_N, mainWidget->btnNew, SLOT(animateClick()) ); new QShortcut( Qt::Key_Space, mainWidget->btnNew, SLOT(animateClick()) ); mainWidget->ok_btn->setFocus(); resize(QSize(400, 500)); move((QApplication::desktop()->width() - this->width()) /2, (QApplication::desktop()->height() - this->height()) /2); }
void __fastcall TForm1::centerClick(TObject *Sender) { img->Center ^= 1 ; updatePreview(); outTypeChange(0); }
void PointSetDlg::slotPointLineSize(const QString &text) { ASSERT_ENGAUGE(pointSetStyle != 0); pointSetStyle->pointLineSize = PointSetStyles::instance().pointLineSize(text); updatePreview(); }
void QgsFontButton::dragLeaveEvent( QDragLeaveEvent *e ) { Q_UNUSED( e ); //reset button color updatePreview(); }