2008年11月19日星期三

Reading Qt 4.4 Tutorial 1

  • The QApplication object must be created before any GUI-related features of Qt are used.
  •     QPushButton hello("Hello world!");
    A push button is created. Because we don't specify a parent window (as second argument to the QPushButton constructor), the button will be a window of its own, with its own window frame and title bar.
  • The button's size is determined by its default size hint. We could call QWidget::move() to assign a specific screen position to the widget, but instead we let the windowing system choose a position.
  •     hello.show();
    A widget is never visible when you create it. You must call QWidget::show() to make it visible.
  •    return app.exec();
    This is where main() passes control to Qt
    int QApplication::exec ()

    Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via quit()).

  • 基本把教程上的COPY下来了,细节注意到了却影响到整体阅读速度,在博客上修改这破格式花了不少时间。


2008年11月18日星期二

C++ STL1

用起瘾了,不好不好,忽略了具体实现和基本功,所谓理由是更能把精力放在算法上。。
不多总结,具体使用方法参见 http://www.cplusplus.com/reference/
今天收获是关键字排序,参见 一个多关键字排序例子
其中ICmpMuls也可直接放MultiData中,bool operator() 重载圆括号,sort第三个参数具体机理还很茫然(updated: 函数指针),以后如果将C++作为主语言,熟练后一定要读读STL源码剖析那本书。

2008年11月8日星期六

qt1

1.

通过使用一个layout管理器对旋转窗口和滑块窗口进行了布局设置。一个布局管理者就是一个根据窗口作用设置其大小和位置的对象。Qt有三个主要的布局管理类:

QHBoxLayout:将窗口部件水平自左至右设置(有些情况下是自右向左)。

QVBoxLayout:将窗口部件垂直自上向下设置。

QGridLayout: 以网格形式设置窗口部件。

调用QWidget::setLayout()函数在对象window上安装布局管理器。通过这个调用,部件自动成为布局管理器所在窗口的子窗口。

2.

Qt程序员最常用的设计模式是:说明所需要的窗口部件,然后设置这些部件必须的特性。程序员把窗口部件添加到布局管理器中,布局管理器就将自动地设置这些部件的大小和位置。而用户界面的行为是通过连接各个部件(运用信号SIGNAL/槽SLOT机制)来实现的。



2008年10月31日星期五

xhtml 1

XHTML 基本规则
  • XHTML 元素必须被关闭(包括空标签 hr, br)
  • XHTML 元素必须小写
  • XHTML 文档必须拥有一个根元素 (html)
  • 属性名称必须小写
  • 属性值必须加引号
  • 属性不能简写
  • 用 id 属性代替 name 属性

2008年10月26日星期日

stack 1

  • 栈
    1. 中缀表达式到后缀表达式(逆波兰表达式)的转换(简单表达式、带括号的表达式)
      引入优先级 <= 栈内优先级则先从栈中取出运算符输出。
    2. 后缀表达式求值