void ChatEditBox::fontChanged(QFont font) { if (m_boldAction->action(actionContext())) m_boldAction->action(actionContext())->setChecked(font.bold()); if (m_italicAction->action(actionContext())) m_italicAction->action(actionContext())->setChecked(font.italic()); if (m_underlineAction->action(actionContext())) m_underlineAction->action(actionContext())->setChecked(font.underline()); }
void ChatEditBox::init() { chatEditBoxes.append(this); Context = static_cast<BaseActionContext *>(actionContext()); ChangeNotifierLock lock(Context->changeNotifier()); RoleSet roles; if (CurrentChat.contacts().size() > 1) roles.insert(ChatRole); else roles.insert(BuddyRole); Context->setRoles(roles); Context->setChat(CurrentChat); Context->setContacts(CurrentChat.contacts()); Context->setBuddies(CurrentChat.contacts().toBuddySet()); updateContext(); connect(m_statusConfigurationHolder, SIGNAL(setStatusModeChanged()), this, SLOT(updateContext())); InputBox = injectedFactory()->makeInjected<CustomInput>(CurrentChat, this); InputBox->setWordWrapMode(QTextOption::WordWrap); setCentralWidget(InputBox); bool old_top = loadOldToolBarsFromConfig("chatTopDockArea", Qt::TopToolBarArea); bool old_middle = loadOldToolBarsFromConfig("chatMiddleDockArea", Qt::TopToolBarArea); bool old_bottom = loadOldToolBarsFromConfig("chatBottomDockArea", Qt::BottomToolBarArea); bool old_left = loadOldToolBarsFromConfig("chatLeftDockArea", Qt::LeftToolBarArea); bool old_right = loadOldToolBarsFromConfig("chatRightDockArea", Qt::RightToolBarArea); if (old_top || old_middle || old_bottom || old_left || old_right) writeToolBarsToConfig(); // port old config else loadToolBarsFromConfig(); // load new config // connect(m_chatWidgetActions->colorSelector(), SIGNAL(actionCreated(Action *)), // this, SLOT(colorSelectorActionCreated(Action *))); connect(InputBox, SIGNAL(keyPressed(QKeyEvent *,CustomInput *, bool &)), this, SIGNAL(keyPressed(QKeyEvent *,CustomInput *,bool &))); connect(InputBox, SIGNAL(fontChanged(QFont)), this, SLOT(fontChanged(QFont))); connect(InputBox, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); connect(m_chatConfigurationHolder, SIGNAL(chatConfigurationUpdated()), this, SLOT(configurationUpdated())); configurationUpdated(); }
void QgsActionManager::doAction( const QUuid& actionId, const QgsFeature& feat, const QgsExpressionContext& context ) { QgsAction act = action( actionId ); if ( !act.isValid() || !act.runable() ) return; QgsExpressionContext actionContext( context ); if ( mLayer ) actionContext << QgsExpressionContextUtils::layerScope( mLayer ); actionContext.setFeature( feat ); QString expandedAction = QgsExpression::replaceExpressionText( act.command(), &actionContext ); if ( expandedAction.isEmpty() ) return; QgsAction newAction( act.type(), act.name(), expandedAction, act.capture() ); runAction( newAction ); }
void QgsActionManager::doAction( int index, const QgsFeature& feat, const QgsExpressionContext& context, const QMap<QString, QVariant> *substitutionMap ) { if ( index < 0 || index >= size() ) return; const QgsAction &action = at( index ); if ( !action.runable() ) return; QgsExpressionContext actionContext( context ); if ( mLayer ) actionContext << QgsExpressionContextUtils::layerScope( mLayer ); actionContext.setFeature( feat ); QString expandedAction = QgsExpression::replaceExpressionText( action.action(), &actionContext, substitutionMap ); if ( expandedAction.isEmpty() ) return; QgsAction newAction( action.type(), action.name(), expandedAction, action.capture() ); runAction( newAction ); }