1.guake终端ubuntu;2. Ubuntu 数据库中文问题;3.状态记录

一. Guake 终端

 介绍:Guake is a drop-down terminal for GNOME Desktop Environment, so you just need to press a key to invoke him, and press again to hide. Guake supports hotkeys, tabs, background transparent, etc.

非常顺手的一款软件

二.

// 关于 ubuntu 下 数据库语言 涉及到中文 无法进行的成功执行的情况
//1. insert update

        query.prepare("INSERT INTO InProduct (Out_sign,Pan_date,Pan_SN,Jinhuo,Memo,StoreCode)"
                      "VALUES (?, ?, ?, ?, ?, ?)");

        query.addBindValue("*");
        query.addBindValue(n_func().f_get_sysdatetime(db));
        query.addBindValue(sn);
        query.addBindValue(2);

        query.addBindValue("会员号:"+l_vipno->text()+",积分赠送.");
        query.addBindValue(storecodes.at(cbbx_factory->currentIndex()));

        //qDebug() << query.boundValues();
        if(!query.exec());

采用 addBindValue函数 ,对所需插入或修改打地方 bindvalue

//2. select where select like ;

而select中中文条件检索 也未成功执行,这里同样采用addBindValue来实现

query.prepare("select * from cyn where p_name = ?");

query.addBindValue("小红");

if(!query.exec());


同样like也是

query.prepare("select * from cyn where p_name like ?");

query.addBindValue("%"+"小红"+"%");

if(!query.exec());

成功执行

三 .状态机

1.A Simple State Machine :
QStateMachine 
QState
setInitialState
start
2.Doing Useful Work on State Entry and Exit
QObject::connect(s3, SIGNAL(entered()), button, SLOT(showMaximized()));
3.State Machines That Finish
QFinalState
enum StateType {
     AbstractState,
     StandardState,
     FinalState,
     HistoryState
};

4.Sharing Transitions By Grouping States
     QState *s1 = new QState();
     QState *s11 = new QState(s1);
     QState *s12 = new QState(s1);
     QState *s13 = new QState(s1);
     s1->setInitialState(s11);
The three original states have been renamed s11s12 and s13 to reflect that they are now children of the new top-level state, s1. Child states implicitly inherit the transitions of their parent state. This means it is now sufficient to add a single transition from s1 to the final state s2. New states added to s1 will also automatically inherit this transition.
三个子状态名字为s11、s12、s13,他们的parent state是s2。子状态可以完全继承parent state的 transition,也就是说parent state 添加新的单个transition,其子状态也会继承这些transition。
A child state can override an inherited transition. For example, the following code adds a transition that effectively causes the Quit button to be ignored when the state machine is in state s12.
子状态可以重载 来至于parent state 的transition,这样将会ignore transition of the parent state
5.Using History States to Save and Restore the Current State
QHistoryState
"QHistoryState::setDefaultState: state %p does not belong "
"to this history state's group (%p)",
值得说明就是:
1.历史状态机需要添加在parent state 里才会real time 的继承group的状态 except parent state;
2.历史状态机也是state的一种,每次parent state refresh ,then 历史状态机就会save current state
3.例子中使用的仅有目标的 transition, 在enter时会 阻塞其他的操作,阻塞结束后,才会进行transition,进入历史状态机
4.历史状态机其实十一个空壳子, 需要再初始化时setDefaultState(s01),这样后就可以调用setInitialState(sh)了,sh也可以和其他的s0一样使用
5.由于两个组状态转换时,总是会返回ini状态,但是若ini状态是 sh, 就可以保留当前,且切换组状态了
6.Using Parallel States to Avoid a Combinatorial Explosion of States
QState *s1 = new QState(QState::ParallelStates);
Q_PROPERTY(bool fill READ fill WRITE setFill)
是自定义 assignProperty(ob, func, value)的一种方法
值得说明就是:
1.    
    QStateMachine *machine = new QStateMachine;
    QState *s = new QState(QState::ParallelStates);
    QState *s0 = new QState(s);
    QState *s1 = new QState(s);
    machine->addState(s);
    machine->setInitialState(s);
2.s0 和 s1 的之间的事物失效
3.s0 和 s1 将会并行执
7.Detecting that a Composite State has Finished
QState::finished()
For parallel state groups, the QState::finished() signal is emitted when all the child states have entered final states.
对于并发state组,finished()信号会在所有的并发组都进入final state后,才会emit finished()
值得说明就是:
1.
  可能会遇到大量的 QFinalState状态
8.Targetless Transitions
QSignalTransition(&button, SIGNAL(clicked()));
qt支持这种 无目标的事务; 无目标的事务,不会对state 的跳转产生影响,
但是就事务本身来说,她的的确确是触发的,这儿可以
connect(trans, SIGNAL(triggered()), &msgBox, SLOT(exec())); 
调用传统的信号槽,实现所需的功能

9.Events, Transitions and Guards
 struct StringEvent : public QEvent
 {
     StringEvent(const QString &val)
     : QEvent(QEvent::Type(QEvent::User+1)),
       value(val) {}

     QString value;
 };

 class StringTransition : public QAbstractTransition
 {
 public:
     StringTransition(const QString &value)
         : m_value(value) {}

 protected:
     virtual bool eventTest(QEvent *e) const
     {
         if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent
             return false;
         StringEvent *se = static_cast<StringEvent*>(e);
         return (m_value == se->value);
     }

     virtual void onTransition(QEvent *) {}

 private:
     QString m_value;
 };

//====================
StringTransition *t1 = new StringTransition("Hello");
     t1->setTargetState(s2);
     s1->addTransition(t1);
machine.postEvent(new StringEvent("Hello"));

这种触发条件,可以通过event来触发
10.Using Restore Policy To Automatically Restore Properties
machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
还原 最好是一个节点下的 多个 state切换
不支持 ParallelStates 组状态; 无视该属性
11.Animating Property Assignments
transition->addAnimation(new QPropertyAnimation(button, "geometry"));
事务添加动画
还有状态机添加动画
12.Detecting That All Properties Have Been Set In A State
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
一个状态是否完成,与他是否添加动画有很大的关系。其实不难想 ,
若是动画完成才算 状态结束的话,很多操作就无法流畅的运行
13.What Happens If A State Is Exited Before The Animation Has Finished
其实动画 会智能 切换, 流畅的运行
14.Default Animations
machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar"));

Note that animations explicitly set on transitions will take precedence over any default animation for the given property
transitions里的动画优先级高于状态及默认的动画
状态机的 的Property可以有多个,Transition却可以有很多
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值