dtkToolBoxItem::dtkToolBoxItem(QWidget *parent) : QFrame(parent), d(new dtkToolBoxItemPrivate) { d->layout = new QVBoxLayout(this); d->layout->setContentsMargins(0, 0, 0, 0); d->layout->setAlignment(Qt::AlignTop); d->button = new dtkToolBoxButton(this); d->button->show(); d->layout->addWidget(d->button); d->widget = NULL; d->is_expanded = false; d->is_enforced = false; d->box = NULL; this->setBackgroundRole(QPalette::Button); this->connect(d->button, SIGNAL(clicked()), this, SLOT(onButtonClicked())); }
AMControlMoveButton::AMControlMoveButton(QWidget *parent, AMControl* control, QList<double> stepSizes, bool directionReversed) : QToolButton(parent) { directionReversed_ = directionReversed; control_ = 0; setControl(control); stepSizes_ = stepSizes; if(stepSizes_.isEmpty()) stepSizes_ << 1.0; // just to make sure we always have at least one, so that stepSizeIndex_ is valid. stepSizeIndex_ = 0; contextMenu_ = 0; setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); setText(QString::number(currentStepSize()) % (control_ ? control_->units() : QString())); connect(this, SIGNAL(clicked()), this, SLOT(onButtonClicked())); }
bool CDKInfo::checkForArma(DesuraId id, const char* key) { if (id.getType() != DesuraId::TYPE_GAME) return false; size_t x=0; while (g_CDKeySpecial[x].item) { if (g_CDKeySpecial[x].item == id.getItem()) { unsigned char binkey[255] = {0}; DecodeMsgAMAR2CDKey(binkey, key); GetUserCore()->updateBinaryRegKey(g_CDKeySpecial[x].reg, (char*)binkey, 15); break; } x++; }; if (g_CDKeySpecial[x].item == 14558 || g_CDKeySpecial[x].item == 0) //take on heli needs the cd key to be entered as well return false; if (m_bLaunch) { wxCommandEvent e(wxEVT_NULL, m_butLaunch->GetId()); onButtonClicked(e); GetParent()->Close(); } else { m_tbCdKey->SetLabel(Managers::GetString(L"#CDK_REGKEY")); m_tbCdKey->SetToolTip(Managers::GetString(L"#CDK_REGKEY_TOOLTIP")); m_imgCopyPart->Disable(); m_imgCopyAll->Disable(); } return true; }
ViewHeaderWithIcon::ViewHeaderWithIcon(QGraphicsItem *parent) : MWidgetController(parent), linearLayout(0), titleWidget(0) { setStyleName("CommonHeaderPanel"); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); MLayout *layout = new MLayout(this); MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal); titleWidget = new MLabel(); titleWidget->setTextElide(true); titleWidget->setStyleName("CommonHeaderInverted"); layoutPolicy->addItem(titleWidget); MButton *refreshButton = new MButton(this); refreshButton->setIconID ("icon-m-common-refresh"); refreshButton->setViewType (MButton::iconType); refreshButton->setStyleName("CommonRightIcon"); layoutPolicy->addItem(refreshButton); layoutPolicy->setAlignment(refreshButton, Qt::AlignLeft | Qt::AlignVCenter); connect(refreshButton, SIGNAL(clicked()), this, SLOT(onButtonClicked())); }
CXTechDlg::CXTechDlg(QObject* _master, const MTechs& _techs, const MTechs& _opts) { Ui::dlgTechnology::setupUi(this); horizontalLayout = new QHBoxLayout(this); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); verticalLayout->addLayout(horizontalLayout); verticalLayout->addStretch(); std::for_each(_techs.begin(), _techs.end(), [this](const MTechsItem _item){ auto btn = new CXTouchButton(this); btn->setProperty("tech", _item.first); btn->setText(_item.second); connect(btn, SIGNAL(clicked()), this, SLOT(onButtonClicked())); horizontalLayout->addWidget(btn); btnList.push_back(btn); }); std::for_each(_opts.begin(), _opts.end(), [this](const MTechsItem _item){ ckBox.push_front( new QCheckBox(this) ); ckBox.front()->setProperty("opt", _item.first); ckBox.front()->setText(_item.second); verticalLayout->addWidget(ckBox.front()); }); }
void BoolEdit::on_no_clicked() { onButtonClicked(false); }
void BoolEdit::on_yes_clicked() { onButtonClicked(true); }
void GameLayer::ccTouchesBegan(CCSet* pTouches, CCEvent* event) { CCSetIterator i; CCTouch * touch; CCPoint tap; for (i = pTouches->begin(); i != pTouches->end(); i++) { touch = (CCTouch *) (*i); if (touch) { // begin to handle a touch event tap = touch->getLocation(); if (_back->boundingBox().containsPoint(tap)) { _back->setPositionY(800 - 56.5); } if (_restart->boundingBox().containsPoint(tap)) { _restart->setPositionY(800 - 56.5); } for (unsigned b = 0; b < _numButtons->count(); b++) { CCSprite* button = (CCSprite*) _numButtons->objectAtIndex(b); if (button->boundingBox().containsPoint(tap)) { onButtonClicked(button, b); } } if(_hint->boundingBox().containsPoint(tap)) { if(Sudoku::state == Running && !Sudoku::isCurPosFilled() && Stats::hintNum > 0) { CCSprite* button = (CCSprite*)_numButtons->objectAtIndex(Sudoku::getResult() - 1); int actionNum = getActionManager()->numberOfRunningActionsInTarget(button); if(!actionNum) { consumeHint(); button->runAction( CCSequence::create( CCRotateBy::create(1, 360), CCDelayTime::create(0.3), CCRotateBy::create(1, 360), NULL ) ); } } } if(_penToRun->boundingBox().containsPoint(tap)) { Sudoku::state = (Sudoku::state == Running) ? Note : Running; _pencilToNote->setVisible(Sudoku::state == Running); _penToRun->setVisible(Sudoku::state == Note); if(Sudoku::state == Note) updateBackplane(); for(int i = 0; i < 9; i++) { CCSprite * rb = (CCSprite *) _numButtons->objectAtIndex(i); rb->setVisible(Sudoku::state == Running); CCSprite * nb = (CCSprite *) _numNote->objectAtIndex(i); nb->setVisible(Sudoku::state == Note); } } // end handling } } }
CScreenShotView::CScreenShotView(const QList<QRect> &rectList, QScreen *screen, bool onlySelect, QWidget *parent) :QGraphicsView(parent) ,m_windowRectList(rectList) ,m_desktopScreen(screen) ,m_screen(NULL) ,m_backgroundItem(NULL) ,m_selectRectItem(NULL) ,m_toolbarItem(NULL) ,m_currentRectItem(NULL) ,m_tooltipSizeItem(NULL) ,m_previewItem(NULL) ,m_positionType(CSCREEN_POSITION_TYPE_NOT_CONTAIN) ,m_shotStatus(CSCREEN_SHOT_STATE_INITIALIZED) ,m_screenButtonType(CSCREEN_BUTTON_TYPE_UNDEFINED) ,m_isPressed(false) ,m_isLocked(false) ,m_isValid(false) ,m_onlySelect(onlySelect) { C_SCREENSHOT_LOG_FUNCTION; this->setMouseTracking(true); m_screen = new CScreenShotScene(this); this->setScene(m_screen); QRect geometry= screen->geometry(); C_SCREENSHOT_LOG_INFO(QString("screen->geometry() (%1,%2,%3,%4)") .arg(geometry.x()) .arg(geometry.y()) .arg(geometry.width()) .arg(geometry.height())); C_SCREENSHOT_LOG_TEST; QPixmap pixmap = createDesktopPixmap(); C_SCREENSHOT_LOG_TEST; drawPixmap(pixmap); m_backgroundItem = new QGraphicsPixmapItem(m_backgroundPixmap); m_screen->addItem(m_backgroundItem); C_SCREENSHOT_LOG_TEST; this->setGeometry(geometry); m_screen->setSceneRect(QRect(0,0,geometry.width(),geometry.height())); m_sx = 1.0 * geometry.width() / pixmap.width(); m_sy = 1.0 * geometry.height() / pixmap.height(); m_backgroundItem->setScale(m_sx); m_selectRectItem = new CScreenSelectRectItem(m_desktopPixmap); m_selectRectItem->setScale(m_sx); m_selectRectItem->setVisible(false); m_screen->addItem(m_selectRectItem); C_SCREENSHOT_LOG_TEST; //==================== m_toolbarItem = new CScreenEditorToolbarItem; connect(m_toolbarItem,SIGNAL(sigButtonClicked(CScreenButtonType)), this,SLOT(onButtonClicked(CScreenButtonType))); m_toolbarItem->setVisible(false); m_toolbarItem->setZValue(m_selectRectItem->zValue() + 1); m_screen->addItem(m_toolbarItem); m_tooltipSizeItem = new CScreenTooltipItem; C_SCREENSHOT_LOG_TEST; m_tooltipSizeItem->setVisible(false); m_screen->addItem(m_tooltipSizeItem); m_previewItem = new QGraphicsPixmapItem; m_previewItem->setVisible(false); m_previewItem->setZValue(m_toolbarItem->zValue() + 1); C_SCREENSHOT_LOG_TEST; m_screen->addItem(m_previewItem); this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setStyleSheet("QWidget{border: 0px solid #1880ed;}"); #ifdef Q_OS_MAC qApp->installEventFilter(this); #endif QPoint pos = QCursor::pos(); if(geometry.contains(pos)) { //TODO 暂时屏蔽 为了快速启动,耗时400ms // updatePreviewItem(this->mapFromGlobal(pos)); } C_SCREENSHOT_LOG_TEST; }
_lineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); ///set the copy/link actions in the right click menu KnobGuiWidgets::enableRightClickMenu(knobUI, _lineEdit, DimIdx(0), getView()); QObject::connect( _lineEdit, SIGNAL(editingFinished()), this, SLOT(onTextEdited()) ); _openFileButton = new Button( layout->parentWidget() ); _openFileButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); QPixmap pix; appPTR->getIcon(NATRON_PIXMAP_OPEN_FILE, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pix); _openFileButton->setIcon( QIcon(pix) ); knobUI->toolTip(_openFileButton, getView()); _openFileButton->setFocusPolicy(Qt::NoFocus); // exclude from tab focus QObject::connect( _openFileButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()) ); layout->addWidget(_lineEdit); layout->addWidget(_openFileButton); if ( knob->getHolder() ) { _reloadButton = new Button( layout->parentWidget() ); _reloadButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); _reloadButton->setFocusPolicy(Qt::NoFocus); QPixmap pixRefresh; appPTR->getIcon(NATRON_PIXMAP_VIEWER_REFRESH, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pixRefresh); _reloadButton->setIcon( QIcon(pixRefresh) ); _reloadButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Reload the file."), NATRON_NAMESPACE::WhiteSpaceNormal) ); QObject::connect( _reloadButton, SIGNAL(clicked()), this, SLOT(onReloadClicked()) ); layout->addWidget(_reloadButton); }
void PasswordReminder::onTextBoxEnter( wxCommandEvent& event ) { wxCommandEvent newE; newE.SetId(m_butSend->GetId()); onButtonClicked(newE); }
int main(int argc, char* argv[]) { QPointer<QCamera> m_camera; QApplication app(argc, argv); Receiver* receiver; QPointer<QMainWindow> mw = new QMainWindow(); mw->resize(600, 400); mw->setWindowTitle("QCamera Test"); QPointer<QWidget> container = new QWidget(); mw->setCentralWidget(container); QPointer<QPushButton> play = new QPushButton( QObject::tr("play camera"), container); QPointer<QPushButton> stop = new QPushButton( QObject::tr("stop camera"), container); QPointer<QPushButton> record = new QPushButton( QObject::tr("Record"), container); QPointer<QPushButton> stopRecord = new QPushButton( QObject::tr("stop record"), container); // Add cameras const QList<QByteArray> devices = QCamera::availableDevices(); m_camera = new QCamera(devices.at(0)); QMediaRecorder* recorder = new QMediaRecorder(m_camera); receiver = new Receiver(m_camera,recorder); QObject::connect(play, SIGNAL(clicked()), receiver, SLOT(onButtonClicked())); QObject::connect(stop, SIGNAL(clicked()), receiver, SLOT(onButtonClicked())); QObject::connect(record, SIGNAL(clicked()), receiver, SLOT(onRecordClicked())); QObject::connect(stopRecord, SIGNAL(clicked()), receiver, SLOT(onRecordClicked())); QVideoEncoderSettings settings = recorder->videoSettings(); settings.setResolution(800, 600); settings.setQuality(QMultimedia::NormalQuality); settings.setFrameRate(30.0); //settings.setCodec("video/mpeg2"); //recorder->setVideoSettings(settings); QString file = "/home/mschweitzer/myRecordingTest.avi"; //QFile file1(file); //file1.open(QIODevice::WriteOnly); QCameraViewfinder* viewfinder = new QCameraViewfinder(); recorder->setOutputLocation(QUrl::fromLocalFile(file)); m_camera->setViewfinder(viewfinder); QVBoxLayout* vlayout = new QVBoxLayout(); QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->addWidget( play, 0, Qt::AlignVCenter ); hLayout->addWidget( stop, 1, Qt::AlignVCenter ); QHBoxLayout* hLayout2 = new QHBoxLayout(); hLayout2->addWidget( record, 0, Qt::AlignVCenter ); hLayout2->addWidget( stopRecord, 1, Qt::AlignVCenter ); vlayout->addLayout(hLayout); vlayout->addLayout(hLayout2); vlayout->addWidget(viewfinder); container->setLayout( vlayout ); mw->show(); //file1.close(); return app.exec(); }
ExportGroupTemplateDialog::ExportGroupTemplateDialog(NodeCollection* group, Gui* gui, QWidget* parent) : QDialog(parent) , _imp( new ExportGroupTemplateDialogPrivate(group, gui) ) { _imp->mainLayout = new QGridLayout(this); _imp->idLabel = new Label(tr("Unique ID"), this); QString idTt = GuiUtils::convertFromPlainText(tr("The unique ID is used by " NATRON_APPLICATION_NAME "to identify the plug-in in various " "places in the application. Generally this contains domain and sub-domains names " "such as fr.inria.group.XXX. If 2 plug-ins happen to have the same ID they will be " "gathered by version. If 2 plug-ins have the same ID and version, the first loaded in the" " search-paths will take precedence over the other."), Qt::WhiteSpaceNormal); _imp->idEdit = new LineEdit(this); _imp->idEdit->setPlaceholderText( QString::fromUtf8("org.organization.pyplugs.XXX") ); _imp->idEdit->setToolTip(idTt); _imp->labelLabel = new Label(tr("Label"), this); QString labelTt = GuiUtils::convertFromPlainText(tr("Set the label of the group as the user will see it in the user interface."), Qt::WhiteSpaceNormal); _imp->labelLabel->setToolTip(labelTt); _imp->labelEdit = new LineEdit(this); _imp->labelEdit->setPlaceholderText( QString::fromUtf8("MyPlugin") ); QObject::connect( _imp->labelEdit, SIGNAL(editingFinished()), this, SLOT(onLabelEditingFinished()) ); _imp->labelEdit->setToolTip(labelTt); _imp->groupingLabel = new Label(tr("Grouping"), this); QString groupingTt = GuiUtils::convertFromPlainText(tr("The grouping of the plug-in specifies where the plug-in will be located in the menus. " "E.g: Color/Transform, or Draw. Each sub-level must be separated by a '/'."), Qt::WhiteSpaceNormal); _imp->groupingLabel->setToolTip(groupingTt); _imp->groupingEdit = new LineEdit(this); _imp->groupingEdit->setPlaceholderText( QString::fromUtf8("Color/Transform") ); _imp->groupingEdit->setToolTip(groupingTt); _imp->iconPathLabel = new Label(tr("Icon relative path"), this); QString iconTt = GuiUtils::convertFromPlainText(tr("Set here the file path of an optional icon to identify the plug-in. " "The path is relative to the Python script."), Qt::WhiteSpaceNormal); _imp->iconPathLabel->setToolTip(iconTt); _imp->iconPath = new LineEdit(this); _imp->iconPath->setPlaceholderText( QString::fromUtf8("Label.png") ); _imp->iconPath->setToolTip(iconTt); _imp->descriptionLabel = new Label(tr("Description"), this); QString descTt = GuiUtils::convertFromPlainText(tr("Set here the (optional) plug-in description that the user will see when clicking the " " \"?\" button on the settings panel of the node."), Qt::WhiteSpaceNormal); _imp->descriptionEdit = new PlaceHolderTextEdit(this); _imp->descriptionEdit->setToolTip(descTt); _imp->descriptionEdit->setPlaceHolderText( tr("This plug-in can be used to produce XXX effect...") ); _imp->fileLabel = new Label(tr("Directory"), this); QString fileTt = GuiUtils::convertFromPlainText(tr("Specify here the directory where to export the Python script."), Qt::WhiteSpaceNormal); _imp->fileLabel->setToolTip(fileTt); _imp->fileEdit = new LineEdit(this); _imp->fileEdit->setToolTip(fileTt); QPixmap openPix; appPTR->getIcon(NATRON_PIXMAP_OPEN_FILE, NATRON_MEDIUM_BUTTON_ICON_SIZE, &openPix); _imp->openButton = new Button(QIcon(openPix), QString(), this); _imp->openButton->setFocusPolicy(Qt::NoFocus); _imp->openButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); QObject::connect( _imp->openButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()) ); _imp->buttons = new QDialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel), Qt::Horizontal, this); QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(onOkClicked()) ); QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) ); _imp->mainLayout->addWidget(_imp->idLabel, 0, 0, 1, 1); _imp->mainLayout->addWidget(_imp->idEdit, 0, 1, 1, 2); _imp->mainLayout->addWidget(_imp->labelLabel, 1, 0, 1, 1); _imp->mainLayout->addWidget(_imp->labelEdit, 1, 1, 1, 2); _imp->mainLayout->addWidget(_imp->groupingLabel, 2, 0, 1, 1); _imp->mainLayout->addWidget(_imp->groupingEdit, 2, 1, 1, 2); _imp->mainLayout->addWidget(_imp->iconPathLabel, 3, 0, 1, 1); _imp->mainLayout->addWidget(_imp->iconPath, 3, 1, 1, 2); _imp->mainLayout->addWidget(_imp->descriptionLabel, 4, 0, 1, 1); _imp->mainLayout->addWidget(_imp->descriptionEdit, 4, 1, 1, 2); _imp->mainLayout->addWidget(_imp->fileLabel, 5, 0, 1, 1); _imp->mainLayout->addWidget(_imp->fileEdit, 5, 1, 1, 1); _imp->mainLayout->addWidget(_imp->openButton, 5, 2, 1, 1); _imp->mainLayout->addWidget(_imp->buttons, 6, 0, 1, 3); resize( 400, sizeHint().height() ); }