
source : http://code.google.com/p/mixtools/source/browse/#svn/trunk/qt/tutorial/tutorial
http://doc.trolltech.com/4.3/tutorial.html
T4:
- qApp is a global variable
 - Put widget on heap, so Qt can manage the memory for you
 
- treat layout as the parent of widgets being enclosed
 - How to overflow?
 
- Remember to show() the widget
 - setLayout() takes a "pointer" as the argument
 - qRand() returns a value between 0 and RAND_MAX (defined in 
and )  - check out more global variable in Qt: http://doc.trolltech.com/4.2/qtglobal.html
 
- Signal can connect to signal: so you fire another signal.
 - Two ways to fire a signal: 1. signal connect to signal 2. directly fire it with emit
 - Cannot treat signal as slot
 - Signal is automatically generated by MOC (meta-object compiler), so do not implement it yourself, or you will get duplicate definition.
 - The Q_OBJECT macro must be used in all subclass of QObject, or the signal/slot will not work. Put the Q_OBJECT in the header file, and put the .h file in .pro file. This way qmake can search source and header files for the Q_Object macro. It will generate build instruction for moc.
 - slots can be public, protected, and private
 - To declare signal, just do "signals:"
 
- setFocus()
 - setFocusProxy()
 - QString::Number() convert number to string
 - use "&" to set the button shortcut with Alt
 
- Understand The Coordinate System of Qt
 - QRect: upper-left + width + height
 - drawPie: 0 is 3 o'clock, and draws counter-clockwise
 - QPainter::rotate(): on coordinate, and counter-clockwise
 - QTimer::start(int millisecs interval), stop(), isActive()
 QTimer::singleShot(600000, &app, SLOT(quit()));
- Understand save() and restore()
 
No comments:
Post a Comment